Browse Source

Small refactoring in plugins.

alteredq 13 years ago
parent
commit
247ec49013
5 changed files with 696 additions and 707 deletions
  1. 369 370
      build/Three.js
  2. 114 114
      build/custom/ThreeExtras.js
  3. 176 177
      build/custom/ThreeWebGL.js
  4. 9 8
      src/extras/plugins/ShadowMapPlugin.js
  5. 28 38
      src/renderers/WebGLRenderer.js

+ 369 - 370
build/Three.js

@@ -17,62 +17,62 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.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())},
 b.z;this.w=a.w-b.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,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};
-THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);q=o.dot(b);if(q<=0)return null;l=r.add(a,n.copy(b).multiplyScalar(q));return p=c.distanceTo(l)}function d(a,b,c,d){o.sub(d,b);r.sub(c,b);n.sub(a,b);s=o.dot(o);t=o.dot(r);v=o.dot(n);y=r.dot(r);I=r.dot(n);z=1/(s*y-t*t);G=(y*v-t*I)*z;u=(s*I-t*v)*z;return G>=0&&u>=0&&G+u<1}this.origin=a||new THREE.Vector3;this.direction=b||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 e=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(n){for(var l,q=[],o=0,r=n.children.length;o<r;o++)Array.prototype.push.apply(q,this.intersectObject(n.children[o]));if(n instanceof THREE.Particle){o=
-c(this.origin,this.direction,n.matrixWorld.getPosition());if(o===null||o>n.scale.x)return[];l={distance:o,point:n.position,face:null,object:n};q.push(l)}else if(n instanceof THREE.Mesh){o=c(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 q;var p,s=n.geometry,t=s.vertices,j;n.matrixRotationWorld.extractRotation(n.matrixWorld);o=0;for(r=s.faces.length;o<r;o++)if(l=s.faces[o],a.copy(this.origin),
-b.copy(this.direction),j=n.matrixWorld,i=j.multiplyVector3(i.copy(l.centroid)).subSelf(a),p=i.dot(b),!(p<=0)&&(e=j.multiplyVector3(e.copy(t[l.a].position)),g=j.multiplyVector3(g.copy(t[l.b].position)),f=j.multiplyVector3(f.copy(t[l.c].position)),l instanceof THREE.Face4&&(h=j.multiplyVector3(h.copy(t[l.d].position))),m=n.matrixRotationWorld.multiplyVector3(m.copy(l.normal)),p=b.dot(m),n.doubleSided||(n.flipSided?p>0:p<0)))if(p=m.dot(i.sub(e,a))/p,k.add(a,b.multiplyScalar(p)),l instanceof THREE.Face3)d(k,
-e,g,f)&&(l={distance:a.distanceTo(k),point:k.clone(),face:l,object:n},q.push(l));else if(l instanceof THREE.Face4&&(d(k,e,g,h)||d(k,g,f,h)))l={distance:a.distanceTo(k),point:k.clone(),face:l,object:n},q.push(l)}return q};var o=new THREE.Vector3,r=new THREE.Vector3,n=new THREE.Vector3,q,l,p,s,t,v,y,I,z,G,u};
-THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,f,k,o){h=!1;b=g;c=f;d=k;e=o;a()};this.addPoint=function(g,f){h?(h=!1,b=g,c=f,d=g,e=f):(b=b<g?b:g,c=c<f?c:f,d=d>g?d:g,e=e>f?e:f);a()};this.add3Points=
-function(g,f,k,o,r,n){h?(h=!1,b=g<k?g<r?g:r:k<r?k:r,c=f<o?f<n?f:n:o<n?o:n,d=g>k?g>r?g:r:k>r?k:r,e=f>o?f>n?f:n:o>n?o:n):(b=g<k?g<r?g<b?g:b:r<b?r:b:k<r?k<b?k:b:r<b?r:b,c=f<o?f<n?f<c?f:c:n<c?n:c:o<n?o<c?o:c:n<c?n:c,d=g>k?g>r?g>d?g:d:r>d?r:d:k>r?k>d?k:d:r>d?r:d,e=f>o?f>n?f>e?f:e:n>e?n:e:o>n?o>e?o:e:n>e?n:e);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
+THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);p=o.dot(b);if(p<=0)return null;n=r.add(a,m.copy(b).multiplyScalar(p));return q=c.distanceTo(n)}function d(a,b,c,d){o.sub(d,b);r.sub(c,b);m.sub(a,b);s=o.dot(o);t=o.dot(r);u=o.dot(m);v=r.dot(r);B=r.dot(m);x=1/(s*v-t*t);C=(v*u-t*B)*x;E=(s*B-t*u)*x;return C>=0&&E>=0&&C+E<1}this.origin=a||new THREE.Vector3;this.direction=b||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 e=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(m){for(var n,p=[],o=0,r=m.children.length;o<r;o++)Array.prototype.push.apply(p,this.intersectObject(m.children[o]));if(m instanceof THREE.Particle){o=
+c(this.origin,this.direction,m.matrixWorld.getPosition());if(o===null||o>m.scale.x)return[];n={distance:o,point:m.position,face:null,object:m};p.push(n)}else if(m instanceof THREE.Mesh){o=c(this.origin,this.direction,m.matrixWorld.getPosition());if(o===null||o>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return p;var q,s=m.geometry,t=s.vertices,u;m.matrixRotationWorld.extractRotation(m.matrixWorld);o=0;for(r=s.faces.length;o<r;o++)if(n=s.faces[o],a.copy(this.origin),
+b.copy(this.direction),u=m.matrixWorld,i=u.multiplyVector3(i.copy(n.centroid)).subSelf(a),q=i.dot(b),!(q<=0)&&(e=u.multiplyVector3(e.copy(t[n.a].position)),g=u.multiplyVector3(g.copy(t[n.b].position)),f=u.multiplyVector3(f.copy(t[n.c].position)),n instanceof THREE.Face4&&(h=u.multiplyVector3(h.copy(t[n.d].position))),l=m.matrixRotationWorld.multiplyVector3(l.copy(n.normal)),q=b.dot(l),m.doubleSided||(m.flipSided?q>0:q<0)))if(q=l.dot(i.sub(e,a))/q,j.add(a,b.multiplyScalar(q)),n instanceof THREE.Face3)d(j,
+e,g,f)&&(n={distance:a.distanceTo(j),point:j.clone(),face:n,object:m},p.push(n));else if(n instanceof THREE.Face4&&(d(j,e,g,h)||d(j,g,f,h)))n={distance:a.distanceTo(j),point:j.clone(),face:n,object:m},p.push(n)}return p};var o=new THREE.Vector3,r=new THREE.Vector3,m=new THREE.Vector3,p,n,q,s,t,u,v,B,x,C,E};
+THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,f,j,o){h=!1;b=g;c=f;d=j;e=o;a()};this.addPoint=function(g,f){h?(h=!1,b=g,c=f,d=g,e=f):(b=b<g?b:g,c=c<f?c:f,d=d>g?d:g,e=e>f?e:f);a()};this.add3Points=
+function(g,f,j,o,r,m){h?(h=!1,b=g<j?g<r?g:r:j<r?j:r,c=f<o?f<m?f:m:o<m?o:m,d=g>j?g>r?g:r:j>r?j:r,e=f>o?f>m?f:m:o>m?o:m):(b=g<j?g<r?g<b?g:b:r<b?r:b:j<r?j<b?j:b:r<b?r:b,c=f<o?f<m?f<c?f:c:m<c?m:c:o<m?o<c?o:c:m<c?m:c,d=g>j?g>r?g>d?g:d:r>d?r:d:j>r?j>d?j:d:r>d?r:d,e=f>o?f>m?f>e?f:e:m>e?m:e:o>m?o>e?o:e:m>e?m:e);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
 g.getBottom()?e:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 g.getBottom()?e:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},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,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,m,k,o,r,n,q,l){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,i||0,m||0,k!==void 0?k:1,o||0,r||0,n||0,q||0,l!==void 0?l:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,m,k,o,r,n,q,l){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=m;this.n33=k;this.n34=o;this.n41=r;this.n42=n;this.n43=q;this.n44=l;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,m=a.n24,k=a.n31,o=a.n32,r=a.n33,n=a.n34,q=a.n41,l=a.n42,p=a.n43,
-s=a.n44,t=b.n11,v=b.n12,y=b.n13,I=b.n14,z=b.n21,G=b.n22,u=b.n23,F=b.n24,A=b.n31,x=b.n32,B=b.n33,N=b.n34,ba=b.n41,Y=b.n42,K=b.n43,j=b.n44;this.n11=c*t+d*z+e*A+g*ba;this.n12=c*v+d*G+e*x+g*Y;this.n13=c*y+d*u+e*B+g*K;this.n14=c*I+d*F+e*N+g*j;this.n21=f*t+h*z+i*A+m*ba;this.n22=f*v+h*G+i*x+m*Y;this.n23=f*y+h*u+i*B+m*K;this.n24=f*I+h*F+i*N+m*j;this.n31=k*t+o*z+r*A+n*ba;this.n32=k*v+o*G+r*x+n*Y;this.n33=k*y+o*u+r*B+n*K;this.n34=k*I+o*F+r*N+n*j;this.n41=q*t+l*z+p*A+s*ba;this.n42=q*v+l*G+p*x+s*Y;this.n43=q*
-y+l*u+p*B+s*K;this.n44=q*I+l*F+p*N+s*j;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,l,j,o,r,m,p,n){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,i||0,l||0,j!==void 0?j:1,o||0,r||0,m||0,p||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,l,j,o,r,m,p,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=j;this.n34=o;this.n41=r;this.n42=m;this.n43=p;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,j=a.n31,o=a.n32,r=a.n33,m=a.n34,p=a.n41,n=a.n42,q=a.n43,
+s=a.n44,t=b.n11,u=b.n12,v=b.n13,B=b.n14,x=b.n21,C=b.n22,E=b.n23,G=b.n24,R=b.n31,z=b.n32,J=b.n33,K=b.n34,U=b.n41,V=b.n42,Y=b.n43,T=b.n44;this.n11=c*t+d*x+e*R+g*U;this.n12=c*u+d*C+e*z+g*V;this.n13=c*v+d*E+e*J+g*Y;this.n14=c*B+d*G+e*K+g*T;this.n21=f*t+h*x+i*R+l*U;this.n22=f*u+h*C+i*z+l*V;this.n23=f*v+h*E+i*J+l*Y;this.n24=f*B+h*G+i*K+l*T;this.n31=j*t+o*x+r*R+m*U;this.n32=j*u+o*C+r*z+m*V;this.n33=j*v+o*E+r*J+m*Y;this.n34=j*B+o*G+r*K+m*T;this.n41=p*t+n*x+q*R+s*U;this.n42=p*u+n*C+q*z+s*V;this.n43=p*v+n*
+E+q*J+s*Y;this.n44=p*B+n*G+q*K+s*T;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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 b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 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 b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
-a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,i=this.n31,m=this.n32,k=this.n33,o=this.n34,r=this.n41,n=this.n42,q=this.n43,l=this.n44;return d*f*m*r-c*h*m*r-d*g*k*r+b*h*k*r+c*g*o*r-b*f*o*r-d*f*i*n+c*h*i*n+d*e*k*n-a*h*k*n-c*e*o*n+a*f*o*n+d*g*i*q-b*h*i*q-d*e*m*q+a*h*m*q+b*e*o*q-a*g*o*q-c*g*i*l+b*f*i*l+c*e*m*l-a*f*m*l-b*e*k*l+a*g*k*l},transpose:function(){var a;
+a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,j=this.n33,o=this.n34,r=this.n41,m=this.n42,p=this.n43,n=this.n44;return d*f*l*r-c*h*l*r-d*g*j*r+b*h*j*r+c*g*o*r-b*f*o*r-d*f*i*m+c*h*i*m+d*e*j*m-a*h*j*m-c*e*o*m+a*f*o*m+d*g*i*p-b*h*i*p-d*e*l*p+a*h*l*p+b*e*o*p-a*g*o*p-c*g*i*n+b*f*i*n+c*e*l*n-a*f*l*n-b*e*j*n+a*g*j*n},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.n34=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=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.n34=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.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
 a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},
 a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},
 setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},
 setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},
-setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,m=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,m*f+c,m*h-d*g,0,i*h-d*f,m*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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 b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,f=a.n22,h=a.n23,i=a.n24,m=a.n31,k=a.n32,o=a.n33,r=a.n34,n=a.n41,q=a.n42,l=a.n43,p=a.n44;this.n11=h*r*q-i*o*q+i*k*l-f*r*l-h*k*p+f*o*p;this.n12=e*o*q-d*r*q-e*k*l+c*r*l+d*k*p-c*o*p;this.n13=d*i*q-e*h*q+e*f*l-c*i*l-d*f*p+c*h*p;this.n14=e*h*k-d*i*k-e*f*o+c*i*o+d*f*r-c*h*r;this.n21=i*o*n-h*r*n-i*m*l+g*r*l+h*m*p-g*o*p;this.n22=d*r*n-e*o*n+
-e*m*l-b*r*l-d*m*p+b*o*p;this.n23=e*h*n-d*i*n-e*g*l+b*i*l+d*g*p-b*h*p;this.n24=d*i*m-e*h*m+e*g*o-b*i*o-d*g*r+b*h*r;this.n31=f*r*n-i*k*n+i*m*q-g*r*q-f*m*p+g*k*p;this.n32=e*k*n-c*r*n-e*m*q+b*r*q+c*m*p-b*k*p;this.n33=c*i*n-e*f*n+e*g*q-b*i*q-c*g*p+b*f*p;this.n34=e*f*m-c*i*m-e*g*k+b*i*k+c*g*r-b*f*r;this.n41=h*k*n-f*o*n-h*m*q+g*o*q+f*m*l-g*k*l;this.n42=c*o*n-d*k*n+d*m*q-b*o*q-c*m*l+b*k*l;this.n43=d*f*n-c*h*n-d*g*q+b*h*q+c*g*l-b*f*l;this.n44=c*h*m-d*f*m+d*g*k-b*h*k-c*g*o+b*f*o;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=f*h,m=f*e,k=d*h,o=d*e;this.n11=i+o*c;this.n12=k*c-m;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=m*c-k;this.n32=o+i*c;this.n33=g*f;break;case "ZXY":i=f*h;m=f*e;k=d*h;o=d*e;this.n11=i-o*c;this.n12=-g*e;this.n13=k+m*c;this.n21=m+k*c;this.n22=g*h;this.n23=o-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=
-g*h;m=g*e;k=c*h;o=c*e;this.n11=f*h;this.n12=k*d-m;this.n13=i*d+o;this.n21=f*e;this.n22=o*d+i;this.n23=m*d-k;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;m=g*d;k=c*f;o=c*d;this.n11=f*h;this.n12=o-i*e;this.n13=k*e+m;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=m*e+k;this.n33=i-o*e;break;case "XZY":i=g*f;m=g*d;k=c*f;o=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=i*e+o;this.n22=g*h;this.n23=m*e-k;this.n31=k*e-m;this.n32=c*h;this.n33=o*e+i;break;default:i=g*h,m=g*
-e,k=c*h,o=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=m+k*d,this.n22=i-o*d,this.n23=-c*f,this.n31=o-i*d,this.n32=k+m*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f;b*=h;var m=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(m+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+m);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,l=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+c,l*h-d*g,0,i*h-d*f,l*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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 b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,f=a.n22,h=a.n23,i=a.n24,l=a.n31,j=a.n32,o=a.n33,r=a.n34,m=a.n41,p=a.n42,n=a.n43,q=a.n44;this.n11=h*r*p-i*o*p+i*j*n-f*r*n-h*j*q+f*o*q;this.n12=e*o*p-d*r*p-e*j*n+c*r*n+d*j*q-c*o*q;this.n13=d*i*p-e*h*p+e*f*n-c*i*n-d*f*q+c*h*q;this.n14=e*h*j-d*i*j-e*f*o+c*i*o+d*f*r-c*h*r;this.n21=i*o*m-h*r*m-i*l*n+g*r*n+h*l*q-g*o*q;this.n22=d*r*m-e*o*m+
+e*l*n-b*r*n-d*l*q+b*o*q;this.n23=e*h*m-d*i*m-e*g*n+b*i*n+d*g*q-b*h*q;this.n24=d*i*l-e*h*l+e*g*o-b*i*o-d*g*r+b*h*r;this.n31=f*r*m-i*j*m+i*l*p-g*r*p-f*l*q+g*j*q;this.n32=e*j*m-c*r*m-e*l*p+b*r*p+c*l*q-b*j*q;this.n33=c*i*m-e*f*m+e*g*p-b*i*p-c*g*q+b*f*q;this.n34=e*f*l-c*i*l-e*g*j+b*i*j+c*g*r-b*f*r;this.n41=h*j*m-f*o*m-h*l*p+g*o*p+f*l*n-g*j*n;this.n42=c*o*m-d*j*m+d*l*p-b*o*p-c*l*n+b*j*n;this.n43=d*f*m-c*h*m-d*g*p+b*h*p+c*g*n-b*f*n;this.n44=c*h*l-d*f*l+d*g*j-b*h*j-c*g*o+b*f*o;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=f*h,l=f*e,j=d*h,o=d*e;this.n11=i+o*c;this.n12=j*c-l;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=l*c-j;this.n32=o+i*c;this.n33=g*f;break;case "ZXY":i=f*h;l=f*e;j=d*h;o=d*e;this.n11=i-o*c;this.n12=-g*e;this.n13=j+l*c;this.n21=l+j*c;this.n22=g*h;this.n23=o-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=
+g*h;l=g*e;j=c*h;o=c*e;this.n11=f*h;this.n12=j*d-l;this.n13=i*d+o;this.n21=f*e;this.n22=o*d+i;this.n23=l*d-j;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;l=g*d;j=c*f;o=c*d;this.n11=f*h;this.n12=o-i*e;this.n13=j*e+l;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+j;this.n33=i-o*e;break;case "XZY":i=g*f;l=g*d;j=c*f;o=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=i*e+o;this.n22=g*h;this.n23=l*e-j;this.n31=j*e-l;this.n32=c*h;this.n33=o*e+i;break;default:i=g*h,l=g*
+e,j=c*h,o=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=l+j*d,this.n22=i-o*d,this.n23=-c*f,this.n31=o-i*d,this.n32=j+l*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f;b*=h;var l=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(l+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=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,m=a.n23*a.n12-a.n22*a.n13,k=-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*m;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*m;c[7]=a*k;c[8]=a*o;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=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,j=-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*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*l;c[7]=a*j;c[8]=a*o;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,i,m;f=new THREE.Matrix4;h=b-a;i=c-d;m=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/m;f.n34=-((g+e)/m);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,b,c,d,e,g){var f,h,i,l;f=new THREE.Matrix4;h=b-a;i=c-d;l=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((g+e)/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.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=
 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};
 !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,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(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 b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;
 if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},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&&
 if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},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 b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 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 b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=m[i]=m[i]||new THREE.RenderableVertex;i++;return a}function c(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 e,g,f=[],h,i,m=[],
-k,o,r=[],n,q=[],l,p,s=[],t,v,y=[],I={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,G=new THREE.Vector4,u=new THREE.Matrix4,F=new THREE.Matrix4,A=new THREE.Frustum,x=new THREE.Vector4,B=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);u.multiply(b.projectionMatrix,b.matrixWorldInverse);u.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);u.multiply(b.matrixWorld,
-b.projectionMatrixInverse);u.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(b,d){g=0;I.objects.length=0;I.sprites.length=0;I.lights.length=0;var f=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||A.contains(b))?(u.multiplyVector3(z.copy(b.position)),e=a(),e.object=
-b,e.z=z.z,I.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(u.multiplyVector3(z.copy(b.position)),e=a(),e.object=b,e.z=z.z,I.sprites.push(e)):b instanceof THREE.Light&&I.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&I.objects.sort(c);return I};this.projectScene=function(a,e,g){var f=e.near,j=e.far,z,J,L,C,O,ea,X,fa,V,R,U,S,aa,Z,qa,da;v=p=n=o=0;I.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);u.multiply(e.projectionMatrix,e.matrixWorldInverse);A.setFromMatrix(u);I=this.projectGraph(a,!1);a=0;for(z=I.objects.length;a<z;a++)if(V=I.objects[a].object,R=V.matrixWorld,S=V.material,i=0,V instanceof THREE.Mesh){U=V.geometry;aa=V.geometry.materials;C=U.vertices;Z=U.faces;qa=U.faceVertexUvs;U=V.matrixRotationWorld.extractRotation(R);J=0;for(L=C.length;J<L;J++)h=b(),h.positionWorld.copy(C[J].position),R.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),u.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<j;C=0;for(J=Z.length;C<J;C++){L=Z[C];if(L instanceof THREE.Face3)if(O=m[L.a],ea=m[L.b],X=m[L.c],O.visible&&ea.visible&&X.visible&&(V.doubleSided||V.flipSided!=(X.positionScreen.x-O.positionScreen.x)*(ea.positionScreen.y-O.positionScreen.y)-(X.positionScreen.y-O.positionScreen.y)*(ea.positionScreen.x-
-O.positionScreen.x)<0))fa=r[o]=r[o]||new THREE.RenderableFace3,o++,k=fa,k.v1.copy(O),k.v2.copy(ea),k.v3.copy(X);else continue;else if(L instanceof THREE.Face4)if(O=m[L.a],ea=m[L.b],X=m[L.c],fa=m[L.d],O.visible&&ea.visible&&X.visible&&fa.visible&&(V.doubleSided||V.flipSided!=((fa.positionScreen.x-O.positionScreen.x)*(ea.positionScreen.y-O.positionScreen.y)-(fa.positionScreen.y-O.positionScreen.y)*(ea.positionScreen.x-O.positionScreen.x)<0||(ea.positionScreen.x-X.positionScreen.x)*(fa.positionScreen.y-
-X.positionScreen.y)-(ea.positionScreen.y-X.positionScreen.y)*(fa.positionScreen.x-X.positionScreen.x)<0)))da=q[n]=q[n]||new THREE.RenderableFace4,n++,k=da,k.v1.copy(O),k.v2.copy(ea),k.v3.copy(X),k.v4.copy(fa);else continue;k.normalWorld.copy(L.normal);U.multiplyVector3(k.normalWorld);k.centroidWorld.copy(L.centroid);R.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);u.multiplyVector3(k.centroidScreen);X=L.vertexNormals;O=0;for(ea=X.length;O<ea;O++)fa=k.vertexNormalsWorld[O],
-fa.copy(X[O]),U.multiplyVector3(fa);O=0;for(ea=qa.length;O<ea;O++)if(da=qa[O][C]){X=0;for(fa=da.length;X<fa;X++)k.uvs[O][X]=da[X]}k.material=S;k.faceMaterial=L.materialIndex!==null?aa[L.materialIndex]:null;k.z=k.centroidScreen.z;I.elements.push(k)}}else if(V instanceof THREE.Line){F.multiply(u,R);C=V.geometry.vertices;O=b();O.positionScreen.copy(C[0].position);F.multiplyVector4(O.positionScreen);J=1;for(L=C.length;J<L;J++)if(O=b(),O.positionScreen.copy(C[J].position),F.multiplyVector4(O.positionScreen),
-ea=m[i-2],x.copy(O.positionScreen),B.copy(ea.positionScreen),d(x,B))x.multiplyScalar(1/x.w),B.multiplyScalar(1/B.w),V=s[p]=s[p]||new THREE.RenderableLine,p++,l=V,l.v1.positionScreen.copy(x),l.v2.positionScreen.copy(B),l.z=Math.max(x.z,B.z),l.material=S,I.elements.push(l)}a=0;for(z=I.sprites.length;a<z;a++)if(V=I.sprites[a].object,R=V.matrixWorld,V instanceof THREE.Particle&&(G.set(R.n14,R.n24,R.n34,1),u.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))f=y[v]=y[v]||new THREE.RenderableParticle,v++,t=f,t.x=
-G.x/G.w,t.y=G.y/G.w,t.z=G.z,t.rotation=V.rotation.z,t.scale.x=V.scale.x*Math.abs(t.x-(G.x+e.projectionMatrix.n11)/(G.w+e.projectionMatrix.n14)),t.scale.y=V.scale.y*Math.abs(t.y-(G.y+e.projectionMatrix.n22)/(G.w+e.projectionMatrix.n24)),t.material=V.material,I.elements.push(t);g&&I.elements.sort(c);return I}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function c(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 e,g,f=[],h,i,l=[],
+j,o,r=[],m,p=[],n,q,s=[],t,u,v=[],B={objects:[],sprites:[],lights:[],elements:[]},x=new THREE.Vector3,C=new THREE.Vector4,E=new THREE.Matrix4,G=new THREE.Matrix4,R=new THREE.Frustum,z=new THREE.Vector4,J=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);E.multiply(b.projectionMatrix,b.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);E.multiply(b.matrixWorld,
+b.projectionMatrixInverse);E.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(b,d){g=0;B.objects.length=0;B.sprites.length=0;B.lights.length=0;var f=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||R.contains(b))?(E.multiplyVector3(x.copy(b.position)),e=a(),e.object=
+b,e.z=x.z,B.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.multiplyVector3(x.copy(b.position)),e=a(),e.object=b,e.z=x.z,B.sprites.push(e)):b instanceof THREE.Light&&B.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&B.objects.sort(c);return B};this.projectScene=function(a,e,g){var f=e.near,x=e.far,k,M,L,I,w,W,da,fa,X,S,$,O,ba,aa,pa,ca;u=q=m=o=0;B.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);E.multiply(e.projectionMatrix,e.matrixWorldInverse);R.setFromMatrix(E);B=this.projectGraph(a,!1);a=0;for(k=B.objects.length;a<k;a++)if(X=B.objects[a].object,S=X.matrixWorld,O=X.material,i=0,X instanceof THREE.Mesh){$=X.geometry;ba=X.geometry.materials;I=$.vertices;aa=$.faces;pa=$.faceVertexUvs;$=X.matrixRotationWorld.extractRotation(S);M=0;for(L=I.length;M<L;M++)h=b(),h.positionWorld.copy(I[M].position),S.multiplyVector3(h.positionWorld),
+h.positionScreen.copy(h.positionWorld),E.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<x;I=0;for(M=aa.length;I<M;I++){L=aa[I];if(L instanceof THREE.Face3)if(w=l[L.a],W=l[L.b],da=l[L.c],w.visible&&W.visible&&da.visible&&(X.doubleSided||X.flipSided!=(da.positionScreen.x-w.positionScreen.x)*(W.positionScreen.y-w.positionScreen.y)-(da.positionScreen.y-w.positionScreen.y)*(W.positionScreen.x-
+w.positionScreen.x)<0))fa=r[o]=r[o]||new THREE.RenderableFace3,o++,j=fa,j.v1.copy(w),j.v2.copy(W),j.v3.copy(da);else continue;else if(L instanceof THREE.Face4)if(w=l[L.a],W=l[L.b],da=l[L.c],fa=l[L.d],w.visible&&W.visible&&da.visible&&fa.visible&&(X.doubleSided||X.flipSided!=((fa.positionScreen.x-w.positionScreen.x)*(W.positionScreen.y-w.positionScreen.y)-(fa.positionScreen.y-w.positionScreen.y)*(W.positionScreen.x-w.positionScreen.x)<0||(W.positionScreen.x-da.positionScreen.x)*(fa.positionScreen.y-
+da.positionScreen.y)-(W.positionScreen.y-da.positionScreen.y)*(fa.positionScreen.x-da.positionScreen.x)<0)))ca=p[m]=p[m]||new THREE.RenderableFace4,m++,j=ca,j.v1.copy(w),j.v2.copy(W),j.v3.copy(da),j.v4.copy(fa);else continue;j.normalWorld.copy(L.normal);$.multiplyVector3(j.normalWorld);j.centroidWorld.copy(L.centroid);S.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);E.multiplyVector3(j.centroidScreen);da=L.vertexNormals;w=0;for(W=da.length;w<W;w++)fa=j.vertexNormalsWorld[w],
+fa.copy(da[w]),$.multiplyVector3(fa);w=0;for(W=pa.length;w<W;w++)if(ca=pa[w][I]){da=0;for(fa=ca.length;da<fa;da++)j.uvs[w][da]=ca[da]}j.material=O;j.faceMaterial=L.materialIndex!==null?ba[L.materialIndex]:null;j.z=j.centroidScreen.z;B.elements.push(j)}}else if(X instanceof THREE.Line){G.multiply(E,S);I=X.geometry.vertices;w=b();w.positionScreen.copy(I[0].position);G.multiplyVector4(w.positionScreen);M=1;for(L=I.length;M<L;M++)if(w=b(),w.positionScreen.copy(I[M].position),G.multiplyVector4(w.positionScreen),
+W=l[i-2],z.copy(w.positionScreen),J.copy(W.positionScreen),d(z,J))z.multiplyScalar(1/z.w),J.multiplyScalar(1/J.w),X=s[q]=s[q]||new THREE.RenderableLine,q++,n=X,n.v1.positionScreen.copy(z),n.v2.positionScreen.copy(J),n.z=Math.max(z.z,J.z),n.material=O,B.elements.push(n)}a=0;for(k=B.sprites.length;a<k;a++)if(X=B.sprites[a].object,S=X.matrixWorld,X instanceof THREE.Particle&&(C.set(S.n14,S.n24,S.n34,1),E.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))f=v[u]=v[u]||new THREE.RenderableParticle,u++,t=f,t.x=
+C.x/C.w,t.y=C.y/C.w,t.z=C.z,t.rotation=X.rotation.z,t.scale.x=X.scale.x*Math.abs(t.x-(C.x+e.projectionMatrix.n11)/(C.w+e.projectionMatrix.n14)),t.scale.y=X.scale.y*Math.abs(t.y-(C.y+e.projectionMatrix.n22)/(C.w+e.projectionMatrix.n24)),t.material=X.material,B.elements.push(t);g&&B.elements.sort(c);return B}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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 b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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 b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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 b=
 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 b=
-this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,i=this.w,m=i*c+f*e-h*d,k=i*d+h*c-g*e,o=i*e+g*d-f*c,c=-g*
-c-f*d-h*e;b.x=m*i+c*-g+k*-h-o*-f;b.y=k*i+c*-f+o*-g-m*-h;b.z=o*i+c*-h+m*-f-k*-g;return b}};
+this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,i=this.w,l=i*c+f*e-h*d,j=i*d+h*c-g*e,o=i*e+g*d-f*c,c=-g*
+c-f*d-h*e;b.x=l*i+c*-g+j*-h-o*-f;b.y=j*i+c*-f+o*-g-l*-h;b.z=o*i+c*-h+l*-f-j*-g;return b}};
 THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -83,15 +83,15 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 b,c,d,e,g,f=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],g=this.vertices[c.c],f.sub(g.position,e.position),h.sub(d.position,e.position),f.crossSelf(h),f.isZero()||f.normalize(),c.normal.copy(f)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=
 b,c,d,e,g,f=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],g=this.vertices[c.c],f.sub(g.position,e.position),h.sub(d.position,e.position),f.crossSelf(h),f.isZero()||f.normalize(),c.normal.copy(f)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=
 this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
 this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
 d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
 d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
-b,c,d,e,g,K){h=a.vertices[b].position;i=a.vertices[c].position;m=a.vertices[d].position;k=f[e];o=f[g];r=f[K];n=i.x-h.x;q=m.x-h.x;l=i.y-h.y;p=m.y-h.y;s=i.z-h.z;t=m.z-h.z;v=o.u-k.u;y=r.u-k.u;I=o.v-k.v;z=r.v-k.v;G=1/(v*z-y*I);x.set((z*n-I*q)*G,(z*l-I*p)*G,(z*s-I*t)*G);B.set((v*q-y*n)*G,(v*p-y*l)*G,(v*t-y*s)*G);F[b].addSelf(x);F[c].addSelf(x);F[d].addSelf(x);A[b].addSelf(B);A[c].addSelf(B);A[d].addSelf(B)}var b,c,d,e,g,f,h,i,m,k,o,r,n,q,l,p,s,t,v,y,I,z,G,u,F=[],A=[],x=new THREE.Vector3,B=new THREE.Vector3,
-N=new THREE.Vector3,ba=new THREE.Vector3,Y=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)F[b]=new THREE.Vector3,A[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var K=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)Y.copy(g.vertexNormals[d]),e=g[K[d]],
-u=F[e],N.copy(u),N.subSelf(Y.multiplyScalar(Y.dot(u))).normalize(),ba.cross(g.vertexNormals[d],u),e=ba.dot(A[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(N.x,N.y,N.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
+b,c,d,e,g,K){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;j=f[e];o=f[g];r=f[K];m=i.x-h.x;p=l.x-h.x;n=i.y-h.y;q=l.y-h.y;s=i.z-h.z;t=l.z-h.z;u=o.u-j.u;v=r.u-j.u;B=o.v-j.v;x=r.v-j.v;C=1/(u*x-v*B);z.set((x*m-B*p)*C,(x*n-B*q)*C,(x*s-B*t)*C);J.set((u*p-v*m)*C,(u*q-v*n)*C,(u*t-v*s)*C);G[b].addSelf(z);G[c].addSelf(z);G[d].addSelf(z);R[b].addSelf(J);R[c].addSelf(J);R[d].addSelf(J)}var b,c,d,e,g,f,h,i,l,j,o,r,m,p,n,q,s,t,u,v,B,x,C,E,G=[],R=[],z=new THREE.Vector3,J=new THREE.Vector3,
+K=new THREE.Vector3,U=new THREE.Vector3,V=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,R[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var Y=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)V.copy(g.vertexNormals[d]),e=g[Y[d]],
+E=G[e],K.copy(E),K.subSelf(V.multiplyScalar(V.dot(E))).normalize(),U.cross(g.vertexNormals[d],E),e=U.dot(R[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
 this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=
 this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=
 0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),g,f;g=0;for(f=this.vertices.length;g<f;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];g=0;for(f=this.faces.length;g<f;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=
 0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),g,f;g=0;for(f=this.vertices.length;g<f;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];g=0;for(f=this.faces.length;g<f;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=
 c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
 c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(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 c=[],d={x:0,y:0,z:0},e,g,f,h,i,m,k,o,r;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){e=(this.points.length-1)*a;g=Math.floor(e);f=e-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;m=this.points[c[0]];k=this.points[c[1]];
-o=this.points[c[2]];r=this.points[c[3]];h=f*f;i=f*h;d.x=b(m.x,k.x,o.x,r.x,f,h,i);d.y=b(m.y,k.y,o.y,r.y,f,h,i);d.z=b(m.z,k.z,o.z,r.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,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];f=Math.ceil(a*c/k.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=
+THREE.Spline=function(a){function b(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 c=[],d={x:0,y:0,z:0},e,g,f,h,i,l,j,o,r;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){e=(this.points.length-1)*a;g=Math.floor(e);f=e-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;l=this.points[c[0]];j=this.points[c[1]];
+o=this.points[c[2]];r=this.points[c[3]];h=f*f;i=f*h;d.x=b(l.x,j.x,o.x,r.x,f,h,i);d.y=b(l.y,j.y,o.y,r.y,f,h,i);d.z=b(l.z,j.z,o.z,r.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,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];f=Math.ceil(a*c/j.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,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,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};
 h}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,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,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
 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,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
 THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
 THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
@@ -148,47 +148,47 @@ 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 b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 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 b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var i,m,k,o,r,n,q,l;a=b.projectScene(c,d);i=0;for(m=a.length;i<m;i++)if(r=a[i],r instanceof THREE.RenderableParticle){q=r.x*e+e;l=r.y*g+g;k=0;for(o=r.material.length;k<o;k++)if(n=r.material[k],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=q+"px",n.style.top=l+"px"}}};
-THREE.CanvasRenderer=function(a){function b(a){if(t!=a)l.globalAlpha=t=a}function c(a){if(v!=a){switch(a){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}v=a}}function d(a){if(y!=a)l.strokeStyle=y=a}function e(a){if(I!=a)l.fillStyle=I=a}var g=this,f,h,i,m=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-o,r,n,q,l=k.getContext("2d"),p=new THREE.Color(0),s=0,t=1,v=0,y=null,I=null,z=null,G=null,u=null,F,A,x,B,N=new THREE.RenderableVertex,ba=new THREE.RenderableVertex,Y,K,j,W,J,L,C,O,ea,X,fa,V,R=new THREE.Color,U=new THREE.Color,S=new THREE.Color,aa=new THREE.Color,Z=new THREE.Color,qa=[],da=[],oa,sa,ja,la,ya,va,xa,Aa,ga,ma,ca=new THREE.Rectangle,ta=new THREE.Rectangle,ua=new THREE.Rectangle,Sa=!1,wa=new THREE.Color,Na=new THREE.Color,Oa=new THREE.Color,ra=new THREE.Vector3,Ka,La,D,za,Ma,Pa,a=16;Ka=
-document.createElement("canvas");Ka.width=Ka.height=2;La=Ka.getContext("2d");La.fillStyle="rgba(0,0,0,1)";La.fillRect(0,0,2,2);D=La.getImageData(0,0,2,2);za=D.data;Ma=document.createElement("canvas");Ma.width=Ma.height=a;Pa=Ma.getContext("2d");Pa.translate(-a/2,-a/2);Pa.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){o=a;r=b;n=Math.floor(o/2);q=Math.floor(r/2);k.width=o;k.height=r;ca.set(-n,-q,
-n,q);ta.set(-n,-q,n,q);t=1;v=0;u=G=z=I=y=null};this.setClearColor=function(a,b){p.copy(a);s=b;ta.set(-n,-q,n,q)};this.setClearColorHex=function(a,b){p.setHex(a);s=b;ta.set(-n,-q,n,q)};this.clear=function(){l.setTransform(1,0,0,-1,n,q);ta.isEmpty()||(ta.minSelf(ca),ta.inflate(2),s<1&&l.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight())),s>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*
-255)+","+s+")"),l.fillRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))),ta.empty())};this.render=function(a,k){function o(a){var b,c,d,e;wa.setRGB(0,0,0);Na.setRGB(0,0,0);Oa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(wa.r+=e.r,wa.g+=e.g,wa.b+=e.b):d instanceof THREE.DirectionalLight?(Na.r+=e.r,Na.g+=e.g,Na.b+=e.b):d instanceof THREE.PointLight&&(Oa.r+=e.r,Oa.g+=e.g,Oa.b+=e.b)}function r(a,b,c,d){var e,
-g,f,ga,h,j;e=0;for(g=a.length;e<g;e++)f=a[e],ga=f.color,f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),j=c.dot(h),j<=0||(j*=f.intensity,d.r+=ga.r*j,d.g+=ga.g*j,d.b+=ga.b*j)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),j=c.dot(ra.sub(h,b).normalize()),j<=0||(j*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),j!=0&&(j*=f.intensity,d.r+=ga.r*j,d.g+=ga.g*j,d.b+=ga.b*j)))}function p(a,g,f){b(f.opacity);c(f.blending);var ga,h,j,i,k,ma;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)i=
-f.map.image,k=i.width>>1,ma=i.height>>1,f=g.scale.x*n,j=g.scale.y*q,ga=f*k,h=j*ma,ua.set(a.x-ga,a.y-h,a.x+ga,a.y+h),ca.intersects(ua)&&(l.save(),l.translate(a.x,a.y),l.rotate(-g.rotation),l.scale(f,-j),l.translate(-k,-ma),l.drawImage(i,0,0),l.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(ga=g.scale.x*n,h=g.scale.y*q,ua.set(a.x-ga,a.y-h,a.x+ga,a.y+h),ca.intersects(ua)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),l.save(),l.translate(a.x,a.y),l.rotate(-g.rotation),l.scale(ga,
-h),f.program(l),l.restore()))}function s(a,e,g,f){b(f.opacity);c(f.blending);l.beginPath();l.moveTo(a.positionScreen.x,a.positionScreen.y);l.lineTo(e.positionScreen.x,e.positionScreen.y);l.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(z!=a)l.lineWidth=z=a;a=f.linecap;if(G!=a)l.lineCap=G=a;a=f.linejoin;if(u!=a)l.lineJoin=u=a;d(f.color.getContextStyle());l.stroke();ua.inflate(f.linewidth*2)}}function t(a,d,e,f,h,n,ca,l){g.info.render.vertices+=3;g.info.render.faces++;b(l.opacity);
-c(l.blending);Y=a.positionScreen.x;K=a.positionScreen.y;j=d.positionScreen.x;W=d.positionScreen.y;J=e.positionScreen.x;L=e.positionScreen.y;y(Y,K,j,W,J,L);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(la=ca.uvs[0],Q(Y,K,j,W,J,L,la[f].u,la[f].v,la[h].u,la[h].v,la[n].u,la[n].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,ra.copy(ca.vertexNormalsWorld[f]),ya=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*
-0.5+0.5,va=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,ra.copy(ca.vertexNormalsWorld[h]),xa=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,Aa=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,ra.copy(ca.vertexNormalsWorld[n]),ga=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,ma=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,Q(Y,K,j,W,J,L,ya,va,xa,Aa,ga,ma,l.envMap)}else l.wireframe?Ba(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):M(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&
-!l.wireframe&&(l.map.mapping instanceof THREE.UVMapping&&(la=ca.uvs[0],Q(Y,K,j,W,J,L,la[f].u,la[f].v,la[h].u,la[h].v,la[n].u,la[n].v,l.map)),c(THREE.SubtractiveBlending)),Sa?!l.wireframe&&l.shading==THREE.SmoothShading&&ca.vertexNormalsWorld.length==3?(U.r=S.r=aa.r=wa.r,U.g=S.g=aa.g=wa.g,U.b=S.b=aa.b=wa.b,r(i,ca.v1.positionWorld,ca.vertexNormalsWorld[0],U),r(i,ca.v2.positionWorld,ca.vertexNormalsWorld[1],S),r(i,ca.v3.positionWorld,ca.vertexNormalsWorld[2],aa),U.r=Math.max(0,Math.min(l.color.r*U.r,
-1)),U.g=Math.max(0,Math.min(l.color.g*U.g,1)),U.b=Math.max(0,Math.min(l.color.b*U.b,1)),S.r=Math.max(0,Math.min(l.color.r*S.r,1)),S.g=Math.max(0,Math.min(l.color.g*S.g,1)),S.b=Math.max(0,Math.min(l.color.b*S.b,1)),aa.r=Math.max(0,Math.min(l.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(l.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(l.color.b*aa.b,1)),Z.r=(S.r+aa.r)*0.5,Z.g=(S.g+aa.g)*0.5,Z.b=(S.b+aa.b)*0.5,ja=Qa(U,S,aa,Z),P(Y,K,j,W,J,L,0,0,1,0,0,1,ja)):(R.r=wa.r,R.g=wa.g,R.b=wa.b,r(i,ca.centroidWorld,ca.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?Ba(R,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):M(R)):l.wireframe?Ba(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):M(l.color);else if(l instanceof THREE.MeshDepthMaterial)oa=k.near,sa=k.far,U.r=U.g=U.b=1-Fa(a.positionScreen.z,oa,sa),S.r=S.g=S.b=1-Fa(d.positionScreen.z,oa,sa),aa.r=aa.g=aa.b=1-Fa(e.positionScreen.z,oa,sa),
-Z.r=(S.r+aa.r)*0.5,Z.g=(S.g+aa.g)*0.5,Z.b=(S.b+aa.b)*0.5,ja=Qa(U,S,aa,Z),P(Y,K,j,W,J,L,0,0,1,0,0,1,ja);else if(l instanceof THREE.MeshNormalMaterial)R.r=Ja(ca.normalWorld.x),R.g=Ja(ca.normalWorld.y),R.b=Ja(ca.normalWorld.z),l.wireframe?Ba(R,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):M(R)}function v(a,d,e,f,ga,h,l,n,ca){g.info.render.vertices+=4;g.info.render.faces++;b(n.opacity);c(n.blending);if(n.map||n.envMap)t(a,d,f,0,1,3,l,n,ca),t(ga,e,h,1,2,3,l,n,ca);else if(Y=a.positionScreen.x,
-K=a.positionScreen.y,j=d.positionScreen.x,W=d.positionScreen.y,J=e.positionScreen.x,L=e.positionScreen.y,C=f.positionScreen.x,O=f.positionScreen.y,ea=ga.positionScreen.x,X=ga.positionScreen.y,fa=h.positionScreen.x,V=h.positionScreen.y,n instanceof THREE.MeshBasicMaterial)I(Y,K,j,W,J,L,C,O),n.wireframe?Ba(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):M(n.color);else if(n instanceof THREE.MeshLambertMaterial)Sa?!n.wireframe&&n.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==
-4?(U.r=S.r=aa.r=Z.r=wa.r,U.g=S.g=aa.g=Z.g=wa.g,U.b=S.b=aa.b=Z.b=wa.b,r(i,l.v1.positionWorld,l.vertexNormalsWorld[0],U),r(i,l.v2.positionWorld,l.vertexNormalsWorld[1],S),r(i,l.v4.positionWorld,l.vertexNormalsWorld[3],aa),r(i,l.v3.positionWorld,l.vertexNormalsWorld[2],Z),U.r=Math.max(0,Math.min(n.color.r*U.r,1)),U.g=Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),S.r=Math.max(0,Math.min(n.color.r*S.r,1)),S.g=Math.max(0,Math.min(n.color.g*S.g,1)),S.b=Math.max(0,Math.min(n.color.b*
-S.b,1)),aa.r=Math.max(0,Math.min(n.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(n.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(n.color.b*aa.b,1)),Z.r=Math.max(0,Math.min(n.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(n.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(n.color.b*Z.b,1)),ja=Qa(U,S,aa,Z),y(Y,K,j,W,C,O),P(Y,K,j,W,C,O,0,0,1,0,0,1,ja),y(ea,X,J,L,fa,V),P(ea,X,J,L,fa,V,1,0,1,1,0,1,ja)):(R.r=wa.r,R.g=wa.g,R.b=wa.b,r(i,l.centroidWorld,l.normalWorld,R),R.r=Math.max(0,Math.min(n.color.r*R.r,1)),R.g=Math.max(0,Math.min(n.color.g*
-R.g,1)),R.b=Math.max(0,Math.min(n.color.b*R.b,1)),I(Y,K,j,W,J,L,C,O),n.wireframe?Ba(R,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):M(R)):(I(Y,K,j,W,J,L,C,O),n.wireframe?Ba(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):M(n.color));else if(n instanceof THREE.MeshNormalMaterial)R.r=Ja(l.normalWorld.x),R.g=Ja(l.normalWorld.y),R.b=Ja(l.normalWorld.z),I(Y,K,j,W,J,L,C,O),n.wireframe?Ba(R,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):M(R);else if(n instanceof
-THREE.MeshDepthMaterial)oa=k.near,sa=k.far,U.r=U.g=U.b=1-Fa(a.positionScreen.z,oa,sa),S.r=S.g=S.b=1-Fa(d.positionScreen.z,oa,sa),aa.r=aa.g=aa.b=1-Fa(f.positionScreen.z,oa,sa),Z.r=Z.g=Z.b=1-Fa(e.positionScreen.z,oa,sa),ja=Qa(U,S,aa,Z),y(Y,K,j,W,C,O),P(Y,K,j,W,C,O,0,0,1,0,0,1,ja),y(ea,X,J,L,fa,V),P(ea,X,J,L,fa,V,1,0,1,1,0,1,ja)}function y(a,b,c,d,e,g){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,g);l.lineTo(a,b);l.closePath()}function I(a,b,c,d,e,g,f,ga){l.beginPath();l.moveTo(a,b);l.lineTo(c,
-d);l.lineTo(e,g);l.lineTo(f,ga);l.lineTo(a,b);l.closePath()}function Ba(a,b,c,e){if(z!=b)l.lineWidth=z=b;if(G!=c)l.lineCap=G=c;if(u!=e)l.lineJoin=u=e;d(a.getContextStyle());l.stroke();ua.inflate(b*2)}function M(a){e(a.getContextStyle());l.fill()}function Q(a,b,c,d,g,f,ga,h,j,i,n,k,ca){if(ca.image.width!=0){if(ca.needsUpdate==!0||qa[ca.id]==void 0){var ma=ca.wrapS==THREE.RepeatWrapping,m=ca.wrapT==THREE.RepeatWrapping;qa[ca.id]=l.createPattern(ca.image,ma&&m?"repeat":ma&&!m?"repeat-x":!ma&&m?"repeat-y":
-"no-repeat");ca.needsUpdate=!1}e(qa[ca.id]);var ma=ca.offset.x/ca.repeat.x,m=ca.offset.y/ca.repeat.y,ta=ca.image.width*ca.repeat.x,o=ca.image.height*ca.repeat.y,ga=(ga+ma)*ta,h=(h+m)*o,j=(j+ma)*ta,i=(i+m)*o,n=(n+ma)*ta,k=(k+m)*o;c-=a;d-=b;g-=a;f-=b;j-=ga;i-=h;n-=ga;k-=h;ma=j*k-n*i;if(ma==0){if(da[ca.id]==void 0)b=document.createElement("canvas"),b.width=ca.image.width,b.height=ca.image.height,a=b.getContext("2d"),a.drawImage(ca.image,0,0),da[ca.id]=a.getImageData(0,0,ca.image.width,ca.image.height).data,
-delete b;b=da[ca.id];ga=(Math.floor(ga)+Math.floor(h)*ca.image.width)*4;R.setRGB(b[ga]/255,b[ga+1]/255,b[ga+2]/255);M(R)}else ma=1/ma,ca=(k*c-i*g)*ma,i=(k*d-i*f)*ma,c=(j*g-n*c)*ma,d=(j*f-n*d)*ma,a=a-ca*ga-c*h,ga=b-i*ga-d*h,l.save(),l.transform(ca,i,c,d,a,ga),l.fill(),l.restore()}}function P(a,b,c,d,e,g,f,ga,h,j,i,n,k){var ca,ma;ca=k.width-1;ma=k.height-1;f*=ca;ga*=ma;h*=ca;j*=ma;i*=ca;n*=ma;c-=a;d-=b;e-=a;g-=b;h-=f;j-=ga;i-=f;n-=ga;ma=1/(h*n-i*j);ca=(n*c-j*e)*ma;j=(n*d-j*g)*ma;c=(h*e-i*c)*ma;d=(h*
-g-i*d)*ma;a=a-ca*f-c*ga;b=b-j*f-d*ga;l.save();l.transform(ca,j,c,d,a,b);l.clip();l.drawImage(k,0,0);l.restore()}function Qa(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),ga=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),i=~~(d.r*255),n=~~(d.g*255),d=~~(d.b*255);za[0]=e<0?0:e>255?255:e;za[1]=g<0?0:g>255?255:g;za[2]=a<0?0:a>255?255:a;za[4]=f<0?0:f>255?255:f;za[5]=ga<0?0:ga>255?255:ga;za[6]=b<0?0:b>255?255:b;za[8]=h<0?0:h>255?255:h;za[9]=j<0?0:j>255?255:j;
-za[10]=c<0?0:c>255?255:c;za[12]=i<0?0:i>255?255:i;za[13]=n<0?0:n>255?255:n;za[14]=d<0?0:d>255?255:d;La.putImageData(D,0,0);Pa.drawImage(Ka,0,0);return Ma}function Fa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ja(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ca(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 Ra,Ta,T,$;this.autoClear?this.clear():l.setTransform(1,0,0,-1,n,q);g.info.render.vertices=0;g.info.render.faces=0;f=m.projectScene(a,
-k,this.sortElements);h=f.elements;i=f.lights;(Sa=i.length>0)&&o(i);Ra=0;for(Ta=h.length;Ra<Ta;Ra++)if(T=h[Ra],$=T.material,$=$ instanceof THREE.MeshFaceMaterial?T.faceMaterial:$,!($==null||$.opacity==0)){ua.empty();if(T instanceof THREE.RenderableParticle)F=T,F.x*=n,F.y*=q,p(F,T,$,a);else if(T instanceof THREE.RenderableLine)F=T.v1,A=T.v2,F.positionScreen.x*=n,F.positionScreen.y*=q,A.positionScreen.x*=n,A.positionScreen.y*=q,ua.addPoint(F.positionScreen.x,F.positionScreen.y),ua.addPoint(A.positionScreen.x,
-A.positionScreen.y),ca.intersects(ua)&&s(F,A,T,$,a);else if(T instanceof THREE.RenderableFace3)F=T.v1,A=T.v2,x=T.v3,F.positionScreen.x*=n,F.positionScreen.y*=q,A.positionScreen.x*=n,A.positionScreen.y*=q,x.positionScreen.x*=n,x.positionScreen.y*=q,$.overdraw&&(Ca(F.positionScreen,A.positionScreen),Ca(A.positionScreen,x.positionScreen),Ca(x.positionScreen,F.positionScreen)),ua.add3Points(F.positionScreen.x,F.positionScreen.y,A.positionScreen.x,A.positionScreen.y,x.positionScreen.x,x.positionScreen.y),
-ca.intersects(ua)&&t(F,A,x,0,1,2,T,$,a);else if(T instanceof THREE.RenderableFace4)F=T.v1,A=T.v2,x=T.v3,B=T.v4,F.positionScreen.x*=n,F.positionScreen.y*=q,A.positionScreen.x*=n,A.positionScreen.y*=q,x.positionScreen.x*=n,x.positionScreen.y*=q,B.positionScreen.x*=n,B.positionScreen.y*=q,N.positionScreen.copy(A.positionScreen),ba.positionScreen.copy(B.positionScreen),$.overdraw&&(Ca(F.positionScreen,A.positionScreen),Ca(A.positionScreen,B.positionScreen),Ca(B.positionScreen,F.positionScreen),Ca(x.positionScreen,
-N.positionScreen),Ca(x.positionScreen,ba.positionScreen)),ua.addPoint(F.positionScreen.x,F.positionScreen.y),ua.addPoint(A.positionScreen.x,A.positionScreen.y),ua.addPoint(x.positionScreen.x,x.positionScreen.y),ua.addPoint(B.positionScreen.x,B.positionScreen.y),ca.intersects(ua)&&v(F,A,x,B,N,ba,T,$,a);ta.addRectangle(ua)}l.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,n;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),n=c.dot(i),n<=0||(n*=f.intensity,d.r+=h.r*n,d.g+=h.g*n,d.b+=h.b*n)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),n=c.dot(F.sub(i,b).normalize()),n<=0||(n*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),n!=0&&(n*=f.intensity,d.r+=h.r*n,d.g+=h.g*n,d.b+=h.b*n)))}function b(a){A[a]==null&&(A[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),Y==0&&A[a].setAttribute("shape-rendering","crispEdges"));return A[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,k,o,r,n,q,l,p,s=new THREE.Rectangle,t=new THREE.Rectangle,v=!1,y=new THREE.Color,I=new THREE.Color,z=new THREE.Color,G=new THREE.Color,u,F=new THREE.Vector3,A=[],x=[],B,N,ba,Y=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":Y=1;break;case "low":Y=0}};this.setSize=function(a,b){m=a;k=b;o=m/2;r=k/2;i.setAttribute("viewBox",-o+" "+-r+" "+m+" "+k);i.setAttribute("width",m);i.setAttribute("height",k);s.set(-o,-r,o,r)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,j){var m,A,L,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,j,this.sortElements);g=e.elements;
-f=e.lights;ba=N=0;if(v=f.length>0){I.setRGB(0,0,0);z.setRGB(0,0,0);G.setRGB(0,0,0);m=0;for(A=f.length;m<A;m++)C=f[m],L=C.color,C instanceof THREE.AmbientLight?(I.r+=L.r,I.g+=L.g,I.b+=L.b):C instanceof THREE.DirectionalLight?(z.r+=L.r,z.g+=L.g,z.b+=L.b):C instanceof THREE.PointLight&&(G.r+=L.r,G.g+=L.g,G.b+=L.b)}m=0;for(A=g.length;m<A;m++)if(L=g[m],C=L.material,C=C instanceof THREE.MeshFaceMaterial?L.faceMaterial:C,!(C==null||C.opacity==0))if(t.empty(),L instanceof THREE.RenderableParticle)n=L,n.x*=
-o,n.y*=-r;else if(L instanceof THREE.RenderableLine){if(n=L.v1,q=L.v2,n.positionScreen.x*=o,n.positionScreen.y*=-r,q.positionScreen.x*=o,q.positionScreen.y*=-r,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){L=n;var O=q,F=ba++;x[F]==null&&(x[F]=document.createElementNS("http://www.w3.org/2000/svg","line"),Y==0&&x[F].setAttribute("shape-rendering","crispEdges"));B=x[F];B.setAttribute("x1",L.positionScreen.x);B.setAttribute("y1",L.positionScreen.y);
-B.setAttribute("x2",O.positionScreen.x);B.setAttribute("y2",O.positionScreen.y);C instanceof THREE.LineBasicMaterial&&(B.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(B))}}else if(L instanceof THREE.RenderableFace3){if(n=L.v1,q=L.v2,l=L.v3,n.positionScreen.x*=o,n.positionScreen.y*=-r,q.positionScreen.x*=o,q.positionScreen.y*=-r,l.positionScreen.x*=
-o,l.positionScreen.y*=-r,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(l.positionScreen.x,l.positionScreen.y),s.intersects(t)){var O=n,F=q,X=l;d.info.render.vertices+=3;d.info.render.faces++;B=b(N++);B.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?y.copy(C.color):C instanceof THREE.MeshLambertMaterial?
-v?(y.r=I.r,y.g=I.g,y.b=I.b,a(f,L.centroidWorld,L.normalWorld,y),y.r=Math.max(0,Math.min(C.color.r*y.r,1)),y.g=Math.max(0,Math.min(C.color.g*y.g,1)),y.b=Math.max(0,Math.min(C.color.b*y.b,1))):y.copy(C.color):C instanceof THREE.MeshDepthMaterial?(u=1-C.__2near/(C.__farPlusNear-L.z*C.__farMinusNear),y.setRGB(u,u,u)):C instanceof THREE.MeshNormalMaterial&&y.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));C.wireframe?B.setAttribute("style","fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+
-C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):B.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(B)}}else if(L instanceof THREE.RenderableFace4&&(n=L.v1,q=L.v2,l=L.v3,p=L.v4,n.positionScreen.x*=o,n.positionScreen.y*=-r,q.positionScreen.x*=o,q.positionScreen.y*=-r,l.positionScreen.x*=o,l.positionScreen.y*=-r,p.positionScreen.x*=o,p.positionScreen.y*=-r,t.addPoint(n.positionScreen.x,
-n.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(l.positionScreen.x,l.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),s.intersects(t))){var O=n,F=q,X=l,fa=p;d.info.render.vertices+=4;d.info.render.faces++;B=b(N++);B.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?
-y.copy(C.color):C instanceof THREE.MeshLambertMaterial?v?(y.r=I.r,y.g=I.g,y.b=I.b,a(f,L.centroidWorld,L.normalWorld,y),y.r=Math.max(0,Math.min(C.color.r*y.r,1)),y.g=Math.max(0,Math.min(C.color.g*y.g,1)),y.b=Math.max(0,Math.min(C.color.b*y.b,1))):y.copy(C.color):C instanceof THREE.MeshDepthMaterial?(u=1-C.__2near/(C.__farPlusNear-L.z*C.__farMinusNear),y.setRGB(u,u,u)):C instanceof THREE.MeshNormalMaterial&&y.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));C.wireframe?B.setAttribute("style",
-"fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):B.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(B)}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var i,l,j,o,r,m,p,n;a=b.projectScene(c,d);i=0;for(l=a.length;i<l;i++)if(r=a[i],r instanceof THREE.RenderableParticle){p=r.x*e+e;n=r.y*g+g;j=0;for(o=r.material.length;j<o;j++)if(m=r.material[j],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=p+"px",m.style.top=n+"px"}}};
+THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}u=a}}function d(a){if(v!=a)n.strokeStyle=v=a}function e(a){if(B!=a)n.fillStyle=B=a}var g=this,f,h,i,l=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+o,r,m,p,n=j.getContext("2d"),q=new THREE.Color(0),s=0,t=1,u=0,v=null,B=null,x=null,C=null,E=null,G,R,z,J,K=new THREE.RenderableVertex,U=new THREE.RenderableVertex,V,Y,T,k,M,L,I,w,W,da,fa,X,S=new THREE.Color,$=new THREE.Color,O=new THREE.Color,ba=new THREE.Color,aa=new THREE.Color,pa=[],ca=[],na,sa,ka,la,ya,xa,ua,za,H,ga,ea=new THREE.Rectangle,va=new THREE.Rectangle,ta=new THREE.Rectangle,Ra=!1,wa=new THREE.Color,Na=new THREE.Color,Oa=new THREE.Color,qa=new THREE.Vector3,Ka,La,Sa,A,Ma,Pa,a=16;Ka=document.createElement("canvas");
+Ka.width=Ka.height=2;La=Ka.getContext("2d");La.fillStyle="rgba(0,0,0,1)";La.fillRect(0,0,2,2);Sa=La.getImageData(0,0,2,2);A=Sa.data;Ma=document.createElement("canvas");Ma.width=Ma.height=a;Pa=Ma.getContext("2d");Pa.translate(-a/2,-a/2);Pa.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;r=b;m=Math.floor(o/2);p=Math.floor(r/2);j.width=o;j.height=r;ea.set(-m,-p,m,p);va.set(-m,-p,m,p);t=1;u=0;
+E=C=x=B=v=null};this.setClearColor=function(a,b){q.copy(a);s=b;va.set(-m,-p,m,p)};this.setClearColorHex=function(a,b){q.setHex(a);s=b;va.set(-m,-p,m,p)};this.clear=function(){n.setTransform(1,0,0,-1,m,p);va.isEmpty()||(va.minSelf(ea),va.inflate(2),s<1&&n.clearRect(Math.floor(va.getX()),Math.floor(va.getY()),Math.floor(va.getWidth()),Math.floor(va.getHeight())),s>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+s+")"),n.fillRect(Math.floor(va.getX()),
+Math.floor(va.getY()),Math.floor(va.getWidth()),Math.floor(va.getHeight()))),va.empty())};this.render=function(a,j){function o(a){var b,c,d,e;wa.setRGB(0,0,0);Na.setRGB(0,0,0);Oa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(wa.r+=e.r,wa.g+=e.g,wa.b+=e.b):d instanceof THREE.DirectionalLight?(Na.r+=e.r,Na.g+=e.g,Na.b+=e.b):d instanceof THREE.PointLight&&(Oa.r+=e.r,Oa.g+=e.g,Oa.b+=e.b)}function r(a,b,c,d){var e,g,f,h,k,ga;e=0;for(g=a.length;e<g;e++)f=a[e],
+h=f.color,f instanceof THREE.DirectionalLight?(k=f.matrixWorld.getPosition(),ga=c.dot(k),ga<=0||(ga*=f.intensity,d.r+=h.r*ga,d.g+=h.g*ga,d.b+=h.b*ga)):f instanceof THREE.PointLight&&(k=f.matrixWorld.getPosition(),ga=c.dot(qa.sub(k,b).normalize()),ga<=0||(ga*=f.distance==0?1:1-Math.min(b.distanceTo(k)/f.distance,1),ga!=0&&(ga*=f.intensity,d.r+=h.r*ga,d.g+=h.g*ga,d.b+=h.b*ga)))}function q(a,g,f){b(f.opacity);c(f.blending);var h,ga,k,i,j,l;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)i=f.map.image,
+j=i.width>>1,l=i.height>>1,f=g.scale.x*m,k=g.scale.y*p,h=f*j,ga=k*l,ta.set(a.x-h,a.y-ga,a.x+h,a.y+ga),ea.intersects(ta)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-k),n.translate(-j,-l),n.drawImage(i,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*m,ga=g.scale.y*p,ta.set(a.x-h,a.y-ga,a.x+h,a.y+ga),ea.intersects(ta)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(h,ga),f.program(n),
+n.restore()))}function s(a,e,g,f){b(f.opacity);c(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(x!=a)n.lineWidth=x=a;a=f.linecap;if(C!=a)n.lineCap=C=a;a=f.linejoin;if(E!=a)n.lineJoin=E=a;d(f.color.getContextStyle());n.stroke();ta.inflate(f.linewidth*2)}}function t(a,d,e,f,h,ea,m,n){g.info.render.vertices+=3;g.info.render.faces++;b(n.opacity);c(n.blending);
+V=a.positionScreen.x;Y=a.positionScreen.y;T=d.positionScreen.x;k=d.positionScreen.y;M=e.positionScreen.x;L=e.positionScreen.y;v(V,Y,T,k,M,L);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],Q(V,Y,T,k,M,L,la[f].u,la[f].v,la[h].u,la[h].v,la[ea].u,la[ea].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,qa.copy(m.vertexNormalsWorld[f]),ya=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,
+xa=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,qa.copy(m.vertexNormalsWorld[h]),ua=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,za=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,qa.copy(m.vertexNormalsWorld[ea]),H=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,ga=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,Q(V,Y,T,k,M,L,ya,xa,ua,za,H,ga,n.envMap)}else n.wireframe?Ba(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&
+(n.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],Q(V,Y,T,k,M,L,la[f].u,la[f].v,la[h].u,la[h].v,la[ea].u,la[ea].v,n.map)),c(THREE.SubtractiveBlending)),Ra?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?($.r=O.r=ba.r=wa.r,$.g=O.g=ba.g=wa.g,$.b=O.b=ba.b=wa.b,r(i,m.v1.positionWorld,m.vertexNormalsWorld[0],$),r(i,m.v2.positionWorld,m.vertexNormalsWorld[1],O),r(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ba),$.r=Math.max(0,Math.min(n.color.r*$.r,1)),$.g=Math.max(0,
+Math.min(n.color.g*$.g,1)),$.b=Math.max(0,Math.min(n.color.b*$.b,1)),O.r=Math.max(0,Math.min(n.color.r*O.r,1)),O.g=Math.max(0,Math.min(n.color.g*O.g,1)),O.b=Math.max(0,Math.min(n.color.b*O.b,1)),ba.r=Math.max(0,Math.min(n.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(n.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(n.color.b*ba.b,1)),aa.r=(O.r+ba.r)*0.5,aa.g=(O.g+ba.g)*0.5,aa.b=(O.b+ba.b)*0.5,ka=P($,O,ba,aa),N(V,Y,T,k,M,L,0,0,1,0,0,1,ka)):(S.r=wa.r,S.g=wa.g,S.b=wa.b,r(i,m.centroidWorld,m.normalWorld,S),S.r=
+Math.max(0,Math.min(n.color.r*S.r,1)),S.g=Math.max(0,Math.min(n.color.g*S.g,1)),S.b=Math.max(0,Math.min(n.color.b*S.b,1)),n.wireframe?Ba(S,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(S)):n.wireframe?Ba(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshDepthMaterial)na=j.near,sa=j.far,$.r=$.g=$.b=1-Fa(a.positionScreen.z,na,sa),O.r=O.g=O.b=1-Fa(d.positionScreen.z,na,sa),ba.r=ba.g=ba.b=1-Fa(e.positionScreen.z,na,sa),aa.r=
+(O.r+ba.r)*0.5,aa.g=(O.g+ba.g)*0.5,aa.b=(O.b+ba.b)*0.5,ka=P($,O,ba,aa),N(V,Y,T,k,M,L,0,0,1,0,0,1,ka);else if(n instanceof THREE.MeshNormalMaterial)S.r=Ja(m.normalWorld.x),S.g=Ja(m.normalWorld.y),S.b=Ja(m.normalWorld.z),n.wireframe?Ba(S,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(S)}function u(a,d,e,f,h,ga,n,m,ea){g.info.render.vertices+=4;g.info.render.faces++;b(m.opacity);c(m.blending);if(m.map||m.envMap)t(a,d,f,0,1,3,n,m,ea),t(h,e,ga,1,2,3,n,m,ea);else if(V=a.positionScreen.x,
+Y=a.positionScreen.y,T=d.positionScreen.x,k=d.positionScreen.y,M=e.positionScreen.x,L=e.positionScreen.y,I=f.positionScreen.x,w=f.positionScreen.y,W=h.positionScreen.x,da=h.positionScreen.y,fa=ga.positionScreen.x,X=ga.positionScreen.y,m instanceof THREE.MeshBasicMaterial)B(V,Y,T,k,M,L,I,w),m.wireframe?Ba(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(m.color);else if(m instanceof THREE.MeshLambertMaterial)Ra?!m.wireframe&&m.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==
+4?($.r=O.r=ba.r=aa.r=wa.r,$.g=O.g=ba.g=aa.g=wa.g,$.b=O.b=ba.b=aa.b=wa.b,r(i,n.v1.positionWorld,n.vertexNormalsWorld[0],$),r(i,n.v2.positionWorld,n.vertexNormalsWorld[1],O),r(i,n.v4.positionWorld,n.vertexNormalsWorld[3],ba),r(i,n.v3.positionWorld,n.vertexNormalsWorld[2],aa),$.r=Math.max(0,Math.min(m.color.r*$.r,1)),$.g=Math.max(0,Math.min(m.color.g*$.g,1)),$.b=Math.max(0,Math.min(m.color.b*$.b,1)),O.r=Math.max(0,Math.min(m.color.r*O.r,1)),O.g=Math.max(0,Math.min(m.color.g*O.g,1)),O.b=Math.max(0,Math.min(m.color.b*
+O.b,1)),ba.r=Math.max(0,Math.min(m.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(m.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(m.color.b*ba.b,1)),aa.r=Math.max(0,Math.min(m.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(m.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(m.color.b*aa.b,1)),ka=P($,O,ba,aa),v(V,Y,T,k,I,w),N(V,Y,T,k,I,w,0,0,1,0,0,1,ka),v(W,da,M,L,fa,X),N(W,da,M,L,fa,X,1,0,1,1,0,1,ka)):(S.r=wa.r,S.g=wa.g,S.b=wa.b,r(i,n.centroidWorld,n.normalWorld,S),S.r=Math.max(0,Math.min(m.color.r*S.r,1)),S.g=Math.max(0,
+Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),B(V,Y,T,k,M,L,I,w),m.wireframe?Ba(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(S)):(B(V,Y,T,k,M,L,I,w),m.wireframe?Ba(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(m.color));else if(m instanceof THREE.MeshNormalMaterial)S.r=Ja(n.normalWorld.x),S.g=Ja(n.normalWorld.y),S.b=Ja(n.normalWorld.z),B(V,Y,T,k,M,L,I,w),m.wireframe?Ba(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):
+Aa(S);else if(m instanceof THREE.MeshDepthMaterial)na=j.near,sa=j.far,$.r=$.g=$.b=1-Fa(a.positionScreen.z,na,sa),O.r=O.g=O.b=1-Fa(d.positionScreen.z,na,sa),ba.r=ba.g=ba.b=1-Fa(f.positionScreen.z,na,sa),aa.r=aa.g=aa.b=1-Fa(e.positionScreen.z,na,sa),ka=P($,O,ba,aa),v(V,Y,T,k,I,w),N(V,Y,T,k,I,w,0,0,1,0,0,1,ka),v(W,da,M,L,fa,X),N(W,da,M,L,fa,X,1,0,1,1,0,1,ka)}function v(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function B(a,b,c,d,e,g,f,h){n.beginPath();
+n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(f,h);n.lineTo(a,b);n.closePath()}function Ba(a,b,c,e){if(x!=b)n.lineWidth=x=b;if(C!=c)n.lineCap=C=c;if(E!=e)n.lineJoin=E=e;d(a.getContextStyle());n.stroke();ta.inflate(b*2)}function Aa(a){e(a.getContextStyle());n.fill()}function Q(a,b,c,d,g,f,h,ga,k,i,m,j,ea){if(ea.image.width!=0){if(ea.needsUpdate==!0||pa[ea.id]==void 0){var l=ea.wrapS==THREE.RepeatWrapping,o=ea.wrapT==THREE.RepeatWrapping;pa[ea.id]=n.createPattern(ea.image,l&&o?"repeat":l&&!o?"repeat-x":
+!l&&o?"repeat-y":"no-repeat");ea.needsUpdate=!1}e(pa[ea.id]);var l=ea.offset.x/ea.repeat.x,o=ea.offset.y/ea.repeat.y,r=ea.image.width*ea.repeat.x,p=ea.image.height*ea.repeat.y,h=(h+l)*r,ga=(ga+o)*p,k=(k+l)*r,i=(i+o)*p,m=(m+l)*r,j=(j+o)*p;c-=a;d-=b;g-=a;f-=b;k-=h;i-=ga;m-=h;j-=ga;l=k*j-m*i;if(l==0){if(ca[ea.id]==void 0)b=document.createElement("canvas"),b.width=ea.image.width,b.height=ea.image.height,a=b.getContext("2d"),a.drawImage(ea.image,0,0),ca[ea.id]=a.getImageData(0,0,ea.image.width,ea.image.height).data,
+delete b;b=ca[ea.id];h=(Math.floor(h)+Math.floor(ga)*ea.image.width)*4;S.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Aa(S)}else l=1/l,ea=(j*c-i*g)*l,i=(j*d-i*f)*l,c=(k*g-m*c)*l,d=(k*f-m*d)*l,a=a-ea*h-c*ga,h=b-i*h-d*ga,n.save(),n.transform(ea,i,c,d,a,h),n.fill(),n.restore()}}function N(a,b,c,d,e,g,f,h,ga,k,i,m,j){var ea,l;ea=j.width-1;l=j.height-1;f*=ea;h*=l;ga*=ea;k*=l;i*=ea;m*=l;c-=a;d-=b;e-=a;g-=b;ga-=f;k-=h;i-=f;m-=h;l=1/(ga*m-i*k);ea=(m*c-k*e)*l;k=(m*d-k*g)*l;c=(ga*e-i*c)*l;d=(ga*g-i*d)*l;a=a-ea*f-
+c*h;b=b-k*f-d*h;n.save();n.transform(ea,k,c,d,a,b);n.clip();n.drawImage(j,0,0);n.restore()}function P(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),ga=~~(c.r*255),k=~~(c.g*255),c=~~(c.b*255),i=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);A[0]=e<0?0:e>255?255:e;A[1]=g<0?0:g>255?255:g;A[2]=a<0?0:a>255?255:a;A[4]=f<0?0:f>255?255:f;A[5]=h<0?0:h>255?255:h;A[6]=b<0?0:b>255?255:b;A[8]=ga<0?0:ga>255?255:ga;A[9]=k<0?0:k>255?255:k;A[10]=c<0?0:c>255?255:c;A[12]=
+i<0?0:i>255?255:i;A[13]=m<0?0:m>255?255:m;A[14]=d<0?0:d>255?255:d;La.putImageData(Sa,0,0);Pa.drawImage(Ka,0,0);return Ma}function Fa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ja(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ca(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 Qa,Ta,ra,Z;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,p);g.info.render.vertices=0;g.info.render.faces=0;f=l.projectScene(a,j,this.sortElements);h=f.elements;
+i=f.lights;(Ra=i.length>0)&&o(i);Qa=0;for(Ta=h.length;Qa<Ta;Qa++)if(ra=h[Qa],Z=ra.material,Z=Z instanceof THREE.MeshFaceMaterial?ra.faceMaterial:Z,!(Z==null||Z.opacity==0)){ta.empty();if(ra instanceof THREE.RenderableParticle)G=ra,G.x*=m,G.y*=p,q(G,ra,Z,a);else if(ra instanceof THREE.RenderableLine)G=ra.v1,R=ra.v2,G.positionScreen.x*=m,G.positionScreen.y*=p,R.positionScreen.x*=m,R.positionScreen.y*=p,ta.addPoint(G.positionScreen.x,G.positionScreen.y),ta.addPoint(R.positionScreen.x,R.positionScreen.y),
+ea.intersects(ta)&&s(G,R,ra,Z,a);else if(ra instanceof THREE.RenderableFace3)G=ra.v1,R=ra.v2,z=ra.v3,G.positionScreen.x*=m,G.positionScreen.y*=p,R.positionScreen.x*=m,R.positionScreen.y*=p,z.positionScreen.x*=m,z.positionScreen.y*=p,Z.overdraw&&(Ca(G.positionScreen,R.positionScreen),Ca(R.positionScreen,z.positionScreen),Ca(z.positionScreen,G.positionScreen)),ta.add3Points(G.positionScreen.x,G.positionScreen.y,R.positionScreen.x,R.positionScreen.y,z.positionScreen.x,z.positionScreen.y),ea.intersects(ta)&&
+t(G,R,z,0,1,2,ra,Z,a);else if(ra instanceof THREE.RenderableFace4)G=ra.v1,R=ra.v2,z=ra.v3,J=ra.v4,G.positionScreen.x*=m,G.positionScreen.y*=p,R.positionScreen.x*=m,R.positionScreen.y*=p,z.positionScreen.x*=m,z.positionScreen.y*=p,J.positionScreen.x*=m,J.positionScreen.y*=p,K.positionScreen.copy(R.positionScreen),U.positionScreen.copy(J.positionScreen),Z.overdraw&&(Ca(G.positionScreen,R.positionScreen),Ca(R.positionScreen,J.positionScreen),Ca(J.positionScreen,G.positionScreen),Ca(z.positionScreen,
+K.positionScreen),Ca(z.positionScreen,U.positionScreen)),ta.addPoint(G.positionScreen.x,G.positionScreen.y),ta.addPoint(R.positionScreen.x,R.positionScreen.y),ta.addPoint(z.positionScreen.x,z.positionScreen.y),ta.addPoint(J.positionScreen.x,J.positionScreen.y),ea.intersects(ta)&&u(G,R,z,J,K,U,ra,Z,a);va.addRectangle(ta)}n.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,m;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),m=c.dot(i),m<=0||(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),m=c.dot(G.sub(i,b).normalize()),m<=0||(m*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),m!=0&&(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function b(a){R[a]==null&&(R[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),V==0&&R[a].setAttribute("shape-rendering","crispEdges"));return R[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,j,o,r,m,p,n,q,s=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,v=new THREE.Color,B=new THREE.Color,x=new THREE.Color,C=new THREE.Color,E,G=new THREE.Vector3,R=[],z=[],J,K,U,V=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":V=1;break;case "low":V=0}};this.setSize=function(a,b){l=a;j=b;o=l/2;r=j/2;i.setAttribute("viewBox",-o+" "+-r+" "+l+" "+j);i.setAttribute("width",l);i.setAttribute("height",j);s.set(-o,-r,o,r)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(j,l){var k,R,L,I;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,l,this.sortElements);g=e.elements;
+f=e.lights;U=K=0;if(u=f.length>0){B.setRGB(0,0,0);x.setRGB(0,0,0);C.setRGB(0,0,0);k=0;for(R=f.length;k<R;k++)I=f[k],L=I.color,I instanceof THREE.AmbientLight?(B.r+=L.r,B.g+=L.g,B.b+=L.b):I instanceof THREE.DirectionalLight?(x.r+=L.r,x.g+=L.g,x.b+=L.b):I instanceof THREE.PointLight&&(C.r+=L.r,C.g+=L.g,C.b+=L.b)}k=0;for(R=g.length;k<R;k++)if(L=g[k],I=L.material,I=I instanceof THREE.MeshFaceMaterial?L.faceMaterial:I,!(I==null||I.opacity==0))if(t.empty(),L instanceof THREE.RenderableParticle)m=L,m.x*=
+o,m.y*=-r;else if(L instanceof THREE.RenderableLine){if(m=L.v1,p=L.v2,m.positionScreen.x*=o,m.positionScreen.y*=-r,p.positionScreen.x*=o,p.positionScreen.y*=-r,t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),s.intersects(t)){L=m;var w=p,G=U++;z[G]==null&&(z[G]=document.createElementNS("http://www.w3.org/2000/svg","line"),V==0&&z[G].setAttribute("shape-rendering","crispEdges"));J=z[G];J.setAttribute("x1",L.positionScreen.x);J.setAttribute("y1",L.positionScreen.y);
+J.setAttribute("x2",w.positionScreen.x);J.setAttribute("y2",w.positionScreen.y);I instanceof THREE.LineBasicMaterial&&(J.setAttribute("style","fill: none; stroke: "+I.color.getContextStyle()+"; stroke-width: "+I.linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.linecap+"; stroke-linejoin: "+I.linejoin),i.appendChild(J))}}else if(L instanceof THREE.RenderableFace3){if(m=L.v1,p=L.v2,n=L.v3,m.positionScreen.x*=o,m.positionScreen.y*=-r,p.positionScreen.x*=o,p.positionScreen.y*=-r,n.positionScreen.x*=
+o,n.positionScreen.y*=-r,t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),t.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(t)){var w=m,G=p,da=n;d.info.render.vertices+=3;d.info.render.faces++;J=b(K++);J.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?v.copy(I.color):I instanceof THREE.MeshLambertMaterial?
+u?(v.r=B.r,v.g=B.g,v.b=B.b,a(f,L.centroidWorld,L.normalWorld,v),v.r=Math.max(0,Math.min(I.color.r*v.r,1)),v.g=Math.max(0,Math.min(I.color.g*v.g,1)),v.b=Math.max(0,Math.min(I.color.b*v.b,1))):v.copy(I.color):I instanceof THREE.MeshDepthMaterial?(E=1-I.__2near/(I.__farPlusNear-L.z*I.__farMinusNear),v.setRGB(E,E,E)):I instanceof THREE.MeshNormalMaterial&&v.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));I.wireframe?J.setAttribute("style","fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+
+I.wireframeLinewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframeLinecap+"; stroke-linejoin: "+I.wireframeLinejoin):J.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+I.opacity);i.appendChild(J)}}else if(L instanceof THREE.RenderableFace4&&(m=L.v1,p=L.v2,n=L.v3,q=L.v4,m.positionScreen.x*=o,m.positionScreen.y*=-r,p.positionScreen.x*=o,p.positionScreen.y*=-r,n.positionScreen.x*=o,n.positionScreen.y*=-r,q.positionScreen.x*=o,q.positionScreen.y*=-r,t.addPoint(m.positionScreen.x,
+m.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t))){var w=m,G=p,da=n,fa=q;d.info.render.vertices+=4;d.info.render.faces++;J=b(K++);J.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?
+v.copy(I.color):I instanceof THREE.MeshLambertMaterial?u?(v.r=B.r,v.g=B.g,v.b=B.b,a(f,L.centroidWorld,L.normalWorld,v),v.r=Math.max(0,Math.min(I.color.r*v.r,1)),v.g=Math.max(0,Math.min(I.color.g*v.g,1)),v.b=Math.max(0,Math.min(I.color.b*v.b,1))):v.copy(I.color):I instanceof THREE.MeshDepthMaterial?(E=1-I.__2near/(I.__farPlusNear-L.z*I.__farMinusNear),v.setRGB(E,E,E)):I instanceof THREE.MeshNormalMaterial&&v.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));I.wireframe?J.setAttribute("style",
+"fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+I.wireframeLinewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframeLinecap+"; stroke-linejoin: "+I.wireframeLinejoin):J.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+I.opacity);i.appendChild(J)}}};
 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",
 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",
 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",
 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",
@@ -221,116 +221,115 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 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.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.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 b(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 f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
+THREE.WebGLRenderer=function(a){function b(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 f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=k.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
 function c(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){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){if(a.vertexColors)return a.vertexColors;return!1}function g(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
 function c(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){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){if(a.vertexColors)return a.vertexColors;return!1}function g(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
-return!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,n=i.length,k=a.__vertexArray,l=a.__colorArray,m=a.__sortArray,o=a.__dirtyVertices,r=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){ya.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,va.copy(e),ya.multiplyVector3(va),m[d]=[va.z,d];m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[m[d][1]].position,f=d*3,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;for(d=0;d<n;d++)f=d*3,e=i[m[d][1]],l[f]=e.r,l[f+
-1]=e.g,l[f+2]=e.b;if(q){i=0;for(n=q.length;i<n;i++)if(h=q[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=m[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,
-f+=3;else if(h.size===4)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=d*3,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;if(r)for(d=0;d<n;d++)e=i[d],f=d*3,l[f]=e.r,l[f+1]=e.g,l[f+2]=e.b;if(q){i=0;for(n=q.length;i<n;i++)if(h=q[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(e=h.value.length,f=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++)g=h.value[d],
-h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(r||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,
-a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(q){i=0;for(n=q.length;i<n;i++)if(h=q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function h(a,b){return b.z-a.z}function i(a,b,c,d,e,f,g,h){var j,i,n,k;b?(i=a.length-1,k=b=-1):(i=0,b=a.length,k=1);for(var l=i;l!==b;l+=k)if(j=a[l],j.render){i=j.object;n=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&K.setBlending(j.blending);K.setDepthTest(j.depthTest);s(j.depthWrite);t(j.polygonOffset,
-j.polygonOffsetFactor,j.polygonOffsetUnits)}K.setObjectFaces(i);K.renderBuffer(d,e,f,j,n,i)}}function m(a,b,c,d,e,f,g){for(var h,j,i=0,n=a.length;i<n;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&K.setBlending(h.blending);K.setDepthTest(h.depthTest);s(h.depthWrite);t(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}K.renderImmediateObject(c,d,e,h,j)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function o(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 n(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function l(a,b,c,d,e){d.program||K.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets);for(var f=0,g=K.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=
-f.uniforms,i=d.uniforms;f!==J&&(j.useProgram(f),J=f,h=!0);if(d.id!==C)C=d.id,h=!0;if(h){j.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);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 n,k,l=0,m=0,o=0,r,q,p,s=xa,t=s.directional.colors,x=s.directional.positions,
-v=s.point.colors,B=s.point.positions,N=s.point.distances,A=0,z=0,c=n=p=0,h=b.length;c<h;c++)if(n=b[c],k=n.color,r=n.position,q=n.intensity,p=n.distance,n instanceof THREE.AmbientLight)K.gammaInput?(l+=k.r*k.r,m+=k.g*k.g,o+=k.b*k.b):(l+=k.r,m+=k.g,o+=k.b);else if(n instanceof THREE.DirectionalLight)p=A*3,K.gammaInput?(t[p]=k.r*k.r*q*q,t[p+1]=k.g*k.g*q*q,t[p+2]=k.b*k.b*q*q):(t[p]=k.r*q,t[p+1]=k.g*q,t[p+2]=k.b*q),x[p]=r.x,x[p+1]=r.y,x[p+2]=r.z,A+=1;else if(n instanceof THREE.SpotLight)p=A*3,K.gammaInput?
-(t[p]=k.r*k.r*q*q,t[p+1]=k.g*k.g*q*q,t[p+2]=k.b*k.b*q*q):(t[p]=k.r*q,t[p+1]=k.g*q,t[p+2]=k.b*q),k=1/r.length(),x[p]=r.x*k,x[p+1]=r.y*k,x[p+2]=r.z*k,A+=1;else if(n instanceof THREE.PointLight)n=z*3,K.gammaInput?(v[n]=k.r*k.r*q*q,v[n+1]=k.g*k.g*q*q,v[n+2]=k.b*k.b*q*q):(v[n]=k.r*q,v[n+1]=k.g*q,v[n+2]=k.b*q),B[n]=r.x,B[n+1]=r.y,B[n+2]=r.z,N[z]=p,z+=1;c=A*3;for(h=t.length;c<h;c++)t[c]=0;c=z*3;for(h=v.length;c<h;c++)v[c]=0;s.point.length=z;s.directional.length=A;s.ambient[0]=l;s.ambient[1]=m;s.ambient[2]=
-o;b=xa;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,K.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=u.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,K.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)K.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<K.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=K.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=K.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=K.shadowMapDarkness;i.shadowBias.value=K.shadowMapBias}b=
-d.uniformsList;i=0;for(c=b.length;i<c;i++)if(m=f.uniforms[b[i][1]])if(l=b[i][0],o=l.type,h=l.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(!l._array)l._array=new Float32Array(3*h.length);o=0;for(r=h.length;o<r;o++)s=
-o*3,l._array[s]=h[o].x,l._array[s+1]=h[o].y,l._array[s+2]=h[o].z;j.uniform3fv(m,l._array)}else if(o==="m4"){if(!l._array)l._array=new Float32Array(16);h.flattenToArray(l._array);j.uniformMatrix4fv(m,!1,l._array)}else if(o==="m4v"){if(!l._array)l._array=new Float32Array(16*h.length);o=0;for(r=h.length;o<r;o++)h[o].flattenToArrayOffset(l._array,o*16);j.uniformMatrix4fv(m,!1,l._array)}else if(o==="t"){if(j.uniform1i(m,h),m=l.texture)if(m.image instanceof Array&&m.image.length===6){if(l=m,l.image.length===
-6)if(l.needsUpdate){if(!l.image.__webglTextureCube)l.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube);h=y(j.TEXTURE_CUBE_MAP,l,l.image[0]);for(m=0;m<6;m++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,l.image[m]);h&&j.generateMipmap(j.TEXTURE_CUBE_MAP);l.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?
-(l=m,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.__webglTexture)):K.setTexture(m,h)}else if(o==="tv"){if(!l._array){l._array=[];o=0;for(r=l.texture.length;o<r;o++)l._array[o]=h+o}j.uniform1iv(m,l._array);o=0;for(r=l.texture.length;o<r;o++)(m=l.texture[o])&&K.setTexture(m,l._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&j.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||
-d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&
-g.objectMatrix!==null&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function p(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function s(a){U!==a&&(j.depthMask(a),U=a)}function t(a,b,c){S!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),S=a);if(a&&(aa!==b||Z!==c))j.polygonOffset(b,c),aa=b,Z=c}function v(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 y(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,G(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,G(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,G(b.magFilter)),j.texParameteri(a,
-j.TEXTURE_MIN_FILTER,G(b.minFilter)),!0):(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,z(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,z(b.minFilter)),!1)}function I(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 z(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function G(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||{},u=a.canvas!==void 0?a.canvas:document.createElement("canvas"),F=a.precision!==void 0?a.precision:
-"highp",A=a.antialias!==void 0?a.antialias:!1,x=a.stencil!==void 0?a.stencil:!0,B=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,N=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ba=a.clearAlpha!==void 0?a.clearAlpha:0,Y=a.maxLights!==void 0?a.maxLights:4;this.domElement=u;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.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var K=this,j,W=[],J=null,L=null,C=-1,O=null,ea=0,X=null,fa=null,V=null,R=
-null,U=null,S=null,aa=null,Z=null,qa=null,da=0,oa=0,sa=0,ja=0,la=new THREE.Frustum,ya=new THREE.Matrix4,va=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=u.getContext("experimental-webgl",{antialias:A,stencil:x,preserveDrawingBuffer:B})))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(N.r,N.g,N.b,ba);this.context=j;var Aa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=
-function(){return Aa};this.setSize=function(a,b){u.width=a;u.height=b;this.setViewport(0,0,u.width,u.height)};this.setViewport=function(a,b,c,d){da=a;oa=b;sa=c;ja=d;j.viewport(da,oa,sa,ja)};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){N.setHex(a);ba=b;j.clearColor(N.r,N.g,N.b,ba)};this.setClearColor=function(a,b){N.copy(a);ba=b;j.clearColor(N.r,N.g,N.b,ba)};this.getClearColor=
-function(){return N};this.getClearAlpha=function(){return ba};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){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};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]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);K.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
-j.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),K.info.memory.textures--};this.updateShadowMap=
-function(a,b){J=null;C=O=U=R=V=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(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,f,g,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],f=c[m+2],g=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+g+h)/3,e=(e+i+n)/3,f=(f+k+l)/3,c[m]=d,c[m+1]=e,c[m+2]=f,c[m+3]=d,c[m+4]=e,c[m+5]=f,c[m+6]=d,c[m+7]=e,c[m+8]=f}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};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=l(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==O&&(O=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(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.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(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],n=-1,k=0;h=f.morphTargetInfluences;var m,
-o=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(m=0;m<o;m++)!i[m]&&h[m]>n&&(k=m,n=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=n;i[k]=1;n=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=
-e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],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))}f instanceof THREE.Mesh?(d.wireframe?
-(d=d.wireframeLinewidth,d!==qa&&(j.lineWidth(d),qa=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)),K.info.render.calls++,K.info.render.vertices+=e.__webglFaceCount,K.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==
-qa&&(j.lineWidth(d),qa=d),j.drawArrays(f,0,e.__webglLineCount),K.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),K.info.render.calls++):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),K.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,g,n,k=a.lights,l=a.fog;C=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();if(this.renderPluginsPre.length){e=0;for(f=this.renderPluginsPre.length;e<f;e++)J=null,C=O=U=R=V=-1,this.renderPluginsPre[e].render(a,b,sa,ja),J=null,C=O=U=R=V=-1}K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=
-new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ya.multiply(b.projectionMatrix,b.matrixWorldInverse);la.setFromMatrix(ya);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=a.__webglObjects;e=0;for(f=d.length;e<f;e++)if(g=d[e],n=g.object,g.render=!1,n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||la.contains(n))){n.matrixWorld.flattenToArray(n._objectMatrixArray);p(n,b);var o=g,q=o.object,
-r=o.buffer,x=void 0,x=x=void 0,x=q.material;if(x instanceof THREE.MeshFaceMaterial){if(x=r.materialIndex,x>=0)x=q.geometry.materials[x],x.transparent?(o.transparent=x,o.opaque=null):(o.opaque=x,o.transparent=null)}else if(x)x.transparent?(o.transparent=x,o.opaque=null):(o.opaque=x,o.transparent=null);g.render=!0;if(this.sortObjects)n.renderDepth?g.z=n.renderDepth:(va.copy(n.position),ya.multiplyVector3(va),g.z=va.z)}this.sortObjects&&d.sort(h);d=a.__webglObjectsImmediate;e=0;for(f=d.length;e<f;e++)if(g=
-d[e],n=g.object,n.visible)n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),p(n,b),n=g.object.material,n.transparent?(g.transparent=n,g.opaque=null):(g.opaque=n,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),s(a.overrideMaterial.depthWrite),t(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,k,l,!0,a.overrideMaterial),
-m(a.__webglObjectsImmediate,"",b,k,l,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,k,l,!1),m(a.__webglObjectsImmediate,"opaque",b,k,l,!1),i(a.__webglObjects,!1,"transparent",b,k,l,!0),m(a.__webglObjectsImmediate,"transparent",b,k,l,!0));if(this.renderPluginsPost.length){e=0;for(f=this.renderPluginsPost.length;e<f;e++)this.renderPluginsPost[e].render(a,b,sa,ja),J=null,C=O=U=R=V=-1}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.renderImmediateObject=function(a,b,c,d,e){var f=l(a,b,c,d,e);O=-1;K.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,la):e.render(function(a){K.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=
-function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,l=void 0,m=void 0,p=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){m=h.geometry;
-if(m.geometryGroups===void 0){var p=m,s=void 0,t=void 0,x=void 0,v=void 0,B=void 0,y=void 0,D=void 0,A={},N=p.morphTargets.length;p.geometryGroups={};s=0;for(t=p.faces.length;s<t;s++)x=p.faces[s],v=x.materialIndex,y=v!==void 0?v:-1,A[y]===void 0&&(A[y]={hash:y,counter:0}),D=A[y].hash+"_"+A[y].counter,p.geometryGroups[D]===void 0&&(p.geometryGroups[D]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:N}),B=x instanceof THREE.Face3?3:4,p.geometryGroups[D].vertices+B>65535&&(A[y].counter+=
-1,D=A[y].hash+"_"+A[y].counter,p.geometryGroups[D]===void 0&&(p.geometryGroups[D]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:N})),x instanceof THREE.Face3?p.geometryGroups[D].faces3.push(s):p.geometryGroups[D].faces4.push(s),p.geometryGroups[D].vertices+=B;p.geometryGroupsList=[];s=void 0;for(s in p.geometryGroups)p.geometryGroups[s].id=ea++,p.geometryGroupsList.push(p.geometryGroups[s])}for(l in m.geometryGroups)if(p=m.geometryGroups[l],!p.__webglVertexBuffer){s=p;s.__webglVertexBuffer=
-j.createBuffer();s.__webglNormalBuffer=j.createBuffer();s.__webglTangentBuffer=j.createBuffer();s.__webglColorBuffer=j.createBuffer();s.__webglUVBuffer=j.createBuffer();s.__webglUV2Buffer=j.createBuffer();s.__webglSkinVertexABuffer=j.createBuffer();s.__webglSkinVertexBBuffer=j.createBuffer();s.__webglSkinIndicesBuffer=j.createBuffer();s.__webglSkinWeightsBuffer=j.createBuffer();s.__webglFaceBuffer=j.createBuffer();s.__webglLineBuffer=j.createBuffer();if(s.numMorphTargets){x=t=void 0;s.__webglMorphTargetsBuffers=
-[];t=0;for(x=s.numMorphTargets;t<x;t++)s.__webglMorphTargetsBuffers.push(j.createBuffer())}K.info.memory.geometries++;v=h;B=v.geometry;t=p.faces3;y=p.faces4;s=t.length*3+y.length*4;x=t.length*1+y.length*2;y=t.length*3+y.length*4;t=c(v,p);D=g(t);A=d(t);N=e(t);p.__vertexArray=new Float32Array(s*3);if(A)p.__normalArray=new Float32Array(s*3);if(B.hasTangents)p.__tangentArray=new Float32Array(s*4);if(N)p.__colorArray=new Float32Array(s*3);if(D){if(B.faceUvs.length>0||B.faceVertexUvs.length>0)p.__uvArray=
-new Float32Array(s*2);if(B.faceUvs.length>1||B.faceVertexUvs.length>1)p.__uv2Array=new Float32Array(s*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)p.__skinVertexAArray=new Float32Array(s*4),p.__skinVertexBArray=new Float32Array(s*4),p.__skinIndexArray=new Float32Array(s*4),p.__skinWeightArray=new Float32Array(s*4);p.__faceArray=new Uint16Array(x*3);p.__lineArray=new Uint16Array(y*2);if(p.numMorphTargets){p.__morphTargetsArrays=[];v=0;for(B=p.numMorphTargets;v<B;v++)p.__morphTargetsArrays.push(new Float32Array(s*
-3))}p.__webglFaceCount=x*3;p.__webglLineCount=y*2;if(t.attributes){if(p.__webglCustomAttributesList===void 0)p.__webglCustomAttributesList=[];x=void 0;for(x in t.attributes){var v=t.attributes[x],B={},z;for(z in v)B[z]=v[z];if(!B.__webglInitialized||B.createUniqueBuffers)B.__webglInitialized=!0,y=1,B.type==="v2"?y=2:B.type==="v3"?y=3:B.type==="v4"?y=4:B.type==="c"&&(y=3),B.size=y,B.array=new Float32Array(s*y),B.buffer=j.createBuffer(),B.buffer.belongsToAttribute=x,v.needsUpdate=!0,B.__original=v;
-p.__webglCustomAttributesList.push(B)}}p.__inittedArrays=!0;m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}}else if(h instanceof THREE.Ribbon){if(m=h.geometry,!m.__webglVertexBuffer)p=m,p.__webglVertexBuffer=j.createBuffer(),p.__webglColorBuffer=j.createBuffer(),K.info.memory.geometries++,p=m,s=p.vertices.length,p.__vertexArray=new Float32Array(s*3),p.__colorArray=new Float32Array(s*3),p.__webglVertexCount=
-s,m.__dirtyVertices=!0,m.__dirtyColors=!0}else if(h instanceof THREE.Line){if(m=h.geometry,!m.__webglVertexBuffer)p=m,p.__webglVertexBuffer=j.createBuffer(),p.__webglColorBuffer=j.createBuffer(),K.info.memory.geometries++,p=m,s=h,t=p.vertices.length,p.__vertexArray=new Float32Array(t*3),p.__colorArray=new Float32Array(t*3),p.__webglLineCount=t,b(p,s),m.__dirtyVertices=!0,m.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(m=h.geometry,!m.__webglVertexBuffer))p=m,p.__webglVertexBuffer=j.createBuffer(),
-p.__webglColorBuffer=j.createBuffer(),K.info.geometries++,p=m,s=h,t=p.vertices.length,p.__vertexArray=new Float32Array(t*3),p.__colorArray=new Float32Array(t*3),p.__sortArray=[],p.__webglParticleCount=t,b(p,s),m.__dirtyVertices=!0,m.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(l in m=h.geometry,m.geometryGroups)p=m.geometryGroups[l],k(i.__webglObjects,p,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(m=h.geometry,k(i.__webglObjects,
-m,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?n(i.__webglObjects,
-h):h instanceof THREE.Sprite?q(i.__webglSprites,h):h instanceof THREE.LensFlare?q(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&n(i.__webglObjectsImmediate,h),h.__webglActive=!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(z=a.__webglObjects[h].object,l=z.geometry,m=x=t=void 0,z instanceof THREE.Mesh){p=0;for(s=l.geometryGroupsList.length;p<s;p++)if(t=l.geometryGroupsList[p],m=c(z,t),x=m.attributes&&o(m),l.__dirtyVertices||l.__dirtyMorphTargets||
-l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||x){var C=z,x=j.DYNAMIC_DRAW,v=!l.dynamic,D=m;if(t.__inittedArrays){var B=d(D),y=e(D),L=g(D),I=B===THREE.SmoothShading,O=A=D=void 0,H=void 0,F=void 0,G=void 0,u=void 0,J=void 0,ba=void 0,Y=O=void 0,M=void 0,Q=void 0,P=void 0,R=H=void 0,V=void 0,U=void 0,W=H=ba=void 0,S=void 0,X=P=Q=M=u=void 0,T=H=P=Q=M=X=P=Q=M=X=P=Q=M=void 0,$=void 0,aa=G=void 0,fa=void 0,Z=void 0,qa=void 0,da=void 0,oa=Y=Z=$=0,la=0,ja=T=O=0,ha=
-u=R=0,E=0,na=void 0,ha=t.__vertexArray,fa=t.__uvArray,E=t.__uv2Array,aa=t.__normalArray,F=t.__tangentArray,V=t.__colorArray,W=t.__skinVertexAArray,S=t.__skinVertexBArray,J=t.__skinIndexArray,pa=t.__skinWeightArray,X=t.__morphTargetsArrays,N=t.__webglCustomAttributesList,w=void 0,w=t.__faceArray,na=t.__lineArray,U=C.geometry,sa=U.__dirtyElements,va=U.__dirtyUvs,G=U.__dirtyNormals,ba=U.__dirtyTangents,ya=U.__dirtyColors,qa=U.__dirtyMorphTargets,da=U.vertices,C=t.faces3,ia=t.faces4,ka=U.faces,xa=U.faceVertexUvs[0],
-Aa=U.faceVertexUvs[1],Ga=U.skinVerticesA,Ha=U.skinVerticesB,Ia=U.skinIndices,Da=U.skinWeights,Ea=U.morphTargets;if(U.__dirtyVertices){D=0;for(A=C.length;D<A;D++)H=ka[C[D]],M=da[H.a].position,Q=da[H.b].position,P=da[H.c].position,ha[Z]=M.x,ha[Z+1]=M.y,ha[Z+2]=M.z,ha[Z+3]=Q.x,ha[Z+4]=Q.y,ha[Z+5]=Q.z,ha[Z+6]=P.x,ha[Z+7]=P.y,ha[Z+8]=P.z,Z+=9;D=0;for(A=ia.length;D<A;D++)H=ka[ia[D]],M=da[H.a].position,Q=da[H.b].position,P=da[H.c].position,H=da[H.d].position,ha[Z]=M.x,ha[Z+1]=M.y,ha[Z+2]=M.z,ha[Z+3]=Q.x,
-ha[Z+4]=Q.y,ha[Z+5]=Q.z,ha[Z+6]=P.x,ha[Z+7]=P.y,ha[Z+8]=P.z,ha[Z+9]=H.x,ha[Z+10]=H.y,ha[Z+11]=H.z,Z+=12;j.bindBuffer(j.ARRAY_BUFFER,t.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ha,x)}if(qa){Z=0;for(qa=Ea.length;Z<qa;Z++){D=ha=0;for(A=C.length;D<A;D++)H=ka[C[D]],M=Ea[Z].vertices[H.a].position,Q=Ea[Z].vertices[H.b].position,P=Ea[Z].vertices[H.c].position,da=X[Z],da[ha]=M.x,da[ha+1]=M.y,da[ha+2]=M.z,da[ha+3]=Q.x,da[ha+4]=Q.y,da[ha+5]=Q.z,da[ha+6]=P.x,da[ha+7]=P.y,da[ha+8]=P.z,ha+=9;D=0;for(A=ia.length;D<
-A;D++)H=ka[ia[D]],M=Ea[Z].vertices[H.a].position,Q=Ea[Z].vertices[H.b].position,P=Ea[Z].vertices[H.c].position,H=Ea[Z].vertices[H.d].position,da=X[Z],da[ha]=M.x,da[ha+1]=M.y,da[ha+2]=M.z,da[ha+3]=Q.x,da[ha+4]=Q.y,da[ha+5]=Q.z,da[ha+6]=P.x,da[ha+7]=P.y,da[ha+8]=P.z,da[ha+9]=H.x,da[ha+10]=H.y,da[ha+11]=H.z,ha+=12;j.bindBuffer(j.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[Z]);j.bufferData(j.ARRAY_BUFFER,X[Z],x)}}if(Da.length){D=0;for(A=C.length;D<A;D++)H=ka[C[D]],M=Da[H.a],Q=Da[H.b],P=Da[H.c],pa[u]=M.x,
-pa[u+1]=M.y,pa[u+2]=M.z,pa[u+3]=M.w,pa[u+4]=Q.x,pa[u+5]=Q.y,pa[u+6]=Q.z,pa[u+7]=Q.w,pa[u+8]=P.x,pa[u+9]=P.y,pa[u+10]=P.z,pa[u+11]=P.w,M=Ia[H.a],Q=Ia[H.b],P=Ia[H.c],J[u]=M.x,J[u+1]=M.y,J[u+2]=M.z,J[u+3]=M.w,J[u+4]=Q.x,J[u+5]=Q.y,J[u+6]=Q.z,J[u+7]=Q.w,J[u+8]=P.x,J[u+9]=P.y,J[u+10]=P.z,J[u+11]=P.w,M=Ga[H.a],Q=Ga[H.b],P=Ga[H.c],W[u]=M.x,W[u+1]=M.y,W[u+2]=M.z,W[u+3]=1,W[u+4]=Q.x,W[u+5]=Q.y,W[u+6]=Q.z,W[u+7]=1,W[u+8]=P.x,W[u+9]=P.y,W[u+10]=P.z,W[u+11]=1,M=Ha[H.a],Q=Ha[H.b],P=Ha[H.c],S[u]=M.x,S[u+1]=M.y,
-S[u+2]=M.z,S[u+3]=1,S[u+4]=Q.x,S[u+5]=Q.y,S[u+6]=Q.z,S[u+7]=1,S[u+8]=P.x,S[u+9]=P.y,S[u+10]=P.z,S[u+11]=1,u+=12;D=0;for(A=ia.length;D<A;D++)H=ka[ia[D]],M=Da[H.a],Q=Da[H.b],P=Da[H.c],X=Da[H.d],pa[u]=M.x,pa[u+1]=M.y,pa[u+2]=M.z,pa[u+3]=M.w,pa[u+4]=Q.x,pa[u+5]=Q.y,pa[u+6]=Q.z,pa[u+7]=Q.w,pa[u+8]=P.x,pa[u+9]=P.y,pa[u+10]=P.z,pa[u+11]=P.w,pa[u+12]=X.x,pa[u+13]=X.y,pa[u+14]=X.z,pa[u+15]=X.w,M=Ia[H.a],Q=Ia[H.b],P=Ia[H.c],X=Ia[H.d],J[u]=M.x,J[u+1]=M.y,J[u+2]=M.z,J[u+3]=M.w,J[u+4]=Q.x,J[u+5]=Q.y,J[u+6]=Q.z,
-J[u+7]=Q.w,J[u+8]=P.x,J[u+9]=P.y,J[u+10]=P.z,J[u+11]=P.w,J[u+12]=X.x,J[u+13]=X.y,J[u+14]=X.z,J[u+15]=X.w,M=Ga[H.a],Q=Ga[H.b],P=Ga[H.c],X=Ga[H.d],W[u]=M.x,W[u+1]=M.y,W[u+2]=M.z,W[u+3]=1,W[u+4]=Q.x,W[u+5]=Q.y,W[u+6]=Q.z,W[u+7]=1,W[u+8]=P.x,W[u+9]=P.y,W[u+10]=P.z,W[u+11]=1,W[u+12]=X.x,W[u+13]=X.y,W[u+14]=X.z,W[u+15]=1,M=Ha[H.a],Q=Ha[H.b],P=Ha[H.c],H=Ha[H.d],S[u]=M.x,S[u+1]=M.y,S[u+2]=M.z,S[u+3]=1,S[u+4]=Q.x,S[u+5]=Q.y,S[u+6]=Q.z,S[u+7]=1,S[u+8]=P.x,S[u+9]=P.y,S[u+10]=P.z,S[u+11]=1,S[u+12]=H.x,S[u+13]=
-H.y,S[u+14]=H.z,S[u+15]=1,u+=16;u>0&&(j.bindBuffer(j.ARRAY_BUFFER,t.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,W,x),j.bindBuffer(j.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,S,x),j.bindBuffer(j.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,J,x),j.bindBuffer(j.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,pa,x))}if(ya&&y){D=0;for(A=C.length;D<A;D++)H=ka[C[D]],u=H.vertexColors,J=H.color,u.length===3&&y===THREE.VertexColors?
-(H=u[0],W=u[1],S=u[2]):S=W=H=J,V[R]=H.r,V[R+1]=H.g,V[R+2]=H.b,V[R+3]=W.r,V[R+4]=W.g,V[R+5]=W.b,V[R+6]=S.r,V[R+7]=S.g,V[R+8]=S.b,R+=9;D=0;for(A=ia.length;D<A;D++)H=ka[ia[D]],u=H.vertexColors,J=H.color,u.length===4&&y===THREE.VertexColors?(H=u[0],W=u[1],S=u[2],u=u[3]):u=S=W=H=J,V[R]=H.r,V[R+1]=H.g,V[R+2]=H.b,V[R+3]=W.r,V[R+4]=W.g,V[R+5]=W.b,V[R+6]=S.r,V[R+7]=S.g,V[R+8]=S.b,V[R+9]=u.r,V[R+10]=u.g,V[R+11]=u.b,R+=12;R>0&&(j.bindBuffer(j.ARRAY_BUFFER,t.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,V,
-x))}if(ba&&U.hasTangents){D=0;for(A=C.length;D<A;D++)H=ka[C[D]],ba=H.vertexTangents,R=ba[0],V=ba[1],U=ba[2],F[T]=R.x,F[T+1]=R.y,F[T+2]=R.z,F[T+3]=R.w,F[T+4]=V.x,F[T+5]=V.y,F[T+6]=V.z,F[T+7]=V.w,F[T+8]=U.x,F[T+9]=U.y,F[T+10]=U.z,F[T+11]=U.w,T+=12;D=0;for(A=ia.length;D<A;D++)H=ka[ia[D]],ba=H.vertexTangents,R=ba[0],V=ba[1],U=ba[2],ba=ba[3],F[T]=R.x,F[T+1]=R.y,F[T+2]=R.z,F[T+3]=R.w,F[T+4]=V.x,F[T+5]=V.y,F[T+6]=V.z,F[T+7]=V.w,F[T+8]=U.x,F[T+9]=U.y,F[T+10]=U.z,F[T+11]=U.w,F[T+12]=ba.x,F[T+13]=ba.y,F[T+
-14]=ba.z,F[T+15]=ba.w,T+=16;j.bindBuffer(j.ARRAY_BUFFER,t.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,F,x)}if(G&&B){D=0;for(A=C.length;D<A;D++)if(H=ka[C[D]],F=H.vertexNormals,G=H.normal,F.length===3&&I)for(T=0;T<3;T++)G=F[T],aa[O]=G.x,aa[O+1]=G.y,aa[O+2]=G.z,O+=3;else for(T=0;T<3;T++)aa[O]=G.x,aa[O+1]=G.y,aa[O+2]=G.z,O+=3;D=0;for(A=ia.length;D<A;D++)if(H=ka[ia[D]],F=H.vertexNormals,G=H.normal,F.length===4&&I)for(T=0;T<4;T++)G=F[T],aa[O]=G.x,aa[O+1]=G.y,aa[O+2]=G.z,O+=3;else for(T=0;T<4;T++)aa[O]=
-G.x,aa[O+1]=G.y,aa[O+2]=G.z,O+=3;j.bindBuffer(j.ARRAY_BUFFER,t.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,aa,x)}if(va&&xa&&L){D=0;for(A=C.length;D<A;D++)if(O=C[D],O=xa[O],O!==void 0)for(T=0;T<3;T++)aa=O[T],fa[Y]=aa.u,fa[Y+1]=aa.v,Y+=2;D=0;for(A=ia.length;D<A;D++)if(O=ia[D],O=xa[O],O!==void 0)for(T=0;T<4;T++)aa=O[T],fa[Y]=aa.u,fa[Y+1]=aa.v,Y+=2;Y>0&&(j.bindBuffer(j.ARRAY_BUFFER,t.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,fa,x))}if(va&&Aa&&L){D=0;for(A=C.length;D<A;D++)if(O=C[D],Y=Aa[O],Y!==
-void 0)for(T=0;T<3;T++)fa=Y[T],E[oa]=fa.u,E[oa+1]=fa.v,oa+=2;D=0;for(A=ia.length;D<A;D++)if(O=ia[D],Y=Aa[O],Y!==void 0)for(T=0;T<4;T++)fa=Y[T],E[oa]=fa.u,E[oa+1]=fa.v,oa+=2;oa>0&&(j.bindBuffer(j.ARRAY_BUFFER,t.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,E,x))}if(sa){D=0;for(A=C.length;D<A;D++)w[la]=$,w[la+1]=$+1,w[la+2]=$+2,la+=3,na[ja]=$,na[ja+1]=$+1,na[ja+2]=$,na[ja+3]=$+2,na[ja+4]=$+1,na[ja+5]=$+2,ja+=6,$+=3;D=0;for(A=ia.length;D<A;D++)w[la]=$,w[la+1]=$+1,w[la+2]=$+3,w[la+3]=$+1,w[la+4]=$+2,
-w[la+5]=$+3,la+=6,na[ja]=$,na[ja+1]=$+1,na[ja+2]=$,na[ja+3]=$+3,na[ja+4]=$+1,na[ja+5]=$+2,na[ja+6]=$+2,na[ja+7]=$+3,ja+=8,$+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,w,x);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,na,x)}if(N){T=0;for($=N.length;T<$;T++)if(w=N[T],w.__original.needsUpdate){E=0;if(w.size===1)if(w.boundTo===void 0||w.boundTo==="vertices"){D=0;for(A=C.length;D<A;D++)H=ka[C[D]],w.array[E]=
-w.value[H.a],w.array[E+1]=w.value[H.b],w.array[E+2]=w.value[H.c],E+=3;D=0;for(A=ia.length;D<A;D++)H=ka[ia[D]],w.array[E]=w.value[H.a],w.array[E+1]=w.value[H.b],w.array[E+2]=w.value[H.c],w.array[E+3]=w.value[H.d],E+=4}else{if(w.boundTo==="faces"){D=0;for(A=C.length;D<A;D++)na=w.value[C[D]],w.array[E]=na,w.array[E+1]=na,w.array[E+2]=na,E+=3;D=0;for(A=ia.length;D<A;D++)na=w.value[ia[D]],w.array[E]=na,w.array[E+1]=na,w.array[E+2]=na,w.array[E+3]=na,E+=4}}else if(w.size===2)if(w.boundTo===void 0||w.boundTo===
-"vertices"){D=0;for(A=C.length;D<A;D++)H=ka[C[D]],M=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],w.array[E]=M.x,w.array[E+1]=M.y,w.array[E+2]=Q.x,w.array[E+3]=Q.y,w.array[E+4]=P.x,w.array[E+5]=P.y,E+=6;D=0;for(A=ia.length;D<A;D++)H=ka[ia[D]],M=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],H=w.value[H.d],w.array[E]=M.x,w.array[E+1]=M.y,w.array[E+2]=Q.x,w.array[E+3]=Q.y,w.array[E+4]=P.x,w.array[E+5]=P.y,w.array[E+6]=H.x,w.array[E+7]=H.y,E+=8}else{if(w.boundTo==="faces"){D=0;for(A=C.length;D<A;D++)P=Q=M=
-na=w.value[C[D]],w.array[E]=M.x,w.array[E+1]=M.y,w.array[E+2]=Q.x,w.array[E+3]=Q.y,w.array[E+4]=P.x,w.array[E+5]=P.y,E+=6;D=0;for(A=ia.length;D<A;D++)H=P=Q=M=na=w.value[ia[D]],w.array[E]=M.x,w.array[E+1]=M.y,w.array[E+2]=Q.x,w.array[E+3]=Q.y,w.array[E+4]=P.x,w.array[E+5]=P.y,w.array[E+6]=H.x,w.array[E+7]=H.y,E+=8}}else if(w.size===3)if(B=w.type==="c"?["r","g","b"]:["x","y","z"],w.boundTo===void 0||w.boundTo==="vertices"){D=0;for(A=C.length;D<A;D++)H=ka[C[D]],M=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],
-w.array[E]=M[B[0]],w.array[E+1]=M[B[1]],w.array[E+2]=M[B[2]],w.array[E+3]=Q[B[0]],w.array[E+4]=Q[B[1]],w.array[E+5]=Q[B[2]],w.array[E+6]=P[B[0]],w.array[E+7]=P[B[1]],w.array[E+8]=P[B[2]],E+=9;D=0;for(A=ia.length;D<A;D++)H=ka[ia[D]],M=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],H=w.value[H.d],w.array[E]=M[B[0]],w.array[E+1]=M[B[1]],w.array[E+2]=M[B[2]],w.array[E+3]=Q[B[0]],w.array[E+4]=Q[B[1]],w.array[E+5]=Q[B[2]],w.array[E+6]=P[B[0]],w.array[E+7]=P[B[1]],w.array[E+8]=P[B[2]],w.array[E+9]=H[B[0]],w.array[E+
-10]=H[B[1]],w.array[E+11]=H[B[2]],E+=12}else{if(w.boundTo==="faces"){D=0;for(A=C.length;D<A;D++)P=Q=M=na=w.value[C[D]],w.array[E]=M[B[0]],w.array[E+1]=M[B[1]],w.array[E+2]=M[B[2]],w.array[E+3]=Q[B[0]],w.array[E+4]=Q[B[1]],w.array[E+5]=Q[B[2]],w.array[E+6]=P[B[0]],w.array[E+7]=P[B[1]],w.array[E+8]=P[B[2]],E+=9;D=0;for(A=ia.length;D<A;D++)H=P=Q=M=na=w.value[ia[D]],w.array[E]=M[B[0]],w.array[E+1]=M[B[1]],w.array[E+2]=M[B[2]],w.array[E+3]=Q[B[0]],w.array[E+4]=Q[B[1]],w.array[E+5]=Q[B[2]],w.array[E+6]=
-P[B[0]],w.array[E+7]=P[B[1]],w.array[E+8]=P[B[2]],w.array[E+9]=H[B[0]],w.array[E+10]=H[B[1]],w.array[E+11]=H[B[2]],E+=12}}else if(w.size===4)if(w.boundTo===void 0||w.boundTo==="vertices"){D=0;for(A=C.length;D<A;D++)H=ka[C[D]],M=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],w.array[E]=M.x,w.array[E+1]=M.y,w.array[E+2]=M.z,w.array[E+3]=M.w,w.array[E+4]=Q.x,w.array[E+5]=Q.y,w.array[E+6]=Q.z,w.array[E+7]=Q.w,w.array[E+8]=P.x,w.array[E+9]=P.y,w.array[E+10]=P.z,w.array[E+11]=P.w,E+=12;D=0;for(A=ia.length;D<
-A;D++)H=ka[ia[D]],M=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],H=w.value[H.d],w.array[E]=M.x,w.array[E+1]=M.y,w.array[E+2]=M.z,w.array[E+3]=M.w,w.array[E+4]=Q.x,w.array[E+5]=Q.y,w.array[E+6]=Q.z,w.array[E+7]=Q.w,w.array[E+8]=P.x,w.array[E+9]=P.y,w.array[E+10]=P.z,w.array[E+11]=P.w,w.array[E+12]=H.x,w.array[E+13]=H.y,w.array[E+14]=H.z,w.array[E+15]=H.w,E+=16}else if(w.boundTo==="faces"){D=0;for(A=C.length;D<A;D++)P=Q=M=na=w.value[C[D]],w.array[E]=M.x,w.array[E+1]=M.y,w.array[E+2]=M.z,w.array[E+3]=
-M.w,w.array[E+4]=Q.x,w.array[E+5]=Q.y,w.array[E+6]=Q.z,w.array[E+7]=Q.w,w.array[E+8]=P.x,w.array[E+9]=P.y,w.array[E+10]=P.z,w.array[E+11]=P.w,E+=12;D=0;for(A=ia.length;D<A;D++)H=P=Q=M=na=w.value[ia[D]],w.array[E]=M.x,w.array[E+1]=M.y,w.array[E+2]=M.z,w.array[E+3]=M.w,w.array[E+4]=Q.x,w.array[E+5]=Q.y,w.array[E+6]=Q.z,w.array[E+7]=Q.w,w.array[E+8]=P.x,w.array[E+9]=P.y,w.array[E+10]=P.z,w.array[E+11]=P.w,w.array[E+12]=H.x,w.array[E+13]=H.y,w.array[E+14]=H.z,w.array[E+15]=H.w,E+=16}j.bindBuffer(j.ARRAY_BUFFER,
-w.buffer);j.bufferData(j.ARRAY_BUFFER,w.array,x)}}v&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}}l.__dirtyVertices=!1;l.__dirtyMorphTargets=!1;l.__dirtyElements=!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=
-!1;m.attributes&&r(m)}else if(z instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){m=l;z=j.DYNAMIC_DRAW;B=p=B=v=v=void 0;y=m.vertices;s=m.colors;D=y.length;t=s.length;A=m.__vertexArray;x=m.__colorArray;N=m.__dirtyColors;if(m.__dirtyVertices){for(v=0;v<D;v++)B=y[v].position,p=v*3,A[p]=B.x,A[p+1]=B.y,A[p+2]=B.z;j.bindBuffer(j.ARRAY_BUFFER,m.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,A,z)}if(N){for(v=0;v<t;v++)B=s[v],p=v*3,x[p]=B.r,x[p+1]=B.g,x[p+2]=B.b;j.bindBuffer(j.ARRAY_BUFFER,
-m.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,x,z)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(z instanceof THREE.Line){m=c(z,t);x=m.attributes&&o(m);if(l.__dirtyVertices||l.__dirtyColors||x){z=l;p=j.DYNAMIC_DRAW;D=s=I=y=L=void 0;y=z.vertices;t=z.colors;D=y.length;x=t.length;A=z.__vertexArray;v=z.__colorArray;N=z.__dirtyColors;B=z.__webglCustomAttributesList;$=ka=ia=C=I=L=void 0;if(z.__dirtyVertices){for(L=0;L<D;L++)I=y[L].position,s=L*3,A[s]=I.x,A[s+1]=I.y,A[s+2]=I.z;j.bindBuffer(j.ARRAY_BUFFER,
-z.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,A,p)}if(N){for(y=0;y<x;y++)D=t[y],s=y*3,v[s]=D.r,v[s+1]=D.g,v[s+2]=D.b;j.bindBuffer(j.ARRAY_BUFFER,z.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,v,p)}if(B){L=0;for(I=B.length;L<I;L++)if($=B[L],$.needsUpdate&&($.boundTo===void 0||$.boundTo==="vertices")){s=0;ia=$.value.length;if($.size===1)for(C=0;C<ia;C++)$.array[C]=$.value[C];else if($.size===2)for(C=0;C<ia;C++)ka=$.value[C],$.array[s]=ka.x,$.array[s+1]=ka.y,s+=2;else if($.size===3)if($.type===
-"c")for(C=0;C<ia;C++)ka=$.value[C],$.array[s]=ka.r,$.array[s+1]=ka.g,$.array[s+2]=ka.b,s+=3;else for(C=0;C<ia;C++)ka=$.value[C],$.array[s]=ka.x,$.array[s+1]=ka.y,$.array[s+2]=ka.z,s+=3;else if($.size===4)for(C=0;C<ia;C++)ka=$.value[C],$.array[s]=ka.x,$.array[s+1]=ka.y,$.array[s+2]=ka.z,$.array[s+3]=ka.w,s+=4;j.bindBuffer(j.ARRAY_BUFFER,$.buffer);j.bufferData(j.ARRAY_BUFFER,$.array,p)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;m.attributes&&r(m)}else if(z instanceof THREE.ParticleSystem)m=c(z,t),x=
-m.attributes&&o(m),(l.__dirtyVertices||l.__dirtyColors||z.sortParticles||x)&&f(l,j.DYNAMIC_DRAW,z),l.__dirtyVertices=!1,l.__dirtyColors=!1,m.attributes&&r(m)};this.initMaterial=function(a,b,c,d){var e,f,g,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 n,l,k;n=k=i=0;for(l=b.length;n<l;n++)g=b[n],g instanceof THREE.SpotLight&&k++,g instanceof THREE.DirectionalLight&&k++,g instanceof THREE.PointLight&&i++;i+k<=Y?n=k:(n=Math.ceil(Y*k/(i+k)),i=Y-n);g={directional:n,point:i};i=k=0;for(n=b.length;i<n;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&k++;
-var m=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)m=d.bones.length;var o;a:{n=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:g.directional,maxPointLights:g.point,maxBones:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,
-shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:k,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(n),d.push(l));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=W.length;p<d;p++)if(W[p].code===h){o=W[p].program;break a}p=j.createProgram();d=[Aa?"#define VERTEX_TEXTURES":"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.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");
-g=["#ifdef GL_ES","precision "+F+" 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:"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.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(p,v("fragment",g+n));j.attachShader(p,
-v("vertex",d+l));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)n=q[d],p.uniforms[n]=j.getUniformLocation(p,
-n);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=j.getAttribLocation(p,c);p.id=W.length;W.push({program:p,code:h});K.info.memory.programs=W.length;o=p}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(f in a.attributes)o[f]!==void 0&&o[f]>=0&&j.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)q="morphTarget"+f,o[q]>=0&&(j.enableVertexAttribArray(o[q]),
-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)};this.setObjectFaces=function(a){if(X!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),X=a.doubleSided;if(fa!==a.flipSided)a.flipSided?j.frontFace(j.CW):
-j.frontFace(j.CCW),fa=a.flipSided};this.setDepthTest=function(a){R!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),R=a)};this.setBlending=function(a){if(a!==V){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)}V=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),K.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);var c=y(j.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,G(a.format),a.image.width,a.image.height,0,G(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,
-0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);c&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(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);y(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,G(a.format),a.width,a.height,0,G(a.format),G(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);I(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),
-a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),y(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,G(a.format),a.width,a.height,0,G(a.format),G(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),I(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=sa,a=ja,d=da,e=oa);b!==L&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),L=b)};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+return!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,m=i.length,j=a.__vertexArray,n=a.__colorArray,l=a.__sortArray,o=a.__dirtyVertices,r=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){xa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,ua.copy(e),xa.multiplyVector3(ua),l[d]=[ua.z,d];l.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[l[d][1]].position,f=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;for(d=0;d<m;d++)f=d*3,e=i[l[d][1]],n[f]=e.r,n[f+
+1]=e.g,n[f+2]=e.b;if(p){i=0;for(m=p.length;i<m;i++)if(h=p[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=l[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,
+f+=3;else if(h.size===4)for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;if(r)for(d=0;d<m;d++)e=i[d],f=d*3,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(p){i=0;for(m=p.length;i<m;i++)if(h=p[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(e=h.value.length,f=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++)g=h.value[d],
+h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}if(o||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,j,b);if(r||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
+a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,n,b);if(p){i=0;for(m=p.length;i<m;i++)if(h=p[i],h.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b)}}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)L=null,w=W=O=$=S=-1,a[d].render(b,c,ka,la),L=null,w=W=O=$=S=-1}function l(a,b,c,d,e,f,g,h){var k,i,m,j;b?(i=a.length-1,j=b=-1):(i=0,b=a.length,j=1);for(var n=i;n!==b;n+=j)if(k=a[n],k.render){i=k.object;
+m=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&T.setBlending(k.blending);T.setDepthTest(k.depthTest);t(k.depthWrite);u(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}T.setObjectFaces(i);T.renderBuffer(d,e,f,k,m,i)}}function j(a,b,c,d,e,f,g){for(var h,k,i=0,m=a.length;i<m;i++)if(h=a[i],k=h.object,k.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&T.setBlending(h.blending);T.setDepthTest(h.depthTest);t(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}T.renderImmediateObject(c,
+d,e,h,k)}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function r(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function m(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 n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){d.program||T.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=
+new Float32Array(T.maxMorphTargets);for(var f=0,g=T.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==L&&(k.useProgram(f),L=f,h=!0);if(d.id!==w)w=d.id,h=!0;if(h){k.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);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 m,j,n=0,l=0,o=0,r,p,q,H=za,s=H.directional.colors,t=H.directional.positions,z=H.point.colors,u=H.point.positions,J=H.point.distances,v=0,R=0,c=m=q=0,h=b.length;c<h;c++)if(m=b[c],j=m.color,r=m.position,p=m.intensity,q=m.distance,m instanceof THREE.AmbientLight)T.gammaInput?(n+=j.r*j.r,l+=j.g*j.g,o+=j.b*j.b):(n+=j.r,l+=j.g,o+=j.b);else if(m instanceof THREE.DirectionalLight)q=v*3,T.gammaInput?(s[q]=j.r*j.r*p*p,s[q+1]=j.g*j.g*p*p,s[q+2]=j.b*j.b*
+p*p):(s[q]=j.r*p,s[q+1]=j.g*p,s[q+2]=j.b*p),t[q]=r.x,t[q+1]=r.y,t[q+2]=r.z,v+=1;else if(m instanceof THREE.SpotLight)q=v*3,T.gammaInput?(s[q]=j.r*j.r*p*p,s[q+1]=j.g*j.g*p*p,s[q+2]=j.b*j.b*p*p):(s[q]=j.r*p,s[q+1]=j.g*p,s[q+2]=j.b*p),j=1/r.length(),t[q]=r.x*j,t[q+1]=r.y*j,t[q+2]=r.z*j,v+=1;else if(m instanceof THREE.PointLight)m=R*3,T.gammaInput?(z[m]=j.r*j.r*p*p,z[m+1]=j.g*j.g*p*p,z[m+2]=j.b*j.b*p*p):(z[m]=j.r*p,z[m+1]=j.g*p,z[m+2]=j.b*p),u[m]=r.x,u[m+1]=r.y,u[m+2]=r.z,J[R]=q,R+=1;c=v*3;for(h=s.length;c<
+h;c++)s[c]=0;c=R*3;for(h=z.length;c<h;c++)z[c]=0;H.point.length=R;H.directional.length=v;H.ambient[0]=n;H.ambient[1]=l;H.ambient[2]=o;b=za;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,T.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=G.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,T.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)T.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<T.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=T.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=
+T.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=T.shadowMapDarkness;i.shadowBias.value=T.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(l=f.uniforms[b[i][1]])if(n=b[i][0],o=n.type,h=n.value,o==="i")k.uniform1i(l,h);else if(o==="f")k.uniform1f(l,h);else if(o==="v2")k.uniform2f(l,h.x,h.y);else if(o==="v3")k.uniform3f(l,h.x,h.y,h.z);else if(o==="v4")k.uniform4f(l,h.x,h.y,h.z,h.w);else if(o==="c")k.uniform3f(l,h.r,h.g,h.b);else if(o==="fv1")k.uniform1fv(l,h);else if(o==="fv")k.uniform3fv(l,
+h);else if(o==="v3v"){if(!n._array)n._array=new Float32Array(3*h.length);o=0;for(r=h.length;o<r;o++)H=o*3,n._array[H]=h[o].x,n._array[H+1]=h[o].y,n._array[H+2]=h[o].z;k.uniform3fv(l,n._array)}else if(o==="m4"){if(!n._array)n._array=new Float32Array(16);h.flattenToArray(n._array);k.uniformMatrix4fv(l,!1,n._array)}else if(o==="m4v"){if(!n._array)n._array=new Float32Array(16*h.length);o=0;for(r=h.length;o<r;o++)h[o].flattenToArrayOffset(n._array,o*16);k.uniformMatrix4fv(l,!1,n._array)}else if(o==="t"){if(k.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=k.createTexture();k.activeTexture(k.TEXTURE0+h);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);h=B(k.TEXTURE_CUBE_MAP,n,n.image[0]);for(l=0;l<6;l++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[l]);h&&k.generateMipmap(k.TEXTURE_CUBE_MAP);n.needsUpdate=!1}else k.activeTexture(k.TEXTURE0+
+h),k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}else l instanceof THREE.WebGLRenderTargetCube?(n=l,k.activeTexture(k.TEXTURE0+h),k.bindTexture(k.TEXTURE_CUBE_MAP,n.__webglTexture)):T.setTexture(l,h)}else if(o==="tv"){if(!n._array){n._array=[];o=0;for(r=n.texture.length;o<r;o++)n._array[o]=h+o}k.uniform1iv(l,n._array);o=0;for(r=n.texture.length;o<r;o++)(l=n.texture[o])&&T.setTexture(l,n._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
+g.cameraPosition!==null&&k.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&k.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(k.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),k.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}k.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&
+k.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&k.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function s(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function t(a){O!==a&&(k.depthMask(a),O=a)}function u(a,b,c){ba!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):
+k.disable(k.POLYGON_OFFSET_FILL),ba=a);if(a&&(aa!==b||pa!==c))k.polygonOffset(b,c),aa=b,pa=c}function v(a,b){var c;a==="fragment"?c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(b),null;return c}function B(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(k.texParameteri(a,k.TEXTURE_WRAP_S,E(b.wrapS)),k.texParameteri(a,
+k.TEXTURE_WRAP_T,E(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,E(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,E(b.minFilter)),!0):(k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_MAG_FILTER,C(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,C(b.minFilter)),!1)}function x(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,
+b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function C(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}
+function E(a){switch(a){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}
+var a=a||{},G=a.canvas!==void 0?a.canvas:document.createElement("canvas"),R=a.precision!==void 0?a.precision:"highp",z=a.antialias!==void 0?a.antialias:!1,J=a.stencil!==void 0?a.stencil:!0,K=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,U=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),V=a.clearAlpha!==void 0?a.clearAlpha:0,Y=a.maxLights!==void 0?a.maxLights:4;this.domElement=G;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.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,
+vertices:0,faces:0}};var T=this,k,M=[],L=null,I=null,w=-1,W=null,da=0,fa=null,X=null,S=null,$=null,O=null,ba=null,aa=null,pa=null,ca=null,na=0,sa=0,ka=0,la=0,ya=new THREE.Frustum,xa=new THREE.Matrix4,ua=new THREE.Vector4,za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};k=function(){var a;try{if(!(a=G.getContext("experimental-webgl",{antialias:z,stencil:J,preserveDrawingBuffer:K})))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}();k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(U.r,U.g,U.b,V);this.context=k;var H=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
+0;this.getContext=function(){return k};this.supportsVertexTextures=function(){return H};this.setSize=function(a,b){G.width=a;G.height=b;this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,b,c,d){na=a;sa=b;ka=c;la=d;k.viewport(na,sa,ka,la)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){U.setHex(a);V=b;k.clearColor(U.r,U.g,U.b,V)};this.setClearColor=function(a,
+b){U.copy(a);V=b;k.clearColor(U.r,U.g,U.b,V)};this.getClearColor=function(){return U};this.getClearAlpha=function(){return V};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=k.COLOR_BUFFER_BIT;if(b===void 0||b)d|=k.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};
+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];k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);
+k.deleteBuffer(c.__webglSkinVertexABuffer);k.deleteBuffer(c.__webglSkinVertexBBuffer);k.deleteBuffer(c.__webglSkinIndicesBuffer);k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer);T.info.memory.geometries--}else if(a instanceof
+THREE.Ribbon)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),T.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),T.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),T.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,
+k.deleteTexture(a.__webglTexture),T.info.memory.textures--};this.updateShadowMap=function(a,b){L=null;w=W=O=$=S=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=k.createBuffer();a.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.position),k.vertexAttribPointer(b.attributes.position,
+3,k.FLOAT,!1,0,0));if(a.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,m,j,n,l,o=a.count*3;for(l=0;l<o;l+=9)c=a.normalArray,d=c[l],e=c[l+1],f=c[l+2],g=c[l+3],i=c[l+4],j=c[l+5],h=c[l+6],m=c[l+7],n=c[l+8],d=(d+g+h)/3,e=(e+i+m)/3,f=(f+j+n)/3,c[l]=d,c[l+1]=e,c[l+2]=f,c[l+3]=d,c[l+4]=e,c[l+5]=f,c[l+6]=d,c[l+7]=e,c[l+8]=f}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,
+3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=q(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==W&&(W=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
+k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),k.vertexAttribPointer(c["morphTarget"+g],3,k.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],m=-1,
+j=0;h=f.morphTargetInfluences;var n,l=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<l;n++)!i[n]&&h[n]>m&&(j=n,m=h[j]);k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]);k.vertexAttribPointer(c["morphTarget"+g],3,k.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=m;i[j]=1;m=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
+0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,k.FLOAT,!1,0,0))}b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,
+e.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
+0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
+(d=d.wireframeLinewidth,d!==ca&&(k.lineWidth(d),ca=d),a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)):(a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)),T.info.render.calls++,T.info.render.vertices+=e.__webglFaceCount,T.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,d=d.linewidth,d!==
+ca&&(k.lineWidth(d),ca=d),k.drawArrays(f,0,e.__webglLineCount),T.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),T.info.render.calls++):f instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),T.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,g,m,n=a.lights,o=a.fog;w=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();i(this.renderPluginsPre,a,b);T.info.render.calls=0;T.info.render.vertices=0;T.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);xa.multiply(b.projectionMatrix,b.matrixWorldInverse);
+ya.setFromMatrix(xa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh)||!g.frustumCulled||ya.contains(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);s(g,b);var p=f,r=p.object,q=p.buffer,H=void 0,H=H=void 0,H=r.material;if(H instanceof THREE.MeshFaceMaterial){if(H=q.materialIndex,H>=0)H=r.geometry.materials[H],
+H.transparent?(p.transparent=H,p.opaque=null):(p.opaque=H,p.transparent=null)}else if(H)H.transparent?(p.transparent=H,p.opaque=null):(p.opaque=H,p.transparent=null);f.render=!0;if(this.sortObjects)g.renderDepth?f.z=g.renderDepth:(ua.copy(g.position),xa.multiplyVector3(ua),f.z=ua.z)}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray),s(g,b),g=f.object.material,g.transparent?
+(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),t(a.overrideMaterial.depthWrite),u(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),l(a.__webglObjects,!0,
+"opaque",b,n,o,!1),j(a.__webglObjectsImmediate,"opaque",b,n,o,!1),l(a.__webglObjects,!1,"transparent",b,n,o,!0),j(a.__webglObjectsImmediate,"transparent",b,n,o,!0));i(this.renderPluginsPost,a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture),k.generateMipmap(k.TEXTURE_CUBE_MAP),k.bindTexture(k.TEXTURE_CUBE_MAP,null)):(k.bindTexture(k.TEXTURE_2D,c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),
+k.bindTexture(k.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);W=-1;T.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,k,ya):e.render(function(a){T.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,j=void 0,l=void 0,H=void 0;if(!h.__webglInit)if(h.__webglInit=
+!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){l=h.geometry;if(l.geometryGroups===void 0){var H=l,q=void 0,s=void 0,t=void 0,z=void 0,u=void 0,J=void 0,A=void 0,v={},R=H.morphTargets.length;H.geometryGroups={};q=0;for(s=H.faces.length;q<s;q++)t=H.faces[q],z=t.materialIndex,J=z!==void 0?z:-1,v[J]===void 0&&
+(v[J]={hash:J,counter:0}),A=v[J].hash+"_"+v[J].counter,H.geometryGroups[A]===void 0&&(H.geometryGroups[A]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:R}),u=t instanceof THREE.Face3?3:4,H.geometryGroups[A].vertices+u>65535&&(v[J].counter+=1,A=v[J].hash+"_"+v[J].counter,H.geometryGroups[A]===void 0&&(H.geometryGroups[A]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:R})),t instanceof THREE.Face3?H.geometryGroups[A].faces3.push(q):H.geometryGroups[A].faces4.push(q),
+H.geometryGroups[A].vertices+=u;H.geometryGroupsList=[];q=void 0;for(q in H.geometryGroups)H.geometryGroups[q].id=da++,H.geometryGroupsList.push(H.geometryGroups[q])}for(j in l.geometryGroups)if(H=l.geometryGroups[j],!H.__webglVertexBuffer){q=H;q.__webglVertexBuffer=k.createBuffer();q.__webglNormalBuffer=k.createBuffer();q.__webglTangentBuffer=k.createBuffer();q.__webglColorBuffer=k.createBuffer();q.__webglUVBuffer=k.createBuffer();q.__webglUV2Buffer=k.createBuffer();q.__webglSkinVertexABuffer=k.createBuffer();
+q.__webglSkinVertexBBuffer=k.createBuffer();q.__webglSkinIndicesBuffer=k.createBuffer();q.__webglSkinWeightsBuffer=k.createBuffer();q.__webglFaceBuffer=k.createBuffer();q.__webglLineBuffer=k.createBuffer();if(q.numMorphTargets){t=s=void 0;q.__webglMorphTargetsBuffers=[];s=0;for(t=q.numMorphTargets;s<t;s++)q.__webglMorphTargetsBuffers.push(k.createBuffer())}T.info.memory.geometries++;z=h;u=z.geometry;s=H.faces3;J=H.faces4;q=s.length*3+J.length*4;t=s.length*1+J.length*2;J=s.length*3+J.length*4;s=c(z,
+H);A=g(s);v=d(s);R=e(s);H.__vertexArray=new Float32Array(q*3);if(v)H.__normalArray=new Float32Array(q*3);if(u.hasTangents)H.__tangentArray=new Float32Array(q*4);if(R)H.__colorArray=new Float32Array(q*3);if(A){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)H.__uvArray=new Float32Array(q*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(q*2)}if(z.geometry.skinWeights.length&&z.geometry.skinIndices.length)H.__skinVertexAArray=new Float32Array(q*4),H.__skinVertexBArray=
+new Float32Array(q*4),H.__skinIndexArray=new Float32Array(q*4),H.__skinWeightArray=new Float32Array(q*4);H.__faceArray=new Uint16Array(t*3);H.__lineArray=new Uint16Array(J*2);if(H.numMorphTargets){H.__morphTargetsArrays=[];z=0;for(u=H.numMorphTargets;z<u;z++)H.__morphTargetsArrays.push(new Float32Array(q*3))}H.__webglFaceCount=t*3;H.__webglLineCount=J*2;if(s.attributes){if(H.__webglCustomAttributesList===void 0)H.__webglCustomAttributesList=[];t=void 0;for(t in s.attributes){var z=s.attributes[t],
+u={},K;for(K in z)u[K]=z[K];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,J=1,u.type==="v2"?J=2:u.type==="v3"?J=3:u.type==="v4"?J=4:u.type==="c"&&(J=3),u.size=J,u.array=new Float32Array(q*J),u.buffer=k.createBuffer(),u.buffer.belongsToAttribute=t,z.needsUpdate=!0,u.__original=z;H.__webglCustomAttributesList.push(u)}}H.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=
+!0}}else if(h instanceof THREE.Ribbon){if(l=h.geometry,!l.__webglVertexBuffer)H=l,H.__webglVertexBuffer=k.createBuffer(),H.__webglColorBuffer=k.createBuffer(),T.info.memory.geometries++,H=l,q=H.vertices.length,H.__vertexArray=new Float32Array(q*3),H.__colorArray=new Float32Array(q*3),H.__webglVertexCount=q,l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(h instanceof THREE.Line){if(l=h.geometry,!l.__webglVertexBuffer)H=l,H.__webglVertexBuffer=k.createBuffer(),H.__webglColorBuffer=k.createBuffer(),
+T.info.memory.geometries++,H=l,q=h,s=H.vertices.length,H.__vertexArray=new Float32Array(s*3),H.__colorArray=new Float32Array(s*3),H.__webglLineCount=s,b(H,q),l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(l=h.geometry,!l.__webglVertexBuffer))H=l,H.__webglVertexBuffer=k.createBuffer(),H.__webglColorBuffer=k.createBuffer(),T.info.geometries++,H=l,q=h,s=H.vertices.length,H.__vertexArray=new Float32Array(s*3),H.__colorArray=new Float32Array(s*3),H.__sortArray=[],H.__webglParticleCount=
+s,b(H,q),l.__dirtyVertices=!0,l.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(j in l=h.geometry,l.geometryGroups)H=l.geometryGroups[j],o(i.__webglObjects,H,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(l=h.geometry,o(i.__webglObjects,l,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):
+h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?p(i.__webglObjects,h):h instanceof THREE.Sprite?n(i.__webglSprites,h):h instanceof THREE.LensFlare?n(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&p(i.__webglObjectsImmediate,h),h.__webglActive=
+!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(K=a.__webglObjects[h].object,j=K.geometry,l=t=s=void 0,K instanceof THREE.Mesh){H=0;for(q=j.geometryGroupsList.length;H<q;H++)if(s=j.geometryGroupsList[H],l=c(K,s),t=l.attributes&&r(l),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||t){var x=K,t=k.DYNAMIC_DRAW,z=!j.dynamic,A=l;if(s.__inittedArrays){var u=d(A),J=e(A),L=g(A),G=u===THREE.SmoothShading,
+B=v=A=void 0,F=void 0,E=void 0,I=void 0,w=void 0,C=void 0,M=void 0,Y=B=void 0,Q=void 0,N=void 0,P=void 0,U=F=void 0,W=void 0,V=void 0,S=F=M=void 0,X=void 0,$=P=N=Q=w=void 0,Z=F=P=N=Q=$=P=N=Q=$=P=N=Q=void 0,O=void 0,ba=I=void 0,fa=void 0,aa=void 0,pa=void 0,ca=void 0,na=Y=aa=O=0,la=0,ka=Z=B=0,ha=w=U=0,D=0,ma=void 0,ha=s.__vertexArray,fa=s.__uvArray,D=s.__uv2Array,ba=s.__normalArray,E=s.__tangentArray,W=s.__colorArray,S=s.__skinVertexAArray,X=s.__skinVertexBArray,C=s.__skinIndexArray,oa=s.__skinWeightArray,
+$=s.__morphTargetsArrays,R=s.__webglCustomAttributesList,y=void 0,y=s.__faceArray,ma=s.__lineArray,V=x.geometry,sa=V.__dirtyElements,ua=V.__dirtyUvs,I=V.__dirtyNormals,M=V.__dirtyTangents,xa=V.__dirtyColors,pa=V.__dirtyMorphTargets,ca=V.vertices,x=s.faces3,ia=s.faces4,ja=V.faces,ya=V.faceVertexUvs[0],za=V.faceVertexUvs[1],Ga=V.skinVerticesA,Ha=V.skinVerticesB,Ia=V.skinIndices,Da=V.skinWeights,Ea=V.morphTargets;if(V.__dirtyVertices){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=ca[F.a].position,N=ca[F.b].position,
+P=ca[F.c].position,ha[aa]=Q.x,ha[aa+1]=Q.y,ha[aa+2]=Q.z,ha[aa+3]=N.x,ha[aa+4]=N.y,ha[aa+5]=N.z,ha[aa+6]=P.x,ha[aa+7]=P.y,ha[aa+8]=P.z,aa+=9;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=ca[F.a].position,N=ca[F.b].position,P=ca[F.c].position,F=ca[F.d].position,ha[aa]=Q.x,ha[aa+1]=Q.y,ha[aa+2]=Q.z,ha[aa+3]=N.x,ha[aa+4]=N.y,ha[aa+5]=N.z,ha[aa+6]=P.x,ha[aa+7]=P.y,ha[aa+8]=P.z,ha[aa+9]=F.x,ha[aa+10]=F.y,ha[aa+11]=F.z,aa+=12;k.bindBuffer(k.ARRAY_BUFFER,s.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,ha,
+t)}if(pa){aa=0;for(pa=Ea.length;aa<pa;aa++){A=ha=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=Ea[aa].vertices[F.a].position,N=Ea[aa].vertices[F.b].position,P=Ea[aa].vertices[F.c].position,ca=$[aa],ca[ha]=Q.x,ca[ha+1]=Q.y,ca[ha+2]=Q.z,ca[ha+3]=N.x,ca[ha+4]=N.y,ca[ha+5]=N.z,ca[ha+6]=P.x,ca[ha+7]=P.y,ca[ha+8]=P.z,ha+=9;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=Ea[aa].vertices[F.a].position,N=Ea[aa].vertices[F.b].position,P=Ea[aa].vertices[F.c].position,F=Ea[aa].vertices[F.d].position,ca=$[aa],ca[ha]=Q.x,ca[ha+
+1]=Q.y,ca[ha+2]=Q.z,ca[ha+3]=N.x,ca[ha+4]=N.y,ca[ha+5]=N.z,ca[ha+6]=P.x,ca[ha+7]=P.y,ca[ha+8]=P.z,ca[ha+9]=F.x,ca[ha+10]=F.y,ca[ha+11]=F.z,ha+=12;k.bindBuffer(k.ARRAY_BUFFER,s.__webglMorphTargetsBuffers[aa]);k.bufferData(k.ARRAY_BUFFER,$[aa],t)}}if(Da.length){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=Da[F.a],N=Da[F.b],P=Da[F.c],oa[w]=Q.x,oa[w+1]=Q.y,oa[w+2]=Q.z,oa[w+3]=Q.w,oa[w+4]=N.x,oa[w+5]=N.y,oa[w+6]=N.z,oa[w+7]=N.w,oa[w+8]=P.x,oa[w+9]=P.y,oa[w+10]=P.z,oa[w+11]=P.w,Q=Ia[F.a],N=Ia[F.b],P=Ia[F.c],
+C[w]=Q.x,C[w+1]=Q.y,C[w+2]=Q.z,C[w+3]=Q.w,C[w+4]=N.x,C[w+5]=N.y,C[w+6]=N.z,C[w+7]=N.w,C[w+8]=P.x,C[w+9]=P.y,C[w+10]=P.z,C[w+11]=P.w,Q=Ga[F.a],N=Ga[F.b],P=Ga[F.c],S[w]=Q.x,S[w+1]=Q.y,S[w+2]=Q.z,S[w+3]=1,S[w+4]=N.x,S[w+5]=N.y,S[w+6]=N.z,S[w+7]=1,S[w+8]=P.x,S[w+9]=P.y,S[w+10]=P.z,S[w+11]=1,Q=Ha[F.a],N=Ha[F.b],P=Ha[F.c],X[w]=Q.x,X[w+1]=Q.y,X[w+2]=Q.z,X[w+3]=1,X[w+4]=N.x,X[w+5]=N.y,X[w+6]=N.z,X[w+7]=1,X[w+8]=P.x,X[w+9]=P.y,X[w+10]=P.z,X[w+11]=1,w+=12;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=Da[F.a],N=
+Da[F.b],P=Da[F.c],$=Da[F.d],oa[w]=Q.x,oa[w+1]=Q.y,oa[w+2]=Q.z,oa[w+3]=Q.w,oa[w+4]=N.x,oa[w+5]=N.y,oa[w+6]=N.z,oa[w+7]=N.w,oa[w+8]=P.x,oa[w+9]=P.y,oa[w+10]=P.z,oa[w+11]=P.w,oa[w+12]=$.x,oa[w+13]=$.y,oa[w+14]=$.z,oa[w+15]=$.w,Q=Ia[F.a],N=Ia[F.b],P=Ia[F.c],$=Ia[F.d],C[w]=Q.x,C[w+1]=Q.y,C[w+2]=Q.z,C[w+3]=Q.w,C[w+4]=N.x,C[w+5]=N.y,C[w+6]=N.z,C[w+7]=N.w,C[w+8]=P.x,C[w+9]=P.y,C[w+10]=P.z,C[w+11]=P.w,C[w+12]=$.x,C[w+13]=$.y,C[w+14]=$.z,C[w+15]=$.w,Q=Ga[F.a],N=Ga[F.b],P=Ga[F.c],$=Ga[F.d],S[w]=Q.x,S[w+1]=Q.y,
+S[w+2]=Q.z,S[w+3]=1,S[w+4]=N.x,S[w+5]=N.y,S[w+6]=N.z,S[w+7]=1,S[w+8]=P.x,S[w+9]=P.y,S[w+10]=P.z,S[w+11]=1,S[w+12]=$.x,S[w+13]=$.y,S[w+14]=$.z,S[w+15]=1,Q=Ha[F.a],N=Ha[F.b],P=Ha[F.c],F=Ha[F.d],X[w]=Q.x,X[w+1]=Q.y,X[w+2]=Q.z,X[w+3]=1,X[w+4]=N.x,X[w+5]=N.y,X[w+6]=N.z,X[w+7]=1,X[w+8]=P.x,X[w+9]=P.y,X[w+10]=P.z,X[w+11]=1,X[w+12]=F.x,X[w+13]=F.y,X[w+14]=F.z,X[w+15]=1,w+=16;w>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,S,t),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinVertexBBuffer),
+k.bufferData(k.ARRAY_BUFFER,X,t),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,C,t),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,oa,t))}if(xa&&J){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],w=F.vertexColors,C=F.color,w.length===3&&J===THREE.VertexColors?(F=w[0],S=w[1],X=w[2]):X=S=F=C,W[U]=F.r,W[U+1]=F.g,W[U+2]=F.b,W[U+3]=S.r,W[U+4]=S.g,W[U+5]=S.b,W[U+6]=X.r,W[U+7]=X.g,W[U+8]=X.b,U+=9;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],w=F.vertexColors,
+C=F.color,w.length===4&&J===THREE.VertexColors?(F=w[0],S=w[1],X=w[2],w=w[3]):w=X=S=F=C,W[U]=F.r,W[U+1]=F.g,W[U+2]=F.b,W[U+3]=S.r,W[U+4]=S.g,W[U+5]=S.b,W[U+6]=X.r,W[U+7]=X.g,W[U+8]=X.b,W[U+9]=w.r,W[U+10]=w.g,W[U+11]=w.b,U+=12;U>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,W,t))}if(M&&V.hasTangents){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],M=F.vertexTangents,U=M[0],W=M[1],V=M[2],E[Z]=U.x,E[Z+1]=U.y,E[Z+2]=U.z,E[Z+3]=U.w,E[Z+4]=W.x,E[Z+5]=W.y,E[Z+6]=W.z,E[Z+7]=W.w,E[Z+
+8]=V.x,E[Z+9]=V.y,E[Z+10]=V.z,E[Z+11]=V.w,Z+=12;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],M=F.vertexTangents,U=M[0],W=M[1],V=M[2],M=M[3],E[Z]=U.x,E[Z+1]=U.y,E[Z+2]=U.z,E[Z+3]=U.w,E[Z+4]=W.x,E[Z+5]=W.y,E[Z+6]=W.z,E[Z+7]=W.w,E[Z+8]=V.x,E[Z+9]=V.y,E[Z+10]=V.z,E[Z+11]=V.w,E[Z+12]=M.x,E[Z+13]=M.y,E[Z+14]=M.z,E[Z+15]=M.w,Z+=16;k.bindBuffer(k.ARRAY_BUFFER,s.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,E,t)}if(I&&u){A=0;for(v=x.length;A<v;A++)if(F=ja[x[A]],E=F.vertexNormals,I=F.normal,E.length===3&&G)for(Z=
+0;Z<3;Z++)I=E[Z],ba[B]=I.x,ba[B+1]=I.y,ba[B+2]=I.z,B+=3;else for(Z=0;Z<3;Z++)ba[B]=I.x,ba[B+1]=I.y,ba[B+2]=I.z,B+=3;A=0;for(v=ia.length;A<v;A++)if(F=ja[ia[A]],E=F.vertexNormals,I=F.normal,E.length===4&&G)for(Z=0;Z<4;Z++)I=E[Z],ba[B]=I.x,ba[B+1]=I.y,ba[B+2]=I.z,B+=3;else for(Z=0;Z<4;Z++)ba[B]=I.x,ba[B+1]=I.y,ba[B+2]=I.z,B+=3;k.bindBuffer(k.ARRAY_BUFFER,s.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,ba,t)}if(ua&&ya&&L){A=0;for(v=x.length;A<v;A++)if(B=x[A],B=ya[B],B!==void 0)for(Z=0;Z<3;Z++)ba=B[Z],
+fa[Y]=ba.u,fa[Y+1]=ba.v,Y+=2;A=0;for(v=ia.length;A<v;A++)if(B=ia[A],B=ya[B],B!==void 0)for(Z=0;Z<4;Z++)ba=B[Z],fa[Y]=ba.u,fa[Y+1]=ba.v,Y+=2;Y>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,fa,t))}if(ua&&za&&L){A=0;for(v=x.length;A<v;A++)if(B=x[A],Y=za[B],Y!==void 0)for(Z=0;Z<3;Z++)fa=Y[Z],D[na]=fa.u,D[na+1]=fa.v,na+=2;A=0;for(v=ia.length;A<v;A++)if(B=ia[A],Y=za[B],Y!==void 0)for(Z=0;Z<4;Z++)fa=Y[Z],D[na]=fa.u,D[na+1]=fa.v,na+=2;na>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglUV2Buffer),
+k.bufferData(k.ARRAY_BUFFER,D,t))}if(sa){A=0;for(v=x.length;A<v;A++)y[la]=O,y[la+1]=O+1,y[la+2]=O+2,la+=3,ma[ka]=O,ma[ka+1]=O+1,ma[ka+2]=O,ma[ka+3]=O+2,ma[ka+4]=O+1,ma[ka+5]=O+2,ka+=6,O+=3;A=0;for(v=ia.length;A<v;A++)y[la]=O,y[la+1]=O+1,y[la+2]=O+3,y[la+3]=O+1,y[la+4]=O+2,y[la+5]=O+3,la+=6,ma[ka]=O,ma[ka+1]=O+1,ma[ka+2]=O,ma[ka+3]=O+3,ma[ka+4]=O+1,ma[ka+5]=O+2,ma[ka+6]=O+2,ma[ka+7]=O+3,ka+=8,O+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,s.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,y,t);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
+s.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ma,t)}if(R){Z=0;for(O=R.length;Z<O;Z++)if(y=R[Z],y.__original.needsUpdate){D=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],y.array[D]=y.value[F.a],y.array[D+1]=y.value[F.b],y.array[D+2]=y.value[F.c],D+=3;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],y.array[D]=y.value[F.a],y.array[D+1]=y.value[F.b],y.array[D+2]=y.value[F.c],y.array[D+3]=y.value[F.d],D+=4}else{if(y.boundTo==="faces"){A=0;for(v=
+x.length;A<v;A++)ma=y.value[x[A]],y.array[D]=ma,y.array[D+1]=ma,y.array[D+2]=ma,D+=3;A=0;for(v=ia.length;A<v;A++)ma=y.value[ia[A]],y.array[D]=ma,y.array[D+1]=ma,y.array[D+2]=ma,y.array[D+3]=ma,D+=4}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=y.value[F.a],N=y.value[F.b],P=y.value[F.c],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=N.x,y.array[D+3]=N.y,y.array[D+4]=P.x,y.array[D+5]=P.y,D+=6;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=y.value[F.a],
+N=y.value[F.b],P=y.value[F.c],F=y.value[F.d],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=N.x,y.array[D+3]=N.y,y.array[D+4]=P.x,y.array[D+5]=P.y,y.array[D+6]=F.x,y.array[D+7]=F.y,D+=8}else{if(y.boundTo==="faces"){A=0;for(v=x.length;A<v;A++)P=N=Q=ma=y.value[x[A]],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=N.x,y.array[D+3]=N.y,y.array[D+4]=P.x,y.array[D+5]=P.y,D+=6;A=0;for(v=ia.length;A<v;A++)F=P=N=Q=ma=y.value[ia[A]],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=N.x,y.array[D+3]=N.y,y.array[D+4]=
+P.x,y.array[D+5]=P.y,y.array[D+6]=F.x,y.array[D+7]=F.y,D+=8}}else if(y.size===3)if(u=y.type==="c"?["r","g","b"]:["x","y","z"],y.boundTo===void 0||y.boundTo==="vertices"){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=y.value[F.a],N=y.value[F.b],P=y.value[F.c],y.array[D]=Q[u[0]],y.array[D+1]=Q[u[1]],y.array[D+2]=Q[u[2]],y.array[D+3]=N[u[0]],y.array[D+4]=N[u[1]],y.array[D+5]=N[u[2]],y.array[D+6]=P[u[0]],y.array[D+7]=P[u[1]],y.array[D+8]=P[u[2]],D+=9;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=y.value[F.a],N=
+y.value[F.b],P=y.value[F.c],F=y.value[F.d],y.array[D]=Q[u[0]],y.array[D+1]=Q[u[1]],y.array[D+2]=Q[u[2]],y.array[D+3]=N[u[0]],y.array[D+4]=N[u[1]],y.array[D+5]=N[u[2]],y.array[D+6]=P[u[0]],y.array[D+7]=P[u[1]],y.array[D+8]=P[u[2]],y.array[D+9]=F[u[0]],y.array[D+10]=F[u[1]],y.array[D+11]=F[u[2]],D+=12}else{if(y.boundTo==="faces"){A=0;for(v=x.length;A<v;A++)P=N=Q=ma=y.value[x[A]],y.array[D]=Q[u[0]],y.array[D+1]=Q[u[1]],y.array[D+2]=Q[u[2]],y.array[D+3]=N[u[0]],y.array[D+4]=N[u[1]],y.array[D+5]=N[u[2]],
+y.array[D+6]=P[u[0]],y.array[D+7]=P[u[1]],y.array[D+8]=P[u[2]],D+=9;A=0;for(v=ia.length;A<v;A++)F=P=N=Q=ma=y.value[ia[A]],y.array[D]=Q[u[0]],y.array[D+1]=Q[u[1]],y.array[D+2]=Q[u[2]],y.array[D+3]=N[u[0]],y.array[D+4]=N[u[1]],y.array[D+5]=N[u[2]],y.array[D+6]=P[u[0]],y.array[D+7]=P[u[1]],y.array[D+8]=P[u[2]],y.array[D+9]=F[u[0]],y.array[D+10]=F[u[1]],y.array[D+11]=F[u[2]],D+=12}}else if(y.size===4)if(y.boundTo===void 0||y.boundTo==="vertices"){A=0;for(v=x.length;A<v;A++)F=ja[x[A]],Q=y.value[F.a],N=
+y.value[F.b],P=y.value[F.c],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=Q.z,y.array[D+3]=Q.w,y.array[D+4]=N.x,y.array[D+5]=N.y,y.array[D+6]=N.z,y.array[D+7]=N.w,y.array[D+8]=P.x,y.array[D+9]=P.y,y.array[D+10]=P.z,y.array[D+11]=P.w,D+=12;A=0;for(v=ia.length;A<v;A++)F=ja[ia[A]],Q=y.value[F.a],N=y.value[F.b],P=y.value[F.c],F=y.value[F.d],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=Q.z,y.array[D+3]=Q.w,y.array[D+4]=N.x,y.array[D+5]=N.y,y.array[D+6]=N.z,y.array[D+7]=N.w,y.array[D+8]=P.x,y.array[D+9]=
+P.y,y.array[D+10]=P.z,y.array[D+11]=P.w,y.array[D+12]=F.x,y.array[D+13]=F.y,y.array[D+14]=F.z,y.array[D+15]=F.w,D+=16}else if(y.boundTo==="faces"){A=0;for(v=x.length;A<v;A++)P=N=Q=ma=y.value[x[A]],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+2]=Q.z,y.array[D+3]=Q.w,y.array[D+4]=N.x,y.array[D+5]=N.y,y.array[D+6]=N.z,y.array[D+7]=N.w,y.array[D+8]=P.x,y.array[D+9]=P.y,y.array[D+10]=P.z,y.array[D+11]=P.w,D+=12;A=0;for(v=ia.length;A<v;A++)F=P=N=Q=ma=y.value[ia[A]],y.array[D]=Q.x,y.array[D+1]=Q.y,y.array[D+
+2]=Q.z,y.array[D+3]=Q.w,y.array[D+4]=N.x,y.array[D+5]=N.y,y.array[D+6]=N.z,y.array[D+7]=N.w,y.array[D+8]=P.x,y.array[D+9]=P.y,y.array[D+10]=P.z,y.array[D+11]=P.w,y.array[D+12]=F.x,y.array[D+13]=F.y,y.array[D+14]=F.z,y.array[D+15]=F.w,D+=16}k.bindBuffer(k.ARRAY_BUFFER,y.buffer);k.bufferData(k.ARRAY_BUFFER,y.array,t)}}z&&(delete s.__inittedArrays,delete s.__colorArray,delete s.__normalArray,delete s.__tangentArray,delete s.__uvArray,delete s.__uv2Array,delete s.__faceArray,delete s.__vertexArray,delete s.__lineArray,
+delete s.__skinVertexAArray,delete s.__skinVertexBArray,delete s.__skinIndexArray,delete s.__skinWeightArray)}}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyColors=!1;j.__dirtyTangents=!1;l.attributes&&m(l)}else if(K instanceof THREE.Ribbon){if(j.__dirtyVertices||j.__dirtyColors){l=j;K=k.DYNAMIC_DRAW;u=H=u=z=z=void 0;J=l.vertices;q=l.colors;A=J.length;s=q.length;v=l.__vertexArray;t=l.__colorArray;R=l.__dirtyColors;if(l.__dirtyVertices){for(z=
+0;z<A;z++)u=J[z].position,H=z*3,v[H]=u.x,v[H+1]=u.y,v[H+2]=u.z;k.bindBuffer(k.ARRAY_BUFFER,l.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,v,K)}if(R){for(z=0;z<s;z++)u=q[z],H=z*3,t[H]=u.r,t[H+1]=u.g,t[H+2]=u.b;k.bindBuffer(k.ARRAY_BUFFER,l.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,t,K)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(K instanceof THREE.Line){l=c(K,s);t=l.attributes&&r(l);if(j.__dirtyVertices||j.__dirtyColors||t){K=j;H=k.DYNAMIC_DRAW;A=q=G=J=L=void 0;J=K.vertices;s=K.colors;
+A=J.length;t=s.length;v=K.__vertexArray;z=K.__colorArray;R=K.__dirtyColors;u=K.__webglCustomAttributesList;O=ja=ia=x=G=L=void 0;if(K.__dirtyVertices){for(L=0;L<A;L++)G=J[L].position,q=L*3,v[q]=G.x,v[q+1]=G.y,v[q+2]=G.z;k.bindBuffer(k.ARRAY_BUFFER,K.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,v,H)}if(R){for(J=0;J<t;J++)A=s[J],q=J*3,z[q]=A.r,z[q+1]=A.g,z[q+2]=A.b;k.bindBuffer(k.ARRAY_BUFFER,K.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,z,H)}if(u){L=0;for(G=u.length;L<G;L++)if(O=u[L],O.needsUpdate&&
+(O.boundTo===void 0||O.boundTo==="vertices")){q=0;ia=O.value.length;if(O.size===1)for(x=0;x<ia;x++)O.array[x]=O.value[x];else if(O.size===2)for(x=0;x<ia;x++)ja=O.value[x],O.array[q]=ja.x,O.array[q+1]=ja.y,q+=2;else if(O.size===3)if(O.type==="c")for(x=0;x<ia;x++)ja=O.value[x],O.array[q]=ja.r,O.array[q+1]=ja.g,O.array[q+2]=ja.b,q+=3;else for(x=0;x<ia;x++)ja=O.value[x],O.array[q]=ja.x,O.array[q+1]=ja.y,O.array[q+2]=ja.z,q+=3;else if(O.size===4)for(x=0;x<ia;x++)ja=O.value[x],O.array[q]=ja.x,O.array[q+
+1]=ja.y,O.array[q+2]=ja.z,O.array[q+3]=ja.w,q+=4;k.bindBuffer(k.ARRAY_BUFFER,O.buffer);k.bufferData(k.ARRAY_BUFFER,O.array,H)}}}j.__dirtyVertices=!1;j.__dirtyColors=!1;l.attributes&&m(l)}else if(K instanceof THREE.ParticleSystem)l=c(K,s),t=l.attributes&&r(l),(j.__dirtyVertices||j.__dirtyColors||K.sortParticles||t)&&f(j,k.DYNAMIC_DRAW,K),j.__dirtyVertices=!1,j.__dirtyColors=!1,l.attributes&&m(l)};this.initMaterial=function(a,b,c,d){var e,f,g,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 j,m,l;j=l=i=0;for(m=b.length;j<m;j++)g=b[j],g instanceof THREE.SpotLight&&
+l++,g instanceof THREE.DirectionalLight&&l++,g instanceof THREE.PointLight&&i++;i+l<=Y?j=l:(j=Math.ceil(Y*l/(i+l)),i=Y-j);g={directional:j,point:i};i=l=0;for(j=b.length;i<j;i++)m=b[i],m instanceof THREE.SpotLight&&m.castShadow&&l++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{j=a.fragmentShader;m=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:g.directional,maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:l,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(j),d.push(m));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=M.length;p<d;p++)if(M[p].code===
+h){o=M[p].program;break a}p=k.createProgram();d=[H?"#define VERTEX_TEXTURES":"",T.gammaInput?"#define GAMMA_INPUT":"",T.gammaOutput?"#define GAMMA_OUTPUT":"",T.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");
+g=["#ifdef GL_ES","precision "+R+" 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:"",T.gammaInput?"#define GAMMA_INPUT":"",T.gammaOutput?"#define GAMMA_OUTPUT":"",T.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");k.attachShader(p,v("fragment",g+j));k.attachShader(p,
+v("vertex",d+m));k.linkProgram(p);k.getProgramParameter(p,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(p,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)j=q[d],p.uniforms[j]=k.getUniformLocation(p,
+j);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=k.getAttribLocation(p,c);p.id=M.length;M.push({program:p,code:h});T.info.memory.programs=M.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&k.enableVertexAttribArray(o.position);o.color>=0&&k.enableVertexAttribArray(o.color);o.normal>=0&&k.enableVertexAttribArray(o.normal);
+o.tangent>=0&&k.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(k.enableVertexAttribArray(o.skinVertexA),k.enableVertexAttribArray(o.skinVertexB),k.enableVertexAttribArray(o.skinIndex),k.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&k.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)q="morphTarget"+f,o[q]>=0&&(k.enableVertexAttribArray(o[q]),
+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"?k.frontFace(k.CCW):k.frontFace(k.CW),a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if(fa!==a.doubleSided)a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),fa=a.doubleSided;if(X!==a.flipSided)a.flipSided?k.frontFace(k.CW):
+k.frontFace(k.CCW),X=a.flipSided};this.setDepthTest=function(a){$!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),$=a)};this.setBlending=function(a){if(a!==S){switch(a){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,
+k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}S=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=k.createTexture(),T.info.memory.textures++;k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);var c=B(k.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,E(a.format),a.image.width,a.image.height,0,E(a.format),k.UNSIGNED_BYTE,a.image.data):k.texImage2D(k.TEXTURE_2D,
+0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,a.image);c&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else k.activeTexture(k.TEXTURE0+b),k.bindTexture(k.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(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=k.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,
+a.__webglTexture);B(k.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=k.createFramebuffer();a.__webglRenderbuffer[c]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,E(a.format),a.width,a.height,0,E(a.format),E(a.type),null);var d=a,e=k.TEXTURE_CUBE_MAP_POSITIVE_X+c;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[c]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,e,d.__webglTexture,0);x(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=k.createFramebuffer(),
+a.__webglRenderbuffer=k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),B(k.TEXTURE_2D,a,a),k.texImage2D(k.TEXTURE_2D,0,E(a.format),a.width,a.height,0,E(a.format),E(a.type),null),c=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer),k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,c,a.__webglTexture,0),x(a.__webglRenderbuffer,a);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,
+null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ka,a=la,d=na,e=sa);b!==I&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),I=b)};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
@@ -340,19 +339,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.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,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;return b}};
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,m=g.faces,k=a.faceVertexUvs[0],o=g.faceVertexUvs[0],r={},n=0;n<a.materials.length;n++)r[a.materials[n].id]=n;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var n=0,q=h.length;n<q;n++){var l=new THREE.Vertex(h[n].position.clone());c&&c.multiplyVector3(l.position);f.push(l)}n=
-0;for(q=m.length;n<q;n++){var f=m[n],p,s,t=f.vertexNormals,v=f.vertexColors;f instanceof THREE.Face3?p=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(p=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));p.normal.copy(f.normal);d&&d.multiplyVector3(p.normal);h=0;for(l=t.length;h<l;h++)s=t[h].clone(),d&&d.multiplyVector3(s),p.vertexNormals.push(s);p.color.copy(f.color);h=0;for(l=v.length;h<l;h++)s=v[h],p.vertexColors.push(s.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
-l=r[h.id];if(l===void 0)l=a.materials.length,a.materials.push(h);p.materialIndex=l}p.centroid.copy(f.centroid);c&&c.multiplyVector3(p.centroid);i.push(p)}n=0;for(q=o.length;n<q;n++){c=o[n];d=[];h=0;for(l=c.length;h<l;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
-for(c=e.length;a<c;a++){var h=e[a],i,m,k=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=k.length;d<f;d++)m=k[d],i.vertexNormals.push(m.clone());i.color.copy(h.color);d=0;for(f=o.length;d<f;d++)m=o[d],i.vertexColors.push(m.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,l=g.faces,j=a.faceVertexUvs[0],o=g.faceVertexUvs[0],r={},m=0;m<a.materials.length;m++)r[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,p=h.length;m<p;m++){var n=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}m=
+0;for(p=l.length;m<p;m++){var f=l[m],q,s,t=f.vertexNormals,u=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=t.length;h<n;h++)s=t[h].clone(),d&&d.multiplyVector3(s),q.vertexNormals.push(s);q.color.copy(f.color);h=0;for(n=u.length;h<n;h++)s=u[h],q.vertexColors.push(s.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
+n=r[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);q.materialIndex=n}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}m=0;for(p=o.length;m<p;m++){c=o[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
+for(c=e.length;a<c;a++){var h=e[a],i,l,j=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=j.length;d<f;d++)l=j[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(f=o.length;d<f;d++)l=o[d],i.vertexColors.push(l.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
 f;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
 f;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
 g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
 g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
-f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return m[e]>a?b(c,e-1):m[e]<a?b(e+1,d):e}return b(0,m.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,m=[],k,o,r,n;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)k=f[d.a].position,o=f[d.b].position,r=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,o,r);else if(d instanceof
-THREE.Face4)k=f[d.a].position,o=f[d.b].position,r=f[d.c].position,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,o,n),d._area2=THREE.GeometryUtils.triangleArea(o,r,n),d._area=d._area1+d._area2;i+=d._area;m[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(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,e,g=a.faces,f=a.vertices,h=g.length,i=0,l=[],j,o,r,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,o=f[d.b].position,r=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,o,r);else if(d instanceof
+THREE.Face4)j=f[d.a].position,o=f[d.b].position,r=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,o,m),d._area2=THREE.GeometryUtils.triangleArea(o,r,m),d._area=d._area1+d._area2;i+=d._area;l[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
 b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.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(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.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(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin="";d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
 THREE.ImageUtils={loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin="";d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},getNormalMap:function(a,b){var c=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]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),m=i.data,k=0;k<d;k++)for(var o=1;o<e;o++){var r=o-1<0?e-1:o-1,n=(o+1)%e,q=k-1<0?d-1:k-1,l=(k+1)%d,p=[],s=[0,0,h[(o*d+k)*4]/255*b];p.push([-1,0,h[(o*d+q)*4]/255*b]);p.push([-1,-1,h[(r*d+q)*4]/255*b]);p.push([0,-1,h[(r*d+k)*4]/255*b]);p.push([1,-1,h[(r*d+l)*4]/255*b]);
-p.push([1,0,h[(o*d+l)*4]/255*b]);p.push([1,1,h[(n*d+l)*4]/255*b]);p.push([0,1,h[(n*d+k)*4]/255*b]);p.push([-1,1,h[(n*d+q)*4]/255*b]);r=[];q=p.length;for(n=0;n<q;n++){var l=p[n],t=p[(n+1)%q],l=[l[0]-s[0],l[1]-s[1],l[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];r.push(c([l[1]*t[2]-l[2]*t[1],l[2]*t[0]-l[0]*t[2],l[0]*t[1]-l[1]*t[0]]))}p=[0,0,0];for(n=0;n<r.length;n++)p[0]+=r[n][0],p[1]+=r[n][1],p[2]+=r[n][2];p[0]/=r.length;p[1]/=r.length;p[2]/=r.length;s=(o*d+k)*4;m[s]=(p[0]+1)/2*255|0;m[s+1]=(p[1]+0.5)*
-255|0;m[s+2]=p[2]*255|0;m[s+3]=255}f.putImageData(i,0,0);return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),l=i.data,j=0;j<d;j++)for(var o=1;o<e;o++){var r=o-1<0?e-1:o-1,m=(o+1)%e,p=j-1<0?d-1:j-1,n=(j+1)%d,q=[],s=[0,0,h[(o*d+j)*4]/255*b];q.push([-1,0,h[(o*d+p)*4]/255*b]);q.push([-1,-1,h[(r*d+p)*4]/255*b]);q.push([0,-1,h[(r*d+j)*4]/255*b]);q.push([1,-1,h[(r*d+n)*4]/255*b]);
+q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(m*d+n)*4]/255*b]);q.push([0,1,h[(m*d+j)*4]/255*b]);q.push([-1,1,h[(m*d+p)*4]/255*b]);r=[];p=q.length;for(m=0;m<p;m++){var n=q[m],t=q[(m+1)%p],n=[n[0]-s[0],n[1]-s[1],n[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];r.push(c([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]))}q=[0,0,0];for(m=0;m<r.length;m++)q[0]+=r[m][0],q[1]+=r[m][1],q[2]+=r[m][2];q[0]/=r.length;q[1]/=r.length;q[2]/=r.length;s=(o*d+j)*4;l[s]=(q[0]+1)/2*255|0;l[s+1]=(q[1]+0.5)*
+255|0;l[s+2]=q[2]*255|0;l[s+3]=255}f.putImageData(i,0,0);return g}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
@@ -397,37 +396,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){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,b),new THREE.Vector2(c,d),new THREE.Vector2(e,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){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,b),new THREE.Vector2(c,d),new THREE.Vector2(e,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
 THREE.Path.prototype.arc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,m,k,o,r,n,q,l;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];o=g[0];r=g[1];c.length>0?(f=c[c.length-1],n=f.x,q=f.y):(f=this.actions[d-1].args,n=f[f.length-2],q=f[f.length-1]);for(f=1;f<=a;f++)l=f/a,g=THREE.Shape.Utils.b2(l,n,o,h),l=THREE.Shape.Utils.b2(l,q,r,
-i),c.push(new THREE.Vector2(g,l));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];o=g[0];r=g[1];m=g[2];k=g[3];c.length>0?(f=c[c.length-1],n=f.x,q=f.y):(f=this.actions[d-1].args,n=f[f.length-2],q=f[f.length-1]);for(f=1;f<=a;f++)l=f/a,g=THREE.Shape.Utils.b3(l,n,o,m,h),l=THREE.Shape.Utils.b3(l,q,r,k,i),c.push(new THREE.Vector2(g,l));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];l=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
-for(f=1;f<=l;f++)c.push(g.getPointAt(f/l));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];m=g[2];o=g[3];l=g[4];r=!!g[5];k=f[f.length-2];n=f[f.length-1];f.length==0&&(k=n=0);q=l-o;var p=a*2;for(f=1;f<=p;f++)l=f/p,r||(l=1-l),l=o+l*q,g=k+h+m*Math.cos(l),l=n+i+m*Math.sin(l),c.push(new THREE.Vector2(g,l))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
-THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,m,k,o;h=0;for(i=f.length;h<i;h++)m=f[h],k=m.x,o=m.y,m.x=a*k+b*o+c,m.y=d*o+e*k+g;return f};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,l,j,o,r,m,p,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];o=g[0];r=g[1];c.length>0?(f=c[c.length-1],m=f.x,p=f.y):(f=this.actions[d-1].args,m=f[f.length-2],p=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,m,o,h),n=THREE.Shape.Utils.b2(n,p,r,
+i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];o=g[0];r=g[1];l=g[2];j=g[3];c.length>0?(f=c[c.length-1],m=f.x,p=f.y):(f=this.actions[d-1].args,m=f[f.length-2],p=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,m,o,l,h),n=THREE.Shape.Utils.b3(n,p,r,j,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
+for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];l=g[2];o=g[3];n=g[4];r=!!g[5];j=f[f.length-2];m=f[f.length-1];f.length==0&&(j=m=0);p=n-o;var q=a*2;for(f=1;f<=q;f++)n=f/q,r||(n=1-n),n=o+n*p,g=j+h+l*Math.cos(n),n=m+i+l*Math.sin(n),c.push(new THREE.Vector2(g,n))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
+THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,l,j,o;h=0;for(i=f.length;h<i;h++)l=f[h],j=l.x,o=l.y,l.x=a*j+b*o+c,l.y=d*o+e*j+g;return f};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
 this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(e.push(g),g=new THREE.Path),g[c].apply(g,d);g.actions.length!=0&&e.push(g);if(e.length==0)return[];var f,g=[];if(THREE.Shape.Utils.isClockWise(e[0].getPoints())){a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&g.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(e.push(g),g=new THREE.Path),g[c].apply(g,d);g.actions.length!=0&&e.push(g);if(e.length==0)return[];var f,g=[];if(THREE.Shape.Utils.isClockWise(e[0].getPoints())){a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&g.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
 d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].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.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,m,k,o,r,n,q=[];for(i=0;i<b.length;i++){m=b[i];Array.prototype.push.apply(d,m);g=Number.POSITIVE_INFINITY;for(e=0;e<m.length;e++){r=m[e];n=[];for(o=0;o<c.length;o++)k=c[o],k=r.distanceToSquared(k),n.push(k),k<g&&(g=k,f=e,h=o)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:m.length-1;var l=[m[f],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(l);var p=[m[f],m[g],c[h]];r=THREE.FontUtils.Triangulate.area(p);n=h;k=f;h+=1;f+=-1;h<
-0&&(h+=c.length);h%=c.length;f<0&&(f+=m.length);f%=m.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:m.length-1;l=[m[f],c[h],c[e]];l=THREE.FontUtils.Triangulate.area(l);p=[m[f],m[g],c[h]];p=THREE.FontUtils.Triangulate.area(p);o+r>l+p&&(h=n,f=k,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=m.length),f%=m.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:m.length-1);o=c.slice(0,h);r=c.slice(h);n=m.slice(f);k=m.slice(0,f);g=[m[f],m[g],c[h]];q.push([m[f],c[h],c[e]]);q.push(g);c=o.concat(n).concat(k).concat(r)}return{shape:c,
-isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,m={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,m[i]!==void 0&&console.log("Duplicate point",i),m[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=m[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=m[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,l,j,o,r,m,p=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);g=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){r=l[e];m=[];for(o=0;o<c.length;o++)j=c[o],j=r.distanceToSquared(j),m.push(j),j<g&&(g=j,f=e,h=o)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:l.length-1;var n=[l[f],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[l[f],l[g],c[h]];r=THREE.FontUtils.Triangulate.area(q);m=h;j=f;h+=1;f+=-1;h<
+0&&(h+=c.length);h%=c.length;f<0&&(f+=l.length);f%=l.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:l.length-1;n=[l[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[l[f],l[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);o+r>n+q&&(h=m,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=l.length),f%=l.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:l.length-1);o=c.slice(0,h);r=c.slice(h);m=l.slice(f);j=l.slice(0,f);g=[l[f],l[g],c[h]];p.push([l[f],c[h],c[e]]);p.push(g);c=o.concat(m).concat(j).concat(r)}return{shape:c,
+isolatedPts:p,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,l={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,l[i]!==void 0&&console.log("Duplicate point",i),l[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={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){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
 THREE.AnimationHandler=function(){var a=[],b={},c={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){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
-0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var m=a.hierarchy[c].keys[d].morphTargets[i];h[m]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
-{};for(m in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===m){k[m]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[m]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
+0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var l=a.hierarchy[c].keys[d].morphTargets[i];h[l]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var j=
+{};for(l in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===l){j[l]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(j[l]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var 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)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var 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)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
 2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
 2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
 THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.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.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,m,k=this.data.JIT.hierarchy,o,r;this.currentTime+=a*this.timeScale;r=this.currentTime;o=this.currentTime%=this.data.length;m=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,q=this.hierarchy.length;n<q;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&k[n][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[n][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=k[n][m],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++){c=b[l];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=r){if(o<r)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<o;)f=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<
-o)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-f.time)/(h.time-f.time);e=f[c];g=h[c];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(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[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]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
-"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&k[0][m]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)k[n][m]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,m;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];m=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],m[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],m[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],m[2],e,c,f);return d};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,l,j=this.data.JIT.hierarchy,o,r;this.currentTime+=a*this.timeScale;r=this.currentTime;o=this.currentTime%=this.data.length;l=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,p=this.hierarchy.length;m<p;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&j[m][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[m][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=j[m][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 n=0;n<3;n++){c=b[n];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=r){if(o<r)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<o;)f=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<
+o)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
+"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&j[0][l]===void 0){this.hierarchy[0].update(null,!0);for(m=0;m<this.hierarchy.length;m++)j[m][l]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,l;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];l=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],l[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],l[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],l[2],e,c,f);return d};
 THREE.Animation.prototype.interpolate=function(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};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.interpolate=function(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};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
@@ -449,14 +448,14 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
 this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.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*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*
 1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.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",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,b){function c(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 e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,s=0;f=p-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<p-1;f++)s=d*h.chunks[f]/h.total,b.keys[f]={time:s,pos:g[f]};e.hierarchy[0]=
+THREE.PathControls=function(a,b){function c(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 e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,s=0;f=q-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<q-1;f++)s=d*h.chunks[f]/h.total,b.keys[f]={time:s,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(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=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(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=b!==void 0?b: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=
 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 b;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;b=this.verticalAngleMap.srcRange;
 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 b;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;b=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
-this.debugPath,b=this.spline,f=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(f,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
+this.debugPath,b=this.spline,f=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(f,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
 !1)}};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
@@ -467,42 +466,42 @@ THREE.FlyControls=function(a,b){function c(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.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",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b: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 c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,m=0,k=0,o=0,r=0,n=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*o);this.rotateVertically(b*r)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*m);this.object.translateY(b*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();e.copy(this.forward);d.set(0,1,0);c.cross(d,
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b: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 c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,l=0,j=0,o=0,r=0,m=window.innerWidth/2,p=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*o);this.rotateVertically(b*r)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*l);this.object.translateY(b*j);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();e.copy(this.forward);d.set(0,1,0);c.cross(d,
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);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*
 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){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);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",
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);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){o=(a.clientX-n)/window.innerWidth;r=(a.clientY-q)/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:m=-1;break;case 40:case 83:i=-1;break;case 39:case 68:m=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:m=0;break;case 40:case 83:i=0;break;case 39:case 68:m=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-m)/window.innerWidth;r=(a.clientY-p)/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: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: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:j=0;break;case 70:j=0}},!1)};
 THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?b: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=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
 THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?b: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=this.noRotate=!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 e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,m=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2,r=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
+this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector2,j=new THREE.Vector2,o=new THREE.Vector2,r=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
 c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.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 b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
 c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.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 b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
--a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-m.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?m=k:m.y+=(k.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=r.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
+-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-l.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?l=j:l.y+=(j.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=r.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
 c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=r:o.addSelf(a.sub(r,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
 c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=r:o.addSelf(a.sub(r,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
-c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),m=k=c.getMouseOnScreen(a.clientX,a.clientY),o=r=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
-!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(r=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?m=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=r=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
+c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),l=j=c.getMouseOnScreen(a.clientX,a.clientY),o=r=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
+!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(r=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?l=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=r=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
 function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
 function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,k,n){var l,o=d||1,p=e||1,q=h/2,r=i/2,j=m.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=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")l="x",o=g||1;var s=o+1,t=p+1,v=h/o,C=i/p,O=new THREE.Vector3;O[l]=k>0?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var ea=new THREE.Vector3;ea[a]=(i*v-q)*c;ea[b]=(h*C-r)*f;ea[l]=k;m.vertices.push(new THREE.Vertex(ea))}for(h=0;h<p;h++)for(i=
-0;i<o;i++)a=new THREE.Face4(i+s*h+j,i+s*(h+1)+j,i+1+s*(h+1)+j,i+1+s*h+j),a.normal.copy(O),a.vertexNormals.push(O.clone(),O.clone(),O.clone(),O.clone()),a.materialIndex=n,m.faces.push(a),m.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var m=this,k=a/2,o=b/2,r=c/2,n,q,l,p,s,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;p=1;q=2;s=3;l=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 v in h)this.sides[v]!=void 0&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,p);this.sides.py&&i("x","z",1,1,a,c,o,q);this.sides.ny&&i("x","z",1,-1,a,c,-o,s);this.sides.pz&&i("x","y",1,-1,a,b,r,l);this.sides.nz&&i("x","y",-1,-1,a,b,-r,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=l.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",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var k=o+1,t=p+1,u=h/o,I=i/p,w=new THREE.Vector3;w[n]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<k;i++){var W=new THREE.Vector3;W[a]=(i*u-q)*c;W[b]=(h*I-r)*f;W[n]=j;l.vertices.push(new THREE.Vertex(W))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+k*h+s,i+k*(h+1)+s,i+1+k*(h+1)+s,i+1+k*h+s),a.normal.copy(w),a.vertexNormals.push(w.clone(),w.clone(),w.clone(),w.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var l=this,j=a/2,o=b/2,r=c/2,m,p,n,q,s,t;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;q=1;p=2;s=
+3;n=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 u in h)this.sides[u]!=void 0&&(this.sides[u]=h[u]);this.sides.px&&i("z","y",-1,-1,c,b,j,m);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,o,p);this.sides.ny&&i("x","z",1,-1,a,c,-o,s);this.sides.pz&&i("x","y",1,-1,a,b,r,n);this.sides.nz&&i("x","y",-1,-1,a,b,-r,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,m=[],k=[];for(i=0;i<=e;i++){var o=[],r=[],n=i/e,q=n*(b-a)+a;for(h=0;h<=d;h++){var l=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(q*Math.sin(l*Math.PI*2),-n*c+f,q*Math.cos(l*Math.PI*2))));o.push(this.vertices.length-1);r.push(new THREE.UV(l,n))}m.push(o);k.push(r)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=m[i][h],o=m[i+1][h],r=m[i+1][h+1],n=m[i][h+1],q=
-this.vertices[c].position.clone().setY(0).normalize(),l=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[r].position.clone().setY(0).normalize(),s=this.vertices[n].position.clone().setY(0).normalize(),t=k[i][h].clone(),v=k[i+1][h].clone(),y=k[i+1][h+1].clone(),I=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,r,n,[q,l,p,s]));this.faceVertexUvs[0].push([t,v,y,I])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=m[0][h],o=m[0][h+
-1],r=this.vertices.length-1,q=new THREE.Vector3(0,1,0),l=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),t=k[0][h].clone(),v=k[0][h+1].clone(),y=new THREE.UV(v.u,0),this.faces.push(new THREE.Face3(c,o,r,[q,l,p])),this.faceVertexUvs[0].push([t,v,y])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=m[i][h+1],o=m[i][h],r=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),l=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),t=k[i][h+1].clone(),v=k[i][h].clone(),
-y=new THREE.UV(v.u,1),this.faces.push(new THREE.Face3(c,o,r,[q,l,p])),this.faceVertexUvs[0].push([t,v,y])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,l=[],j=[];for(i=0;i<=e;i++){var o=[],r=[],m=i/e,p=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(p*Math.sin(n*Math.PI*2),-m*c+f,p*Math.cos(n*Math.PI*2))));o.push(this.vertices.length-1);r.push(new THREE.UV(n,m))}l.push(o);j.push(r)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],o=l[i+1][h],r=l[i+1][h+1],m=l[i][h+1],p=
+this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[o].position.clone().setY(0).normalize(),q=this.vertices[r].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),t=j[i][h].clone(),u=j[i+1][h].clone(),v=j[i+1][h+1].clone(),B=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,r,m,[p,n,q,s]));this.faceVertexUvs[0].push([t,u,v,B])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=l[0][h],o=l[0][h+
+1],r=this.vertices.length-1,p=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),t=j[0][h].clone(),u=j[0][h+1].clone(),v=new THREE.UV(u.u,0),this.faces.push(new THREE.Face3(c,o,r,[p,n,q])),this.faceVertexUvs[0].push([t,u,v])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=l[i][h+1],o=l[i][h],r=this.vertices.length-1,p=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),t=j[i][h+1].clone(),u=j[i][h].clone(),
+v=new THREE.UV(u.u,1),this.faces.push(new THREE.Face3(c,o,r,[p,n,q])),this.faceVertexUvs[0].push([t,u,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(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();
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(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 e(a){for(x=a.length;--x>=0;){ea=x;X=x-1;X<0&&(X=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=fa+ea+d,g=fa+ea+e,l=f,d=fa+X+d,e=fa+X+e,m=g;l+=A;d+=A;e+=A;m+=A;F.faces.push(new THREE.Face4(l,d,e,m,null,null,y));y&&(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 g(a,b,c){F.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=A;b+=A;c+=A;F.faces.push(new THREE.Face3(a,b,c,
-null,null,v));if(v){var d=I.maxY,e=I.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=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,m=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,
-r=b.curveSegments!==void 0?b.curveSegments:12,n=b.steps!==void 0?b.steps:1,q=b.bendPath,l=b.extrudePath,p,s=!1,t=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,v=b.material,y=b.extrudeMaterial,I=this.shapebb;if(l)p=l.getPoints(r),n=p.length,s=!0,o=!1;o||(m=i=k=0);var z,G,u,F=this,A=this.vertices.length;q&&a.addWrapPath(q);r=t?a.extractAllSpacedPoints(r):a.extractAllPoints(r);q=r.shape;r=r.holes;if(l=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();G=0;for(u=r.length;G<u;G++)z=r[G],THREE.Shape.Utils.isClockWise(z)&&
-(r[G]=z.reverse());l=!1}l=THREE.Shape.Utils.triangulateShape(q,r);t=q;G=0;for(u=r.length;G<u;G++)z=r[G],q=q.concat(z);var x,B,N,ba,Y,K,j=q.length,W=l.length,J=[];x=0;B=t.length;ea=B-1;for(X=x+1;x<B;x++,ea++,X++)ea===B&&(ea=0),X===B&&(X=0),J[x]=d(t[x],t[ea],t[X]);var L=[],C,O=J.concat();G=0;for(u=r.length;G<u;G++){z=r[G];C=[];x=0;B=z.length;ea=B-1;for(X=x+1;x<B;x++,ea++,X++)ea===B&&(ea=0),X===B&&(X=0),C[x]=d(z[x],z[ea],z[X]);L.push(C);O=O.concat(C)}for(N=0;N<k;N++){ba=N/k;Y=i*(1-ba);ba=m*Math.sin(ba*
-Math.PI/2);x=0;for(B=t.length;x<B;x++)K=c(t[x],J[x],ba),g(K.x,K.y,-Y);G=0;for(u=r.length;G<u;G++){z=r[G];C=L[G];x=0;for(B=z.length;x<B;x++)K=c(z[x],C[x],ba),g(K.x,K.y,-Y)}}ba=m;for(x=0;x<j;x++)K=o?c(q[x],O[x],ba):q[x],s?g(K.x,K.y+p[0].y,p[0].x):g(K.x,K.y,0);for(N=1;N<=n;N++)for(x=0;x<j;x++)K=o?c(q[x],O[x],ba):q[x],s?g(K.x,K.y+p[N-1].y,p[N-1].x):g(K.x,K.y,h/n*N);for(N=k-1;N>=0;N--){ba=N/k;Y=i*(1-ba);ba=m*Math.sin(ba*Math.PI/2);x=0;for(B=t.length;x<B;x++)K=c(t[x],J[x],ba),g(K.x,K.y,h+Y);G=0;for(u=r.length;G<
-u;G++){z=r[G];C=L[G];x=0;for(B=z.length;x<B;x++)K=c(z[x],C[x],ba),s?g(K.x,K.y+p[n-1].y,p[n-1].x+Y):g(K.x,K.y,h+Y)}}if(o){o=j*0;for(x=0;x<W;x++)m=l[x],f(m[2]+o,m[1]+o,m[0]+o);o=j*(n+k*2);for(x=0;x<W;x++)m=l[x],f(m[0]+o,m[1]+o,m[2]+o)}else{for(x=0;x<W;x++)m=l[x],f(m[2],m[1],m[0]);for(x=0;x<W;x++)m=l[x],f(m[0]+j*n,m[1]+j*n,m[2]+j*n)}var ea,X,fa=0;e(t);fa+=t.length;G=0;for(u=r.length;G<u;G++)z=r[G],e(z),fa+=z.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 e(a){for(z=a.length;--z>=0;){W=z;da=z-1;da<0&&(da=a.length-1);for(var b=
+0,c=m+j*2,b=0;b<c;b++){var d=T*b,e=T*(b+1),f=fa+W+d,g=fa+W+e,k=f,d=fa+da+d,e=fa+da+e,l=g;k+=R;d+=R;e+=R;l+=R;G.faces.push(new THREE.Face4(k,d,e,l,null,null,v));v&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(G.vertices[f].position.z+i)/e,g=(G.vertices[g].position.z+i)/e,G.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=R;b+=R;c+=R;G.faces.push(new THREE.Face3(a,b,c,
+null,null,u));if(u){var d=B.maxY,e=B.maxX,f=G.vertices[b].position.x,b=G.vertices[b].position.y,g=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/e,G.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,
+r=b.curveSegments!==void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,p=b.bendPath,n=b.extrudePath,q,s=!1,t=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,u=b.material,v=b.extrudeMaterial,B=this.shapebb;if(n)q=n.getPoints(r),m=q.length,s=!0,o=!1;o||(l=i=j=0);var x,C,E,G=this,R=this.vertices.length;p&&a.addWrapPath(p);r=t?a.extractAllSpacedPoints(r):a.extractAllPoints(r);p=r.shape;r=r.holes;if(n=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();C=0;for(E=r.length;C<E;C++)x=r[C],THREE.Shape.Utils.isClockWise(x)&&
+(r[C]=x.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(p,r);t=p;C=0;for(E=r.length;C<E;C++)x=r[C],p=p.concat(x);var z,J,K,U,V,Y,T=p.length,k=n.length,M=[];z=0;J=t.length;W=J-1;for(da=z+1;z<J;z++,W++,da++)W===J&&(W=0),da===J&&(da=0),M[z]=d(t[z],t[W],t[da]);var L=[],I,w=M.concat();C=0;for(E=r.length;C<E;C++){x=r[C];I=[];z=0;J=x.length;W=J-1;for(da=z+1;z<J;z++,W++,da++)W===J&&(W=0),da===J&&(da=0),I[z]=d(x[z],x[W],x[da]);L.push(I);w=w.concat(I)}for(K=0;K<j;K++){U=K/j;V=i*(1-U);U=l*Math.sin(U*Math.PI/
+2);z=0;for(J=t.length;z<J;z++)Y=c(t[z],M[z],U),g(Y.x,Y.y,-V);C=0;for(E=r.length;C<E;C++){x=r[C];I=L[C];z=0;for(J=x.length;z<J;z++)Y=c(x[z],I[z],U),g(Y.x,Y.y,-V)}}U=l;for(z=0;z<T;z++)Y=o?c(p[z],w[z],U):p[z],s?g(Y.x,Y.y+q[0].y,q[0].x):g(Y.x,Y.y,0);for(K=1;K<=m;K++)for(z=0;z<T;z++)Y=o?c(p[z],w[z],U):p[z],s?g(Y.x,Y.y+q[K-1].y,q[K-1].x):g(Y.x,Y.y,h/m*K);for(K=j-1;K>=0;K--){U=K/j;V=i*(1-U);U=l*Math.sin(U*Math.PI/2);z=0;for(J=t.length;z<J;z++)Y=c(t[z],M[z],U),g(Y.x,Y.y,h+V);C=0;for(E=r.length;C<E;C++){x=
+r[C];I=L[C];z=0;for(J=x.length;z<J;z++)Y=c(x[z],I[z],U),s?g(Y.x,Y.y+q[m-1].y,q[m-1].x+V):g(Y.x,Y.y,h+V)}}if(o){o=T*0;for(z=0;z<k;z++)l=n[z],f(l[2]+o,l[1]+o,l[0]+o);o=T*(m+j*2);for(z=0;z<k;z++)l=n[z],f(l[0]+o,l[1]+o,l[2]+o)}else{for(z=0;z<k;z++)l=n[z],f(l[2],l[1],l[0]);for(z=0;z<k;z++)l=n[z],f(l[0]+T*m,l[1]+T*m,l[2]+T*m)}var W,da,fa=0;e(t);fa+=t.length;C=0;for(E=r.length;C<E;C++)x=r[C],e(x),fa+=x.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.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-
 (Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
 (Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
-1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),m=d(g.faces[h].b,g.faces[h].c),k=d(g.faces[h].c,g.faces[h].a);c(g.faces[h].a,i,k,a);c(g.faces[h].b,m,i,a);c(g.faces[h].c,k,m,a);c(i,m,k,a)}g.faces=a.faces;g.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=
+1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),l=d(g.faces[h].b,g.faces[h].c),j=d(g.faces[h].c,g.faces[h].a);c(g.faces[h].a,i,j,a);c(g.faces[h].b,l,i,a);c(g.faces[h].c,j,l,a);c(i,l,j,a)}g.faces=a.faces;g.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=
 g.faces;e.faceVertexUvs[0]=g.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 g.faces;e.faceVertexUvs[0]=g.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;i==0&&(g=d);
 THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;i==0&&(g=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[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-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[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-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
@@ -510,34 +509,34 @@ THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize()
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,e(a,b),e(a,c),h),d(e(a,b),b,e(b,c),h),d(e(a,c),e(b,c),c,h),d(e(a,b),e(b,c),e(a,c),h))}function e(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];d===void 0&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function g(a,b,c){c<0&&a.u===
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,e(a,b),e(a,c),h),d(e(a,b),b,e(b,c),h),d(e(a,c),e(b,c),c,h),d(e(a,b),e(b,c),e(a,c),h))}function e(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];d===void 0&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function g(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 b=b||0,f=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],b);d(i[0],i[4],i[3],b);d(i[0],i[3],i[5],b);d(i[0],i[5],i[2],b);d(i[1],i[2],i[5],b);d(i[1],i[5],i[3],b);d(i[1],i[3],i[4],b);d(i[1],i[4],i[2],b);this.boundingSphere=
 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 b=b||0,f=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],b);d(i[0],i[4],i[3],b);d(i[0],i[3],i[5],b);d(i[0],i[5],i[2],b);d(i[1],i[2],i[5],b);d(i[1],i[5],i[3],b);d(i[1],i[3],i[4],b);d(i[1],i[4],i[2],b);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,m=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*m-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,l=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*l-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(j),e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,m=[],k=[];for(i=0;i<=c;i++){var o=[],r=[];for(h=0;h<=b;h++){var n=h/b,q=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+n*e)*Math.sin(g+q*f),a*Math.cos(g+q*f),a*Math.sin(d+n*e)*Math.sin(g+q*f))));o.push(this.vertices.length-1);r.push(new THREE.UV(n,q))}m.push(o);
-k.push(r)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=m[i][h+1],e=m[i][h],g=m[i+1][h],f=m[i+1][h+1],o=this.vertices[d].position.clone().normalize(),r=this.vertices[e].position.clone().normalize(),n=this.vertices[g].position.clone().normalize(),q=this.vertices[f].position.clone().normalize(),l=k[i][h+1].clone(),p=k[i][h].clone(),s=k[i+1][h].clone(),t=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[o,n,q])),this.faceVertexUvs[0].push([l,s,t])):Math.abs(this.vertices[g].position.y)==
-a?(this.faces.push(new THREE.Face3(d,e,g,[o,r,n])),this.faceVertexUvs[0].push([l,p,s])):(this.faces.push(new THREE.Face4(d,e,g,f,[o,r,n,q])),this.faceVertexUvs[0].push([l,p,s,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,l=[],j=[];for(i=0;i<=c;i++){var o=[],r=[];for(h=0;h<=b;h++){var m=h/b,p=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+p*f),a*Math.cos(g+p*f),a*Math.sin(d+m*e)*Math.sin(g+p*f))));o.push(this.vertices.length-1);r.push(new THREE.UV(m,p))}l.push(o);
+j.push(r)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],e=l[i][h],g=l[i+1][h],f=l[i+1][h+1],o=this.vertices[d].position.clone().normalize(),r=this.vertices[e].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),p=this.vertices[f].position.clone().normalize(),n=j[i][h+1].clone(),q=j[i][h].clone(),s=j[i+1][h].clone(),t=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[o,m,p])),this.faceVertexUvs[0].push([n,s,t])):Math.abs(this.vertices[g].position.y)==
+a?(this.faces.push(new THREE.Face3(d,e,g,[o,r,m])),this.faceVertexUvs[0].push([n,q,s])):(this.faces.push(new THREE.Face4(d,e,g,f,[o,r,m,p])),this.faceVertexUvs[0].push([n,q,s,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 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 b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
 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 b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,m,k,o,r,n,q,l,p,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));m=b.length;for(a=0;a<m;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,
-k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(n,q,i,k);if(f=g[g.length-1]){o=f.x;r=f.y;f=1;for(h=this.divisions;f<=h;f++){var t=f/h,v=THREE.Shape.Utils.b2(t,o,n,i),t=THREE.Shape.Utils.b2(t,r,q,k);g.push(new THREE.Vector2(v,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,n=b[a++]*c+d,q=b[a++]*-c,l=b[a++]*c+d,p=b[a++]*-c,e.bezierCurveTo(i,k,n,q,l,p),f=g[g.length-1]){o=f.x;r=f.y;f=1;for(h=this.divisions;f<=h;f++)t=f/h,v=THREE.Shape.Utils.b3(t,o,n,
-l,i),t=THREE.Shape.Utils.b3(t,r,q,p,k),g.push(new THREE.Vector2(v,t))}}}return{offset:s.ha*c,points:g,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,m,k;if(b(a)>0)for(m=0;m<e;m++)f[m]=m;else for(m=0;m<e;m++)f[m]=e-1-m;var o=2*e;for(m=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=m;e<=i&&(i=0);m=i+1;e<=m&&(m=0);k=m+1;e<=k&&(k=0);var r;a:{r=a;var n=i,q=m,l=k,p=e,s=f,t=void 0,v=void 0,y=void 0,
-I=void 0,z=void 0,G=void 0,u=void 0,F=void 0,A=void 0,v=r[s[n]].x,y=r[s[n]].y,I=r[s[q]].x,z=r[s[q]].y,G=r[s[l]].x,u=r[s[l]].y;if(1.0E-10>(I-v)*(u-y)-(z-y)*(G-v))r=!1;else{for(t=0;t<p;t++)if(!(t==n||t==q||t==l)){var F=r[s[t]].x,A=r[s[t]].y,x=void 0,B=void 0,N=void 0,ba=void 0,Y=void 0,K=void 0,j=void 0,W=void 0,J=void 0,L=void 0,C=void 0,O=void 0,x=N=Y=void 0,x=G-I,B=u-z,N=v-G,ba=y-u,Y=I-v,K=z-y,j=F-v,W=A-y,J=F-I,L=A-z,C=F-G,O=A-u,x=x*L-B*J,Y=Y*W-K*j,N=N*O-ba*C;if(x>=0&&N>=0&&Y>=0){r=!1;break a}}r=
-!0}}if(r){g.push([a[f[i]],a[f[m]],a[f[k]]]);h.push([f[i],f[m],f[k]]);i=m;for(k=m+1;k<e;i++,k++)f[i]=f[k];e--;o=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,l,j,o,r,m,p,n,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=b.length;for(a=0;a<l;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
+j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;m=b[a++]*c+d;p=b[a++]*c;e.quadraticCurveTo(m,p,i,j);if(f=g[g.length-1]){o=f.x;r=f.y;f=1;for(h=this.divisions;f<=h;f++){var t=f/h,u=THREE.Shape.Utils.b2(t,o,m,i),t=THREE.Shape.Utils.b2(t,r,p,j);g.push(new THREE.Vector2(u,t))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,m=b[a++]*c+d,p=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,j,m,p,n,q),f=g[g.length-1]){o=f.x;r=f.y;f=1;for(h=this.divisions;f<=h;f++)t=f/h,u=THREE.Shape.Utils.b3(t,o,m,
+n,i),t=THREE.Shape.Utils.b3(t,r,p,q,j),g.push(new THREE.Vector2(u,t))}}}return{offset:s.ha*c,points:g,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,l,j;if(b(a)>0)for(l=0;l<e;l++)f[l]=l;else for(l=0;l<e;l++)f[l]=e-1-l;var o=2*e;for(l=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);j=l+1;e<=j&&(j=0);var r;a:{r=a;var m=i,p=l,n=j,q=e,s=f,t=void 0,u=void 0,v=void 0,
+B=void 0,x=void 0,C=void 0,E=void 0,G=void 0,R=void 0,u=r[s[m]].x,v=r[s[m]].y,B=r[s[p]].x,x=r[s[p]].y,C=r[s[n]].x,E=r[s[n]].y;if(1.0E-10>(B-u)*(E-v)-(x-v)*(C-u))r=!1;else{for(t=0;t<q;t++)if(!(t==m||t==p||t==n)){var G=r[s[t]].x,R=r[s[t]].y,z=void 0,J=void 0,K=void 0,U=void 0,V=void 0,Y=void 0,T=void 0,k=void 0,M=void 0,L=void 0,I=void 0,w=void 0,z=K=V=void 0,z=C-B,J=E-x,K=u-C,U=v-E,V=B-u,Y=x-v,T=G-u,k=R-v,M=G-B,L=R-x,I=G-C,w=R-E,z=z*L-J*M,V=V*k-Y*T,K=K*w-U*I;if(z>=0&&K>=0&&V>=0){r=!1;break a}}r=!0}}if(r){g.push([a[f[i]],
+a[f[l]],a[f[j]]]);h.push([f[i],f[l],f[j]]);i=l;for(j=l+1;j<e;i++,j++)f[i]=f[j];e--;o=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[e].clone(),a[g].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 this.faceVertexUvs[0].push([a[e].clone(),a[g].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,b,c,d,e,g,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=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
 THREE.TorusKnotGeometry=function(a,b,c,d,e,g,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=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
 this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=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);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
 this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=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);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
-e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,m,k])}this.computeCentroids();
+e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,l,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 b=this.subdivisions;b-- >0;)this.smooth(a)};
 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 b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var l=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){l.vertexColors=[];for(var n,k,m,o=0;o<4;o++){m=i[o];n=new THREE.Color;n.setRGB(0,0,0);for(var p=0;p<m.length;p++)k=h.vertexColors[m[p]-1],n.r+=k.r,n.g+=k.g,n.b+=k.b;n.r/=m.length;n.g/=m.length;n.b/=m.length;l.vertexColors[o]=n}}e.push(l);(!f.supportUVs||r.length!=0)&&g.push([r[a],r[b],r[c],r[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),m=[],k={},o={},r=[],n,q,l,p,s,t=a.faceVertexUvs[0];n=0;for(q=t.length;n<q;n++){l=0;for(p=t[n].length;l<p;l++)s=d[n]["abcd".charAt(l)],r[s]||(r[s]=t[n][l])}var v;n=0;for(q=d.length;n<q;n++)if(s=d[n],m.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&r.length!=0){v=new THREE.UV;if(s instanceof THREE.Face3)v.u=r[s.a].u+r[s.b].u+r[s.c].u,v.v=r[s.a].v+r[s.b].v+r[s.c].v,v.u/=3,v.v/=3;else if(s instanceof THREE.Face4)v.u=
-r[s.a].u+r[s.b].u+r[s.c].u+r[s.d].u,v.v=r[s.a].v+r[s.b].v+r[s.c].v+r[s.d].v,v.u/=4,v.v/=4;r.push(v)}q=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].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=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var y=0,t=h.length,I,z,G={},u={},F=function(a,
-b){G[a]===void 0&&(G[a]=[]);G[a].push(b)},A=function(a,b){u[a]===void 0&&(u[a]={});u[a][b]=null};for(n in q){v=q[n];I=n.split("_");z=I[0];I=I[1];F(z,[z,I]);F(I,[z,I]);l=0;for(p=v.length;l<p;l++)s=v[l],A(z,s,n),A(I,s,n);v.length<2&&(o[n]=!0)}for(n in q)if(v=q[n],s=v[0],v=v[1],I=n.split("_"),z=I[0],I=I[1],p=new THREE.Vector3,o[n]?(p.addSelf(h[z].position),p.addSelf(h[I].position),p.multiplyScalar(0.5)):(p.addSelf(m[s]),p.addSelf(m[v]),p.addSelf(h[z].position),p.addSelf(h[I].position),p.multiplyScalar(0.25)),
-k[n]=t+d.length+y,i.push(new THREE.Vertex(p)),y++,f.supportUVs&&r.length!=0)v=new THREE.UV,v.u=r[z].u+r[I].u,v.v=r[z].v+r[I].v,v.u/=2,v.v/=2,r.push(v);var x,B;I=["123","12","2","23"];p=["123","23","3","31"];var F=["123","31","1","12"],A=["1234","12","2","23"],N=["1234","23","3","34"],ba=["1234","34","4","41"],Y=["1234","41","1","12"];n=0;for(q=m.length;n<q;n++)s=d[n],v=t+n,s instanceof THREE.Face3?(y=c(s.a,s.b),z=c(s.b,s.c),x=c(s.c,s.a),b(v,k[y],s.b,k[z],s,I),b(v,k[z],s.c,k[x],s,p),b(v,k[x],s.a,k[y],
-s,F)):s instanceof THREE.Face4?(y=c(s.a,s.b),z=c(s.b,s.c),x=c(s.c,s.d),B=c(s.d,s.a),b(v,k[y],s.b,k[z],s,A),b(v,k[z],s.c,k[x],s,N),b(v,k[x],s.d,k[B],s,ba),b(v,k[B],s.a,k[y],s,Y)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;n=0;for(q=h.length;n<q;n++)if(G[n]!==void 0){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);v=0;for(l in u[n])i.addSelf(m[l]),v++;y=0;t=G[n].length;for(l=0;l<t;l++)o[c(G[n][l][0],G[n][l][1])]&&y++;if(y!=2){i.divideScalar(v);for(l=0;l<
-t;l++)v=G[n][l],v=h[v[0]].position.clone().addSelf(h[v[1]].position).divideScalar(2),k.addSelf(v);k.divideScalar(t);s.addSelf(h[n].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(t);d[n].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var m,l,n,o=0;o<4;o++){n=i[o];m=new THREE.Color;m.setRGB(0,0,0);for(var p=0;p<n.length;p++)l=h.vertexColors[n[p]-1],m.r+=l.r,m.g+=l.g,m.b+=l.b;m.r/=n.length;m.g/=n.length;m.b/=n.length;j.vertexColors[o]=m}}e.push(j);(!f.supportUVs||r.length!=0)&&g.push([r[a],r[b],r[c],r[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],j={},o={},r=[],m,p,n,q,s,t=a.faceVertexUvs[0];m=0;for(p=t.length;m<p;m++){n=0;for(q=t[m].length;n<q;n++)s=d[m]["abcd".charAt(n)],r[s]||(r[s]=t[m][n])}var u;m=0;for(p=d.length;m<p;m++)if(s=d[m],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&r.length!=0){u=new THREE.UV;if(s instanceof THREE.Face3)u.u=r[s.a].u+r[s.b].u+r[s.c].u,u.v=r[s.a].v+r[s.b].v+r[s.c].v,u.u/=3,u.v/=3;else if(s instanceof THREE.Face4)u.u=
+r[s.a].u+r[s.b].u+r[s.c].u+r[s.d].u,u.v=r[s.a].v+r[s.b].v+r[s.c].v+r[s.d].v,u.u/=4,u.v/=4;r.push(u)}p=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].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=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var v=0,t=h.length,B,x,C={},E={},G=function(a,
+b){C[a]===void 0&&(C[a]=[]);C[a].push(b)},R=function(a,b){E[a]===void 0&&(E[a]={});E[a][b]=null};for(m in p){u=p[m];B=m.split("_");x=B[0];B=B[1];G(x,[x,B]);G(B,[x,B]);n=0;for(q=u.length;n<q;n++)s=u[n],R(x,s,m),R(B,s,m);u.length<2&&(o[m]=!0)}for(m in p)if(u=p[m],s=u[0],u=u[1],B=m.split("_"),x=B[0],B=B[1],q=new THREE.Vector3,o[m]?(q.addSelf(h[x].position),q.addSelf(h[B].position),q.multiplyScalar(0.5)):(q.addSelf(l[s]),q.addSelf(l[u]),q.addSelf(h[x].position),q.addSelf(h[B].position),q.multiplyScalar(0.25)),
+j[m]=t+d.length+v,i.push(new THREE.Vertex(q)),v++,f.supportUVs&&r.length!=0)u=new THREE.UV,u.u=r[x].u+r[B].u,u.v=r[x].v+r[B].v,u.u/=2,u.v/=2,r.push(u);var z,J;B=["123","12","2","23"];q=["123","23","3","31"];var G=["123","31","1","12"],R=["1234","12","2","23"],K=["1234","23","3","34"],U=["1234","34","4","41"],V=["1234","41","1","12"];m=0;for(p=l.length;m<p;m++)s=d[m],u=t+m,s instanceof THREE.Face3?(v=c(s.a,s.b),x=c(s.b,s.c),z=c(s.c,s.a),b(u,j[v],s.b,j[x],s,B),b(u,j[x],s.c,j[z],s,q),b(u,j[z],s.a,j[v],
+s,G)):s instanceof THREE.Face4?(v=c(s.a,s.b),x=c(s.b,s.c),z=c(s.c,s.d),J=c(s.d,s.a),b(u,j[v],s.b,j[x],s,R),b(u,j[x],s.c,j[z],s,K),b(u,j[z],s.d,j[J],s,U),b(u,j[J],s.a,j[v],s,V)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(p=h.length;m<p;m++)if(C[m]!==void 0){i.set(0,0,0);j.set(0,0,0);s=new THREE.Vector3(0,0,0);u=0;for(n in E[m])i.addSelf(l[n]),u++;v=0;t=C[m].length;for(n=0;n<t;n++)o[c(C[m][n][0],C[m][n][1])]&&v++;if(v!=2){i.divideScalar(u);for(n=0;n<
+t;n++)u=C[m][n],u=h[u[0]].position.clone().addSelf(h[u[1]].position).divideScalar(2),j.addSelf(u);j.divideScalar(t);s.addSelf(h[m].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(j.multiplyScalar(2));s.divideScalar(t);d[m].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;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=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 b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 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 b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
@@ -545,124 +544,124 @@ a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this
 if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}d(a[c],b+"/"+e)}function g(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(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}d(a[c],b+"/"+e)}function g(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=g(a.colorDiffuse);
 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=g(a.colorDiffuse);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=g(a.colorSpecular);if(a.colorAmbient)f.ambient=g(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=g(a.colorSpecular);if(a.colorAmbient)f.ambient=g(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(m.uniforms),o=f.color;h=f.specular;i=f.ambient;var r=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(o);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=r;if(f.opacity)k.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.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&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(l.uniforms),o=f.color;h=f.specular;i=f.ambient;var r=f.shininess;j.tNormal.texture=f.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(f.map)j.tDiffuse.texture=f.map,j.enableDiffuse.value=!0;if(f.specularMap)j.tSpecular.texture=f.specularMap,j.enableSpecular.value=!0;if(f.lightMap)j.tAO.texture=
+f.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(o);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=r;if(f.opacity)j.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:j,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,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){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,c,e,d,g)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){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,c,e,d,g)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
 f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
 g.responseType="arraybuffer";g.send(null)};
 g.responseType="arraybuffer";g.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function m(b,c){var d,e,f,g,h,i,k,n,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=v[e*2];e=v[e*2+1];i=v[f*2];k=v[f*2+1];f=v[g*2];n=v[g*2+1];g=l.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,k));o.push(new THREE.UV(f,n));g.push(o)}}
-function k(b,c){var d,e,f,g,h,i,k,n,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=v[e*2];e=v[e*2+1];k=v[f*2];m=v[f*2+1];n=v[g*2];o=v[g*2+1];g=v[h*2];f=v[h*2+1];h=l.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(k,m));q.push(new THREE.UV(n,o));q.push(new THREE.UV(g,f));h.push(q)}}function o(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],l.faces.push(new THREE.Face3(e,
-f,g,null,null,h))}function r(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=k[d],l.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function n(b,c,d,e){for(var f,g,h,i,k,n,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];k=d[e*3];n=d[e*3+1];m=d[e*3+2];i=o[e];var p=t[n*3],q=t[n*3+1];n=t[n*3+2];var r=t[m*3],s=t[m*3+1];m=t[m*3+2];l.faces.push(new THREE.Face3(f,
-g,h,[new THREE.Vector3(t[k*3],t[k*3+1],t[k*3+2]),new THREE.Vector3(p,q,n),new THREE.Vector3(r,s,m)],null,i))}}function q(b,c,d,e){for(var f,g,h,i,k,n,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];n=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];k=q[e];var r=t[m*3],s=t[m*3+1];m=t[m*3+2];var u=t[o*3],v=t[o*3+1];o=t[o*3+2];var y=t[p*3],z=t[p*3+1];p=t[p*3+2];l.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(t[n*
-3],t[n*3+1],t[n*3+2]),new THREE.Vector3(r,s,m),new THREE.Vector3(u,v,o),new THREE.Vector3(y,z,p)],null,k))}}var l=this,p=0,s,t=[],v=[],y,I,z,G,u,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(l,d,b);s={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,p,12),header_bytes:e(a,p+12),vertex_coordinate_bytes:e(a,p+13),normal_coordinate_bytes:e(a,p+14),uv_coordinate_bytes:e(a,p+15),vertex_index_bytes:e(a,p+16),normal_index_bytes:e(a,
-p+17),uv_index_bytes:e(a,p+18),material_index_bytes:e(a,p+19),nvertices:i(a,p+20),nnormals:i(a,p+20+4),nuvs:i(a,p+20+8),ntri_flat:i(a,p+20+12),ntri_smooth:i(a,p+20+16),ntri_flat_uv:i(a,p+20+20),ntri_smooth_uv:i(a,p+20+24),nquad_flat:i(a,p+20+28),nquad_smooth:i(a,p+20+32),nquad_flat_uv:i(a,p+20+36),nquad_smooth_uv:i(a,p+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;F=s.vertex_index_bytes*
-4+s.material_index_bytes;y=s.ntri_flat*b;I=s.ntri_smooth*(b+s.normal_index_bytes*3);z=s.ntri_flat_uv*(b+s.uv_index_bytes*3);G=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);u=s.nquad_flat*F;b=s.nquad_smooth*(F+s.normal_index_bytes*4);F=s.nquad_flat_uv*(F+s.uv_index_bytes*4);p+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],l.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(p);
-p+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],t.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(p);p+=c(s.nnormals*3);p+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],v.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(p);y=p+y+c(s.ntri_flat*2);I=y+I+c(s.ntri_smooth*2);z=I+z+c(s.ntri_flat_uv*2);G=z+G+c(s.ntri_smooth_uv*2);u=G+u+c(s.nquad_flat*2);
-b=u+b+c(s.nquad_smooth*2);F=b+F+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);m(b,c)}})(I);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);m(b,d)}})(z);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;r(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
-c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(F);(function(a){var b=s.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(y);(function(a){var b=s.nquad_flat;b&&r(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(G);(function(a){var b=
-s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(u);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
-THREE.ColladaLoader=function(){function a(a,d,e){V=a;d=d||S;e!==void 0&&(a=e.split("/"),a.pop(),ya=a.length<1?"":a.join("/")+"/");Z=b("//dae:library_images/dae:image",f,"image");sa=b("//dae:library_materials/dae:material",u,"material");ja=b("//dae:library_effects/dae:effect",N,"effect");oa=b("//dae:library_geometries/dae:geometry",p,"geometry");da=b("//dae:library_controllers/dae:controller",h,"controller");qa=b("//dae:library_animations/dae:animation",Y,"animation");la=b(".//dae:library_visual_scenes/dae:visual_scene",
-k,"visual_scene");va=[];xa=[];(a=V.evaluate(".//dae:scene/dae:instance_visual_scene",V,J,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),U=la[a]):U=null;R=new THREE.Object3D;for(a=0;a<U.nodes.length;a++)R.add(g(U.nodes[a]));c();for(var i in qa);i={scene:R,morphs:va,skins:xa,dae:{images:Z,materials:sa,effects:ja,geometries:oa,controllers:da,animations:qa,visualScenes:la,scene:U}};d&&d(i);return i}function b(a,b,c){for(var a=V.evaluate(a,V,J,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 c(){var a=1E6,b=-a,c=0,d;for(d in qa)for(var e=qa[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 e(a,b,e){var f=da[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=c(),b=U.getChildById(b.skeleton[0],!0)||U.getChildBySid(b.skeleton[0],!0),h,i,j,l,k=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(b,m,e);h=m;i=f.skin;for(l=0;l<h.length;l++)if(j=h[l],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 r=i.weights[p][q];r.joint==n&&j.weights.push(r)}}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],l=j.index,j=j.weight,n=a.vertices[l],l=o[l],k.x=n.position.x,k.y=n.position.y,k.z=n.position.z,m[h].skinningMatrix.multiplyVector3(k),l.position.x+=k.x*j,l.position.y+=k.y*j,l.position.z+=k.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function g(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(oa[i.skin.source]){var j=
-new l;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&&oa[i.morph.source]))j=new l,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(oa[i.morph.source])j=new l,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=oa[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=ja[sa[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)e(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_"+xa.length,xa.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(m=0;m<k.targets.length;m++)if(p=oa[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_"+va.length;va.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(g(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 m(){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 o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function r(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function l(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function v(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function y(){this.source="";this.stride=this.count=0;this.params=[]}function I(){this.input={}}function z(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function G(a){this.id=a;this.type=null}function u(){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 A(a,b){this.type=a;this.effect=b;this.material=null}function x(a){this.effect=a;this.format=this.init_from=null}function B(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function N(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function ba(){this.url=""}function Y(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function K(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 W(a){var b=a.getAttribute("id");
-if(aa[b]!=void 0)return aa[b];aa[b]=(new G(b)).parse(a);return aa[b]}function J(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=O(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function C(a){for(var a=O(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function O(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function ea(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function X(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+=X(a.x,b)+",";c+=X(a.y,b)+",";c+=X(a.z,b);return c}var V=null,R=null,U,S=null,aa={},Z={},qa={},da={},oa={},sa={},ja={},la,ya,va,xa,Aa=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 m).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 z).parse(d))}}return b};
-m.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=L(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};m.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 z).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()}}};m.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 z).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 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)}};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 o).parse(c))}}return this};o.prototype.getChannelForTransform=
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,f,g,h,i,k,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=u[e*2];e=u[e*2+1];i=u[f*2];k=u[f*2+1];f=u[g*2];j=u[g*2+1];g=n.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,k));m.push(new THREE.UV(f,j));g.push(m)}}
+function j(b,c){var d,e,f,g,h,i,k,j,l,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=u[e*2];e=u[e*2+1];k=u[f*2];l=u[f*2+1];j=u[g*2];m=u[g*2+1];g=u[h*2];f=u[h*2+1];h=n.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(k,l));p.push(new THREE.UV(j,m));p.push(new THREE.UV(g,f));h.push(p)}}function o(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
+f,g,null,null,h))}function r(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=k[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,k,j,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];k=d[e*3];j=d[e*3+1];l=d[e*3+2];i=m[e];var o=t[j*3],p=t[j*3+1];j=t[j*3+2];var q=t[l*3],r=t[l*3+1];l=t[l*3+2];n.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(t[k*3],t[k*3+1],t[k*3+2]),new THREE.Vector3(o,p,j),new THREE.Vector3(q,r,l)],null,i))}}function p(b,c,d,e){for(var f,g,h,i,k,j,l,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];j=d[e*4];l=d[e*4+1];m=d[e*4+2];o=d[e*4+3];k=p[e];var q=t[l*3],r=t[l*3+1];l=t[l*3+2];var s=t[m*3],u=t[m*3+1];m=t[m*3+2];var v=t[o*3],x=t[o*3+1];o=t[o*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(t[j*
+3],t[j*3+1],t[j*3+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(s,u,m),new THREE.Vector3(v,x,o)],null,k))}}var n=this,q=0,s,t=[],u=[],v,B,x,C,E,G;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);s={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
+q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;G=s.vertex_index_bytes*
+4+s.material_index_bytes;v=s.ntri_flat*b;B=s.ntri_smooth*(b+s.normal_index_bytes*3);x=s.ntri_flat_uv*(b+s.uv_index_bytes*3);C=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);E=s.nquad_flat*G;b=s.nquad_smooth*(G+s.normal_index_bytes*4);G=s.nquad_flat_uv*(G+s.uv_index_bytes*4);q+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
+q+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],t.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(s.nnormals*3);q+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],u.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);v=q+v+c(s.ntri_flat*2);B=v+B+c(s.ntri_smooth*2);x=B+x+c(s.ntri_flat_uv*2);C=x+C+c(s.ntri_smooth_uv*2);E=C+E+c(s.nquad_flat*2);
+b=E+b+c(s.nquad_smooth*2);G=b+G+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(B);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(x);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;r(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
+c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(G);(function(a){var b=s.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(v);(function(a){var b=s.nquad_flat;b&&r(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(C);(function(a){var b=
+s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(E);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
+THREE.ColladaLoader=function(){function a(a,d,e){X=a;d=d||O;e!==void 0&&(a=e.split("/"),a.pop(),ya=a.length<1?"":a.join("/")+"/");aa=b("//dae:library_images/dae:image",f,"image");sa=b("//dae:library_materials/dae:material",E,"material");ka=b("//dae:library_effects/dae:effect",K,"effect");na=b("//dae:library_geometries/dae:geometry",q,"geometry");ca=b("//dae:library_controllers/dae:controller",h,"controller");pa=b("//dae:library_animations/dae:animation",V,"animation");la=b(".//dae:library_visual_scenes/dae:visual_scene",
+j,"visual_scene");xa=[];ua=[];(a=X.evaluate(".//dae:scene/dae:instance_visual_scene",X,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),$=la[a]):$=null;S=new THREE.Object3D;for(a=0;a<$.nodes.length;a++)S.add(g($.nodes[a]));c();for(var i in pa);i={scene:S,morphs:xa,skins:ua,dae:{images:aa,materials:sa,effects:ka,geometries:na,controllers:ca,animations:pa,visualScenes:la,scene:$}};d&&d(i);return i}function b(a,b,c){for(var a=X.evaluate(a,X,M,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 c(){var a=1E6,b=-a,c=0,d;for(d in pa)for(var e=pa[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 e(a,b,e){var f=ca[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=c(),b=$.getChildById(b.skeleton[0],!0)||$.getChildBySid(b.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(b,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 g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=ca[a.controllers[f].url];switch(i.type){case "skin":if(na[i.skin.source]){var j=
+new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(ca[i.skin.source]&&(d=i=ca[i.skin.source],i.morph&&na[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(na[i.morph.source])j=new n,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=na[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=ka[sa[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)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=ca[c.url],j.skinInstanceController=c,j.name="skin_"+ua.length,ua.push(j);else if(d!==void 0){h=i;k=d instanceof m?ca[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=na[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_"+xa.length;xa.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(g(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 j(){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 r(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function u(){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 B(){this.input={}}function x(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function C(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function G(){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 R(a,b){this.type=a;this.effect=b;this.material=null}function z(a){this.effect=a;this.format=this.init_from=null}function J(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 U(){this.url=""}function V(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function Y(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function T(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function k(a){var b=a.getAttribute("id");
+if(ba[b]!=void 0)return ba[b];ba[b]=(new C(b)).parse(a);return ba[b]}function M(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=w(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function I(a){for(var a=w(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function w(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function W(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function da(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+=da(a.x,b)+",";c+=da(a.y,b)+",";c+=da(a.z,b);return c}var X=null,S=null,$,O=null,ba={},aa={},pa={},ca={},na={},sa={},ka={},la,ya,xa,ua,za=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 C).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};
+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=L(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 C).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 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()}}};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 x).parse(g));break;case "v":c=I(g.textContent);break;case "vcount":d=I(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)}};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 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,
 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");
 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 l).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,J,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 r).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in qa)for(var e=qa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
+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 m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=
+b.getAttribute("url").replace(/^#/,"");(b=X.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",X,M,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 r).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in pa)for(var e=pa[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=
 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};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
 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)};r.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};r.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[a].matrix)};r.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};r.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=V.evaluate(".//dae:instance_material",c,J,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.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=V.evaluate(".//dae:instance_material",c,J,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};p.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 s(this)).parse(c)}}return this};s.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":W(d);break;case "vertices":this.vertices=(new I).parse(d);break;case "triangles":this.primitives.push((new v).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=aa[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};s.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,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=[],q=[],r={},s=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=aa[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":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":s.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;m==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):m==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
-e[1],e[2]]);d+=h.length*m}};t.prototype=new v;t.prototype.constructor=t;v.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};v.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=ea(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 z).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-C(c.textContent);break;case "p":this.p=C(c.textContent)}}return this};y.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=ea(a,"count",0);this.stride=ea(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};I.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 z).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};z.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=ea(a,"set",-1);this.offset=ea(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=O(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=L(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=O(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 y).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};u.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 ba).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=L(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};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 "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=V.evaluate(".//dae:float",c,J,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};A.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=Z[this.effect.surface.init_from]))a.map=
-THREE.ImageUtils.loadTexture(ya+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=Aa;return this.material=new THREE.MeshLambertMaterial(a)};x.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};B.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};N.prototype.create=function(){if(this.shader==null)return null};N.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};
-N.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 x(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new B(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};N.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};N.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 A(c.nodeName,this)).parse(c)}}};ba.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Y.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 j(this)).parse(c));break;case "channel":this.channel.push((new K(this)).parse(c))}}return this};K.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 z).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=
+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};m.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=X.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new p).parse(d)),d=c.iterateNext()}}return this};p.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.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=X.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new p).parse(b)),b=a.iterateNext();break}}return this};q.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 s(this)).parse(c)}}return this};s.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":k(d);break;case "vertices":this.vertices=(new B).parse(d);break;case "triangles":this.primitives.push((new u).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=ba[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};s.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=[],q=[],r={},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=ba[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":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":s.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
+e[1],e[2]]);d+=h.length*n}};t.prototype=new u;t.prototype.constructor=t;u.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};u.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=W(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=
+I(c.textContent);break;case "p":this.p=I(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=W(a,"count",0);this.stride=W(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};B.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=W(a,"set",-1);this.offset=W(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};C.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=w(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=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=I(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=w(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 v).parse(c.childNodes[d]);break}}}return this};
+C.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};E.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 U).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};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 "color":c=L(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};R.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 G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=X.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};R.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 G)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=aa[this.effect.surface.init_from]))a.map=
+THREE.ImageUtils.loadTexture(ya+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=za;return this.material=new THREE.MeshLambertMaterial(a)};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 "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};J.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};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 z(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new J(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 R(c.nodeName,this)).parse(c)}}};U.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};V.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 C).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new T(this)).parse(c));break;case "channel":this.channel.push((new Y(this)).parse(c))}}return this};Y.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};T.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};
+T.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==
 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))S=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){Aa=a},applySkin:e,geometries:oa}};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))O=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){za=a},applySkin:e,geometries:na}};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,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
 g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,m,k,o,r,n,q,l,p,s,t,v,y=a.faces;o=a.vertices;var I=a.normals,z=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]=[];m=0;for(k=o.length;m<
-k;)r=new THREE.Vertex,r.position.x=o[m++]*b,r.position.y=o[m++]*b,r.position.z=o[m++]*b,d.vertices.push(r);m=0;for(k=y.length;m<k;){b=y[m++];o=b&1;i=b&2;c=b&4;e=b&8;n=b&16;r=b&32;l=b&64;b&=128;o?(p=new THREE.Face4,p.a=y[m++],p.b=y[m++],p.c=y[m++],p.d=y[m++],o=4):(p=new THREE.Face3,p.a=y[m++],p.b=y[m++],p.c=y[m++],o=3);if(i)i=y[m++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<G;c++)s=a.uvs[c],q=y[m++],v=s[q*2],q=s[q*2+1],d.faceUvs[c][i]=new THREE.UV(v,q);if(e)for(c=0;c<G;c++){s=a.uvs[c];t=[];
-for(e=0;e<o;e++)q=y[m++],v=s[q*2],q=s[q*2+1],t[e]=new THREE.UV(v,q);d.faceVertexUvs[c][i]=t}if(n)n=y[m++]*3,e=new THREE.Vector3,e.x=I[n++],e.y=I[n++],e.z=I[n],p.normal=e;if(r)for(c=0;c<o;c++)n=y[m++]*3,e=new THREE.Vector3,e.x=I[n++],e.y=I[n++],e.z=I[n],p.vertexNormals.push(e);if(l)r=y[m++],r=new THREE.Color(z[r]),p.color=r;if(b)for(c=0;c<o;c++)r=y[m++],r=new THREE.Color(z[r]),p.vertexColors.push(r);d.faces.push(p)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,m,k,o,r,n,q;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
-q=a.morphTargets[c].vertices;i=0;for(m=q.length;i<m;i+=3)k=q[i]*b,o=q[i+1]*b,r=q[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,o,r)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];m=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(k[b],k[b+1],k[b+2]),m.push(o)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,l,j,o,r,m,p,n,q,s,t,u,v=a.faces;o=a.vertices;var B=a.normals,x=a.colors,C=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&C++;for(c=0;c<C;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(j=o.length;l<
+j;)r=new THREE.Vertex,r.position.x=o[l++]*b,r.position.y=o[l++]*b,r.position.z=o[l++]*b,d.vertices.push(r);l=0;for(j=v.length;l<j;){b=v[l++];o=b&1;i=b&2;c=b&4;e=b&8;m=b&16;r=b&32;n=b&64;b&=128;o?(q=new THREE.Face4,q.a=v[l++],q.b=v[l++],q.c=v[l++],q.d=v[l++],o=4):(q=new THREE.Face3,q.a=v[l++],q.b=v[l++],q.c=v[l++],o=3);if(i)i=v[l++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<C;c++)s=a.uvs[c],p=v[l++],u=s[p*2],p=s[p*2+1],d.faceUvs[c][i]=new THREE.UV(u,p);if(e)for(c=0;c<C;c++){s=a.uvs[c];t=[];
+for(e=0;e<o;e++)p=v[l++],u=s[p*2],p=s[p*2+1],t[e]=new THREE.UV(u,p);d.faceVertexUvs[c][i]=t}if(m)m=v[l++]*3,e=new THREE.Vector3,e.x=B[m++],e.y=B[m++],e.z=B[m],q.normal=e;if(r)for(c=0;c<o;c++)m=v[l++]*3,e=new THREE.Vector3,e.x=B[m++],e.y=B[m++],e.z=B[m],q.vertexNormals.push(e);if(n)r=v[l++],r=new THREE.Color(x[r]),q.color=r;if(b)for(c=0;c<o;c++)r=v[l++],r=new THREE.Color(x[r]),q.vertexColors.push(r);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,l,j,o,r,m,p;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
+p=a.morphTargets[c].vertices;i=0;for(l=p.length;i<l;i+=3)j=p[i]*b,o=p[i+1]*b,r=p[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(j,o,r)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(j[b],j[b+1],j[b+2]),l.push(o)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();b(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;
 d.computeTangents();b(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,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),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)};
 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,b,c){function d(a,b){return b=="relativeToHTML"?a:m+"/"+a}function e(){var a;for(r in N.objects)if(!J.objects[r])if(s=N.objects[r],s.geometry!==void 0){if(F=J.geometries[s.geometry]){a=!1;for(C=0;C<s.materials.length;C++)B=J.materials[s.materials[C]],a=B instanceof THREE.ShaderMaterial;a&&F.computeTangents();y=s.position;I=s.rotation;z=s.quaternion;G=s.scale;z=0;B.length==0&&(B=new THREE.MeshFaceMaterial);B.length>1&&(B=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(F,B);a.name=r;a.position.set(y[0],y[1],y[2]);z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(I[0],I[1],I[2]);a.scale.set(G[0],G[1],G[2]);a.visible=s.visible;J.scene.add(a);J.objects[r]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);J.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(F),J.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},J.triggers[a.name]=b)}}else y=s.position,I=s.rotation,z=s.quaternion,G=s.scale,z=0,a=new THREE.Object3D,a.name=r,a.position.set(y[0],y[1],y[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(I[0],I[1],I[2]),a.scale.set(G[0],G[1],G[2]),a.visible=s.visible!==void 0?s.visible:!1,J.scene.add(a),J.objects[r]=a,J.empties[r]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},J.triggers[a.name]=b)}function g(a){return function(b){J.geometries[a]=
-b;e();Y-=1;i.onLoadComplete();h()}}function f(a){return function(b){J.geometries[a]=b}}function h(){i.callbackProgress({totalModels:j,totalTextures:W,loadedModels:j-Y,loadedTextures:W-K},J);i.onLoadProgress();Y==0&&K==0&&b(J)}var i=this,m=THREE.Loader.prototype.extractUrlbase(c),k,o,r,n,q,l,p,s,t,v,y,I,z,G,u,F,A,x,B,N,ba,Y,K,j,W,J;N=a;c=new THREE.BinaryLoader;ba=new THREE.JSONLoader;K=Y=0;J={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(r in N.objects)if(s=N.objects[r],s.meshCollider){a=!0;break}if(a)J.scene.collisions=new THREE.CollisionSystem;if(N.transform){a=N.transform.position;t=N.transform.rotation;var L=N.transform.scale;a&&J.scene.position.set(a[0],a[1],a[2]);t&&J.scene.rotation.set(t[0],t[1],t[2]);L&&J.scene.scale.set(L[0],L[1],L[2]);(a||t||L)&&J.scene.updateMatrix()}a=function(){K-=1;h();i.onLoadComplete()};for(q in N.cameras)t=N.cameras[q],t.type=="perspective"?A=new THREE.PerspectiveCamera(t.fov,
-t.aspect,t.near,t.far):t.type=="ortho"&&(A=new THREE.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far)),y=t.position,t=t.target,A.position.set(y[0],y[1],y[2]),A.target=new THREE.Vector3(t[0],t[1],t[2]),J.cameras[q]=A;for(n in N.lights)t=N.lights[n],q=t.color!==void 0?t.color:16777215,A=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(y=t.direction,v=new THREE.DirectionalLight(q,A),v.position.set(y[0],y[1],y[2]),v.position.normalize()):t.type=="point"?(y=t.position,v=t.distance,
-v=new THREE.PointLight(q,A,v),v.position.set(y[0],y[1],y[2])):t.type=="ambient"&&(v=new THREE.AmbientLight(q)),J.scene.add(v),J.lights[n]=v;for(l in N.fogs)n=N.fogs[l],n.type=="linear"?x=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(x=new THREE.FogExp2(0,n.density)),t=n.color,x.color.setRGB(t[0],t[1],t[2]),J.fogs[l]=x;if(J.cameras&&N.defaults.camera)J.currentCamera=J.cameras[N.defaults.camera];if(J.fogs&&N.defaults.fog)J.scene.fog=J.fogs[N.defaults.fog];t=N.defaults.bgcolor;J.bgColor=new THREE.Color;
-J.bgColor.setRGB(t[0],t[1],t[2]);J.bgColorAlpha=N.defaults.bgalpha;for(k in N.geometries)if(l=N.geometries[k],l.type=="bin_mesh"||l.type=="ascii_mesh")Y+=1,i.onLoadStart();j=Y;for(k in N.geometries)l=N.geometries[k],l.type=="cube"?(F=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides),J.geometries[k]=F):l.type=="plane"?(F=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight),J.geometries[k]=F):l.type=="sphere"?
-(F=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight),J.geometries[k]=F):l.type=="cylinder"?(F=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,l.heightSegs),J.geometries[k]=F):l.type=="torus"?(F=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT),J.geometries[k]=F):l.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(l.subdivisions),J.geometries[k]=F):l.type=="bin_mesh"?c.load(d(l.url,N.urlBaseType),g(k)):l.type=="ascii_mesh"?ba.load(d(l.url,N.urlBaseType),
-g(k)):l.type=="embedded_mesh"&&(l=N.embeds[l.id])&&ba.createModel(l,f(k),"");for(p in N.textures)if(k=N.textures[p],k.url instanceof Array){K+=k.url.length;for(l=0;l<k.url.length;l++)i.onLoadStart()}else K+=1,i.onLoadStart();W=K;for(p in N.textures){k=N.textures[p];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){l=[];for(var C=0;C<k.url.length;C++)l[C]=d(k.url[C],N.urlBaseType);l=THREE.ImageUtils.loadTextureCube(l,k.mapping,a)}else{l=THREE.ImageUtils.loadTexture(d(k.url,
-N.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)l.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)l.magFilter=THREE[k.magFilter];if(k.repeat){l.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)l.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)l.wrapT=THREE.RepeatWrapping}k.offset&&l.offset.set(k.offset[0],k.offset[1]);if(k.wrap){x={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(x[k.wrap[0]]!==void 0)l.wrapS=x[k.wrap[0]];if(x[k.wrap[1]]!==void 0)l.wrapT=
-x[k.wrap[1]]}}J.textures[p]=l}for(o in N.materials){p=N.materials[o];for(u in p.parameters)if(u=="envMap"||u=="map"||u=="lightMap")p.parameters[u]=J.textures[p.parameters[u]];else if(u=="shading")p.parameters[u]=p.parameters[u]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(u=="blending")p.parameters[u]=THREE[p.parameters[u]]?THREE[p.parameters[u]]:THREE.NormalBlending;else if(u=="combine")p.parameters[u]=p.parameters[u]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(u==
-"vertexColors")if(p.parameters[u]=="face")p.parameters[u]=THREE.FaceColors;else if(p.parameters[u])p.parameters[u]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);l=p.parameters.color;x=p.parameters.specular;c=p.parameters.ambient;ba=p.parameters.shininess;a.tNormal.texture=J.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=J.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(x);a.uAmbientColor.value.setHex(c);a.uShininess.value=ba;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
-vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);J.materials[o]=p}e();i.callbackSync(J);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function e(){var a;for(r in K.objects)if(!M.objects[r])if(s=K.objects[r],s.geometry!==void 0){if(G=M.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)J=M.materials[s.materials[I]],a=J instanceof THREE.ShaderMaterial;a&&G.computeTangents();v=s.position;B=s.rotation;x=s.quaternion;C=s.scale;x=0;J.length==0&&(J=new THREE.MeshFaceMaterial);J.length>1&&(J=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(G,J);a.name=r;a.position.set(v[0],v[1],v[2]);x?(a.quaternion.set(x[0],x[1],x[2],x[3]),a.useQuaternion=!0):a.rotation.set(B[0],B[1],B[2]);a.scale.set(C[0],C[1],C[2]);a.visible=s.visible;M.scene.add(a);M.objects[r]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);M.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(G),M.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},M.triggers[a.name]=b)}}else v=s.position,B=s.rotation,x=s.quaternion,C=s.scale,x=0,a=new THREE.Object3D,a.name=r,a.position.set(v[0],v[1],v[2]),x?(a.quaternion.set(x[0],x[1],x[2],x[3]),a.useQuaternion=!0):a.rotation.set(B[0],B[1],B[2]),a.scale.set(C[0],C[1],C[2]),a.visible=s.visible!==void 0?s.visible:!1,M.scene.add(a),M.objects[r]=a,M.empties[r]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},M.triggers[a.name]=b)}function g(a){return function(b){M.geometries[a]=
+b;e();V-=1;i.onLoadComplete();h()}}function f(a){return function(b){M.geometries[a]=b}}function h(){i.callbackProgress({totalModels:T,totalTextures:k,loadedModels:T-V,loadedTextures:k-Y},M);i.onLoadProgress();V==0&&Y==0&&b(M)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),j,o,r,m,p,n,q,s,t,u,v,B,x,C,E,G,R,z,J,K,U,V,Y,T,k,M;K=a;c=new THREE.BinaryLoader;U=new THREE.JSONLoader;Y=V=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(r in K.objects)if(s=K.objects[r],s.meshCollider){a=!0;break}if(a)M.scene.collisions=new THREE.CollisionSystem;if(K.transform){a=K.transform.position;t=K.transform.rotation;var L=K.transform.scale;a&&M.scene.position.set(a[0],a[1],a[2]);t&&M.scene.rotation.set(t[0],t[1],t[2]);L&&M.scene.scale.set(L[0],L[1],L[2]);(a||t||L)&&M.scene.updateMatrix()}a=function(){Y-=1;h();i.onLoadComplete()};for(p in K.cameras)t=K.cameras[p],t.type=="perspective"?R=new THREE.PerspectiveCamera(t.fov,
+t.aspect,t.near,t.far):t.type=="ortho"&&(R=new THREE.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far)),v=t.position,t=t.target,R.position.set(v[0],v[1],v[2]),R.target=new THREE.Vector3(t[0],t[1],t[2]),M.cameras[p]=R;for(m in K.lights)t=K.lights[m],p=t.color!==void 0?t.color:16777215,R=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(v=t.direction,u=new THREE.DirectionalLight(p,R),u.position.set(v[0],v[1],v[2]),u.position.normalize()):t.type=="point"?(v=t.position,u=t.distance,
+u=new THREE.PointLight(p,R,u),u.position.set(v[0],v[1],v[2])):t.type=="ambient"&&(u=new THREE.AmbientLight(p)),M.scene.add(u),M.lights[m]=u;for(n in K.fogs)m=K.fogs[n],m.type=="linear"?z=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(z=new THREE.FogExp2(0,m.density)),t=m.color,z.color.setRGB(t[0],t[1],t[2]),M.fogs[n]=z;if(M.cameras&&K.defaults.camera)M.currentCamera=M.cameras[K.defaults.camera];if(M.fogs&&K.defaults.fog)M.scene.fog=M.fogs[K.defaults.fog];t=K.defaults.bgcolor;M.bgColor=new THREE.Color;
+M.bgColor.setRGB(t[0],t[1],t[2]);M.bgColorAlpha=K.defaults.bgalpha;for(j in K.geometries)if(n=K.geometries[j],n.type=="bin_mesh"||n.type=="ascii_mesh")V+=1,i.onLoadStart();T=V;for(j in K.geometries)n=K.geometries[j],n.type=="cube"?(G=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),M.geometries[j]=G):n.type=="plane"?(G=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),M.geometries[j]=G):n.type=="sphere"?
+(G=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),M.geometries[j]=G):n.type=="cylinder"?(G=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),M.geometries[j]=G):n.type=="torus"?(G=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),M.geometries[j]=G):n.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(n.subdivisions),M.geometries[j]=G):n.type=="bin_mesh"?c.load(d(n.url,K.urlBaseType),g(j)):n.type=="ascii_mesh"?U.load(d(n.url,K.urlBaseType),
+g(j)):n.type=="embedded_mesh"&&(n=K.embeds[n.id])&&U.createModel(n,f(j),"");for(q in K.textures)if(j=K.textures[q],j.url instanceof Array){Y+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else Y+=1,i.onLoadStart();k=Y;for(q in K.textures){j=K.textures[q];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=[];for(var I=0;I<j.url.length;I++)n[I]=d(j.url[I],K.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(j.url,
+K.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){z={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(z[j.wrap[0]]!==void 0)n.wrapS=z[j.wrap[0]];if(z[j.wrap[1]]!==void 0)n.wrapT=
+z[j.wrap[1]]}}M.textures[q]=n}for(o in K.materials){q=K.materials[o];for(E in q.parameters)if(E=="envMap"||E=="map"||E=="lightMap")q.parameters[E]=M.textures[q.parameters[E]];else if(E=="shading")q.parameters[E]=q.parameters[E]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(E=="blending")q.parameters[E]=THREE[q.parameters[E]]?THREE[q.parameters[E]]:THREE.NormalBlending;else if(E=="combine")q.parameters[E]=q.parameters[E]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(E==
+"vertexColors")if(q.parameters[E]=="face")q.parameters[E]=THREE.FaceColors;else if(q.parameters[E])q.parameters[E]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);n=q.parameters.color;z=q.parameters.specular;c=q.parameters.ambient;U=q.parameters.shininess;a.tNormal.texture=M.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
+q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=M.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(z);a.uAmbientColor.value.setHex(c);a.uShininess.value=U;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
+vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);M.materials[o]=q}e();i.callbackSync(M);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 b,e,g,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 b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
 b,e,g,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 b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),m=[],k=[];(function(a,f,i){for(var k,l,m,s=a.length;i<s;i+=f)k=a[i],l=a[i+1],m=a[i+2],k=k/16383*c,l=l/16383*c,m=m/16383*c,k+=d,l+=e,m+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,m)))})(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,m.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,t,v,y,I=a.length;for(c=0;c<I;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;v=d;y=e;i=f;t=d;var z=e,G=f,u=g.materials[0],F=m[z*3],A=m[z*3+1],z=m[z*3+2],x=m[G*3],B=m[G*3+1],G=m[G*3+2];t=new THREE.Vector3(m[t*3],m[t*3+1],m[t*3+2]);z=new THREE.Vector3(F,A,z);G=new THREE.Vector3(x,B,G);g.faces.push(new THREE.Face3(v,y,i,[t,z,G],null,u));g=k[d*2];d=k[d*2+
-1];i=k[e*2];t=k[e*2+1];v=k[f*2];y=k[f*2+1];f=b.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(v,y));f.push(t)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],j=[];(function(a,f,i){for(var j,l,q,s=a.length;i<s;i+=f)j=a[i],l=a[i+1],q=a[i+2],j=j/16383*c,l=l/16383*c,q=q/16383*c,j+=d,l+=e,q+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,l,q)))})(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,j.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 c,d,e,f,g,i,t,u,v,B=a.length;for(c=0;c<B;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;u=d;v=e;i=f;t=d;var x=e,C=f,E=g.materials[0],G=l[x*3],R=l[x*3+1],x=l[x*3+2],z=l[C*3],J=l[C*3+1],C=l[C*3+2];t=new THREE.Vector3(l[t*3],l[t*3+1],l[t*3+2]);x=new THREE.Vector3(G,R,x);C=new THREE.Vector3(z,J,C);g.faces.push(new THREE.Face3(u,v,i,[t,x,C],null,E));g=j[d*2];d=j[d*2+
+1];i=j[e*2];t=j[e*2+1];u=j[f*2];v=j[f*2+1];f=b.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(u,v));f.push(t)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(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 b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 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 b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=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=
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
-this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,m,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=m;e[g]=this.lerp(k[a],k[a+3],f);e[g+1]=this.lerp(k[a+1],k[a+4],f);e[g+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,m,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=m;b=a+this.yd*
-3;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,m,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=m+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,m=g+this.yd,k=g+this.zd,o=i+this.yd,r=i+this.zd,n=g+this.yd+this.zd,q=i+this.yd+this.zd,l=0,p=this.field[g],s=this.field[i],t=this.field[m],v=this.field[o],y=this.field[k],I=this.field[r],z=this.field[n],G=this.field[q];p<f&&(l|=1);s<f&&(l|=2);t<f&&(l|=8);v<f&&(l|=4);y<f&&(l|=16);I<f&&(l|=32);z<f&&(l|=128);G<f&&(l|=64);var u=THREE.edgeTable[l];if(u===0)return 0;var F=this.delta,A=a+
-F,x=b+F,F=e+F;u&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,p,s));u&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,A,b,e,s,v));u&4&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,6,f,a,x,e,t,v));u&8&&(this.compNorm(g),this.compNorm(m),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,p,t));u&16&&(this.compNorm(k),this.compNorm(r),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,b,F,y,I));u&32&&(this.compNorm(r),
-this.compNorm(q),this.VIntY(r*3,this.vlist,this.nlist,15,f,A,b,F,I,G));u&64&&(this.compNorm(n),this.compNorm(q),this.VIntX(n*3,this.vlist,this.nlist,18,f,a,x,F,z,G));u&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,b,F,y,z));u&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,p,y));u&512&&(this.compNorm(i),this.compNorm(r),this.VIntZ(i*3,this.vlist,this.nlist,27,f,A,b,e,s,I));u&1024&&(this.compNorm(o),this.compNorm(q),this.VIntZ(o*
-3,this.vlist,this.nlist,30,f,A,x,e,v,G));u&2048&&(this.compNorm(m),this.compNorm(n),this.VIntZ(m*3,this.vlist,this.nlist,33,f,a,x,e,t,z));l<<=4;for(f=g=0;THREE.triTable[l+f]!=-1;)a=l+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
+this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=l;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=l;b=a+this.yd*
+3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=l+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,l=g+this.yd,j=g+this.zd,o=i+this.yd,r=i+this.zd,m=g+this.yd+this.zd,p=i+this.yd+this.zd,n=0,q=this.field[g],s=this.field[i],t=this.field[l],u=this.field[o],v=this.field[j],B=this.field[r],x=this.field[m],C=this.field[p];q<f&&(n|=1);s<f&&(n|=2);t<f&&(n|=8);u<f&&(n|=4);v<f&&(n|=16);B<f&&(n|=32);x<f&&(n|=128);C<f&&(n|=64);var E=THREE.edgeTable[n];if(E===0)return 0;var G=this.delta,R=a+
+G,z=b+G,G=e+G;E&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,s));E&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,R,b,e,s,u));E&4&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,z,e,t,u));E&8&&(this.compNorm(g),this.compNorm(l),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,t));E&16&&(this.compNorm(j),this.compNorm(r),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,G,v,B));E&32&&(this.compNorm(r),
+this.compNorm(p),this.VIntY(r*3,this.vlist,this.nlist,15,f,R,b,G,B,C));E&64&&(this.compNorm(m),this.compNorm(p),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,z,G,x,C));E&128&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,G,v,x));E&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,v));E&512&&(this.compNorm(i),this.compNorm(r),this.VIntZ(i*3,this.vlist,this.nlist,27,f,R,b,e,s,B));E&1024&&(this.compNorm(o),this.compNorm(p),this.VIntZ(o*
+3,this.vlist,this.nlist,30,f,R,z,e,u,C));E&2048&&(this.compNorm(l),this.compNorm(m),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,z,e,t,x));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
 4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
 4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[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 b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,m=b*this.size,k=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 r=Math.floor(m-h);r<1&&(r=1);m=Math.floor(m+h);m>this.size-1&&(m=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 q,l,p,s,t,v;o<i;o++){k=this.size2*o;l=o/this.size-e;t=l*l;for(l=r;l<m;l++){p=k+this.size*l;q=l/this.size-b;v=q*q;for(q=n;q<h;q++)s=q/this.size-a,s=g/(1.0E-6+s*s+v+t)-f,s>0&&(this.field[p+q]+=s)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,m=this.size,k=this.yd,o=this.zd,r=this.field,n=m*Math.sqrt(a/b);n>m&&(n=m);for(e=0;e<n;e++)if(g=e/m,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<m;g++){i=e+g*k;for(f=0;f<m;f++)r[o*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,m,k=this.size,o=this.yd,r=
-this.zd,n=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(g=0;g<q;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*o;for(e=0;e<k;e++){m=i+e;for(f=0;f<k;f++)n[r*f+m]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,m,k=this.size,o=this.yd,r=this.zd,n=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(f=0;f<q;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,h>0){i=r*f;for(g=0;g<k;g++){m=i+g*o;for(e=0;e<k;e++)n[m+e]+=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 b,e,g,f,h,i,m,k,o,r=this.size-2;for(f=1;f<r;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(g=1;g<r;g++){k=o+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<r;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,m,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,m,k,o,r,n;for(f=0;f<g.count;f++)r=f*3,k=r+1,n=r+2,h=g.positionArray[r],i=g.positionArray[k],m=
-g.positionArray[n],o=new THREE.Vector3(h,i,m),h=g.normalArray[r],i=g.normalArray[k],m=g.normalArray[n],r=new THREE.Vector3(h,i,m),r.normalize(),k=new THREE.Vertex(o),b.vertices.push(k),e.push(r);o=g.count/3;for(f=0;f<o;f++)r=(a+f)*3,k=r+1,n=r+2,h=e[r],i=e[k],m=e[n],r=new THREE.Face3(r,k,n,[h,i,m]),b.faces.push(r);a+=o;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,l=b*this.size,j=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 r=Math.floor(l-h);r<1&&(r=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var m=Math.floor(j-h);m<1&&(m=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
+1);for(var p,n,q,s,t,u;o<i;o++){j=this.size2*o;n=o/this.size-e;t=n*n;for(n=r;n<l;n++){q=j+this.size*n;p=n/this.size-b;u=p*p;for(p=m;p<h;p++)s=p/this.size-a,s=g/(1.0E-6+s*s+u+t)-f,s>0&&(this.field[q+p]+=s)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,l=this.size,j=this.yd,o=this.zd,r=this.field,m=l*Math.sqrt(a/b);m>l&&(m=l);for(e=0;e<m;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<l;g++){i=e+g*j;for(f=0;f<l;f++)r[o*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,l,j=this.size,o=this.yd,r=
+this.zd,m=this.field,p=j*Math.sqrt(a/b);p>j&&(p=j);for(g=0;g<p;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*o;for(e=0;e<j;e++){l=i+e;for(f=0;f<j;f++)m[r*f+l]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,l,j=this.size,o=this.yd,r=this.zd,m=this.field,p=j*Math.sqrt(a/b);p>j&&(p=j);for(f=0;f<p;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=r*f;for(g=0;g<j;g++){l=i+g*o;for(e=0;e<j;e++)m[l+e]+=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 b,e,g,f,h,i,l,j,o,r=this.size-2;for(f=1;f<r;f++){o=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(g=1;g<r;g++){j=o+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<r;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,l,j,o,r,m;for(f=0;f<g.count;f++)r=f*3,j=r+1,m=r+2,h=g.positionArray[r],i=g.positionArray[j],l=
+g.positionArray[m],o=new THREE.Vector3(h,i,l),h=g.normalArray[r],i=g.normalArray[j],l=g.normalArray[m],r=new THREE.Vector3(h,i,l),r.normalize(),j=new THREE.Vertex(o),b.vertices.push(j),e.push(r);o=g.count/3;for(f=0;f<o;f++)r=(a+f)*3,j=r+1,m=r+2,h=e[r],i=e[j],l=e[m],r=new THREE.Face3(r,j,m,[h,i,l]),b.faces.push(r);a+=o;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 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]);
 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]);
@@ -694,29 +693,29 @@ d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.verti
 d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
 d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
 b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
 b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
 !0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
 !0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
-"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var m=new THREE.Vector3,k=h/f,o=f*0.5,r=h*0.5,n=16/h,q=new THREE.Vector2(n*k,n),l=new THREE.Vector3(1,1,0),p=new THREE.Vector2(1,1),s=d.uniforms,n=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
-b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(s.occlusionMap,0);b.uniform1i(s.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(n.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(n.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var t,v,y,I,z;for(t=0;t<i;t++)if(n=16/h,q.set(n*k,n),I=a[t],m.set(I.matrixWorld.n14,I.matrixWorld.n24,I.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(m),
-g.projectionMatrix.multiplyVector3(m),l.copy(m),p.x=l.x*o+o,p.y=l.y*r+r,d.hasVertexTexture||p.x>0&&p.x<f&&p.y>0&&p.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,p.x-8,p.y-8,16,16,0);b.uniform1i(s.renderType,0);b.uniform2f(s.scale,q.x,q.y);b.uniform3f(s.screenPosition,l.x,l.y,l.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
-b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,p.x-8,p.y-8,16,16,0);b.uniform1i(s.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);I.positionScreen.copy(l);I.customUpdateCallback?I.customUpdateCallback(I):I.updateLensFlares();b.uniform1i(s.renderType,2);b.enable(b.BLEND);v=0;for(y=I.lensFlares.length;v<y;v++)if(z=I.lensFlares[v],z.opacity>0.0010&&z.scale>0.0010)l.x=z.x,l.y=z.y,l.z=z.z,n=z.size*z.scale/
-h,q.x=n*k,q.y=n,b.uniform3f(s.screenPosition,l.x,l.y,l.z),b.uniform2f(s.scale,q.x,q.y),b.uniform1f(s.rotation,z.rotation),b.uniform1f(s.opacity,z.opacity),b.uniform3f(s.color,z.color.r,z.color.g,z.color.b),c.setBlending(z.blending),c.setTexture(z.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var l=new THREE.Vector3,j=h/f,o=f*0.5,r=h*0.5,m=16/h,p=new THREE.Vector2(m*j,m),n=new THREE.Vector3(1,1,0),q=new THREE.Vector2(1,1),s=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(s.occlusionMap,0);b.uniform1i(s.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var t,u,v,B,x;for(t=0;t<i;t++)if(m=16/h,p.set(m*j,m),B=a[t],l.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(l),
+g.projectionMatrix.multiplyVector3(l),n.copy(l),q.x=n.x*o+o,q.y=n.y*r+r,d.hasVertexTexture||q.x>0&&q.x<f&&q.y>0&&q.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,q.x-8,q.y-8,16,16,0);b.uniform1i(s.renderType,0);b.uniform2f(s.scale,p.x,p.y);b.uniform3f(s.screenPosition,n.x,n.y,n.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,q.x-8,q.y-8,16,16,0);b.uniform1i(s.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(n);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(s.renderType,2);b.enable(b.BLEND);u=0;for(v=B.lensFlares.length;u<v;u++)if(x=B.lensFlares[u],x.opacity>0.0010&&x.scale>0.0010)n.x=x.x,n.y=x.y,n.z=x.z,m=x.size*x.scale/
+h,p.x=m*j,p.y=m,b.uniform3f(s.screenPosition,n.x,n.y,n.z),b.uniform2f(s.scale,p.x,p.y),b.uniform1f(s.rotation,x.rotation),b.uniform1f(s.opacity,x.opacity),b.uniform3f(s.color,x.color.r,x.color.g,x.color.b),c.setBlending(x.blending),c.setTexture(x.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,g=new THREE.Frustum,f=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,g=new THREE.Frustum,f=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,m,k,o,r,n,q,l=0,p=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(m=p.length;i<m;i++)if(q=p[i],q.castShadow&&q instanceof THREE.SpotLight){this.shadowMap[l]||(this.shadowMap[l]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),
-this.shadowMatrix[l]=new THREE.Matrix4);k=this.shadowMap[l];o=this.shadowMatrix[l];e.position.copy(q.position);e.lookAt(q.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(e.projectionMatrix);o.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);
-if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(k);a.clearColor(1,0,1,1);b.clear();k=b.getClearColor();o=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,o);o=h.__webglObjects.length;for(k=0;k<o;k++)if(r=h.__webglObjects[k],q=r.object,r.render=!1,q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||g.contains(q)))q.matrixWorld.flattenToArray(q._objectMatrixArray),
-q._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),r.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);for(k=0;k<o;k++)if(r=h.__webglObjects[k],r.render)q=r.object,r=r.buffer,b.setObjectFaces(q),n=q.customDepthMaterial?q.customDepthMaterial:q.geometry.morphTargets.length?d:c,b.renderBuffer(e,p,null,n,r,q);o=h.__webglObjectsImmediate.length;for(k=0;k<o;k++)r=h.__webglObjectsImmediate[k],q=r.object,q.visible&&q.castShadow&&(q.matrixAutoUpdate&&
-q.matrixWorld.flattenToArray(q._objectMatrixArray),q._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),b.renderImmediateObject(e,p,null,c,q));l++}}};
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,l,j,o,r,m,p,n,q=0,s=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(l=s.length;i<l;i++)if(p=s[i],p.castShadow&&p instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);j=this.shadowMap[q];o=this.shadowMatrix[q];e.position.copy(p.position);e.lookAt(p.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(e.projectionMatrix);o.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
+new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();o=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,o);n=h.__webglObjects;j=0;for(o=n.length;j<o;j++)if(r=n[j],p=r.object,r.render=!1,p.visible&&p.castShadow&&
+(!(p instanceof THREE.Mesh)||!p.frustumCulled||g.contains(p)))p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),r.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(o=n.length;j<o;j++)if(r=n[j],r.render)p=r.object,r=r.buffer,b.setObjectFaces(p),m=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?d:c,b.renderBuffer(e,s,null,m,r,p);n=h.__webglObjectsImmediate;
+j=0;for(o=n.length;j<o;j++)r=n[j],p=r.object,p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),b.renderImmediateObject(e,s,null,c,p));q++}}};
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
 2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
 2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
 b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
 b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
 b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
 b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
-"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var m=d.attributes,k=d.uniforms,o=h/f;f*=0.5;var r=h*0.5,n=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(m.position),b.enableVertexAttribArray(m.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.position,
-2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(k.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(k.map,0);for(var q,l=[],m=0;m<i;m++)if(q=e[m],q.visible&&q.opacity!==0)q.useScreenCoordinates?q.z=-q.position.z:(q._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),q.z=-q._modelViewMatrix.n34);e.sort(a);for(m=0;m<i;m++)q=e[m],q.visible&&
-q.opacity!==0&&q.map&&q.map.image&&q.map.image.width&&(q.useScreenCoordinates?(b.uniform1i(k.useScreenCoordinates,1),b.uniform3f(k.screenPosition,(q.position.x-f)/f,(r-q.position.y)/r,Math.max(0,Math.min(1,q.position.z)))):(b.uniform1i(k.useScreenCoordinates,0),b.uniform1i(k.affectedByDistance,q.affectedByDistance?1:0),b.uniformMatrix4fv(k.modelViewMatrix,!1,q._modelViewMatrixArray)),g=q.map.image.width/(q.scaleByViewport?h:1),l[0]=g*o*q.scale.x,l[1]=g*q.scale.y,b.uniform2f(k.uvScale,q.uvScale.x,
-q.uvScale.y),b.uniform2f(k.uvOffset,q.uvOffset.x,q.uvOffset.y),b.uniform2f(k.alignment,q.alignment.x,q.alignment.y),b.uniform1f(k.opacity,q.opacity),b.uniform3f(k.color,q.color.r,q.color.g,q.color.b),b.uniform1f(k.rotation,q.rotation),b.uniform2fv(k.scale,l),q.mergeWith3D&&!n?(b.enable(b.DEPTH_TEST),n=!0):!q.mergeWith3D&&n&&(b.disable(b.DEPTH_TEST),n=!1),c.setBlending(q.blending),c.setTexture(q.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,m,k,o;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},r=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
-1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:r},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(q);this.setSize=function(a,d){c.call(b,a,d);r.width=a;r.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||m!==c.near||k!==c.far||o!==c.fov){i=c.aspect;m=c.near;k=c.far;o=c.fov;var t=c.projectionMatrix.clone(),v=125/30*0.5,y=v*m/125,I=m*Math.tan(o*Math.PI/360),z;f.n14=v;h.n14=-v;v=-I*i+y;z=I*i+y;t.n11=2*m/(z-v);t.n13=(z+v)/(z-v);e.projectionMatrix.copy(t);v=-I*i-y;z=I*i-y;t.n11=
-2*m/(z-v);t.n13=(z+v)/(z-v);g.projectionMatrix.copy(t)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,r,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,n,!0);l.updateMatrixWorld();d.call(b,l,q)}};
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var l=d.attributes,j=d.uniforms,o=h/f;f*=0.5;var r=h*0.5,m=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(l.position),b.enableVertexAttribArray(l.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(l.position,
+2,b.FLOAT,!1,16,0);b.vertexAttribPointer(l.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var p,n=[],l=0;l<i;l++)if(p=e[l],p.visible&&p.opacity!==0)p.useScreenCoordinates?p.z=-p.position.z:(p._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),p.z=-p._modelViewMatrix.n34);e.sort(a);for(l=0;l<i;l++)p=e[l],p.visible&&
+p.opacity!==0&&p.map&&p.map.image&&p.map.image.width&&(p.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(p.position.x-f)/f,(r-p.position.y)/r,Math.max(0,Math.min(1,p.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,p.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,p._modelViewMatrixArray)),g=p.map.image.width/(p.scaleByViewport?h:1),n[0]=g*o*p.scale.x,n[1]=g*p.scale.y,b.uniform2f(j.uvScale,p.uvScale.x,
+p.uvScale.y),b.uniform2f(j.uvOffset,p.uvOffset.x,p.uvOffset.y),b.uniform2f(j.alignment,p.alignment.x,p.alignment.y),b.uniform1f(j.opacity,p.opacity),b.uniform3f(j.color,p.color.r,p.color.g,p.color.b),b.uniform1f(j.rotation,p.rotation),b.uniform2fv(j.scale,n),p.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!p.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!1),c.setBlending(p.blending),c.setTexture(p.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,l,j,o;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},r=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.PerspectiveCamera(53,
+1,1,1E4);p.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:r},mapRight:{type:"t",value:1,texture:m}},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}"}),
+n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(p);this.setSize=function(a,d){c.call(b,a,d);r.width=a;r.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||l!==c.near||j!==c.far||o!==c.fov){i=c.aspect;l=c.near;j=c.far;o=c.fov;var t=c.projectionMatrix.clone(),u=125/30*0.5,v=u*l/125,B=l*Math.tan(o*Math.PI/360),x;f.n14=u;h.n14=-u;u=-B*i+v;x=B*i+v;t.n11=2*l/(x-u);t.n13=(x+u)/(x-u);e.projectionMatrix.copy(t);u=-B*i-v;x=B*i-v;t.n11=
+2*l/(x-u);t.n13=(x+u)/(x-u);g.projectionMatrix.copy(t)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,r,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,p)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,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);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,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);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
 c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
 c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 114 - 114
build/custom/ThreeExtras.js

@@ -1,18 +1,18 @@
 // ThreeExtras.js r47dev - http://github.com/mrdoob/three.js
 // ThreeExtras.js r47dev - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;return b}};
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],r=g.faceVertexUvs[0],o={},m=0;m<a.materials.length;m++)o[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,l=h.length;m<l;m++){var n=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}m=
-0;for(l=k.length;m<l;m++){var f=k[m],q,p,s=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=s.length;h<n;h++)p=s[h].clone(),d&&d.multiplyVector3(p),q.vertexNormals.push(p);q.color.copy(f.color);h=0;for(n=t.length;h<n;h++)p=t[h],q.vertexColors.push(p.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
-n=o[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);q.materialIndex=n}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}m=0;for(l=r.length;m<l;m++){c=r[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],r=g.faceVertexUvs[0],o={},l=0;l<a.materials.length;l++)o[a.materials[l].id]=l;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var l=0,n=h.length;l<n;l++){var m=new THREE.Vertex(h[l].position.clone());c&&c.multiplyVector3(m.position);f.push(m)}l=
+0;for(n=k.length;l<n;l++){var f=k[l],q,p,s=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(m=s.length;h<m;h++)p=s[h].clone(),d&&d.multiplyVector3(p),q.vertexNormals.push(p);q.color.copy(f.color);h=0;for(m=t.length;h<m;h++)p=t[h],q.vertexColors.push(p.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
+m=o[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);q.materialIndex=m}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}l=0;for(n=r.length;l<n;l++){c=r[l];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
 for(c=e.length;a<c;a++){var h=e[a],i,k,j=h.vertexNormals,r=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=j.length;d<f;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=r.length;d<f;d++)k=r[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
 for(c=e.length;a<c;a++){var h=e[a],i,k,j=h.vertexNormals,r=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=j.length;d<f;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=r.length;d<f;d++)k=r[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
 f;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
 f;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
 g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
 g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
-f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(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,e,g=a.faces,f=a.vertices,h=g.length,i=0,k=[],j,r,o,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,r=f[d.b].position,o=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,r,o);else if(d instanceof
-THREE.Face4)j=f[d.a].position,r=f[d.b].position,o=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,r,m),d._area2=THREE.GeometryUtils.triangleArea(r,o,m),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(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,e,g=a.faces,f=a.vertices,h=g.length,i=0,k=[],j,r,o,l;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,r=f[d.b].position,o=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,r,o);else if(d instanceof
+THREE.Face4)j=f[d.a].position,r=f[d.b].position,o=f[d.c].position,l=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,r,l),d._area2=THREE.GeometryUtils.triangleArea(r,o,l),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
 b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.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(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.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(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin="";d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
 THREE.ImageUtils={loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin="";d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},getNormalMap:function(a,b){var c=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]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var r=1;r<e;r++){var o=r-1<0?e-1:r-1,m=(r+1)%e,l=j-1<0?d-1:j-1,n=(j+1)%d,q=[],p=[0,0,h[(r*d+j)*4]/255*b];q.push([-1,0,h[(r*d+l)*4]/255*b]);q.push([-1,-1,h[(o*d+l)*4]/255*b]);q.push([0,-1,h[(o*d+j)*4]/255*b]);q.push([1,-1,h[(o*d+n)*4]/255*b]);
-q.push([1,0,h[(r*d+n)*4]/255*b]);q.push([1,1,h[(m*d+n)*4]/255*b]);q.push([0,1,h[(m*d+j)*4]/255*b]);q.push([-1,1,h[(m*d+l)*4]/255*b]);o=[];l=q.length;for(m=0;m<l;m++){var n=q[m],s=q[(m+1)%l],n=[n[0]-p[0],n[1]-p[1],n[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];o.push(c([n[1]*s[2]-n[2]*s[1],n[2]*s[0]-n[0]*s[2],n[0]*s[1]-n[1]*s[0]]))}q=[0,0,0];for(m=0;m<o.length;m++)q[0]+=o[m][0],q[1]+=o[m][1],q[2]+=o[m][2];q[0]/=o.length;q[1]/=o.length;q[2]/=o.length;p=(r*d+j)*4;k[p]=(q[0]+1)/2*255|0;k[p+1]=(q[1]+0.5)*
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var r=1;r<e;r++){var o=r-1<0?e-1:r-1,l=(r+1)%e,n=j-1<0?d-1:j-1,m=(j+1)%d,q=[],p=[0,0,h[(r*d+j)*4]/255*b];q.push([-1,0,h[(r*d+n)*4]/255*b]);q.push([-1,-1,h[(o*d+n)*4]/255*b]);q.push([0,-1,h[(o*d+j)*4]/255*b]);q.push([1,-1,h[(o*d+m)*4]/255*b]);
+q.push([1,0,h[(r*d+m)*4]/255*b]);q.push([1,1,h[(l*d+m)*4]/255*b]);q.push([0,1,h[(l*d+j)*4]/255*b]);q.push([-1,1,h[(l*d+n)*4]/255*b]);o=[];n=q.length;for(l=0;l<n;l++){var m=q[l],s=q[(l+1)%n],m=[m[0]-p[0],m[1]-p[1],m[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];o.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]-m[1]*s[0]]))}q=[0,0,0];for(l=0;l<o.length;l++)q[0]+=o[l][0],q[1]+=o[l][1],q[2]+=o[l][2];q[0]/=o.length;q[1]/=o.length;q[2]/=o.length;p=(r*d+j)*4;k[p]=(q[0]+1)/2*255|0;k[p+1]=(q[1]+0.5)*
 255|0;k[p+2]=q[2]*255|0;k[p+3]=255}f.putImageData(i,0,0);return g}};
 255|0;k[p+2]=q[2]*255|0;k[p+3]=255}f.putImageData(i,0,0);return g}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
@@ -58,9 +58,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){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,b),new THREE.Vector2(c,d),new THREE.Vector2(e,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){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,b),new THREE.Vector2(c,d),new THREE.Vector2(e,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
 THREE.Path.prototype.arc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,r,o,m,l,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];r=g[0];o=g[1];c.length>0?(f=c[c.length-1],m=f.x,l=f.y):(f=this.actions[d-1].args,m=f[f.length-2],l=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,m,r,h),n=THREE.Shape.Utils.b2(n,l,o,
-i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];r=g[0];o=g[1];k=g[2];j=g[3];c.length>0?(f=c[c.length-1],m=f.x,l=f.y):(f=this.actions[d-1].args,m=f[f.length-2],l=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,m,r,k,h),n=THREE.Shape.Utils.b3(n,l,o,j,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
-for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];k=g[2];r=g[3];n=g[4];o=!!g[5];j=f[f.length-2];m=f[f.length-1];f.length==0&&(j=m=0);l=n-r;var q=a*2;for(f=1;f<=q;f++)n=f/q,o||(n=1-n),n=r+n*l,g=j+h+k*Math.cos(n),n=m+i+k*Math.sin(n),c.push(new THREE.Vector2(g,n))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,r,o,l,n,m;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];r=g[0];o=g[1];c.length>0?(f=c[c.length-1],l=f.x,n=f.y):(f=this.actions[d-1].args,l=f[f.length-2],n=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,g=THREE.Shape.Utils.b2(m,l,r,h),m=THREE.Shape.Utils.b2(m,n,o,
+i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];r=g[0];o=g[1];k=g[2];j=g[3];c.length>0?(f=c[c.length-1],l=f.x,n=f.y):(f=this.actions[d-1].args,l=f[f.length-2],n=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,g=THREE.Shape.Utils.b3(m,l,r,k,h),m=THREE.Shape.Utils.b3(m,n,o,j,i),c.push(new THREE.Vector2(g,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*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
+for(f=1;f<=m;f++)c.push(g.getPointAt(f/m));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];k=g[2];r=g[3];m=g[4];o=!!g[5];j=f[f.length-2];l=f[f.length-1];f.length==0&&(j=l=0);n=m-r;var q=a*2;for(f=1;f<=q;f++)m=f/q,o||(m=1-m),m=r+m*n,g=j+h+k*Math.cos(m),m=l+i+k*Math.sin(m),c.push(new THREE.Vector2(g,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
 THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,k,j,r;h=0;for(i=f.length;h<i;h++)k=f[h],j=k.x,r=k.y,k.x=a*j+b*r+c,k.y=d*r+e*j+g;return f};
 THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,k,j,r;h=0;for(i=f.length;h<i;h++)k=f[h],j=k.x,r=k.y,k.x=a*j+b*r+c,k.y=d*r+e*j+g;return f};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
 this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
@@ -68,9 +68,9 @@ THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;a=0;f
 d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].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.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,r,o,m,l=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);g=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){o=k[e];m=[];for(r=0;r<c.length;r++)j=c[r],j=o.distanceToSquared(j),m.push(j),j<g&&(g=j,f=e,h=r)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;var n=[k[f],c[h],c[e]];r=THREE.FontUtils.Triangulate.area(n);var q=[k[f],k[g],c[h]];o=THREE.FontUtils.Triangulate.area(q);m=h;j=f;h+=1;f+=-1;h<
-0&&(h+=c.length);h%=c.length;f<0&&(f+=k.length);f%=k.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;n=[k[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[k[f],k[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);r+o>n+q&&(h=m,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=k.length),f%=k.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:k.length-1);r=c.slice(0,h);o=c.slice(h);m=k.slice(f);j=k.slice(0,f);g=[k[f],k[g],c[h]];l.push([k[f],c[h],c[e]]);l.push(g);c=r.concat(m).concat(j).concat(o)}return{shape:c,
-isolatedPts:l,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,k={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,r,o,l,n=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);g=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){o=k[e];l=[];for(r=0;r<c.length;r++)j=c[r],j=o.distanceToSquared(j),l.push(j),j<g&&(g=j,f=e,h=r)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;var m=[k[f],c[h],c[e]];r=THREE.FontUtils.Triangulate.area(m);var q=[k[f],k[g],c[h]];o=THREE.FontUtils.Triangulate.area(q);l=h;j=f;h+=1;f+=-1;h<
+0&&(h+=c.length);h%=c.length;f<0&&(f+=k.length);f%=k.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;m=[k[f],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);q=[k[f],k[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);r+o>m+q&&(h=l,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=k.length),f%=k.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:k.length-1);r=c.slice(0,h);o=c.slice(h);l=k.slice(f);j=k.slice(0,f);g=[k[f],k[g],c[h]];n.push([k[f],c[h],c[e]]);n.push(g);c=r.concat(l).concat(j).concat(o)}return{shape:c,
+isolatedPts:n,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,k={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
@@ -83,11 +83,11 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.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.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,k,j=this.data.JIT.hierarchy,r,o;this.currentTime+=a*this.timeScale;o=this.currentTime;r=this.currentTime%=this.data.length;k=parseInt(Math.min(r*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,l=this.hierarchy.length;m<l;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&j[m][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=j[m][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 n=0;n<3;n++){c=b[n];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=o){if(r<o)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<r;)f=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<
-r)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(r-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
-"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(m=0;m<this.hierarchy.length;m++)j[m][k]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,k,j=this.data.JIT.hierarchy,r,o;this.currentTime+=a*this.timeScale;o=this.currentTime;r=this.currentTime%=this.data.length;k=parseInt(Math.min(r*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,n=this.hierarchy.length;l<n;l++)if(a=this.hierarchy[l],i=a.animationCache,this.JITCompile&&j[l][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[l][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=j[l][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++){c=b[m];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=o){if(r<o)if(this.loop){f=this.data.hierarchy[l].keys[0];for(h=this.getNextKeyWith(c,l,1);h.time<r;)f=h,h=this.getNextKeyWith(c,l,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,l,h.index+1);while(h.time<
+r)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(r-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+l),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",l,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",l,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
+"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(l=0;l<this.hierarchy.length;l++)j[l][k]=this.hierarchy[l]instanceof THREE.Bone?this.hierarchy[l].skinMatrix.clone():this.hierarchy[l].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,k;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],k[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],k[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],k[2],e,c,f);return d};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,k;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],k[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],k[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],k[2],e,c,f);return d};
 THREE.Animation.prototype.interpolate=function(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};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.interpolate=function(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};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
@@ -117,7 +117,7 @@ this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this
 a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
-this.debugPath,b=this.spline,f=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(f,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
+this.debugPath,b=this.spline,f=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),l=0;l<b.points.length;l++)c=new THREE.Mesh(f,h),c.position.copy(b.points[l]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
 !1)}};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
@@ -128,12 +128,12 @@ THREE.FlyControls=function(a,b){function c(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.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",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b: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 c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,k=0,j=0,r=0,o=0,m=window.innerWidth/2,l=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b: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 c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,k=0,j=0,r=0,o=0,l=window.innerWidth/2,n=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
 this.rotateHorizontally(b*r);this.rotateVertically(b*o)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);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();e.copy(this.forward);d.set(0,1,0);c.cross(d,
 this.rotateHorizontally(b*r);this.rotateVertically(b*o)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);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();e.copy(this.forward);d.set(0,1,0);c.cross(d,
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);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*
 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){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);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",
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);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){r=(a.clientX-m)/window.innerWidth;o=(a.clientY-l)/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){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){r=(a.clientX-l)/window.innerWidth;o=(a.clientY-n)/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: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:f=!1;break;case 69:f=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
 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: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:f=!1;break;case 69:f=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
 THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?b: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=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
 THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?b: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=this.noRotate=!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 e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,r=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,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
 this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,r=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,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
@@ -143,23 +143,23 @@ c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?r=o:r.addSelf(a.
 c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=c.getMouseOnScreen(a.clientX,a.clientY),r=o=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
 c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=c.getMouseOnScreen(a.clientX,a.clientY),r=o=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
 !c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(o=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(r=o=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
 !c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(o=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(r=o=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
 function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
 function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,m){var n,o=d||1,l=e||1,p=h/2,q=i/2,r=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",l=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var s=o+1,t=l+1,L=h/o,H=i/l,M=new THREE.Vector3;M[n]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var J=new THREE.Vector3;J[a]=(i*L-p)*c;J[b]=(h*H-q)*f;J[n]=j;k.vertices.push(new THREE.Vertex(J))}for(h=0;h<l;h++)for(i=0;i<o;i++)a=
-new THREE.Face4(i+s*h+r,i+s*(h+1)+r,i+1+s*(h+1)+r,i+1+s*h+r),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=m,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/l),new THREE.UV(i/o,(h+1)/l),new THREE.UV((i+1)/o,(h+1)/l),new THREE.UV((i+1)/o,h/l)])}THREE.Geometry.call(this);var k=this,j=a/2,r=b/2,o=c/2,m,l,n,q,p,s;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;q=1;l=2;p=
-3;n=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 t in h)this.sides[t]!=void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,m);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,r,l);this.sides.ny&&i("x","z",1,-1,a,c,-r,p);this.sides.pz&&i("x","y",1,-1,a,b,o,n);this.sides.nz&&i("x","y",-1,-1,a,b,-o,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,l){var m,o=d||1,n=e||1,p=h/2,q=i/2,r=k.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",n=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",o=g||1;var s=o+1,t=n+1,L=h/o,H=i/n,M=new THREE.Vector3;M[m]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var J=new THREE.Vector3;J[a]=(i*L-p)*c;J[b]=(h*H-q)*f;J[m]=j;k.vertices.push(new THREE.Vertex(J))}for(h=0;h<n;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+s*h+r,i+s*(h+1)+r,i+1+s*(h+1)+r,i+1+s*h+r),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=l,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/n),new THREE.UV(i/o,(h+1)/n),new THREE.UV((i+1)/o,(h+1)/n),new THREE.UV((i+1)/o,h/n)])}THREE.Geometry.call(this);var k=this,j=a/2,r=b/2,o=c/2,l,n,m,q,p,s;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(l=0;l<6;l++)this.materials.push(f)}l=0;q=1;n=2;p=
+3;m=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 t in h)this.sides[t]!=void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,l);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,r,n);this.sides.ny&&i("x","z",1,-1,a,c,-r,p);this.sides.pz&&i("x","y",1,-1,a,b,o,m);this.sides.nz&&i("x","y",-1,-1,a,b,-o,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var r=[],o=[],m=i/e,l=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(l*Math.sin(n*Math.PI*2),-m*c+f,l*Math.cos(n*Math.PI*2))));r.push(this.vertices.length-1);o.push(new THREE.UV(n,m))}k.push(r);j.push(o)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],r=k[i+1][h],o=k[i+1][h+1],m=k[i][h+1],l=
-this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[r].position.clone().setY(0).normalize(),q=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[m].position.clone().setY(0).normalize(),s=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),y=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,r,o,m,[l,n,q,p]));this.faceVertexUvs[0].push([s,t,w,y])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=k[0][h],r=k[0][h+
-1],o=this.vertices.length-1,l=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),s=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,r,o,[l,n,q])),this.faceVertexUvs[0].push([s,t,w])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=k[i][h+1],r=k[i][h],o=this.vertices.length-1,l=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),s=j[i][h+1].clone(),t=j[i][h].clone(),
-w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,r,o,[l,n,q])),this.faceVertexUvs[0].push([s,t,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var r=[],o=[],l=i/e,n=l*(b-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(n*Math.sin(m*Math.PI*2),-l*c+f,n*Math.cos(m*Math.PI*2))));r.push(this.vertices.length-1);o.push(new THREE.UV(m,l))}k.push(r);j.push(o)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],r=k[i+1][h],o=k[i+1][h+1],l=k[i][h+1],n=
+this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[r].position.clone().setY(0).normalize(),q=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[l].position.clone().setY(0).normalize(),s=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),y=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,r,o,l,[n,m,q,p]));this.faceVertexUvs[0].push([s,t,w,y])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=k[0][h],r=k[0][h+
+1],o=this.vertices.length-1,n=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),s=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,r,o,[n,m,q])),this.faceVertexUvs[0].push([s,t,w])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=k[i][h+1],r=k[i][h],o=this.vertices.length-1,n=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),s=j[i][h+1].clone(),t=j[i][h].clone(),
+w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,r,o,[n,m,q])),this.faceVertexUvs[0].push([s,t,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(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();
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(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 e(a){for(v=a.length;--v>=0;){J=v;N=v-1;N<0&&(N=a.length-1);for(var b=
 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 e(a){for(v=a.length;--v>=0;){J=v;N=v-1;N<0&&(N=a.length-1);for(var b=
-0,c=m+j*2,b=0;b<c;b++){var d=K*b,e=K*(b+1),f=Q+J+d,g=Q+J+e,k=f,d=Q+N+d,e=Q+N+e,n=g;k+=F;d+=F;e+=F;n+=F;A.faces.push(new THREE.Face4(k,d,e,n,null,null,w));w&&(k=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,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,b,c,null,
+0,c=l+j*2,b=0;b<c;b++){var d=K*b,e=K*(b+1),f=Q+J+d,g=Q+J+e,k=f,d=Q+N+d,e=Q+N+e,m=g;k+=F;d+=F;e+=F;m+=F;A.faces.push(new THREE.Face4(k,d,e,m,null,null,w));w&&(k=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,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,b,c,null,
 null,t));if(t){var d=y.maxY,e=y.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=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,r=b.bevelEnabled!==void 0?b.bevelEnabled:!0,o=b.curveSegments!==
 null,t));if(t){var d=y.maxY,e=y.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=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,r=b.bevelEnabled!==void 0?b.bevelEnabled:!0,o=b.curveSegments!==
-void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,l=b.bendPath,n=b.extrudePath,q,p=!1,s=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,w=b.extrudeMaterial,y=this.shapebb;if(n)q=n.getPoints(o),m=q.length,p=!0,r=!1;r||(k=i=j=0);var u,x,z,A=this,F=this.vertices.length;l&&a.addWrapPath(l);o=s?a.extractAllSpacedPoints(o):a.extractAllPoints(o);l=o.shape;o=o.holes;if(n=!THREE.Shape.Utils.isClockWise(l)){l=l.reverse();x=0;for(z=o.length;x<z;x++)u=o[x],THREE.Shape.Utils.isClockWise(u)&&
-(o[x]=u.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(l,o);s=l;x=0;for(z=o.length;x<z;x++)u=o[x],l=l.concat(u);var v,D,B,G,I,E,K=l.length,O=n.length,C=[];v=0;D=s.length;J=D-1;for(N=v+1;v<D;v++,J++,N++)J===D&&(J=0),N===D&&(N=0),C[v]=d(s[v],s[J],s[N]);var L=[],H,M=C.concat();x=0;for(z=o.length;x<z;x++){u=o[x];H=[];v=0;D=u.length;J=D-1;for(N=v+1;v<D;v++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[v]=d(u[v],u[J],u[N]);L.push(H);M=M.concat(H)}for(B=0;B<j;B++){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=
-0;for(D=s.length;v<D;v++)E=c(s[v],C[v],G),g(E.x,E.y,-I);x=0;for(z=o.length;x<z;x++){u=o[x];H=L[x];v=0;for(D=u.length;v<D;v++)E=c(u[v],H[v],G),g(E.x,E.y,-I)}}G=k;for(v=0;v<K;v++)E=r?c(l[v],M[v],G):l[v],p?g(E.x,E.y+q[0].y,q[0].x):g(E.x,E.y,0);for(B=1;B<=m;B++)for(v=0;v<K;v++)E=r?c(l[v],M[v],G):l[v],p?g(E.x,E.y+q[B-1].y,q[B-1].x):g(E.x,E.y,h/m*B);for(B=j-1;B>=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=0;for(D=s.length;v<D;v++)E=c(s[v],C[v],G),g(E.x,E.y,h+I);x=0;for(z=o.length;x<z;x++){u=o[x];
-H=L[x];v=0;for(D=u.length;v<D;v++)E=c(u[v],H[v],G),p?g(E.x,E.y+q[m-1].y,q[m-1].x+I):g(E.x,E.y,h+I)}}if(r){r=K*0;for(v=0;v<O;v++)k=n[v],f(k[2]+r,k[1]+r,k[0]+r);r=K*(m+j*2);for(v=0;v<O;v++)k=n[v],f(k[0]+r,k[1]+r,k[2]+r)}else{for(v=0;v<O;v++)k=n[v],f(k[2],k[1],k[0]);for(v=0;v<O;v++)k=n[v],f(k[0]+K*m,k[1]+K*m,k[2]+K*m)}var J,N,Q=0;e(s);Q+=s.length;x=0;for(z=o.length;x<z;x++)u=o[x],e(u),Q+=u.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+void 0?b.curveSegments:12,l=b.steps!==void 0?b.steps:1,n=b.bendPath,m=b.extrudePath,q,p=!1,s=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,w=b.extrudeMaterial,y=this.shapebb;if(m)q=m.getPoints(o),l=q.length,p=!0,r=!1;r||(k=i=j=0);var u,x,z,A=this,F=this.vertices.length;n&&a.addWrapPath(n);o=s?a.extractAllSpacedPoints(o):a.extractAllPoints(o);n=o.shape;o=o.holes;if(m=!THREE.Shape.Utils.isClockWise(n)){n=n.reverse();x=0;for(z=o.length;x<z;x++)u=o[x],THREE.Shape.Utils.isClockWise(u)&&
+(o[x]=u.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(n,o);s=n;x=0;for(z=o.length;x<z;x++)u=o[x],n=n.concat(u);var v,D,B,G,I,E,K=n.length,O=m.length,C=[];v=0;D=s.length;J=D-1;for(N=v+1;v<D;v++,J++,N++)J===D&&(J=0),N===D&&(N=0),C[v]=d(s[v],s[J],s[N]);var L=[],H,M=C.concat();x=0;for(z=o.length;x<z;x++){u=o[x];H=[];v=0;D=u.length;J=D-1;for(N=v+1;v<D;v++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[v]=d(u[v],u[J],u[N]);L.push(H);M=M.concat(H)}for(B=0;B<j;B++){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=
+0;for(D=s.length;v<D;v++)E=c(s[v],C[v],G),g(E.x,E.y,-I);x=0;for(z=o.length;x<z;x++){u=o[x];H=L[x];v=0;for(D=u.length;v<D;v++)E=c(u[v],H[v],G),g(E.x,E.y,-I)}}G=k;for(v=0;v<K;v++)E=r?c(n[v],M[v],G):n[v],p?g(E.x,E.y+q[0].y,q[0].x):g(E.x,E.y,0);for(B=1;B<=l;B++)for(v=0;v<K;v++)E=r?c(n[v],M[v],G):n[v],p?g(E.x,E.y+q[B-1].y,q[B-1].x):g(E.x,E.y,h/l*B);for(B=j-1;B>=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=0;for(D=s.length;v<D;v++)E=c(s[v],C[v],G),g(E.x,E.y,h+I);x=0;for(z=o.length;x<z;x++){u=o[x];
+H=L[x];v=0;for(D=u.length;v<D;v++)E=c(u[v],H[v],G),p?g(E.x,E.y+q[l-1].y,q[l-1].x+I):g(E.x,E.y,h+I)}}if(r){r=K*0;for(v=0;v<O;v++)k=m[v],f(k[2]+r,k[1]+r,k[0]+r);r=K*(l+j*2);for(v=0;v<O;v++)k=m[v],f(k[0]+r,k[1]+r,k[2]+r)}else{for(v=0;v<O;v++)k=m[v],f(k[2],k[1],k[0]);for(v=0;v<O;v++)k=m[v],f(k[0]+K*l,k[1]+K*l,k[2]+K*l)}var J,N,Q=0;e(s);Q+=s.length;x=0;for(z=o.length;x<z;x++)u=o[x],e(u),Q+=u.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.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-
 (Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
 (Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
@@ -173,17 +173,17 @@ f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,k=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*k-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(j),e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
 THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,k=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*k-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(j),e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,k=[],j=[];for(i=0;i<=c;i++){var r=[],o=[];for(h=0;h<=b;h++){var m=h/b,l=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+l*f),a*Math.cos(g+l*f),a*Math.sin(d+m*e)*Math.sin(g+l*f))));r.push(this.vertices.length-1);o.push(new THREE.UV(m,l))}k.push(r);
-j.push(o)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],g=k[i+1][h],f=k[i+1][h+1],r=this.vertices[d].position.clone().normalize(),o=this.vertices[e].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),n=j[i][h+1].clone(),q=j[i][h].clone(),p=j[i+1][h].clone(),s=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[r,m,l])),this.faceVertexUvs[0].push([n,p,s])):Math.abs(this.vertices[g].position.y)==
-a?(this.faces.push(new THREE.Face3(d,e,g,[r,o,m])),this.faceVertexUvs[0].push([n,q,p])):(this.faces.push(new THREE.Face4(d,e,g,f,[r,o,m,l])),this.faceVertexUvs[0].push([n,q,p,s]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,k=[],j=[];for(i=0;i<=c;i++){var r=[],o=[];for(h=0;h<=b;h++){var l=h/b,n=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+l*e)*Math.sin(g+n*f),a*Math.cos(g+n*f),a*Math.sin(d+l*e)*Math.sin(g+n*f))));r.push(this.vertices.length-1);o.push(new THREE.UV(l,n))}k.push(r);
+j.push(o)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],g=k[i+1][h],f=k[i+1][h+1],r=this.vertices[d].position.clone().normalize(),o=this.vertices[e].position.clone().normalize(),l=this.vertices[g].position.clone().normalize(),n=this.vertices[f].position.clone().normalize(),m=j[i][h+1].clone(),q=j[i][h].clone(),p=j[i+1][h].clone(),s=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[r,l,n])),this.faceVertexUvs[0].push([m,p,s])):Math.abs(this.vertices[g].position.y)==
+a?(this.faces.push(new THREE.Face3(d,e,g,[r,o,l])),this.faceVertexUvs[0].push([m,q,p])):(this.faces.push(new THREE.Face4(d,e,g,f,[r,o,l,n])),this.faceVertexUvs[0].push([m,q,p,s]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 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 b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
 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 b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,k,j,r,o,m,l,n,q,p=b.glyphs[a]||b.glyphs["?"];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
-j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;m=b[a++]*c+d;l=b[a++]*c;e.quadraticCurveTo(m,l,i,j);if(f=g[g.length-1]){r=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var s=f/h,t=THREE.Shape.Utils.b2(s,r,m,i),s=THREE.Shape.Utils.b2(s,o,l,j);g.push(new THREE.Vector2(t,s))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,m=b[a++]*c+d,l=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,j,m,l,n,q),f=g[g.length-1]){r=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)s=f/h,t=THREE.Shape.Utils.b3(s,r,m,
-n,i),s=THREE.Shape.Utils.b3(s,o,l,q,j),g.push(new THREE.Vector2(t,s))}}}return{offset:p.ha*c,points:g,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,k,j;if(b(a)>0)for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var r=2*e;for(k=e-1;e>2;){if(r--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var o;a:{o=a;var m=i,l=k,n=j,q=e,p=f,s=void 0,t=void 0,w=void 0,
-y=void 0,u=void 0,x=void 0,z=void 0,A=void 0,F=void 0,t=o[p[m]].x,w=o[p[m]].y,y=o[p[l]].x,u=o[p[l]].y,x=o[p[n]].x,z=o[p[n]].y;if(1.0E-10>(y-t)*(z-w)-(u-w)*(x-t))o=!1;else{for(s=0;s<q;s++)if(!(s==m||s==l||s==n)){var A=o[p[s]].x,F=o[p[s]].y,v=void 0,D=void 0,B=void 0,G=void 0,I=void 0,E=void 0,K=void 0,O=void 0,C=void 0,L=void 0,H=void 0,M=void 0,v=B=I=void 0,v=x-y,D=z-u,B=t-x,G=w-z,I=y-t,E=u-w,K=A-t,O=F-w,C=A-y,L=F-u,H=A-x,M=F-z,v=v*L-D*C,I=I*O-E*K,B=B*M-G*H;if(v>=0&&B>=0&&I>=0){o=!1;break a}}o=!0}}if(o){g.push([a[f[i]],
+0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,k,j,r,o,l,n,m,q,p=b.glyphs[a]||b.glyphs["?"];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
+j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;l=b[a++]*c+d;n=b[a++]*c;e.quadraticCurveTo(l,n,i,j);if(f=g[g.length-1]){r=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var s=f/h,t=THREE.Shape.Utils.b2(s,r,l,i),s=THREE.Shape.Utils.b2(s,o,n,j);g.push(new THREE.Vector2(t,s))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,l=b[a++]*c+d,n=b[a++]*-c,m=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,j,l,n,m,q),f=g[g.length-1]){r=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)s=f/h,t=THREE.Shape.Utils.b3(s,r,l,
+m,i),s=THREE.Shape.Utils.b3(s,o,n,q,j),g.push(new THREE.Vector2(t,s))}}}return{offset:p.ha*c,points:g,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,k,j;if(b(a)>0)for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var r=2*e;for(k=e-1;e>2;){if(r--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var o;a:{o=a;var l=i,n=k,m=j,q=e,p=f,s=void 0,t=void 0,w=void 0,
+y=void 0,u=void 0,x=void 0,z=void 0,A=void 0,F=void 0,t=o[p[l]].x,w=o[p[l]].y,y=o[p[n]].x,u=o[p[n]].y,x=o[p[m]].x,z=o[p[m]].y;if(1.0E-10>(y-t)*(z-w)-(u-w)*(x-t))o=!1;else{for(s=0;s<q;s++)if(!(s==l||s==n||s==m)){var A=o[p[s]].x,F=o[p[s]].y,v=void 0,D=void 0,B=void 0,G=void 0,I=void 0,E=void 0,K=void 0,O=void 0,C=void 0,L=void 0,H=void 0,M=void 0,v=B=I=void 0,v=x-y,D=z-u,B=t-x,G=w-z,I=y-t,E=u-w,K=A-t,O=F-w,C=A-y,L=F-u,H=A-x,M=F-z,v=v*L-D*C,I=I*O-E*K,B=B*M-G*H;if(v>=0&&B>=0&&I>=0){o=!1;break a}}o=!0}}if(o){g.push([a[f[i]],
 a[f[k]],a[f[j]]]);h.push([f[i],f[k],f[j]]);i=k;for(j=k+1;j<e;i++,j++)f[i]=f[j];e--;r=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 a[f[k]],a[f[j]]]);h.push([f[i],f[k],f[j]]);i=k;for(j=k+1;j<e;i++,j++)f[i]=f[j];e--;r=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
@@ -192,13 +192,13 @@ THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e,f){b=c/d*a;
 this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=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);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
 this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=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);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
 e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,k,j])}this.computeCentroids();
 e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,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 b=this.subdivisions;b-- >0;)this.smooth(a)};
 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 b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,m,n,l=0;l<4;l++){n=i[l];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<n.length;p++)m=h.vertexColors[n[p]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=n.length;k.g/=n.length;k.b/=n.length;j.vertexColors[l]=k}}e.push(j);(!f.supportUVs||o.length!=0)&&g.push([o[a],o[b],o[c],o[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},r={},o=[],m,l,n,q,p,s=a.faceVertexUvs[0];m=0;for(l=s.length;m<l;m++){n=0;for(q=s[m].length;n<q;n++)p=d[m]["abcd".charAt(n)],o[p]||(o[p]=s[m][n])}var t;m=0;for(l=d.length;m<l;m++)if(p=d[m],k.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),f.supportUVs&&o.length!=0){t=new THREE.UV;if(p instanceof THREE.Face3)t.u=o[p.a].u+o[p.b].u+o[p.c].u,t.v=o[p.a].v+o[p.b].v+o[p.c].v,t.u/=3,t.v/=3;else if(p instanceof THREE.Face4)t.u=
-o[p.a].u+o[p.b].u+o[p.c].u+o[p.d].u,t.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,t.u/=4,t.v/=4;o.push(t)}l=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].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=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var w=0,s=h.length,y,u,x={},z={},A=function(a,
-b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){z[a]===void 0&&(z[a]={});z[a][b]=null};for(m in l){t=l[m];y=m.split("_");u=y[0];y=y[1];A(u,[u,y]);A(y,[u,y]);n=0;for(q=t.length;n<q;n++)p=t[n],F(u,p,m),F(y,p,m);t.length<2&&(r[m]=!0)}for(m in l)if(t=l[m],p=t[0],t=t[1],y=m.split("_"),u=y[0],y=y[1],q=new THREE.Vector3,r[m]?(q.addSelf(h[u].position),q.addSelf(h[y].position),q.multiplyScalar(0.5)):(q.addSelf(k[p]),q.addSelf(k[t]),q.addSelf(h[u].position),q.addSelf(h[y].position),q.multiplyScalar(0.25)),
-j[m]=s+d.length+w,i.push(new THREE.Vertex(q)),w++,f.supportUVs&&o.length!=0)t=new THREE.UV,t.u=o[u].u+o[y].u,t.v=o[u].v+o[y].v,t.u/=2,t.v/=2,o.push(t);var v,D;y=["123","12","2","23"];q=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],B=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];m=0;for(l=k.length;m<l;m++)p=d[m],t=s+m,p instanceof THREE.Face3?(w=c(p.a,p.b),u=c(p.b,p.c),v=c(p.c,p.a),b(t,j[w],p.b,j[u],p,y),b(t,j[u],p.c,j[v],p,q),b(t,j[v],p.a,j[w],
-p,A)):p instanceof THREE.Face4?(w=c(p.a,p.b),u=c(p.b,p.c),v=c(p.c,p.d),D=c(p.d,p.a),b(t,j[w],p.b,j[u],p,F),b(t,j[u],p.c,j[v],p,B),b(t,j[v],p.d,j[D],p,G),b(t,j[D],p.a,j[w],p,I)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(l=h.length;m<l;m++)if(x[m]!==void 0){i.set(0,0,0);j.set(0,0,0);p=new THREE.Vector3(0,0,0);t=0;for(n in z[m])i.addSelf(k[n]),t++;w=0;s=x[m].length;for(n=0;n<s;n++)r[c(x[m][n][0],x[m][n][1])]&&w++;if(w!=2){i.divideScalar(t);for(n=0;n<
-s;n++)t=x[m][n],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(s);p.addSelf(h[m].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(j.multiplyScalar(2));p.divideScalar(s);d[m].position=p}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,m,l,n=0;n<4;n++){l=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<l.length;p++)m=h.vertexColors[l[p]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[n]=k}}e.push(j);(!f.supportUVs||o.length!=0)&&g.push([o[a],o[b],o[c],o[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},r={},o=[],l,n,m,q,p,s=a.faceVertexUvs[0];l=0;for(n=s.length;l<n;l++){m=0;for(q=s[l].length;m<q;m++)p=d[l]["abcd".charAt(m)],o[p]||(o[p]=s[l][m])}var t;l=0;for(n=d.length;l<n;l++)if(p=d[l],k.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),f.supportUVs&&o.length!=0){t=new THREE.UV;if(p instanceof THREE.Face3)t.u=o[p.a].u+o[p.b].u+o[p.c].u,t.v=o[p.a].v+o[p.b].v+o[p.c].v,t.u/=3,t.v/=3;else if(p instanceof THREE.Face4)t.u=
+o[p.a].u+o[p.b].u+o[p.c].u+o[p.d].u,t.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,t.u/=4,t.v/=4;o.push(t)}n=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].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=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var w=0,s=h.length,y,u,x={},z={},A=function(a,
+b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){z[a]===void 0&&(z[a]={});z[a][b]=null};for(l in n){t=n[l];y=l.split("_");u=y[0];y=y[1];A(u,[u,y]);A(y,[u,y]);m=0;for(q=t.length;m<q;m++)p=t[m],F(u,p,l),F(y,p,l);t.length<2&&(r[l]=!0)}for(l in n)if(t=n[l],p=t[0],t=t[1],y=l.split("_"),u=y[0],y=y[1],q=new THREE.Vector3,r[l]?(q.addSelf(h[u].position),q.addSelf(h[y].position),q.multiplyScalar(0.5)):(q.addSelf(k[p]),q.addSelf(k[t]),q.addSelf(h[u].position),q.addSelf(h[y].position),q.multiplyScalar(0.25)),
+j[l]=s+d.length+w,i.push(new THREE.Vertex(q)),w++,f.supportUVs&&o.length!=0)t=new THREE.UV,t.u=o[u].u+o[y].u,t.v=o[u].v+o[y].v,t.u/=2,t.v/=2,o.push(t);var v,D;y=["123","12","2","23"];q=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],B=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];l=0;for(n=k.length;l<n;l++)p=d[l],t=s+l,p instanceof THREE.Face3?(w=c(p.a,p.b),u=c(p.b,p.c),v=c(p.c,p.a),b(t,j[w],p.b,j[u],p,y),b(t,j[u],p.c,j[v],p,q),b(t,j[v],p.a,j[w],
+p,A)):p instanceof THREE.Face4?(w=c(p.a,p.b),u=c(p.b,p.c),v=c(p.c,p.d),D=c(p.d,p.a),b(t,j[w],p.b,j[u],p,F),b(t,j[u],p.c,j[v],p,B),b(t,j[v],p.d,j[D],p,G),b(t,j[D],p.a,j[w],p,I)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;j=new THREE.Vector3;l=0;for(n=h.length;l<n;l++)if(x[l]!==void 0){i.set(0,0,0);j.set(0,0,0);p=new THREE.Vector3(0,0,0);t=0;for(m in z[l])i.addSelf(k[m]),t++;w=0;s=x[l].length;for(m=0;m<s;m++)r[c(x[l][m][0],x[l][m][1])]&&w++;if(w!=2){i.divideScalar(t);for(m=0;m<
+s;m++)t=x[l][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(s);p.addSelf(h[l].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(j.multiplyScalar(2));p.divideScalar(s);d[l].position=p}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;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=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 b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 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 b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
@@ -213,29 +213,29 @@ THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){var f=new XMLHtt
 f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
 g.responseType="arraybuffer";g.send(null)};
 g.responseType="arraybuffer";g.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,f,g,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=n.faceVertexUvs[0];var l=[];l.push(new THREE.UV(h,e));l.push(new THREE.UV(i,j));l.push(new THREE.UV(f,k));g.push(l)}}
-function j(b,c){var d,e,f,g,h,i,j,k,m,l,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];m=t[f*2+1];k=t[g*2];l=t[g*2+1];g=t[h*2];f=t[h*2+1];h=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(j,m));o.push(new THREE.UV(k,l));o.push(new THREE.UV(g,f));h.push(o)}}function r(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
-f,g,null,null,h))}function o(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,j,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];m=d[e*3+2];i=l[e];var p=s[k*3],o=s[k*3+1];k=s[k*3+2];var q=s[m*3],r=s[m*3+1];m=s[m*3+2];n.faces.push(new THREE.Face3(f,
-g,h,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(q,r,m)],null,i))}}function l(b,c,d,e){for(var f,g,h,i,j,k,m,l,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];m=d[e*4+1];l=d[e*4+2];p=d[e*4+3];j=o[e];var q=s[m*3],r=s[m*3+1];m=s[m*3+2];var t=s[l*3],u=s[l*3+1];l=s[l*3+2];var w=s[p*3],x=s[p*3+1];p=s[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(s[k*
-3],s[k*3+1],s[k*3+2]),new THREE.Vector3(q,r,m),new THREE.Vector3(t,u,l),new THREE.Vector3(w,x,p)],null,j))}}var n=this,q=0,p,s=[],t=[],w,y,u,x,z,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);p={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=m.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));n.push(new THREE.UV(f,k));g.push(n)}}
+function j(b,c){var d,e,f,g,h,i,j,k,l,n,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];l=t[f*2+1];k=t[g*2];n=t[g*2+1];g=t[h*2];f=t[h*2+1];h=m.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(j,l));o.push(new THREE.UV(k,n));o.push(new THREE.UV(g,f));h.push(o)}}function r(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],m.faces.push(new THREE.Face3(e,
+f,g,null,null,h))}function o(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],m.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function l(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=n[e];var p=s[k*3],o=s[k*3+1];k=s[k*3+2];var q=s[l*3],r=s[l*3+1];l=s[l*3+2];m.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(q,r,l)],null,i))}}function n(b,c,d,e){for(var f,g,h,i,j,k,l,n,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];n=d[e*4+2];p=d[e*4+3];j=o[e];var q=s[l*3],r=s[l*3+1];l=s[l*3+2];var t=s[n*3],u=s[n*3+1];n=s[n*3+2];var w=s[p*3],x=s[p*3+1];p=s[p*3+2];m.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(s[k*
+3],s[k*3+1],s[k*3+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(t,u,n),new THREE.Vector3(w,x,p)],null,j))}}var m=this,q=0,p,s=[],t=[],w,y,u,x,z,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(m,d,b);p={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
 q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};p.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=p.header_bytes;b=p.vertex_index_bytes*3+p.material_index_bytes;A=p.vertex_index_bytes*
 q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};p.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=p.header_bytes;b=p.vertex_index_bytes*3+p.material_index_bytes;A=p.vertex_index_bytes*
-4+p.material_index_bytes;w=p.ntri_flat*b;y=p.ntri_smooth*(b+p.normal_index_bytes*3);u=p.ntri_flat_uv*(b+p.uv_index_bytes*3);x=p.ntri_smooth_uv*(b+p.normal_index_bytes*3+p.uv_index_bytes*3);z=p.nquad_flat*A;b=p.nquad_smooth*(A+p.normal_index_bytes*4);A=p.nquad_flat_uv*(A+p.uv_index_bytes*4);q+=function(b){var c=p.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
+4+p.material_index_bytes;w=p.ntri_flat*b;y=p.ntri_smooth*(b+p.normal_index_bytes*3);u=p.ntri_flat_uv*(b+p.uv_index_bytes*3);x=p.ntri_smooth_uv*(b+p.normal_index_bytes*3+p.uv_index_bytes*3);z=p.nquad_flat*A;b=p.nquad_smooth*(A+p.normal_index_bytes*4);A=p.nquad_flat_uv*(A+p.uv_index_bytes*4);q+=function(b){var c=p.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],m.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
 q+=function(b){var c=p.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],s.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(p.nnormals*3);q+=function(b){var c=p.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);w=q+w+c(p.ntri_flat*2);y=w+y+c(p.ntri_smooth*2);u=y+u+c(p.ntri_flat_uv*2);x=u+x+c(p.ntri_smooth_uv*2);z=x+z+c(p.nquad_flat*2);
 q+=function(b){var c=p.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],s.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(p.nnormals*3);q+=function(b){var c=p.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);w=q+w+c(p.ntri_flat*2);y=w+y+c(p.ntri_smooth*2);u=y+u+c(p.ntri_flat_uv*2);x=u+x+c(p.ntri_smooth_uv*2);z=x+z+c(p.nquad_flat*2);
-b=z+b+c(p.nquad_smooth*2);A=b+A+c(p.nquad_flat_uv*2);(function(a){var b=p.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;r(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(y);(function(a){var b=p.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(u);(function(a){var b=p.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
-c)}})(b);(function(a){var b=p.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=p.ntri_flat;b&&r(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=p.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=p.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
-p.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(z);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
+b=z+b+c(p.nquad_smooth*2);A=b+A+c(p.nquad_flat_uv*2);(function(a){var b=p.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;r(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(y);(function(a){var b=p.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(u);(function(a){var b=p.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
+c)}})(b);(function(a){var b=p.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;n(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=p.ntri_flat;b&&r(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=p.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=p.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
+p.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;n(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(z);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
 THREE.ColladaLoader=function(){function a(a,d,e){P=a;d=d||ca;e!==void 0&&(a=e.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");Z=b("//dae:library_images/dae:image",f,"image");$=b("//dae:library_materials/dae:material",z,"material");aa=b("//dae:library_effects/dae:effect",B,"effect");S=b("//dae:library_geometries/dae:geometry",q,"geometry");R=b("//dae:library_controllers/dae:controller",h,"controller");U=b("//dae:library_animations/dae:animation",I,"animation");ba=b(".//dae:library_visual_scenes/dae:visual_scene",
 THREE.ColladaLoader=function(){function a(a,d,e){P=a;d=d||ca;e!==void 0&&(a=e.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");Z=b("//dae:library_images/dae:image",f,"image");$=b("//dae:library_materials/dae:material",z,"material");aa=b("//dae:library_effects/dae:effect",B,"effect");S=b("//dae:library_geometries/dae:geometry",q,"geometry");R=b("//dae:library_controllers/dae:controller",h,"controller");U=b("//dae:library_animations/dae:animation",I,"animation");ba=b(".//dae:library_visual_scenes/dae:visual_scene",
 j,"visual_scene");W=[];X=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ba[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(g(T.nodes[a]));c();for(var i in U);i={scene:Y,morphs:W,skins:X,dae:{images:Z,materials:$,effects:aa,geometries:S,controllers:R,animations:U,visualScenes:ba,scene:T}};d&&d(i);return i}function b(a,b,c){for(var a=P.evaluate(a,P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 j,"visual_scene");W=[];X=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ba[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(g(T.nodes[a]));c();for(var i in U);i={scene:Y,morphs:W,skins:X,dae:{images:Z,materials:$,effects:aa,geometries:S,controllers:R,animations:U,visualScenes:ba,scene:T}};d&&d(i);return i}function b(a,b,c){for(var a=P.evaluate(a,P,C,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 c(){var a=1E6,b=-a,c=0,d;for(d in U)for(var e=U[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
 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 c(){var a=1E6,b=-a,c=0,d;for(d in U)for(var e=U[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 e(a,b,e){var f=R[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=c(),b=T.getChildById(b.skeleton[0],!0)||T.getChildBySid(b.skeleton[0],!0),h,i,j,k,m=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 l=[],p=[];for(h=0;h<a.vertices.length;h++)p.push(new THREE.Vertex(new THREE.Vector3));d(b,l,e);h=l;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],n=-1,j.type=="JOINT"){for(var o=0;o<i.joints.length;o++)if(j.sid==i.joints[o]){n=o;break}if(n>=0){o=i.invBindMatrices[n];j.invBindMatrix=o;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,o);j.weights=[];for(o=0;o<i.weights.length;o++)for(var q=0;q<i.weights[o].length;q++){var r=i.weights[o][q];r.joint==n&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<l.length;h++)if(l[h].type=="JOINT")for(i=0;i<l[h].weights.length;i++)j=l[h].weights[i],k=j.index,j=j.weight,n=a.vertices[k],k=p[k],m.x=n.position.x,m.y=n.position.y,m.z=n.position.z,l[h].skinningMatrix.multiplyVector3(m),k.position.x+=m.x*j,k.position.y+=m.y*j,k.position.z+=m.z*j;a.morphTargets.push({name:"target_"+e,vertices:p})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=R[a.controllers[f].url];switch(i.type){case "skin":if(S[i.skin.source]){var j=
-new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(R[i.skin.source]&&(d=i=R[i.skin.source],i.morph&&S[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(S[i.morph.source])j=new n,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=S[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=aa[$[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)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=R[c.url],j.skinInstanceController=c,j.name="skin_"+X.length,X.push(j);else if(d!==void 0){h=i;k=d instanceof m?R[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=S[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_"+W.length;W.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(g(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 j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function r(){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 m(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function l(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function y(){this.input={}}function u(){this.semantic=
+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 e(a,b,e){var f=R[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=c(),b=T.getChildById(b.skeleton[0],!0)||T.getChildBySid(b.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=[],p=[];for(h=0;h<a.vertices.length;h++)p.push(new THREE.Vertex(new THREE.Vector3));d(b,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 o=0;o<i.joints.length;o++)if(j.sid==i.joints[o]){m=o;break}if(m>=0){o=i.invBindMatrices[m];j.invBindMatrix=o;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,o);j.weights=[];for(o=0;o<i.weights.length;o++)for(var q=0;q<i.weights[o].length;q++){var r=i.weights[o][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=p[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:p})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=R[a.controllers[f].url];switch(i.type){case "skin":if(S[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(R[i.skin.source]&&(d=i=R[i.skin.source],i.morph&&S[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(S[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=S[i.url],k={},n=0,p;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++){p=j[h];var o=aa[$[p.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;p=k[p.symbol]=o.material;n++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(n>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)n=
+i.faces[h],n.materials=[k[n.daeMaterial]]}if(c!==void 0)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=R[c.url],j.skinInstanceController=c,j.name="skin_"+X.length,X.push(j);else if(d!==void 0){h=i;k=d instanceof l?R[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(n=0;n<k.targets.length;n++)if(o=S[k.targets[n]],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_"+W.length;W.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(g(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 j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function r(){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 l(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function n(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function y(){this.input={}}function u(){this.semantic=
 "";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function z(){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 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.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function z(){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 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 B(){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 K(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");
 this.source=null}function B(){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 K(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(V[b]!=void 0)return V[b];V[b]=(new x(b)).parse(a);return V[b]}function C(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function J(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function N(a,
 if(V[b]!=void 0)return V[b];V[b]=(new x(b)).parse(a);return V[b]}function C(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function J(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function N(a,
@@ -248,18 +248,18 @@ a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new u).
 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 r).parse(c))}}return this};r.prototype.getChannelForTransform=
 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 r).parse(c))}}return this};r.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};r.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,
 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};r.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};r.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};r.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};r.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");
 b);if(d)return d}return null};r.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};r.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};r.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 r).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=
+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 r).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new l).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=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new r).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 U)for(var e=U[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
 b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new r).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 U)for(var e=U[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=
 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};r.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
 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};r.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=L(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[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(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;
-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};m.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,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new l).parse(d)),d=c.iterateNext()}}return this};l.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.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,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new l).parse(b)),b=a.iterateNext();break}}return this};q.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=
+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};l.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,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new n).parse(d)),d=c.iterateNext()}}return this};n.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=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new n).parse(b)),b=a.iterateNext();break}}return this};q.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=Q(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 t).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(d))}}var e=
 (new p(this)).parse(c)}}return this};p.prototype.parse=function(a){function b(a,c){var d=Q(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 t).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).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();
 {};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};p.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=[],r={},s=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;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=Q(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":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":s.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]],s.length?s: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]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<p.length;f++)e=r[p[f]],b.faceVertexUvs[f].push([e[0],
+return this};p.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,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=[],q=[],r={},s=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;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=Q(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":s.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;m==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):m==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
 e[1],e[2]]);d+=h.length*m}};s.prototype=new t;s.prototype.constructor=s;t.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};t.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 u).parse(a.childNodes[b]));break;case "vcount":this.vcount=
 e[1],e[2]]);d+=h.length*m}};s.prototype=new t;s.prototype.constructor=s;t.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};t.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 u).parse(a.childNodes[b]));break;case "vcount":this.vcount=
 H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.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};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
 H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.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};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 u).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};u.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=M(c.textContent).split(/\s+/),
 "input"){var c=(new u).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};u.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=M(c.textContent).split(/\s+/),
@@ -281,28 +281,28 @@ Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.i
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
 g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,k,j,r,o,m,l,n,q,p,s,t,w=a.faces;r=a.vertices;var y=a.normals,u=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=r.length;k<
-j;)o=new THREE.Vertex,o.position.x=r[k++]*b,o.position.y=r[k++]*b,o.position.z=r[k++]*b,d.vertices.push(o);k=0;for(j=w.length;k<j;){b=w[k++];r=b&1;i=b&2;c=b&4;e=b&8;m=b&16;o=b&32;n=b&64;b&=128;r?(q=new THREE.Face4,q.a=w[k++],q.b=w[k++],q.c=w[k++],q.d=w[k++],r=4):(q=new THREE.Face3,q.a=w[k++],q.b=w[k++],q.c=w[k++],r=3);if(i)i=w[k++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)p=a.uvs[c],l=w[k++],t=p[l*2],l=p[l*2+1],d.faceUvs[c][i]=new THREE.UV(t,l);if(e)for(c=0;c<x;c++){p=a.uvs[c];s=[];
-for(e=0;e<r;e++)l=w[k++],t=p[l*2],l=p[l*2+1],s[e]=new THREE.UV(t,l);d.faceVertexUvs[c][i]=s}if(m)m=w[k++]*3,e=new THREE.Vector3,e.x=y[m++],e.y=y[m++],e.z=y[m],q.normal=e;if(o)for(c=0;c<r;c++)m=w[k++]*3,e=new THREE.Vector3,e.x=y[m++],e.y=y[m++],e.z=y[m],q.vertexNormals.push(e);if(n)o=w[k++],o=new THREE.Color(u[o]),q.color=o;if(b)for(c=0;c<r;c++)o=w[k++],o=new THREE.Color(u[o]),q.vertexColors.push(o);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,j,r,o,m,l;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
-l=a.morphTargets[c].vertices;i=0;for(k=l.length;i<k;i+=3)j=l[i]*b,r=l[i+1]*b,o=l[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(j,r,o)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;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)r=new THREE.Color(16755200),r.setRGB(j[b],j[b+1],j[b+2]),k.push(r)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,k,j,r,o,l,n,m,q,p,s,t,w=a.faces;r=a.vertices;var y=a.normals,u=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=r.length;k<
+j;)o=new THREE.Vertex,o.position.x=r[k++]*b,o.position.y=r[k++]*b,o.position.z=r[k++]*b,d.vertices.push(o);k=0;for(j=w.length;k<j;){b=w[k++];r=b&1;i=b&2;c=b&4;e=b&8;l=b&16;o=b&32;m=b&64;b&=128;r?(q=new THREE.Face4,q.a=w[k++],q.b=w[k++],q.c=w[k++],q.d=w[k++],r=4):(q=new THREE.Face3,q.a=w[k++],q.b=w[k++],q.c=w[k++],r=3);if(i)i=w[k++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)p=a.uvs[c],n=w[k++],t=p[n*2],n=p[n*2+1],d.faceUvs[c][i]=new THREE.UV(t,n);if(e)for(c=0;c<x;c++){p=a.uvs[c];s=[];
+for(e=0;e<r;e++)n=w[k++],t=p[n*2],n=p[n*2+1],s[e]=new THREE.UV(t,n);d.faceVertexUvs[c][i]=s}if(l)l=w[k++]*3,e=new THREE.Vector3,e.x=y[l++],e.y=y[l++],e.z=y[l],q.normal=e;if(o)for(c=0;c<r;c++)l=w[k++]*3,e=new THREE.Vector3,e.x=y[l++],e.y=y[l++],e.z=y[l],q.vertexNormals.push(e);if(m)o=w[k++],o=new THREE.Color(u[o]),q.color=o;if(b)for(c=0;c<r;c++)o=w[k++],o=new THREE.Color(u[o]),q.vertexColors.push(o);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,j,r,o,l,n;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;
+n=a.morphTargets[c].vertices;i=0;for(k=n.length;i<k;i+=3)j=n[i]*b,r=n[i+1]*b,o=n[i+2]*b,l.push(new THREE.Vertex(new THREE.Vector3(j,r,o)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;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)r=new THREE.Color(16755200),r.setRGB(j[b],j[b+1],j[b+2]),k.push(r)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();b(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;
 d.computeTangents();b(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,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),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)};
 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,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(o in B.objects)if(!C.objects[o])if(p=B.objects[o],p.geometry!==void 0){if(A=C.geometries[p.geometry]){a=!1;for(H=0;H<p.materials.length;H++)D=C.materials[p.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=p.position;y=p.rotation;u=p.quaternion;x=p.scale;u=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
 THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(o in B.objects)if(!C.objects[o])if(p=B.objects[o],p.geometry!==void 0){if(A=C.geometries[p.geometry]){a=!1;for(H=0;H<p.materials.length;H++)D=C.materials[p.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=p.position;y=p.rotation;u=p.quaternion;x=p.scale;u=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
 a=new THREE.Mesh(A,D);a.name=o;a.position.set(w[0],w[1],w[2]);u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(x[0],x[1],x[2]);a.visible=p.visible;C.scene.add(a);C.objects[o]=a;if(p.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(p.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;p.trigger&&p.trigger.toLowerCase()!="none"&&(b=
 a=new THREE.Mesh(A,D);a.name=o;a.position.set(w[0],w[1],w[2]);u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(x[0],x[1],x[2]);a.visible=p.visible;C.scene.add(a);C.objects[o]=a;if(p.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(p.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;p.trigger&&p.trigger.toLowerCase()!="none"&&(b=
 {type:p.trigger,object:p},C.triggers[a.name]=b)}}else w=p.position,y=p.rotation,u=p.quaternion,x=p.scale,u=0,a=new THREE.Object3D,a.name=o,a.position.set(w[0],w[1],w[2]),u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(x[0],x[1],x[2]),a.visible=p.visible!==void 0?p.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,p.trigger&&p.trigger.toLowerCase()!="none"&&(b={type:p.trigger,object:p},C.triggers[a.name]=b)}function g(a){return function(b){C.geometries[a]=
 {type:p.trigger,object:p},C.triggers[a.name]=b)}}else w=p.position,y=p.rotation,u=p.quaternion,x=p.scale,u=0,a=new THREE.Object3D,a.name=o,a.position.set(w[0],w[1],w[2]),u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(x[0],x[1],x[2]),a.visible=p.visible!==void 0?p.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,p.trigger&&p.trigger.toLowerCase()!="none"&&(b={type:p.trigger,object:p},C.triggers[a.name]=b)}function g(a){return function(b){C.geometries[a]=
-b;e();I-=1;i.onLoadComplete();h()}}function f(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:K,totalTextures:O,loadedModels:K-I,loadedTextures:O-E},C);i.onLoadProgress();I==0&&E==0&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,r,o,m,l,n,q,p,s,t,w,y,u,x,z,A,F,v,D,B,G,I,E,K,O,C;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(o in B.objects)if(p=B.objects[o],p.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;s=B.transform.rotation;var L=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);s&&C.scene.rotation.set(s[0],s[1],s[2]);L&&C.scene.scale.set(L[0],L[1],L[2]);(a||s||L)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(l in B.cameras)s=B.cameras[l],s.type=="perspective"?F=new THREE.PerspectiveCamera(s.fov,
-s.aspect,s.near,s.far):s.type=="ortho"&&(F=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far)),w=s.position,s=s.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(s[0],s[1],s[2]),C.cameras[l]=F;for(m in B.lights)s=B.lights[m],l=s.color!==void 0?s.color:16777215,F=s.intensity!==void 0?s.intensity:1,s.type=="directional"?(w=s.direction,t=new THREE.DirectionalLight(l,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):s.type=="point"?(w=s.position,t=s.distance,
-t=new THREE.PointLight(l,F,t),t.position.set(w[0],w[1],w[2])):s.type=="ambient"&&(t=new THREE.AmbientLight(l)),C.scene.add(t),C.lights[m]=t;for(n in B.fogs)m=B.fogs[n],m.type=="linear"?v=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(v=new THREE.FogExp2(0,m.density)),s=m.color,v.color.setRGB(s[0],s[1],s[2]),C.fogs[n]=v;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];s=B.defaults.bgcolor;C.bgColor=new THREE.Color;
-C.bgColor.setRGB(s[0],s[1],s[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(n=B.geometries[j],n.type=="bin_mesh"||n.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in B.geometries)n=B.geometries[j],n.type=="cube"?(A=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),C.geometries[j]=A):n.type=="plane"?(A=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),C.geometries[j]=A):n.type=="sphere"?
-(A=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),C.geometries[j]=A):n.type=="cylinder"?(A=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),C.geometries[j]=A):n.type=="torus"?(A=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),C.geometries[j]=A):n.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(n.subdivisions),C.geometries[j]=A):n.type=="bin_mesh"?c.load(d(n.url,B.urlBaseType),g(j)):n.type=="ascii_mesh"?G.load(d(n.url,B.urlBaseType),
-g(j)):n.type=="embedded_mesh"&&(n=B.embeds[n.id])&&G.createModel(n,f(j),"");for(q in B.textures)if(j=B.textures[q],j.url instanceof Array){E+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(q in B.textures){j=B.textures[q];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=[];for(var H=0;H<j.url.length;H++)n[H]=d(j.url[H],B.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(j.url,
-B.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.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)n.wrapS=v[j.wrap[0]];if(v[j.wrap[1]]!==void 0)n.wrapT=
-v[j.wrap[1]]}}C.textures[q]=n}for(r in B.materials){q=B.materials[r];for(z in q.parameters)if(z=="envMap"||z=="map"||z=="lightMap")q.parameters[z]=C.textures[q.parameters[z]];else if(z=="shading")q.parameters[z]=q.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z=="blending")q.parameters[z]=THREE[q.parameters[z]]?THREE[q.parameters[z]]:THREE.NormalBlending;else if(z=="combine")q.parameters[z]=q.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==
-"vertexColors")if(q.parameters[z]=="face")q.parameters[z]=THREE.FaceColors;else if(q.parameters[z])q.parameters[z]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);n=q.parameters.color;v=q.parameters.specular;c=q.parameters.ambient;G=q.parameters.shininess;a.tNormal.texture=C.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
-q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=C.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(v);a.uAmbientColor.value.setHex(c);a.uShininess.value=G;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
+b;e();I-=1;i.onLoadComplete();h()}}function f(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:K,totalTextures:O,loadedModels:K-I,loadedTextures:O-E},C);i.onLoadProgress();I==0&&E==0&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,r,o,l,n,m,q,p,s,t,w,y,u,x,z,A,F,v,D,B,G,I,E,K,O,C;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(o in B.objects)if(p=B.objects[o],p.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;s=B.transform.rotation;var L=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);s&&C.scene.rotation.set(s[0],s[1],s[2]);L&&C.scene.scale.set(L[0],L[1],L[2]);(a||s||L)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(n in B.cameras)s=B.cameras[n],s.type=="perspective"?F=new THREE.PerspectiveCamera(s.fov,
+s.aspect,s.near,s.far):s.type=="ortho"&&(F=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far)),w=s.position,s=s.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(s[0],s[1],s[2]),C.cameras[n]=F;for(l in B.lights)s=B.lights[l],n=s.color!==void 0?s.color:16777215,F=s.intensity!==void 0?s.intensity:1,s.type=="directional"?(w=s.direction,t=new THREE.DirectionalLight(n,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):s.type=="point"?(w=s.position,t=s.distance,
+t=new THREE.PointLight(n,F,t),t.position.set(w[0],w[1],w[2])):s.type=="ambient"&&(t=new THREE.AmbientLight(n)),C.scene.add(t),C.lights[l]=t;for(m in B.fogs)l=B.fogs[m],l.type=="linear"?v=new THREE.Fog(0,l.near,l.far):l.type=="exp2"&&(v=new THREE.FogExp2(0,l.density)),s=l.color,v.color.setRGB(s[0],s[1],s[2]),C.fogs[m]=v;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];s=B.defaults.bgcolor;C.bgColor=new THREE.Color;
+C.bgColor.setRGB(s[0],s[1],s[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(m=B.geometries[j],m.type=="bin_mesh"||m.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in B.geometries)m=B.geometries[j],m.type=="cube"?(A=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[j]=A):m.type=="plane"?(A=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="sphere"?
+(A=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="cylinder"?(A=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[j]=A):m.type=="torus"?(A=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[j]=A):m.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(m.subdivisions),C.geometries[j]=A):m.type=="bin_mesh"?c.load(d(m.url,B.urlBaseType),g(j)):m.type=="ascii_mesh"?G.load(d(m.url,B.urlBaseType),
+g(j)):m.type=="embedded_mesh"&&(m=B.embeds[m.id])&&G.createModel(m,f(j),"");for(q in B.textures)if(j=B.textures[q],j.url instanceof Array){E+=j.url.length;for(m=0;m<j.url.length;m++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(q in B.textures){j=B.textures[q];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){m=[];for(var H=0;H<j.url.length;H++)m[H]=d(j.url[H],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,j.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(j.url,
+B.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)m.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)m.magFilter=THREE[j.magFilter];if(j.repeat){m.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}j.offset&&m.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)m.wrapS=v[j.wrap[0]];if(v[j.wrap[1]]!==void 0)m.wrapT=
+v[j.wrap[1]]}}C.textures[q]=m}for(r in B.materials){q=B.materials[r];for(z in q.parameters)if(z=="envMap"||z=="map"||z=="lightMap")q.parameters[z]=C.textures[q.parameters[z]];else if(z=="shading")q.parameters[z]=q.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z=="blending")q.parameters[z]=THREE[q.parameters[z]]?THREE[q.parameters[z]]:THREE.NormalBlending;else if(z=="combine")q.parameters[z]=q.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==
+"vertexColors")if(q.parameters[z]=="face")q.parameters[z]=THREE.FaceColors;else if(q.parameters[z])q.parameters[z]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);m=q.parameters.color;v=q.parameters.specular;c=q.parameters.ambient;G=q.parameters.shininess;a.tNormal.texture=C.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
+q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=C.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(v);a.uAmbientColor.value.setHex(c);a.uShininess.value=G;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
 vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);C.materials[r]=q}e();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);C.materials[r]=q}e();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 b,e,g,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 b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
 b,e,g,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 b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
@@ -314,16 +314,16 @@ c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=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=
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
 this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,k,j,r){f=(f-j)/(r-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=k;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,k,j,r){f=(f-j)/(r-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=k;b=a+this.yd*
 this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,k,j,r){f=(f-j)/(r-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=k;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,k,j,r){f=(f-j)/(r-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=k;b=a+this.yd*
 3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,k,j,r){f=(f-j)/(r-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=k+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
 3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,k,j,r){f=(f-j)/(r-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=k+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,k=g+this.yd,j=g+this.zd,r=i+this.yd,o=i+this.zd,m=g+this.yd+this.zd,l=i+this.yd+this.zd,n=0,q=this.field[g],p=this.field[i],s=this.field[k],t=this.field[r],w=this.field[j],y=this.field[o],u=this.field[m],x=this.field[l];q<f&&(n|=1);p<f&&(n|=2);s<f&&(n|=8);t<f&&(n|=4);w<f&&(n|=16);y<f&&(n|=32);u<f&&(n|=128);x<f&&(n|=64);var z=THREE.edgeTable[n];if(z===0)return 0;var A=this.delta,F=a+
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,k=g+this.yd,j=g+this.zd,r=i+this.yd,o=i+this.zd,l=g+this.yd+this.zd,n=i+this.yd+this.zd,m=0,q=this.field[g],p=this.field[i],s=this.field[k],t=this.field[r],w=this.field[j],y=this.field[o],u=this.field[l],x=this.field[n];q<f&&(m|=1);p<f&&(m|=2);s<f&&(m|=8);t<f&&(m|=4);w<f&&(m|=16);y<f&&(m|=32);u<f&&(m|=128);x<f&&(m|=64);var z=THREE.edgeTable[m];if(z===0)return 0;var A=this.delta,F=a+
 A,v=b+A,A=e+A;z&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,p));z&2&&(this.compNorm(i),this.compNorm(r),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,b,e,p,t));z&4&&(this.compNorm(k),this.compNorm(r),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,v,e,s,t));z&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,s));z&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,A,w,y));z&32&&(this.compNorm(o),
 A,v=b+A,A=e+A;z&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,p));z&2&&(this.compNorm(i),this.compNorm(r),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,b,e,p,t));z&4&&(this.compNorm(k),this.compNorm(r),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,v,e,s,t));z&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,s));z&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,A,w,y));z&32&&(this.compNorm(o),
-this.compNorm(l),this.VIntY(o*3,this.vlist,this.nlist,15,f,F,b,A,y,x));z&64&&(this.compNorm(m),this.compNorm(l),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,v,A,u,x));z&128&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,A,w,u));z&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,w));z&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,b,e,p,y));z&1024&&(this.compNorm(r),this.compNorm(l),this.VIntZ(r*
-3,this.vlist,this.nlist,30,f,F,v,e,t,x));z&2048&&(this.compNorm(k),this.compNorm(m),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,v,e,s,u));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
+this.compNorm(n),this.VIntY(o*3,this.vlist,this.nlist,15,f,F,b,A,y,x));z&64&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,18,f,a,v,A,u,x));z&128&&(this.compNorm(j),this.compNorm(l),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,A,w,u));z&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,w));z&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,b,e,p,y));z&1024&&(this.compNorm(r),this.compNorm(n),this.VIntZ(r*
+3,this.vlist,this.nlist,30,f,F,v,e,t,x));z&2048&&(this.compNorm(k),this.compNorm(l),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,v,e,s,u));m<<=4;for(f=g=0;THREE.triTable[m+f]!=-1;)a=m+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
 4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
 4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[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 b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,k=b*this.size,j=a*this.size,r=Math.floor(i-h);r<1&&(r=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var m=Math.floor(j-h);m<1&&(m=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
-1);for(var l,n,q,p,s,t;r<i;r++){j=this.size2*r;n=r/this.size-e;s=n*n;for(n=o;n<k;n++){q=j+this.size*n;l=n/this.size-b;t=l*l;for(l=m;l<h;l++)p=l/this.size-a,p=g/(1.0E-6+p*p+t+s)-f,p>0&&(this.field[q+l]+=p)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,j=this.yd,r=this.zd,o=this.field,m=k*Math.sqrt(a/b);m>k&&(m=k);for(e=0;e<m;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<k;g++){i=e+g*j;for(f=0;f<k;f++)o[r*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,k,j=this.size,r=this.yd,o=
-this.zd,m=this.field,l=j*Math.sqrt(a/b);l>j&&(l=j);for(g=0;g<l;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*r;for(e=0;e<j;e++){k=i+e;for(f=0;f<j;f++)m[o*f+k]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,k,j=this.size,r=this.yd,o=this.zd,m=this.field,l=j*Math.sqrt(a/b);l>j&&(l=j);for(f=0;f<l;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=o*f;for(g=0;g<j;g++){k=i+g*r;for(e=0;e<j;e++)m[k+e]+=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 b,e,g,f,h,i,k,j,r,o=this.size-2;for(f=1;f<o;f++){r=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++){j=r+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<o;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,k,j,r,o,m;for(f=0;f<g.count;f++)o=f*3,j=o+1,m=o+2,h=g.positionArray[o],i=g.positionArray[j],k=
-g.positionArray[m],r=new THREE.Vector3(h,i,k),h=g.normalArray[o],i=g.normalArray[j],k=g.normalArray[m],o=new THREE.Vector3(h,i,k),o.normalize(),j=new THREE.Vertex(r),b.vertices.push(j),e.push(o);r=g.count/3;for(f=0;f<r;f++)o=(a+f)*3,j=o+1,m=o+2,h=e[o],i=e[j],k=e[m],o=new THREE.Face3(o,j,m,[h,i,k]),b.faces.push(o);a+=r;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,k=b*this.size,j=a*this.size,r=Math.floor(i-h);r<1&&(r=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var l=Math.floor(j-h);l<1&&(l=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
+1);for(var n,m,q,p,s,t;r<i;r++){j=this.size2*r;m=r/this.size-e;s=m*m;for(m=o;m<k;m++){q=j+this.size*m;n=m/this.size-b;t=n*n;for(n=l;n<h;n++)p=n/this.size-a,p=g/(1.0E-6+p*p+t+s)-f,p>0&&(this.field[q+n]+=p)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,j=this.yd,r=this.zd,o=this.field,l=k*Math.sqrt(a/b);l>k&&(l=k);for(e=0;e<l;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<k;g++){i=e+g*j;for(f=0;f<k;f++)o[r*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,k,j=this.size,r=this.yd,o=
+this.zd,l=this.field,n=j*Math.sqrt(a/b);n>j&&(n=j);for(g=0;g<n;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*r;for(e=0;e<j;e++){k=i+e;for(f=0;f<j;f++)l[o*f+k]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,k,j=this.size,r=this.yd,o=this.zd,l=this.field,n=j*Math.sqrt(a/b);n>j&&(n=j);for(f=0;f<n;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=o*f;for(g=0;g<j;g++){k=i+g*r;for(e=0;e<j;e++)l[k+e]+=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 b,e,g,f,h,i,k,j,r,o=this.size-2;for(f=1;f<o;f++){r=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++){j=r+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<o;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,k,j,r,o,l;for(f=0;f<g.count;f++)o=f*3,j=o+1,l=o+2,h=g.positionArray[o],i=g.positionArray[j],k=
+g.positionArray[l],r=new THREE.Vector3(h,i,k),h=g.normalArray[o],i=g.normalArray[j],k=g.normalArray[l],o=new THREE.Vector3(h,i,k),o.normalize(),j=new THREE.Vertex(r),b.vertices.push(j),e.push(o);r=g.count/3;for(f=0;f<r;f++)o=(a+f)*3,j=o+1,l=o+2,h=e[o],i=e[j],k=e[l],o=new THREE.Face3(o,j,l,[h,i,k]),b.faces.push(o);a+=r;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 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]);
 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]);
@@ -355,29 +355,29 @@ d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.verti
 d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
 d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
 b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
 b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
 !0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
 !0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
-"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var k=new THREE.Vector3,j=h/f,r=f*0.5,o=h*0.5,m=16/h,l=new THREE.Vector2(m*j,m),n=new THREE.Vector3(1,1,0),q=new THREE.Vector2(1,1),p=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
-b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(p.occlusionMap,0);b.uniform1i(p.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var s,t,w,y,u;for(s=0;s<i;s++)if(m=16/h,l.set(m*j,m),y=a[s],k.set(y.matrixWorld.n14,y.matrixWorld.n24,y.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(k),
-g.projectionMatrix.multiplyVector3(k),n.copy(k),q.x=n.x*r+r,q.y=n.y*o+o,d.hasVertexTexture||q.x>0&&q.x<f&&q.y>0&&q.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,q.x-8,q.y-8,16,16,0);b.uniform1i(p.renderType,0);b.uniform2f(p.scale,l.x,l.y);b.uniform3f(p.screenPosition,n.x,n.y,n.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
-b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,q.x-8,q.y-8,16,16,0);b.uniform1i(p.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);y.positionScreen.copy(n);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(p.renderType,2);b.enable(b.BLEND);t=0;for(w=y.lensFlares.length;t<w;t++)if(u=y.lensFlares[t],u.opacity>0.0010&&u.scale>0.0010)n.x=u.x,n.y=u.y,n.z=u.z,m=u.size*u.scale/
-h,l.x=m*j,l.y=m,b.uniform3f(p.screenPosition,n.x,n.y,n.z),b.uniform2f(p.scale,l.x,l.y),b.uniform1f(p.rotation,u.rotation),b.uniform1f(p.opacity,u.opacity),b.uniform3f(p.color,u.color.r,u.color.g,u.color.b),c.setBlending(u.blending),c.setTexture(u.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var k=new THREE.Vector3,j=h/f,r=f*0.5,o=h*0.5,l=16/h,n=new THREE.Vector2(l*j,l),m=new THREE.Vector3(1,1,0),q=new THREE.Vector2(1,1),p=d.uniforms,l=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(p.occlusionMap,0);b.uniform1i(p.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(l.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(l.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var s,t,w,y,u;for(s=0;s<i;s++)if(l=16/h,n.set(l*j,l),y=a[s],k.set(y.matrixWorld.n14,y.matrixWorld.n24,y.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(k),
+g.projectionMatrix.multiplyVector3(k),m.copy(k),q.x=m.x*r+r,q.y=m.y*o+o,d.hasVertexTexture||q.x>0&&q.x<f&&q.y>0&&q.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,q.x-8,q.y-8,16,16,0);b.uniform1i(p.renderType,0);b.uniform2f(p.scale,n.x,n.y);b.uniform3f(p.screenPosition,m.x,m.y,m.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,q.x-8,q.y-8,16,16,0);b.uniform1i(p.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);y.positionScreen.copy(m);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(p.renderType,2);b.enable(b.BLEND);t=0;for(w=y.lensFlares.length;t<w;t++)if(u=y.lensFlares[t],u.opacity>0.0010&&u.scale>0.0010)m.x=u.x,m.y=u.y,m.z=u.z,l=u.size*u.scale/
+h,n.x=l*j,n.y=l,b.uniform3f(p.screenPosition,m.x,m.y,m.z),b.uniform2f(p.scale,n.x,n.y),b.uniform1f(p.rotation,u.rotation),b.uniform1f(p.opacity,u.opacity),b.uniform3f(p.color,u.color.r,u.color.g,u.color.b),c.setBlending(u.blending),c.setTexture(u.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,g=new THREE.Frustum,f=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,g=new THREE.Frustum,f=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=
-function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,k,j,r,o,m,l,n=0,q=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(k=q.length;i<k;i++)if(l=q[i],l.castShadow&&l instanceof THREE.SpotLight){this.shadowMap[n]||(this.shadowMap[n]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),
-this.shadowMatrix[n]=new THREE.Matrix4);j=this.shadowMap[n];r=this.shadowMatrix[n];e.position.copy(l.position);e.lookAt(l.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(e.projectionMatrix);r.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);
-if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();r=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,r);r=h.__webglObjects.length;for(j=0;j<r;j++)if(o=h.__webglObjects[j],l=o.object,o.render=!1,l.visible&&l.castShadow&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||g.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),
-l._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),o.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);for(j=0;j<r;j++)if(o=h.__webglObjects[j],o.render)l=o.object,o=o.buffer,b.setObjectFaces(l),m=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c,b.renderBuffer(e,q,null,m,o,l);r=h.__webglObjectsImmediate.length;for(j=0;j<r;j++)o=h.__webglObjectsImmediate[j],l=o.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&
-l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(e,q,null,c,l));n++}}};
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,k,j,r,o,l,n,m,q=0,p=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(k=p.length;i<k;i++)if(n=p[i],n.castShadow&&n instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);j=this.shadowMap[q];r=this.shadowMatrix[q];e.position.copy(n.position);e.lookAt(n.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(e.projectionMatrix);r.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
+new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();r=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,r);m=h.__webglObjects;j=0;for(r=m.length;j<r;j++)if(o=m[j],n=o.object,o.render=!1,n.visible&&n.castShadow&&
+(!(n instanceof THREE.Mesh)||!n.frustumCulled||g.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),o.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(r=m.length;j<r;j++)if(o=m[j],o.render)n=o.object,o=o.buffer,b.setObjectFaces(n),l=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c,b.renderBuffer(e,p,null,l,o,n);m=h.__webglObjectsImmediate;
+j=0;for(r=m.length;j<r;j++)o=m[j],n=o.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(e,p,null,c,n));q++}}};
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
 2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
 2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
 b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
 b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
 b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
 b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
-"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var k=d.attributes,j=d.uniforms,r=h/f;f*=0.5;var o=h*0.5,m=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(k.position,
-2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var l,n=[],k=0;k<i;k++)if(l=e[k],l.visible&&l.opacity!==0)l.useScreenCoordinates?l.z=-l.position.z:(l._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),l.z=-l._modelViewMatrix.n34);e.sort(a);for(k=0;k<i;k++)l=e[k],l.visible&&
-l.opacity!==0&&l.map&&l.map.image&&l.map.image.width&&(l.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(l.position.x-f)/f,(o-l.position.y)/o,Math.max(0,Math.min(1,l.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,l.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,l._modelViewMatrixArray)),g=l.map.image.width/(l.scaleByViewport?h:1),n[0]=g*r*l.scale.x,n[1]=g*l.scale.y,b.uniform2f(j.uvScale,l.uvScale.x,
-l.uvScale.y),b.uniform2f(j.uvOffset,l.uvOffset.x,l.uvOffset.y),b.uniform2f(j.alignment,l.alignment.x,l.alignment.y),b.uniform1f(j.opacity,l.opacity),b.uniform3f(j.color,l.color.r,l.color.g,l.color.b),b.uniform1f(j.rotation,l.rotation),b.uniform2fv(j.scale,n),l.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!l.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!1),c.setBlending(l.blending),c.setTexture(l.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,r;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),l=new THREE.PerspectiveCamera(53,
-1,1,1E4);l.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:m}},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}"}),
-n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(l);this.setSize=function(a,d){c.call(b,a,d);o.width=a;o.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||j!==c.far||r!==c.fov){i=c.aspect;k=c.near;j=c.far;r=c.fov;var s=c.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,y=k*Math.tan(r*Math.PI/360),u;f.n14=t;h.n14=-t;t=-y*i+w;u=y*i+w;s.n11=2*k/(u-t);s.n13=(u+t)/(u-t);e.projectionMatrix.copy(s);t=-y*i-w;u=y*i-w;s.n11=
-2*k/(u-t);s.n13=(u+t)/(u-t);g.projectionMatrix.copy(s)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,o,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,l)}};
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var k=d.attributes,j=d.uniforms,r=h/f;f*=0.5;var o=h*0.5,l=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(k.position,
+2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var n,m=[],k=0;k<i;k++)if(n=e[k],n.visible&&n.opacity!==0)n.useScreenCoordinates?n.z=-n.position.z:(n._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),n.z=-n._modelViewMatrix.n34);e.sort(a);for(k=0;k<i;k++)n=e[k],n.visible&&
+n.opacity!==0&&n.map&&n.map.image&&n.map.image.width&&(n.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(n.position.x-f)/f,(o-n.position.y)/o,Math.max(0,Math.min(1,n.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,n.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,n._modelViewMatrixArray)),g=n.map.image.width/(n.scaleByViewport?h:1),m[0]=g*r*n.scale.x,m[1]=g*n.scale.y,b.uniform2f(j.uvScale,n.uvScale.x,
+n.uvScale.y),b.uniform2f(j.uvOffset,n.uvOffset.x,n.uvOffset.y),b.uniform2f(j.alignment,n.alignment.x,n.alignment.y),b.uniform1f(j.opacity,n.opacity),b.uniform3f(j.color,n.color.r,n.color.g,n.color.b),b.uniform1f(j.rotation,n.rotation),b.uniform2fv(j.scale,m),n.mergeWith3D&&!l?(b.enable(b.DEPTH_TEST),l=!0):!n.mergeWith3D&&l&&(b.disable(b.DEPTH_TEST),l=!1),c.setBlending(n.blending),c.setTexture(n.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,r;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),l=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.PerspectiveCamera(53,
+1,1,1E4);n.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:l}},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(n);this.setSize=function(a,d){c.call(b,a,d);o.width=a;o.height=d;l.width=a;l.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||j!==c.far||r!==c.fov){i=c.aspect;k=c.near;j=c.far;r=c.fov;var s=c.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,y=k*Math.tan(r*Math.PI/360),u;f.n14=t;h.n14=-t;t=-y*i+w;u=y*i+w;s.n11=2*k/(u-t);s.n13=(u+t)/(u-t);e.projectionMatrix.copy(s);t=-y*i-w;u=y*i-w;s.n11=
+2*k/(u-t);s.n13=(u+t)/(u-t);g.projectionMatrix.copy(s)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,o,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,l,!0);m.updateMatrixWorld();d.call(b,m,n)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,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);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,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);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
 c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
 c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 176 - 177
build/custom/ThreeWebGL.js

@@ -1,7 +1,7 @@
 // ThreeWebGL.js r47dev - http://github.com/mrdoob/three.js
 // ThreeWebGL.js r47dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,g,f;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),g=a*6-d,a=c*(1-b),f=c*(1-
-b*g),b=c*(1-b*(1-g)),d){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,g;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),g=c*(1-
+b*f),b=c*(1-b*(1-f)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
@@ -14,85 +14,85 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.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())},
 b.z;this.w=a.w-b.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,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};
-THREE.Ray=function(a,b){function c(a,b,c){n.sub(c,a);G=n.dot(b);if(G<=0)return null;u=w.add(a,x.copy(b).multiplyScalar(G));return K=c.distanceTo(u)}function d(a,b,c,d){n.sub(d,b);w.sub(c,b);x.sub(a,b);ta=n.dot(n);O=n.dot(w);ia=n.dot(x);ea=w.dot(w);D=w.dot(x);P=1/(ta*ea-O*O);H=(ea*ia-O*D)*P;M=(ta*D-O*ia)*P;return H>=0&&M>=0&&H+M<1}this.origin=a||new THREE.Vector3;this.direction=b||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,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(n){for(var x,G=[],w=0,u=n.children.length;w<u;w++)Array.prototype.push.apply(G,this.intersectObject(n.children[w]));if(n instanceof THREE.Particle){w=
-c(this.origin,this.direction,n.matrixWorld.getPosition());if(w===null||w>n.scale.x)return[];x={distance:w,point:n.position,face:null,object:n};G.push(x)}else if(n instanceof THREE.Mesh){w=c(this.origin,this.direction,n.matrixWorld.getPosition());if(w===null||w>n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)))return G;var ba,K=n.geometry,E=K.vertices,e;n.matrixRotationWorld.extractRotation(n.matrixWorld);w=0;for(u=K.faces.length;w<u;w++)if(x=K.faces[w],a.copy(this.origin),
-b.copy(this.direction),e=n.matrixWorld,p=e.multiplyVector3(p.copy(x.centroid)).subSelf(a),ba=p.dot(b),!(ba<=0)&&(g=e.multiplyVector3(g.copy(E[x.a].position)),f=e.multiplyVector3(f.copy(E[x.b].position)),h=e.multiplyVector3(h.copy(E[x.c].position)),x instanceof THREE.Face4&&(i=e.multiplyVector3(i.copy(E[x.d].position))),q=n.matrixRotationWorld.multiplyVector3(q.copy(x.normal)),ba=b.dot(q),n.doubleSided||(n.flipSided?ba>0:ba<0)))if(ba=q.dot(p.sub(g,a))/ba,k.add(a,b.multiplyScalar(ba)),x instanceof THREE.Face3)d(k,
-g,f,h)&&(x={distance:a.distanceTo(k),point:k.clone(),face:x,object:n},G.push(x));else if(x instanceof THREE.Face4&&(d(k,g,f,i)||d(k,f,h,i)))x={distance:a.distanceTo(k),point:k.clone(),face:x,object:n},G.push(x)}return G};var n=new THREE.Vector3,w=new THREE.Vector3,x=new THREE.Vector3,G,u,K,ta,O,ia,ea,D,P,H,M};
-THREE.Rectangle=function(){function a(){f=d-b;h=g-c}var b,c,d,g,f,h,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(f,h,k,n){i=!1;b=f;c=h;d=k;g=n;a()};this.addPoint=function(f,h){i?(i=!1,b=f,c=h,d=f,g=h):(b=b<f?b:f,c=c<h?c:h,d=d>f?d:f,g=g>h?g:h);a()};this.add3Points=
-function(f,h,k,n,w,x){i?(i=!1,b=f<k?f<w?f:w:k<w?k:w,c=h<n?h<x?h:x:n<x?n:x,d=f>k?f>w?f:w:k>w?k:w,g=h>n?h>x?h:x:n>x?n:x):(b=f<k?f<w?f<b?f:b:w<b?w:b:k<w?k<b?k:b:w<b?w:b,c=h<n?h<x?h<c?h:c:x<c?x:c:n<x?n<c?n:c:x<c?x:c,d=f>k?f>w?f>d?f:d:w>d?w:d:k>w?k>d?k:d:w>d?w:d,g=h>n?h>x?h>g?h:g:x>g?x:g:n>x?n>g?n:g:x>g?x:g);a()};this.addRectangle=function(f){i?(i=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),g=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),g=g>
-f.getBottom()?g:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;g+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();g=g<f.getBottom()?g:f.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(g,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;g=d=c=b=0;a()};this.isEmpty=function(){return i}};
-THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,g){return d+(a-b)*(g-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
+THREE.Ray=function(a,b){function c(a,b,c){l.sub(c,a);G=l.dot(b);if(G<=0)return null;C=w.add(a,u.copy(b).multiplyScalar(G));return J=c.distanceTo(C)}function d(a,b,c,d){l.sub(d,b);w.sub(c,b);u.sub(a,b);qa=l.dot(l);T=l.dot(w);la=l.dot(u);ga=w.dot(w);K=w.dot(u);P=1/(qa*ga-T*T);N=(ga*la-T*K)*P;O=(qa*K-T*la)*P;return N>=0&&O>=0&&N+O<1}this.origin=a||new THREE.Vector3;this.direction=b||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 f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(u){for(var l,G=[],w=0,C=u.children.length;w<C;w++)Array.prototype.push.apply(G,this.intersectObject(u.children[w]));if(u instanceof THREE.Particle){w=
+c(this.origin,this.direction,u.matrixWorld.getPosition());if(w===null||w>u.scale.x)return[];l={distance:w,point:u.position,face:null,object:u};G.push(l)}else if(u instanceof THREE.Mesh){w=c(this.origin,this.direction,u.matrixWorld.getPosition());if(w===null||w>u.geometry.boundingSphere.radius*Math.max(u.scale.x,Math.max(u.scale.y,u.scale.z)))return G;var L,J=u.geometry,K=J.vertices,E;u.matrixRotationWorld.extractRotation(u.matrixWorld);w=0;for(C=J.faces.length;w<C;w++)if(l=J.faces[w],a.copy(this.origin),
+b.copy(this.direction),E=u.matrixWorld,p=E.multiplyVector3(p.copy(l.centroid)).subSelf(a),L=p.dot(b),!(L<=0)&&(f=E.multiplyVector3(f.copy(K[l.a].position)),g=E.multiplyVector3(g.copy(K[l.b].position)),h=E.multiplyVector3(h.copy(K[l.c].position)),l instanceof THREE.Face4&&(i=E.multiplyVector3(i.copy(K[l.d].position))),n=u.matrixRotationWorld.multiplyVector3(n.copy(l.normal)),L=b.dot(n),u.doubleSided||(u.flipSided?L>0:L<0)))if(L=n.dot(p.sub(f,a))/L,k.add(a,b.multiplyScalar(L)),l instanceof THREE.Face3)d(k,
+f,g,h)&&(l={distance:a.distanceTo(k),point:k.clone(),face:l,object:u},G.push(l));else if(l instanceof THREE.Face4&&(d(k,f,g,i)||d(k,g,h,i)))l={distance:a.distanceTo(k),point:k.clone(),face:l,object:u},G.push(l)}return G};var l=new THREE.Vector3,w=new THREE.Vector3,u=new THREE.Vector3,G,C,J,qa,T,la,ga,K,P,N,O};
+THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(g,h,k,l){i=!1;b=g;c=h;d=k;f=l;a()};this.addPoint=function(g,h){i?(i=!1,b=g,c=h,d=g,f=h):(b=b<g?b:g,c=c<h?c:h,d=d>g?d:g,f=f>h?f:h);a()};this.add3Points=
+function(g,h,k,l,w,u){i?(i=!1,b=g<k?g<w?g:w:k<w?k:w,c=h<l?h<u?h:u:l<u?l:u,d=g>k?g>w?g:w:k>w?k:w,f=h>l?h>u?h:u:l>u?l:u):(b=g<k?g<w?g<b?g:b:w<b?w:b:k<w?k<b?k:b:w<b?w:b,c=h<l?h<u?h<c?h:c:u<c?u:c:l<u?l<c?l:c:u<c?u:c,d=g>k?g>w?g>d?g:d:w>d?w:d:k>w?k>d?k:d:w>d?w:d,f=h>l?h>u?h>f?h:f:u>f?u:f:l>u?l>f?l:f:u>f?u:f);a()};this.addRectangle=function(g){i?(i=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),f=f>
+g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;f=d=c=b=0;a()};this.isEmpty=function(){return i}};
+THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},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,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,g,f,h,i,p,q,k,n,w,x,G,u){this.set(a!==void 0?a:1,b||0,c||0,d||0,g||0,f!==void 0?f:1,h||0,i||0,p||0,q||0,k!==void 0?k:1,n||0,w||0,x||0,G||0,u!==void 0?u:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,g,f,h,i,p,q,k,n,w,x,G,u){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=g;this.n22=f;this.n23=h;this.n24=i;this.n31=p;this.n32=q;this.n33=k;this.n34=n;this.n41=w;this.n42=x;this.n43=G;this.n44=u;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();d.length()===0&&(f.x+=1.0E-4,d.cross(c,f).normalize());g.cross(f,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=f.x;this.n21=d.y;this.n22=g.y;this.n23=f.y;this.n31=d.z;this.n32=g.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,g=a.n13,f=a.n14,h=a.n21,i=a.n22,p=a.n23,q=a.n24,k=a.n31,n=a.n32,w=a.n33,x=a.n34,G=a.n41,u=a.n42,K=a.n43,
-ta=a.n44,O=b.n11,ia=b.n12,ea=b.n13,D=b.n14,P=b.n21,H=b.n22,M=b.n23,oa=b.n24,pa=b.n31,wa=b.n32,sa=b.n33,R=b.n34,ba=b.n41,ya=b.n42,E=b.n43,e=b.n44;this.n11=c*O+d*P+g*pa+f*ba;this.n12=c*ia+d*H+g*wa+f*ya;this.n13=c*ea+d*M+g*sa+f*E;this.n14=c*D+d*oa+g*R+f*e;this.n21=h*O+i*P+p*pa+q*ba;this.n22=h*ia+i*H+p*wa+q*ya;this.n23=h*ea+i*M+p*sa+q*E;this.n24=h*D+i*oa+p*R+q*e;this.n31=k*O+n*P+w*pa+x*ba;this.n32=k*ia+n*H+w*wa+x*ya;this.n33=k*ea+n*M+w*sa+x*E;this.n34=k*D+n*oa+w*R+x*e;this.n41=G*O+u*P+K*pa+ta*ba;this.n42=
-G*ia+u*H+K*wa+ta*ya;this.n43=G*ea+u*M+K*sa+ta*E;this.n44=G*D+u*oa+K*R+ta*e;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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 b=a.x,c=a.y,d=a.z,g=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*g;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*
-d+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*
-a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,g=this.n21,f=this.n22,h=this.n23,i=this.n24,p=this.n31,q=this.n32,k=this.n33,n=this.n34,w=this.n41,x=this.n42,G=this.n43,u=this.n44;return d*h*q*w-c*i*q*w-d*f*k*w+b*i*k*w+c*f*n*w-b*h*n*w-d*h*p*x+c*i*p*x+d*g*k*x-a*i*k*x-c*g*n*x+a*h*n*x+d*f*p*G-b*i*p*G-d*g*q*G+a*i*q*G+b*g*n*G-a*f*n*G-c*f*p*u+b*h*p*u+
-c*g*q*u-a*h*q*u-b*g*k*u+a*f*k*u},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
-a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=
-this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=
-this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,
-0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),g=1-c,f=a.x,h=a.y,i=a.z,p=g*f,q=g*h;this.set(p*f+c,p*h-d*i,p*i+d*h,0,p*h+d*i,q*h+c,q*i-d*f,0,p*i-d*h,q*i+d*f,g*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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 b=a.n11,c=a.n12,d=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,p=a.n24,q=a.n31,k=a.n32,n=a.n33,w=a.n34,x=a.n41,G=a.n42,u=a.n43,K=a.n44;this.n11=i*w*G-p*n*G+p*k*u-h*w*u-i*k*K+h*n*K;this.n12=g*n*G-d*w*G-g*k*u+c*w*u+d*k*K-c*n*K;this.n13=d*p*G-g*i*G+g*h*u-c*p*u-d*h*K+c*i*K;this.n14=g*i*k-d*p*k-g*h*n+c*p*n+d*h*w-c*i*w;this.n21=p*n*x-i*w*x-p*q*u+f*w*u+i*q*K-f*n*K;this.n22=d*w*x-g*n*x+
-g*q*u-b*w*u-d*q*K+b*n*K;this.n23=g*i*x-d*p*x-g*f*u+b*p*u+d*f*K-b*i*K;this.n24=d*p*q-g*i*q+g*f*n-b*p*n-d*f*w+b*i*w;this.n31=h*w*x-p*k*x+p*q*G-f*w*G-h*q*K+f*k*K;this.n32=g*k*x-c*w*x-g*q*G+b*w*G+c*q*K-b*k*K;this.n33=c*p*x-g*h*x+g*f*G-b*p*G-c*f*K+b*h*K;this.n34=g*h*q-c*p*q-g*f*k+b*p*k+c*f*w-b*h*w;this.n41=i*k*x-h*n*x-i*q*G+f*n*G+h*q*u-f*k*u;this.n42=c*n*x-d*k*x+d*q*G-b*n*G-c*q*u+b*k*u;this.n43=d*h*x-c*i*x-d*f*G+b*i*G+c*f*u-b*h*u;this.n44=c*i*q-d*h*q+d*f*k-b*i*k-c*f*n+b*h*n;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,g=a.z,f=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),i=Math.cos(g),g=Math.sin(g);switch(b){case "YXZ":var p=h*i,q=h*g,k=d*i,n=d*g;this.n11=p+n*c;this.n12=k*c-q;this.n13=f*d;this.n21=f*g;this.n22=f*i;this.n23=-c;this.n31=q*c-k;this.n32=n+p*c;this.n33=f*h;break;case "ZXY":p=h*i;q=h*g;k=d*i;n=d*g;this.n11=p-n*c;this.n12=-f*g;this.n13=k+q*c;this.n21=q+k*c;this.n22=f*i;this.n23=n-p*c;this.n31=-f*d;this.n32=c;this.n33=f*h;break;case "ZYX":p=
-f*i;q=f*g;k=c*i;n=c*g;this.n11=h*i;this.n12=k*d-q;this.n13=p*d+n;this.n21=h*g;this.n22=n*d+p;this.n23=q*d-k;this.n31=-d;this.n32=c*h;this.n33=f*h;break;case "YZX":p=f*h;q=f*d;k=c*h;n=c*d;this.n11=h*i;this.n12=n-p*g;this.n13=k*g+q;this.n21=g;this.n22=f*i;this.n23=-c*i;this.n31=-d*i;this.n32=q*g+k;this.n33=p-n*g;break;case "XZY":p=f*h;q=f*d;k=c*h;n=c*d;this.n11=h*i;this.n12=-g;this.n13=d*i;this.n21=p*g+n;this.n22=f*i;this.n23=q*g-k;this.n31=k*g-q;this.n32=c*i;this.n33=n*g+p;break;default:p=f*i,q=f*
-g,k=c*i,n=c*g,this.n11=h*i,this.n12=-h*g,this.n13=d,this.n21=q+k*d,this.n22=p-n*d,this.n23=-c*h,this.n31=n-p*d,this.n32=k+q*d,this.n33=f*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,g=a.w,f=b+b,h=c+c,i=d+d,a=b*f,p=b*h;b*=i;var q=c*h;c*=i;d*=i;f*=g;h*=g;g*=i;this.n11=1-(q+d);this.n12=p-g;this.n13=b+h;this.n21=p+g;this.n22=1-(a+d);this.n23=c-f;this.n31=b-h;this.n32=c+f;this.n33=1-(a+q);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
-a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,g=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);g.setScale(c.x,c.y,c.z);this.multiply(d,g);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);g.set(this.n12,this.n22,this.n32);f.set(this.n13,
-this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=g.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
-return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,p=-a.n32*a.n11+a.n31*a.n12,q=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*h+a.n31*q;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*g;c[2]=a*f;c[3]=a*h;c[4]=a*i;c[5]=a*p;c[6]=a*q;c[7]=a*k;c[8]=a*n;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,g,f){var h;h=new THREE.Matrix4;h.n11=2*g/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*g/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(f+g)/(f-g);h.n34=-2*f*g/(f-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var g,a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,g,f){var h,i,p,q;h=new THREE.Matrix4;i=b-a;p=c-d;q=f-g;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/p;h.n23=0;h.n24=-((c+d)/p);h.n31=0;h.n32=0;h.n33=-2/q;h.n34=-((f+g)/q);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4=function(a,b,c,d,f,g,h,i,p,n,k,l,w,u,G,C){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,g!==void 0?g:1,h||0,i||0,p||0,n||0,k!==void 0?k:1,l||0,w||0,u||0,G||0,C!==void 0?C:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,g,h,i,p,n,k,l,w,u,G,C){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=i;this.n31=p;this.n32=n;this.n33=k;this.n34=l;this.n41=w;this.n42=u;this.n43=G;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,i=a.n22,p=a.n23,n=a.n24,k=a.n31,l=a.n32,w=a.n33,u=a.n34,G=a.n41,C=a.n42,J=a.n43,
+qa=a.n44,T=b.n11,la=b.n12,ga=b.n13,K=b.n14,P=b.n21,N=b.n22,O=b.n23,ja=b.n24,ua=b.n31,da=b.n32,ta=b.n33,ra=b.n34,L=b.n41,va=b.n42,wa=b.n43,E=b.n44;this.n11=c*T+d*P+f*ua+g*L;this.n12=c*la+d*N+f*da+g*va;this.n13=c*ga+d*O+f*ta+g*wa;this.n14=c*K+d*ja+f*ra+g*E;this.n21=h*T+i*P+p*ua+n*L;this.n22=h*la+i*N+p*da+n*va;this.n23=h*ga+i*O+p*ta+n*wa;this.n24=h*K+i*ja+p*ra+n*E;this.n31=k*T+l*P+w*ua+u*L;this.n32=k*la+l*N+w*da+u*va;this.n33=k*ga+l*O+w*ta+u*wa;this.n34=k*K+l*ja+w*ra+u*E;this.n41=G*T+C*P+J*ua+qa*L;this.n42=
+G*la+C*N+J*da+qa*va;this.n43=G*ga+C*O+J*ta+qa*wa;this.n44=G*K+C*ja+J*ra+qa*E;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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 b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*
+c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*
+a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,i=this.n24,p=this.n31,n=this.n32,k=this.n33,l=this.n34,w=this.n41,u=this.n42,G=this.n43,C=this.n44;return d*h*n*w-c*i*n*w-d*g*k*w+b*i*k*w+c*g*l*w-b*h*l*w-d*h*p*u+c*i*p*u+d*f*k*u-a*i*k*u-c*f*l*u+a*h*l*u+d*g*p*G-b*i*p*G-d*f*n*G+a*i*n*G+b*f*l*G-a*g*l*G-c*
+g*p*C+b*h*p*C+c*f*n*C-a*h*n*C-b*f*k*C+a*g*k*C},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.n34=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;
+a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},
+flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=
+this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),
+a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,i=a.z,p=f*g,n=f*h;this.set(p*g+c,p*h-d*i,p*i+d*h,0,p*h+d*i,n*h+c,n*i-d*g,0,p*i-d*h,n*i+d*g,f*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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 b=a.n11,c=a.n12,d=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,p=a.n24,n=a.n31,k=a.n32,l=a.n33,w=a.n34,u=a.n41,G=a.n42,C=a.n43,J=a.n44;this.n11=i*w*G-p*l*G+p*k*C-h*w*C-i*k*J+h*l*J;this.n12=f*l*G-d*w*G-f*k*C+c*w*C+d*k*J-c*l*J;this.n13=d*p*G-f*i*G+f*h*C-c*p*C-d*h*J+c*i*J;this.n14=f*i*k-d*p*k-f*h*l+c*p*l+d*h*w-
+c*i*w;this.n21=p*l*u-i*w*u-p*n*C+g*w*C+i*n*J-g*l*J;this.n22=d*w*u-f*l*u+f*n*C-b*w*C-d*n*J+b*l*J;this.n23=f*i*u-d*p*u-f*g*C+b*p*C+d*g*J-b*i*J;this.n24=d*p*n-f*i*n+f*g*l-b*p*l-d*g*w+b*i*w;this.n31=h*w*u-p*k*u+p*n*G-g*w*G-h*n*J+g*k*J;this.n32=f*k*u-c*w*u-f*n*G+b*w*G+c*n*J-b*k*J;this.n33=c*p*u-f*h*u+f*g*G-b*p*G-c*g*J+b*h*J;this.n34=f*h*n-c*p*n-f*g*k+b*p*k+c*g*w-b*h*w;this.n41=i*k*u-h*l*u-i*n*G+g*l*G+h*n*C-g*k*C;this.n42=c*l*u-d*k*u+d*n*G-b*l*G-c*n*C+b*k*C;this.n43=d*h*u-c*i*u-d*g*G+b*i*G+c*g*C-b*h*C;
+this.n44=c*i*n-d*h*n+d*g*k-b*i*k-c*g*l+b*h*l;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var p=h*i,n=h*f,k=d*i,l=d*f;this.n11=p+l*c;this.n12=k*c-n;this.n13=g*d;this.n21=g*f;this.n22=g*i;this.n23=-c;this.n31=n*c-k;this.n32=l+p*c;this.n33=g*h;break;case "ZXY":p=h*i;n=h*f;k=d*i;l=d*f;this.n11=p-l*c;this.n12=-g*f;this.n13=k+n*c;this.n21=
+n+k*c;this.n22=g*i;this.n23=l-p*c;this.n31=-g*d;this.n32=c;this.n33=g*h;break;case "ZYX":p=g*i;n=g*f;k=c*i;l=c*f;this.n11=h*i;this.n12=k*d-n;this.n13=p*d+l;this.n21=h*f;this.n22=l*d+p;this.n23=n*d-k;this.n31=-d;this.n32=c*h;this.n33=g*h;break;case "YZX":p=g*h;n=g*d;k=c*h;l=c*d;this.n11=h*i;this.n12=l-p*f;this.n13=k*f+n;this.n21=f;this.n22=g*i;this.n23=-c*i;this.n31=-d*i;this.n32=n*f+k;this.n33=p-l*f;break;case "XZY":p=g*h;n=g*d;k=c*h;l=c*d;this.n11=h*i;this.n12=-f;this.n13=d*i;this.n21=p*f+l;this.n22=
+g*i;this.n23=n*f-k;this.n31=k*f-n;this.n32=c*i;this.n33=l*f+p;break;default:p=g*i,n=g*f,k=c*i,l=c*f,this.n11=h*i,this.n12=-h*f,this.n13=d,this.n21=n+k*d,this.n22=p-l*d,this.n23=-c*h,this.n31=l-p*d,this.n32=k+n*d,this.n33=g*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,i=d+d,a=b*g,p=b*h;b*=i;var n=c*h;c*=i;d*=i;g*=f;h*=f;f*=i;this.n11=1-(n+d);this.n12=p-f;this.n13=b+h;this.n21=p+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+n);
+return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;
+d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=f.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,
+b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,p=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*h+a.n31*n;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*i;c[5]=a*p;c[6]=a*n;c[7]=a*k;c[8]=a*l;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
+THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,i,p,n;h=new THREE.Matrix4;i=b-a;p=c-d;n=g-f;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/p;h.n23=0;h.n24=-((c+d)/p);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+f)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.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=
 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};
 !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,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(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 b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,g;c=0;for(d=this.children.length;c<d;c++){g=this.children[c];if(g.name===a)return g;
-if(b&&(g=g.getChildByName(a,b),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&&
+-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;
+if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},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 b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 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 b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function b(){var a=q[p]=q[p]||new THREE.RenderableVertex;p++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,f,h=[],i,p,q=[],
-k,n,w=[],x,G=[],u,K,ta=[],O,ia,ea=[],D={objects:[],sprites:[],lights:[],elements:[]},P=new THREE.Vector3,H=new THREE.Vector4,M=new THREE.Matrix4,oa=new THREE.Matrix4,pa=new THREE.Frustum,wa=new THREE.Vector4,sa=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);M.multiply(b.projectionMatrix,b.matrixWorldInverse);M.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);M.multiply(b.matrixWorld,
-b.projectionMatrixInverse);M.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(b,d){f=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var h=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||pa.contains(b))?(M.multiplyVector3(P.copy(b.position)),g=a(),
-g.object=b,g.z=P.z,D.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(M.multiplyVector3(P.copy(b.position)),g=a(),g.object=b,g.z=P.z,D.sprites.push(g)):b instanceof THREE.Light&&D.lights.push(b);for(var e=0,c=b.children.length;e<c;e++)h(b.children[e])}};h(b);d&&D.objects.sort(c);return D};this.projectScene=function(a,g,f){var h=g.near,e=g.far,P,va,X,ua,N,xa,ka,na,S,qa,ra,Ca,Fa,Da,Aa,za;ia=K=x=n=0;D.elements.length=0;g.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(g));a.updateMatrixWorld();g.matrixWorldInverse.getInverse(g.matrixWorld);M.multiply(g.projectionMatrix,g.matrixWorldInverse);pa.setFromMatrix(M);D=this.projectGraph(a,!1);a=0;for(P=D.objects.length;a<P;a++)if(S=D.objects[a].object,qa=S.matrixWorld,Ca=S.material,p=0,S instanceof THREE.Mesh){ra=S.geometry;Fa=S.geometry.materials;ua=ra.vertices;Da=ra.faces;Aa=ra.faceVertexUvs;ra=S.matrixRotationWorld.extractRotation(qa);va=0;for(X=ua.length;va<X;va++)i=b(),i.positionWorld.copy(ua[va].position),
-qa.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),M.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<e;ua=0;for(va=Da.length;ua<va;ua++){X=Da[ua];if(X instanceof THREE.Face3)if(N=q[X.a],xa=q[X.b],ka=q[X.c],N.visible&&xa.visible&&ka.visible&&(S.doubleSided||S.flipSided!=(ka.positionScreen.x-N.positionScreen.x)*(xa.positionScreen.y-N.positionScreen.y)-(ka.positionScreen.y-
-N.positionScreen.y)*(xa.positionScreen.x-N.positionScreen.x)<0))na=w[n]=w[n]||new THREE.RenderableFace3,n++,k=na,k.v1.copy(N),k.v2.copy(xa),k.v3.copy(ka);else continue;else if(X instanceof THREE.Face4)if(N=q[X.a],xa=q[X.b],ka=q[X.c],na=q[X.d],N.visible&&xa.visible&&ka.visible&&na.visible&&(S.doubleSided||S.flipSided!=((na.positionScreen.x-N.positionScreen.x)*(xa.positionScreen.y-N.positionScreen.y)-(na.positionScreen.y-N.positionScreen.y)*(xa.positionScreen.x-N.positionScreen.x)<0||(xa.positionScreen.x-
-ka.positionScreen.x)*(na.positionScreen.y-ka.positionScreen.y)-(xa.positionScreen.y-ka.positionScreen.y)*(na.positionScreen.x-ka.positionScreen.x)<0)))za=G[x]=G[x]||new THREE.RenderableFace4,x++,k=za,k.v1.copy(N),k.v2.copy(xa),k.v3.copy(ka),k.v4.copy(na);else continue;k.normalWorld.copy(X.normal);ra.multiplyVector3(k.normalWorld);k.centroidWorld.copy(X.centroid);qa.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);M.multiplyVector3(k.centroidScreen);ka=X.vertexNormals;N=0;for(xa=
-ka.length;N<xa;N++)na=k.vertexNormalsWorld[N],na.copy(ka[N]),ra.multiplyVector3(na);N=0;for(xa=Aa.length;N<xa;N++)if(za=Aa[N][ua]){ka=0;for(na=za.length;ka<na;ka++)k.uvs[N][ka]=za[ka]}k.material=Ca;k.faceMaterial=X.materialIndex!==null?Fa[X.materialIndex]:null;k.z=k.centroidScreen.z;D.elements.push(k)}}else if(S instanceof THREE.Line){oa.multiply(M,qa);ua=S.geometry.vertices;N=b();N.positionScreen.copy(ua[0].position);oa.multiplyVector4(N.positionScreen);va=1;for(X=ua.length;va<X;va++)if(N=b(),N.positionScreen.copy(ua[va].position),
-oa.multiplyVector4(N.positionScreen),xa=q[p-2],wa.copy(N.positionScreen),sa.copy(xa.positionScreen),d(wa,sa))wa.multiplyScalar(1/wa.w),sa.multiplyScalar(1/sa.w),S=ta[K]=ta[K]||new THREE.RenderableLine,K++,u=S,u.v1.positionScreen.copy(wa),u.v2.positionScreen.copy(sa),u.z=Math.max(wa.z,sa.z),u.material=Ca,D.elements.push(u)}a=0;for(P=D.sprites.length;a<P;a++)if(S=D.sprites[a].object,qa=S.matrixWorld,S instanceof THREE.Particle&&(H.set(qa.n14,qa.n24,qa.n34,1),M.multiplyVector4(H),H.z/=H.w,H.z>0&&H.z<
-1))h=ea[ia]=ea[ia]||new THREE.RenderableParticle,ia++,O=h,O.x=H.x/H.w,O.y=H.y/H.w,O.z=H.z,O.rotation=S.rotation.z,O.scale.x=S.scale.x*Math.abs(O.x-(H.x+g.projectionMatrix.n11)/(H.w+g.projectionMatrix.n14)),O.scale.y=S.scale.y*Math.abs(O.y-(H.y+g.projectionMatrix.n22)/(H.w+g.projectionMatrix.n24)),O.material=S.material,D.elements.push(O);f&&D.elements.sort(c);return D}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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 b=Math.PI/360,c=a.x*b,d=a.y*b,g=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-g),g=Math.sin(-g),f=Math.cos(c),c=Math.sin(c),h=a*b,i=d*g;this.w=h*f-i*c;this.x=h*c+i*f;this.y=d*b*f+a*g*c;this.z=a*g*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+THREE.Projector=function(){function a(){var a=h[g]=h[g]||new THREE.RenderableObject;g++;return a}function b(){var a=n[p]=n[p]||new THREE.RenderableVertex;p++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,g=a.z+a.w,e=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return g>=0&&e>=0&&f>=0&&h>=0?!0:g<0&&e<0||f<0&&h<0?!1:(g<0?c=Math.max(c,g/(g-e)):e<0&&(d=Math.min(d,g/(g-e))),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 f,g,h=[],i,p,n=[],
+k,l,w=[],u,G=[],C,J,qa=[],T,la,ga=[],K={objects:[],sprites:[],lights:[],elements:[]},P=new THREE.Vector3,N=new THREE.Vector4,O=new THREE.Matrix4,ja=new THREE.Matrix4,ua=new THREE.Frustum,da=new THREE.Vector4,ta=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);O.multiply(b.projectionMatrix,b.matrixWorldInverse);O.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);O.multiply(b.matrixWorld,
+b.projectionMatrixInverse);O.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(b,d){g=0;K.objects.length=0;K.sprites.length=0;K.lights.length=0;var h=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||ua.contains(b))?(O.multiplyVector3(P.copy(b.position)),f=a(),
+f.object=b,f.z=P.z,K.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(O.multiplyVector3(P.copy(b.position)),f=a(),f.object=b,f.z=P.z,K.sprites.push(f)):b instanceof THREE.Light&&K.lights.push(b);for(var c=0,e=b.children.length;c<e;c++)h(b.children[c])}};h(b);d&&K.objects.sort(c);return K};this.projectScene=function(a,g,f){var h=g.near,E=g.far,e,P,R,na,D,S,pa,xa,Z,oa,sa,za,Ea,Ba,Ca,ya;la=J=u=l=0;K.elements.length=0;g.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(g));a.updateMatrixWorld();g.matrixWorldInverse.getInverse(g.matrixWorld);O.multiply(g.projectionMatrix,g.matrixWorldInverse);ua.setFromMatrix(O);K=this.projectGraph(a,!1);a=0;for(e=K.objects.length;a<e;a++)if(Z=K.objects[a].object,oa=Z.matrixWorld,za=Z.material,p=0,Z instanceof THREE.Mesh){sa=Z.geometry;Ea=Z.geometry.materials;na=sa.vertices;Ba=sa.faces;Ca=sa.faceVertexUvs;sa=Z.matrixRotationWorld.extractRotation(oa);P=0;for(R=na.length;P<R;P++)i=b(),i.positionWorld.copy(na[P].position),oa.multiplyVector3(i.positionWorld),
+i.positionScreen.copy(i.positionWorld),O.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<E;na=0;for(P=Ba.length;na<P;na++){R=Ba[na];if(R instanceof THREE.Face3)if(D=n[R.a],S=n[R.b],pa=n[R.c],D.visible&&S.visible&&pa.visible&&(Z.doubleSided||Z.flipSided!=(pa.positionScreen.x-D.positionScreen.x)*(S.positionScreen.y-D.positionScreen.y)-(pa.positionScreen.y-D.positionScreen.y)*(S.positionScreen.x-
+D.positionScreen.x)<0))xa=w[l]=w[l]||new THREE.RenderableFace3,l++,k=xa,k.v1.copy(D),k.v2.copy(S),k.v3.copy(pa);else continue;else if(R instanceof THREE.Face4)if(D=n[R.a],S=n[R.b],pa=n[R.c],xa=n[R.d],D.visible&&S.visible&&pa.visible&&xa.visible&&(Z.doubleSided||Z.flipSided!=((xa.positionScreen.x-D.positionScreen.x)*(S.positionScreen.y-D.positionScreen.y)-(xa.positionScreen.y-D.positionScreen.y)*(S.positionScreen.x-D.positionScreen.x)<0||(S.positionScreen.x-pa.positionScreen.x)*(xa.positionScreen.y-
+pa.positionScreen.y)-(S.positionScreen.y-pa.positionScreen.y)*(xa.positionScreen.x-pa.positionScreen.x)<0)))ya=G[u]=G[u]||new THREE.RenderableFace4,u++,k=ya,k.v1.copy(D),k.v2.copy(S),k.v3.copy(pa),k.v4.copy(xa);else continue;k.normalWorld.copy(R.normal);sa.multiplyVector3(k.normalWorld);k.centroidWorld.copy(R.centroid);oa.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);O.multiplyVector3(k.centroidScreen);pa=R.vertexNormals;D=0;for(S=pa.length;D<S;D++)xa=k.vertexNormalsWorld[D],
+xa.copy(pa[D]),sa.multiplyVector3(xa);D=0;for(S=Ca.length;D<S;D++)if(ya=Ca[D][na]){pa=0;for(xa=ya.length;pa<xa;pa++)k.uvs[D][pa]=ya[pa]}k.material=za;k.faceMaterial=R.materialIndex!==null?Ea[R.materialIndex]:null;k.z=k.centroidScreen.z;K.elements.push(k)}}else if(Z instanceof THREE.Line){ja.multiply(O,oa);na=Z.geometry.vertices;D=b();D.positionScreen.copy(na[0].position);ja.multiplyVector4(D.positionScreen);P=1;for(R=na.length;P<R;P++)if(D=b(),D.positionScreen.copy(na[P].position),ja.multiplyVector4(D.positionScreen),
+S=n[p-2],da.copy(D.positionScreen),ta.copy(S.positionScreen),d(da,ta))da.multiplyScalar(1/da.w),ta.multiplyScalar(1/ta.w),Z=qa[J]=qa[J]||new THREE.RenderableLine,J++,C=Z,C.v1.positionScreen.copy(da),C.v2.positionScreen.copy(ta),C.z=Math.max(da.z,ta.z),C.material=za,K.elements.push(C)}a=0;for(e=K.sprites.length;a<e;a++)if(Z=K.sprites[a].object,oa=Z.matrixWorld,Z instanceof THREE.Particle&&(N.set(oa.n14,oa.n24,oa.n34,1),O.multiplyVector4(N),N.z/=N.w,N.z>0&&N.z<1))h=ga[la]=ga[la]||new THREE.RenderableParticle,
+la++,T=h,T.x=N.x/N.w,T.y=N.y/N.w,T.z=N.z,T.rotation=Z.rotation.z,T.scale.x=Z.scale.x*Math.abs(T.x-(N.x+g.projectionMatrix.n11)/(N.w+g.projectionMatrix.n14)),T.scale.y=Z.scale.y*Math.abs(T.y-(N.y+g.projectionMatrix.n22)/(N.w+g.projectionMatrix.n24)),T.material=Z.material,K.elements.push(T);f&&K.elements.sort(c);return K}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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 b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),h=a*b,i=d*f;this.w=h*g-i*c;this.x=h*c+i*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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 b=
 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 b=
-this.x,c=this.y,d=this.z,g=this.w,f=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+g*f+c*i-d*h;this.y=c*a+g*h+d*f-b*i;this.z=d*a+g*i+b*h-c*f;this.w=g*a-b*f-c*h-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,g=a.z,f=this.x,h=this.y,i=this.z,p=this.w,q=p*c+h*g-i*d,k=p*d+i*c-f*g,n=p*g+f*d-h*c,c=-f*
-c-h*d-i*g;b.x=q*p+c*-f+k*-i-n*-h;b.y=k*p+c*-h+n*-f-q*-i;b.z=n*p+c*-i+q*-h-k*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;g<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,g=-g):c.copy(b);if(Math.abs(g)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,b,c,d,g,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,d,g,f,h){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+f*g+c*i-d*h;this.y=c*a+f*h+d*g-b*i;this.z=d*a+f*i+b*h-c*g;this.w=f*a-b*g-c*h-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,i=this.z,p=this.w,n=p*c+h*f-i*d,k=p*d+i*c-g*f,l=p*f+g*d-h*c,c=-g*
+c-h*d-i*f;b.x=n*p+c*-g+k*-i-l*-h;b.y=k*p+c*-h+l*-g-n*-i;b.z=l*p+c*-i+n*-h-k*-g;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,d,f,g,h){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var g=this.faces[c];b.multiplyVector3(g.normal);for(var f=0,h=g.vertexNormals.length;f<h;f++)b.multiplyVector3(g.vertexNormals[f]);a.multiplyVector3(g.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
+THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var g=0,h=f.vertexNormals.length;g<h;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a,
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a,
-b,c,d,g,f,h=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],g=this.vertices[c.b],f=this.vertices[c.c],h.sub(f.position,g.position),i.sub(d.position,g.position),h.crossSelf(i),h.isZero()||h.normalize(),c.normal.copy(h)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=
+b,c,d,f,g,h=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.sub(g.position,f.position),i.sub(d.position,f.position),h.crossSelf(i),h.isZero()||h.normalize(),c.normal.copy(h)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=
 this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
 this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
 d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
 d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
-b,c,d,g,f,E){i=a.vertices[b].position;p=a.vertices[c].position;q=a.vertices[d].position;k=h[g];n=h[f];w=h[E];x=p.x-i.x;G=q.x-i.x;u=p.y-i.y;K=q.y-i.y;ta=p.z-i.z;O=q.z-i.z;ia=n.u-k.u;ea=w.u-k.u;D=n.v-k.v;P=w.v-k.v;H=1/(ia*P-ea*D);wa.set((P*x-D*G)*H,(P*u-D*K)*H,(P*ta-D*O)*H);sa.set((ia*G-ea*x)*H,(ia*K-ea*u)*H,(ia*O-ea*ta)*H);oa[b].addSelf(wa);oa[c].addSelf(wa);oa[d].addSelf(wa);pa[b].addSelf(sa);pa[c].addSelf(sa);pa[d].addSelf(sa)}var b,c,d,g,f,h,i,p,q,k,n,w,x,G,u,K,ta,O,ia,ea,D,P,H,M,oa=[],pa=[],wa=
-new THREE.Vector3,sa=new THREE.Vector3,R=new THREE.Vector3,ba=new THREE.Vector3,ya=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)oa[b]=new THREE.Vector3,pa[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],h=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var E=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)ya.copy(f.vertexNormals[d]),
-g=f[E[d]],M=oa[g],R.copy(M),R.subSelf(ya.multiplyScalar(ya.dot(M))).normalize(),ba.cross(f.vertexNormals[d],M),g=ba.dot(pa[g]),g=g<0?-1:1,f.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.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 b=1,c=this.vertices.length;b<
+b,c,d,g,f,O){i=a.vertices[b].position;p=a.vertices[c].position;n=a.vertices[d].position;k=h[g];l=h[f];w=h[O];u=p.x-i.x;G=n.x-i.x;C=p.y-i.y;J=n.y-i.y;qa=p.z-i.z;T=n.z-i.z;la=l.u-k.u;ga=w.u-k.u;K=l.v-k.v;P=w.v-k.v;N=1/(la*P-ga*K);da.set((P*u-K*G)*N,(P*C-K*J)*N,(P*qa-K*T)*N);ta.set((la*G-ga*u)*N,(la*J-ga*C)*N,(la*T-ga*qa)*N);ja[b].addSelf(da);ja[c].addSelf(da);ja[d].addSelf(da);ua[b].addSelf(ta);ua[c].addSelf(ta);ua[d].addSelf(ta)}var b,c,d,f,g,h,i,p,n,k,l,w,u,G,C,J,qa,T,la,ga,K,P,N,O,ja=[],ua=[],da=
+new THREE.Vector3,ta=new THREE.Vector3,ra=new THREE.Vector3,L=new THREE.Vector3,va=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)ja[b]=new THREE.Vector3,ua[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],h=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var wa=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)va.copy(g.vertexNormals[d]),
+f=g[wa[d]],O=ja[f],ra.copy(O),ra.subSelf(va.multiplyScalar(va.dot(O))).normalize(),L.cross(g.vertexNormals[d],O),f=L.dot(ua[f]),f=f<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(ra.x,ra.y,ra.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<
 c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=
 c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=
-0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,g=Math.pow(10,4),f,h;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];f=0;for(h=this.faces.length;f<h;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=
+0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),g,h;g=0;for(h=this.vertices.length;g<h;g++)d=this.vertices[g].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];g=0;for(h=this.faces.length;g<h;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=
 c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
 c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,g,f,h){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*g+b}this.points=a;var c=[],d={x:0,y:0,z:0},g,f,h,i,p,q,k,n,w;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;f=Math.floor(g);h=g-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;q=this.points[c[0]];k=this.points[c[1]];
-n=this.points[c[2]];w=this.points[c[3]];i=h*h;p=h*i;d.x=b(q.x,k.x,n.x,w.x,h,i,p);d.y=b(q.y,k.y,n.y,w.y,h,i,p);d.z=b(q.z,k.z,n.z,w.z,h,i,p);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,g=b=b=0,f=new THREE.Vector3,h=new THREE.Vector3,i=[],n=0;i[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),h.copy(d),n+=h.distanceTo(f),
-f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=g&&(i[b]=n,g=b);i[i.length]=n;return{chunks:i,total:n}};this.reparametrizeByArcLength=function(a){var b,c,d,g,f,h,i=[],n=new THREE.Vector3,k=this.getLength();i.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];h=Math.ceil(a*c/k.total);g=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++)d=g+c*(1/h)*(f-g),d=this.getPoint(d),i.push(n.copy(d).clone());i.push(n.copy(this.points[b]).clone())}this.points=
+THREE.Spline=function(a){function b(a,b,c,d,g,f,h){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*g+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,g,h,i,p,n,k,l,w;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){f=(this.points.length-1)*a;g=Math.floor(f);h=f-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;n=this.points[c[0]];k=this.points[c[1]];
+l=this.points[c[2]];w=this.points[c[3]];i=h*h;p=h*i;d.x=b(n.x,k.x,l.x,w.x,h,i,p);d.y=b(n.y,k.y,l.y,w.y,h,i,p);d.z=b(n.z,k.z,l.z,w.z,h,i,p);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,g=b=b=0,f=new THREE.Vector3,h=new THREE.Vector3,i=[],k=0;i[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),h.copy(d),k+=h.distanceTo(f),
+f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=g&&(i[b]=k,g=b);i[i.length]=k;return{chunks:i,total:k}};this.reparametrizeByArcLength=function(a){var b,c,d,g,f,h,i=[],k=new THREE.Vector3,l=this.getLength();i.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];h=Math.ceil(a*c/l.total);g=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++)d=g+c*(1/h)*(f-g),d=this.getPoint(d),i.push(k.copy(d).clone());i.push(k.copy(this.points[b]).clone())}this.points=
 i}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,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};
 i}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,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,b,c,d,g,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=g!==void 0?g:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
+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,b,c,d,f,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
 THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
 THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
-THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,g,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=g;this.height=f;this.updateProjectionMatrix()};
+THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=g;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
 THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
@@ -115,22 +115,22 @@ THREE.MeshShaderMaterial=function(a){console.warn("DEPRECATED: MeshShaderMateria
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
 THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
 void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
 void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
-THREE.Texture=function(a,b,c,d,g,f){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1;this.onUpdate=null};
+THREE.Texture=function(a,b,c,d,f,g){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1;this.onUpdate=null};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,g,f,h,i,p){THREE.Texture.call(this,null,g,f,h,i,p);this.image={data:a,width:b,height:c};this.format=d!==void 0?d:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,f,g,h,i,p){THREE.Texture.call(this,null,f,g,h,i,p);this.image={data:a,width:b,height:c};this.format=d!==void 0?d:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1};
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1};
 THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
 for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
 THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,g,f,h,i;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)g=this.geometry.bones[c],f=g.pos,h=g.rotq,i=g.scl,d=this.addBone(),d.name=g.name,d.position.set(f[0],f[1],f[2]),d.quaternion.set(h[0],h[1],h[2],h[3]),d.useQuaternion=!0,i!==void 0?d.scale.set(i[0],i[1],i[2]):d.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)g=this.geometry.bones[c],
-d=this.bones[c],g.parent===-1?this.add(d):this.bones[g.parent].add(d);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,h,i;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],g=f.pos,h=f.rotq,i=f.scl,d=this.addBone(),d.name=f.name,d.position.set(g[0],g[1],g[2]),d.quaternion.set(h[0],h[1],h[2],h[3]),d.useQuaternion=!0,i!==void 0?d.scale.set(i[0],i[1],i[2]):d.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
+d=this.bones[c],f.parent===-1?this.add(d):this.bones[f.parent].add(d);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.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;for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,!1):c.updateMatrixWorld(!0)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
 THREE.SkinnedMesh.prototype.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;for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,!1):c.updateMatrixWorld(!0)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
 a*16)};
 a*16)};
-THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,g=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,d=
-new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[f].multiplyVector3(d));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};
+THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y,d=
+new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};
 THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
 THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
 THREE.LOD.prototype.update=function(a){if(this.LODs.length>1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=!1}};
 THREE.LOD.prototype.update=function(a){if(this.LODs.length>1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=!1}};
 THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map instanceof THREE.Texture?a.map:THREE.ImageUtils.loadTexture(a.map);this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?a.useScreenCoordinates:!0;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:
 THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map instanceof THREE.Texture?a.map:THREE.ImageUtils.loadTexture(a.map);this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?a.useScreenCoordinates:!0;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:
@@ -154,7 +154,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu
 default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
 default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
 shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
 shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
 shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
 shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
-THREE.UniformsUtils={merge:function(a){var b,c,d,g={};for(b=0;b<a.length;b++)for(c in d=this.clone(a[b]),d)g[c]=d[c];return g},clone:function(a){var b,c,d,g={};for(b in a)for(c in g[b]={},a[b])d=a[b][c],g[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d;return g}};
+THREE.UniformsUtils={merge:function(a){var b,c,d,f={};for(b=0;b<a.length;b++)for(c in d=this.clone(a[b]),d)f[c]=d[c];return f},clone:function(a){var b,c,d,f={};for(b in a)for(c in f[b]={},a[b])d=a[b][c],f[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d;return f}};
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
 value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
 value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
 value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
 value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
@@ -174,115 +174,114 @@ 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.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.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 b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var g in d.attributes){var f=d.attributes[g];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var h=1;f.type==="v2"?h=2:f.type==="v3"?h=3:f.type==="v4"?h=4:f.type==="c"&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=e.createBuffer();f.buffer.belongsToAttribute=g;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var g in d.attributes){var f=d.attributes[g];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var h=1;f.type==="v2"?h=2:f.type==="v3"?h=3:f.type==="v4"?h=4:f.type==="c"&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=e.createBuffer();f.buffer.belongsToAttribute=g;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
-function c(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){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function g(a){if(a.vertexColors)return a.vertexColors;return!1}function f(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
-return!1}function h(a,b,c){var d,g,f,h,l=a.vertices;h=l.length;var I=a.colors,i=I.length,r=a.__vertexArray,n=a.__colorArray,j=a.__sortArray,o=a.__dirtyVertices,k=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){Ga.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)g=l[d].position,Ea.copy(g),Ga.multiplyVector3(Ea),j[d]=[Ea.z,d];j.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++)g=l[j[d][1]].position,f=d*3,r[f]=g.x,r[f+1]=g.y,r[f+2]=g.z;for(d=0;d<i;d++)f=d*3,g=I[j[d][1]],n[f]=g.r,n[f+
-1]=g.g,n[f+2]=g.b;if(p){I=0;for(i=p.length;I<i;I++)if(l=p[I],l.boundTo===void 0||l.boundTo==="vertices")if(f=0,g=l.value.length,l.size===1)for(d=0;d<g;d++)h=j[d][1],l.array[d]=l.value[h];else if(l.size===2)for(d=0;d<g;d++)h=j[d][1],h=l.value[h],l.array[f]=h.x,l.array[f+1]=h.y,f+=2;else if(l.size===3)if(l.type==="c")for(d=0;d<g;d++)h=j[d][1],h=l.value[h],l.array[f]=h.r,l.array[f+1]=h.g,l.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=j[d][1],h=l.value[h],l.array[f]=h.x,l.array[f+1]=h.y,l.array[f+2]=h.z,
-f+=3;else if(l.size===4)for(d=0;d<g;d++)h=j[d][1],h=l.value[h],l.array[f]=h.x,l.array[f+1]=h.y,l.array[f+2]=h.z,l.array[f+3]=h.w,f+=4}}else{if(o)for(d=0;d<h;d++)g=l[d].position,f=d*3,r[f]=g.x,r[f+1]=g.y,r[f+2]=g.z;if(k)for(d=0;d<i;d++)g=I[d],f=d*3,n[f]=g.r,n[f+1]=g.g,n[f+2]=g.b;if(p){I=0;for(i=p.length;I<i;I++)if(l=p[I],l.needsUpdate&&(l.boundTo===void 0||l.boundTo==="vertices"))if(g=l.value.length,f=0,l.size===1)for(d=0;d<g;d++)l.array[d]=l.value[d];else if(l.size===2)for(d=0;d<g;d++)h=l.value[d],
-l.array[f]=h.x,l.array[f+1]=h.y,f+=2;else if(l.size===3)if(l.type==="c")for(d=0;d<g;d++)h=l.value[d],l.array[f]=h.r,l.array[f+1]=h.g,l.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=l.value[d],l.array[f]=h.x,l.array[f+1]=h.y,l.array[f+2]=h.z,f+=3;else if(l.size===4)for(d=0;d<g;d++)h=l.value[d],l.array[f]=h.x,l.array[f+1]=h.y,l.array[f+2]=h.z,l.array[f+3]=h.w,f+=4}}if(o||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,r,b);if(k||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
-a.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,n,b);if(p){I=0;for(i=p.length;I<i;I++)if(l=p[I],l.needsUpdate||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,l.buffer),e.bufferData(e.ARRAY_BUFFER,l.array,b)}}function i(a,b){return b.z-a.z}function p(a,b,c,e,d,f,g,h){var i,n,r,k;b?(n=a.length-1,k=b=-1):(n=0,b=a.length,k=1);for(var j=n;j!==b;j+=k)if(i=a[j],i.render){n=i.object;r=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&E.setBlending(i.blending);E.setDepthTest(i.depthTest);ta(i.depthWrite);O(i.polygonOffset,
-i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(n);E.renderBuffer(e,d,f,i,r,n)}}function q(a,b,c,e,d,f,g){for(var h,i,n=0,r=a.length;n<r;n++)if(h=a[n],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&E.setBlending(h.blending);E.setDepthTest(h.depthTest);ta(h.depthWrite);O(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}E.renderImmediateObject(c,e,d,h,i)}}function k(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 w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function x(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function G(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function u(a,b,c,d,f){d.program||E.initMaterial(d,b,c,f);if(d.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var g=0,h=E.maxMorphTargets;g<h;g++)f.__webglMorphTargetInfluences[g]=0}var l=!1,g=d.program,h=
-g.uniforms,i=d.uniforms;g!==va&&(e.useProgram(g),va=g,l=!0);if(d.id!==ua)ua=d.id,l=!0;if(l){e.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray);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 n,r,k=0,j=0,o=0,p,q,w,x=La,u=x.directional.colors,G=x.directional.positions,
-t=x.point.colors,H=x.point.positions,K=x.point.distances,v=0,T=0,c=n=w=0,l=b.length;c<l;c++)if(n=b[c],r=n.color,p=n.position,q=n.intensity,w=n.distance,n instanceof THREE.AmbientLight)E.gammaInput?(k+=r.r*r.r,j+=r.g*r.g,o+=r.b*r.b):(k+=r.r,j+=r.g,o+=r.b);else if(n instanceof THREE.DirectionalLight)w=v*3,E.gammaInput?(u[w]=r.r*r.r*q*q,u[w+1]=r.g*r.g*q*q,u[w+2]=r.b*r.b*q*q):(u[w]=r.r*q,u[w+1]=r.g*q,u[w+2]=r.b*q),G[w]=p.x,G[w+1]=p.y,G[w+2]=p.z,v+=1;else if(n instanceof THREE.SpotLight)w=v*3,E.gammaInput?
-(u[w]=r.r*r.r*q*q,u[w+1]=r.g*r.g*q*q,u[w+2]=r.b*r.b*q*q):(u[w]=r.r*q,u[w+1]=r.g*q,u[w+2]=r.b*q),r=1/p.length(),G[w]=p.x*r,G[w+1]=p.y*r,G[w+2]=p.z*r,v+=1;else if(n instanceof THREE.PointLight)n=T*3,E.gammaInput?(t[n]=r.r*r.r*q*q,t[n+1]=r.g*r.g*q*q,t[n+2]=r.b*r.b*q*q):(t[n]=r.r*q,t[n+1]=r.g*q,t[n+2]=r.b*q),H[n]=p.x,H[n+1]=p.y,H[n+2]=p.z,K[T]=w,T+=1;c=v*3;for(l=u.length;c<l;c++)u[c]=0;c=T*3;for(l=t.length;c<l;c++)t[c]=0;x.point.length=T;x.directional.length=v;x.ambient[0]=k;x.ambient[1]=j;x.ambient[2]=
-o;b=La;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,E.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=M.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,E.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)E.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(f.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<E.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=E.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=E.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=E.shadowMapDarkness;i.shadowBias.value=E.shadowMapBias}b=
-d.uniformsList;i=0;for(c=b.length;i<c;i++)if(j=g.uniforms[b[i][1]])if(k=b[i][0],o=k.type,l=k.value,o==="i")e.uniform1i(j,l);else if(o==="f")e.uniform1f(j,l);else if(o==="v2")e.uniform2f(j,l.x,l.y);else if(o==="v3")e.uniform3f(j,l.x,l.y,l.z);else if(o==="v4")e.uniform4f(j,l.x,l.y,l.z,l.w);else if(o==="c")e.uniform3f(j,l.r,l.g,l.b);else if(o==="fv1")e.uniform1fv(j,l);else if(o==="fv")e.uniform3fv(j,l);else if(o==="v3v"){if(!k._array)k._array=new Float32Array(3*l.length);o=0;for(p=l.length;o<p;o++)x=
-o*3,k._array[x]=l[o].x,k._array[x+1]=l[o].y,k._array[x+2]=l[o].z;e.uniform3fv(j,k._array)}else if(o==="m4"){if(!k._array)k._array=new Float32Array(16);l.flattenToArray(k._array);e.uniformMatrix4fv(j,!1,k._array)}else if(o==="m4v"){if(!k._array)k._array=new Float32Array(16*l.length);o=0;for(p=l.length;o<p;o++)l[o].flattenToArrayOffset(k._array,o*16);e.uniformMatrix4fv(j,!1,k._array)}else if(o==="t"){if(e.uniform1i(j,l),j=k.texture)if(j.image instanceof Array&&j.image.length===6){if(k=j,k.image.length===
-6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+l);e.bindTexture(e.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);l=ea(e.TEXTURE_CUBE_MAP,k,k.image[0]);for(j=0;j<6;j++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,k.image[j]);l&&e.generateMipmap(e.TEXTURE_CUBE_MAP);k.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+l),e.bindTexture(e.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else j instanceof THREE.WebGLRenderTargetCube?
-(k=j,e.activeTexture(e.TEXTURE0+l),e.bindTexture(e.TEXTURE_CUBE_MAP,k.__webglTexture)):E.setTexture(j,l)}else if(o==="tv"){if(!k._array){k._array=[];o=0;for(p=k.texture.length;o<p;o++)k._array[o]=l+o}e.uniform1iv(j,k._array);o=0;for(p=k.texture.length;o<p;o++)(j=k.texture[o])&&E.setTexture(j,k._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null&&e.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||
-d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==null&&e.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(e.uniformMatrix4fv(h.cameraInverseMatrix,!1,a._viewMatrixArray),e.uniformMatrix4fv(h.boneGlobalMatrices,!1,f.boneMatrices))}e.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray);h.normalMatrix&&e.uniformMatrix3fv(h.normalMatrix,!1,f._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&
-h.objectMatrix!==null&&e.uniformMatrix4fv(h.objectMatrix,!1,f._objectMatrixArray);return g}function K(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function ta(a){ra!==a&&(e.depthMask(a),ra=a)}function O(a,b,c){Ca!==a&&(a?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Ca=a);if(a&&(Fa!==b||Da!==c))e.polygonOffset(b,c),Fa=b,Da=c}function ia(a,
-b){var c;a==="fragment"?c=e.createShader(e.FRAGMENT_SHADER):a==="vertex"&&(c=e.createShader(e.VERTEX_SHADER));e.shaderSource(c,b);e.compileShader(c);if(!e.getShaderParameter(c,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(c)),console.error(b),null;return c}function ea(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(e.texParameteri(a,e.TEXTURE_WRAP_S,H(b.wrapS)),e.texParameteri(a,e.TEXTURE_WRAP_T,H(b.wrapT)),e.texParameteri(a,e.TEXTURE_MAG_FILTER,H(b.magFilter)),e.texParameteri(a,
-e.TEXTURE_MIN_FILTER,H(b.minFilter)),!0):(e.texParameteri(a,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_MAG_FILTER,P(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,P(b.minFilter)),!1)}function D(a,b){e.bindRenderbuffer(e.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,a)):b.depthBuffer&&
-b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,a)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height)}function P(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function H(a){switch(a){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;
-case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;
-case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var a=a||{},M=a.canvas!==void 0?a.canvas:document.createElement("canvas"),oa=a.precision!==void 0?a.precision:
-"highp",pa=a.antialias!==void 0?a.antialias:!1,wa=a.stencil!==void 0?a.stencil:!0,sa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,R=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ba=a.clearAlpha!==void 0?a.clearAlpha:0,ya=a.maxLights!==void 0?a.maxLights:4;this.domElement=M;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.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var E=this,e,Ba=[],va=null,X=null,ua=-1,N=null,xa=0,ka=null,
-na=null,S=null,qa=null,ra=null,Ca=null,Fa=null,Da=null,Aa=null,za=0,Ja=0,Ha=0,Ia=0,Ka=new THREE.Frustum,Ga=new THREE.Matrix4,Ea=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};e=function(){var a;try{if(!(a=M.getContext("experimental-webgl",{antialias:pa,stencil:wa,preserveDrawingBuffer:sa})))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}();e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(R.r,R.g,R.b,ba);this.context=e;var Ma=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return e};
-this.supportsVertexTextures=function(){return Ma};this.setSize=function(a,b){M.width=a;M.height=b;this.setViewport(0,0,M.width,M.height)};this.setViewport=function(a,b,c,d){za=a;Ja=b;Ha=c;Ia=d;e.viewport(za,Ja,Ha,Ia)};this.setScissor=function(a,b,c,d){e.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(a,b){R.setHex(a);ba=b;e.clearColor(R.r,R.g,R.b,ba)};this.setClearColor=function(a,b){R.copy(a);ba=b;e.clearColor(R.r,
-R.g,R.b,ba)};this.getClearColor=function(){return R};this.getClearAlpha=function(){return ba};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=e.COLOR_BUFFER_BIT;if(b===void 0||b)d|=e.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=e.STENCIL_BUFFER_BIT;e.clear(d)};this.clearTarget=function(a,b,c,e){this.setRenderTarget(a);this.clear(b,c,e)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};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];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);
-e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)e.deleteBuffer(c.__webglCustomAttributesList[d].buffer);E.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=
-a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,e.deleteTexture(a.__webglTexture),
-E.info.memory.textures--};this.updateShadowMap=function(a,b){va=null;ua=N=ra=qa=S=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=e.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=e.createBuffer();a.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,a.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(b.attributes.position),e.vertexAttribPointer(b.attributes.position,
-3,e.FLOAT,!1,0,0));if(a.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,g,h,i,k,n,r,p,j,o=a.count*3;for(j=0;j<o;j+=9)c=a.normalArray,d=c[j],f=c[j+1],g=c[j+2],h=c[j+3],k=c[j+4],r=c[j+5],i=c[j+6],n=c[j+7],p=c[j+8],d=(d+h+i)/3,f=(f+k+n)/3,g=(g+r+p)/3,c[j]=d,c[j+1]=f,c[j+2]=g,c[j+3]=d,c[j+4]=f,c[j+5]=g,c[j+6]=d,c[j+7]=f,c[j+8]=g}e.bufferData(e.ARRAY_BUFFER,a.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(b.attributes.normal);e.vertexAttribPointer(b.attributes.normal,
-3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,a.count);a.count=0};this.renderBuffer=function(a,b,c,d,f,g){if(d.opacity!==0){var h,i,c=u(a,b,c,d,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(d.wireframe?1:0);c!==N&&(N=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),
-e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){h=0;var k=g.morphTargetForcedOrder;for(i=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<k.length;)e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k[h]]),e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[h]=i[k[h]],h++}else{var k=[],n=-1,
-r=0;i=g.morphTargetInfluences;var p,j=i.length;h=0;for(g.morphTargetBase!==-1&&(k[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(p=0;p<j;p++)!k[p]&&i[p]>n&&(r=p,n=i[r]);e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[r]);e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=n;k[r]=1;n=-1;h++}}d.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){h=
+function c(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){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){if(a.vertexColors)return a.vertexColors;return!1}function g(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
+return!1}function h(a,b,c){var d,g,f,h,o=a.vertices;h=o.length;var H=a.colors,i=H.length,s=a.__vertexArray,k=a.__colorArray,j=a.__sortArray,q=a.__dirtyVertices,l=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){Fa.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)g=o[d].position,Da.copy(g),Fa.multiplyVector3(Da),j[d]=[Da.z,d];j.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++)g=o[j[d][1]].position,f=d*3,s[f]=g.x,s[f+1]=g.y,s[f+2]=g.z;for(d=0;d<i;d++)f=d*3,g=H[j[d][1]],k[f]=g.r,k[f+
+1]=g.g,k[f+2]=g.b;if(p){H=0;for(i=p.length;H<i;H++)if(o=p[H],o.boundTo===void 0||o.boundTo==="vertices")if(f=0,g=o.value.length,o.size===1)for(d=0;d<g;d++)h=j[d][1],o.array[d]=o.value[h];else if(o.size===2)for(d=0;d<g;d++)h=j[d][1],h=o.value[h],o.array[f]=h.x,o.array[f+1]=h.y,f+=2;else if(o.size===3)if(o.type==="c")for(d=0;d<g;d++)h=j[d][1],h=o.value[h],o.array[f]=h.r,o.array[f+1]=h.g,o.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=j[d][1],h=o.value[h],o.array[f]=h.x,o.array[f+1]=h.y,o.array[f+2]=h.z,
+f+=3;else if(o.size===4)for(d=0;d<g;d++)h=j[d][1],h=o.value[h],o.array[f]=h.x,o.array[f+1]=h.y,o.array[f+2]=h.z,o.array[f+3]=h.w,f+=4}}else{if(q)for(d=0;d<h;d++)g=o[d].position,f=d*3,s[f]=g.x,s[f+1]=g.y,s[f+2]=g.z;if(l)for(d=0;d<i;d++)g=H[d],f=d*3,k[f]=g.r,k[f+1]=g.g,k[f+2]=g.b;if(p){H=0;for(i=p.length;H<i;H++)if(o=p[H],o.needsUpdate&&(o.boundTo===void 0||o.boundTo==="vertices"))if(g=o.value.length,f=0,o.size===1)for(d=0;d<g;d++)o.array[d]=o.value[d];else if(o.size===2)for(d=0;d<g;d++)h=o.value[d],
+o.array[f]=h.x,o.array[f+1]=h.y,f+=2;else if(o.size===3)if(o.type==="c")for(d=0;d<g;d++)h=o.value[d],o.array[f]=h.r,o.array[f+1]=h.g,o.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=o.value[d],o.array[f]=h.x,o.array[f+1]=h.y,o.array[f+2]=h.z,f+=3;else if(o.size===4)for(d=0;d<g;d++)h=o.value[d],o.array[f]=h.x,o.array[f+1]=h.y,o.array[f+2]=h.z,o.array[f+3]=h.w,f+=4}}if(q||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,s,b);if(l||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
+a.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,k,b);if(p){H=0;for(i=p.length;H<i;H++)if(o=p[H],o.needsUpdate||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,o.buffer),e.bufferData(e.ARRAY_BUFFER,o.array,b)}}function i(a,b){return b.z-a.z}function p(a,b,c){if(a.length)for(var e=0,d=a.length;e<d;e++)R=null,D=S=za=sa=oa=-1,a[e].render(b,c,Ga,Ha),R=null,D=S=za=sa=oa=-1}function n(a,b,c,e,d,f,g,h){var i,k,s,l;b?(k=a.length-1,l=b=-1):(k=0,b=a.length,l=1);for(var j=k;j!==b;j+=l)if(i=a[j],i.render){k=i.object;
+s=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&E.setBlending(i.blending);E.setDepthTest(i.depthTest);T(i.depthWrite);la(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(k);E.renderBuffer(e,d,f,i,s,k)}}function k(a,b,c,e,d,f,g){for(var h,i,k=0,s=a.length;k<s;k++)if(h=a[k],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&E.setBlending(h.blending);E.setDepthTest(h.depthTest);T(h.depthWrite);la(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}E.renderImmediateObject(c,
+e,d,h,i)}}function l(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function w(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 G(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function C(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function J(a,b,c,d,f){d.program||E.initMaterial(d,b,c,f);if(d.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=
+new Float32Array(E.maxMorphTargets);for(var g=0,h=E.maxMorphTargets;g<h;g++)f.__webglMorphTargetInfluences[g]=0}var o=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==R&&(e.useProgram(g),R=g,o=!0);if(d.id!==D)D=d.id,o=!0;if(o){e.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray);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,s,l=0,j=0,q=0,p,n,u,w=La,C=w.directional.colors,G=w.directional.positions,t=w.point.colors,J=w.point.positions,O=w.point.distances,v=0,U=0,c=k=u=0,o=b.length;c<o;c++)if(k=b[c],s=k.color,p=k.position,n=k.intensity,u=k.distance,k instanceof THREE.AmbientLight)E.gammaInput?(l+=s.r*s.r,j+=s.g*s.g,q+=s.b*s.b):(l+=s.r,j+=s.g,q+=s.b);else if(k instanceof THREE.DirectionalLight)u=v*3,E.gammaInput?(C[u]=s.r*s.r*n*n,C[u+1]=s.g*s.g*n*n,C[u+2]=s.b*s.b*
+n*n):(C[u]=s.r*n,C[u+1]=s.g*n,C[u+2]=s.b*n),G[u]=p.x,G[u+1]=p.y,G[u+2]=p.z,v+=1;else if(k instanceof THREE.SpotLight)u=v*3,E.gammaInput?(C[u]=s.r*s.r*n*n,C[u+1]=s.g*s.g*n*n,C[u+2]=s.b*s.b*n*n):(C[u]=s.r*n,C[u+1]=s.g*n,C[u+2]=s.b*n),s=1/p.length(),G[u]=p.x*s,G[u+1]=p.y*s,G[u+2]=p.z*s,v+=1;else if(k instanceof THREE.PointLight)k=U*3,E.gammaInput?(t[k]=s.r*s.r*n*n,t[k+1]=s.g*s.g*n*n,t[k+2]=s.b*s.b*n*n):(t[k]=s.r*n,t[k+1]=s.g*n,t[k+2]=s.b*n),J[k]=p.x,J[k+1]=p.y,J[k+2]=p.z,O[U]=u,U+=1;c=v*3;for(o=C.length;c<
+o;c++)C[c]=0;c=U*3;for(o=t.length;c<o;c++)t[c]=0;w.point.length=U;w.directional.length=v;w.ambient[0]=l;w.ambient[1]=j;w.ambient[2]=q;b=La;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,E.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=ja.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,E.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)E.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(f.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<E.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=E.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=
+E.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=E.shadowMapDarkness;i.shadowBias.value=E.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(j=g.uniforms[b[i][1]])if(l=b[i][0],q=l.type,o=l.value,q==="i")e.uniform1i(j,o);else if(q==="f")e.uniform1f(j,o);else if(q==="v2")e.uniform2f(j,o.x,o.y);else if(q==="v3")e.uniform3f(j,o.x,o.y,o.z);else if(q==="v4")e.uniform4f(j,o.x,o.y,o.z,o.w);else if(q==="c")e.uniform3f(j,o.r,o.g,o.b);else if(q==="fv1")e.uniform1fv(j,o);else if(q==="fv")e.uniform3fv(j,
+o);else if(q==="v3v"){if(!l._array)l._array=new Float32Array(3*o.length);q=0;for(p=o.length;q<p;q++)w=q*3,l._array[w]=o[q].x,l._array[w+1]=o[q].y,l._array[w+2]=o[q].z;e.uniform3fv(j,l._array)}else if(q==="m4"){if(!l._array)l._array=new Float32Array(16);o.flattenToArray(l._array);e.uniformMatrix4fv(j,!1,l._array)}else if(q==="m4v"){if(!l._array)l._array=new Float32Array(16*o.length);q=0;for(p=o.length;q<p;q++)o[q].flattenToArrayOffset(l._array,q*16);e.uniformMatrix4fv(j,!1,l._array)}else if(q==="t"){if(e.uniform1i(j,
+o),j=l.texture)if(j.image instanceof Array&&j.image.length===6){if(l=j,l.image.length===6)if(l.needsUpdate){if(!l.image.__webglTextureCube)l.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+o);e.bindTexture(e.TEXTURE_CUBE_MAP,l.image.__webglTextureCube);o=K(e.TEXTURE_CUBE_MAP,l,l.image[0]);for(j=0;j<6;j++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,l.image[j]);o&&e.generateMipmap(e.TEXTURE_CUBE_MAP);l.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+
+o),e.bindTexture(e.TEXTURE_CUBE_MAP,l.image.__webglTextureCube)}else j instanceof THREE.WebGLRenderTargetCube?(l=j,e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture)):E.setTexture(j,o)}else if(q==="tv"){if(!l._array){l._array=[];q=0;for(p=l.texture.length;q<p;q++)l._array[q]=o+q}e.uniform1iv(j,l._array);q=0;for(p=l.texture.length;q<p;q++)(j=l.texture[q])&&E.setTexture(j,l._array[q])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
+h.cameraPosition!==null&&e.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==null&&e.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(e.uniformMatrix4fv(h.cameraInverseMatrix,!1,a._viewMatrixArray),e.uniformMatrix4fv(h.boneGlobalMatrices,!1,f.boneMatrices))}e.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray);h.normalMatrix&&
+e.uniformMatrix3fv(h.normalMatrix,!1,f._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&h.objectMatrix!==null&&e.uniformMatrix4fv(h.objectMatrix,!1,f._objectMatrixArray);return g}function qa(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function T(a){za!==a&&(e.depthMask(a),za=a)}function la(a,b,c){Ea!==a&&(a?
+e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Ea=a);if(a&&(Ba!==b||Ca!==c))e.polygonOffset(b,c),Ba=b,Ca=c}function ga(a,b){var c;a==="fragment"?c=e.createShader(e.FRAGMENT_SHADER):a==="vertex"&&(c=e.createShader(e.VERTEX_SHADER));e.shaderSource(c,b);e.compileShader(c);if(!e.getShaderParameter(c,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(c)),console.error(b),null;return c}function K(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(e.texParameteri(a,
+e.TEXTURE_WRAP_S,O(b.wrapS)),e.texParameteri(a,e.TEXTURE_WRAP_T,O(b.wrapT)),e.texParameteri(a,e.TEXTURE_MAG_FILTER,O(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,O(b.minFilter)),!0):(e.texParameteri(a,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_MAG_FILTER,N(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,N(b.minFilter)),!1)}function P(a,b){e.bindRenderbuffer(e.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,
+e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,a)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height)}function N(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
+default:return e.LINEAR}}function O(a){switch(a){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
+var a=a||{},ja=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ua=a.precision!==void 0?a.precision:"highp",da=a.antialias!==void 0?a.antialias:!1,ta=a.stencil!==void 0?a.stencil:!0,ra=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,L=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),va=a.clearAlpha!==void 0?a.clearAlpha:0,wa=a.maxLights!==void 0?a.maxLights:4;this.domElement=ja;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.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,
+textures:0},render:{calls:0,vertices:0,faces:0}};var E=this,e,Aa=[],R=null,na=null,D=-1,S=null,pa=0,xa=null,Z=null,oa=null,sa=null,za=null,Ea=null,Ba=null,Ca=null,ya=null,Ia=0,Ja=0,Ga=0,Ha=0,Ka=new THREE.Frustum,Fa=new THREE.Matrix4,Da=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};e=function(){var a;try{if(!(a=ja.getContext("experimental-webgl",{antialias:da,stencil:ta,preserveDrawingBuffer:ra})))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}();e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(L.r,L.g,L.b,va);this.context=
+e;var Ma=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return e};this.supportsVertexTextures=function(){return Ma};this.setSize=function(a,b){ja.width=a;ja.height=b;this.setViewport(0,0,ja.width,ja.height)};this.setViewport=function(a,b,c,d){Ia=a;Ja=b;Ga=c;Ha=d;e.viewport(Ia,Ja,Ga,Ha)};this.setScissor=function(a,b,c,d){e.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(a,b){L.setHex(a);
+va=b;e.clearColor(L.r,L.g,L.b,va)};this.setClearColor=function(a,b){L.copy(a);va=b;e.clearColor(L.r,L.g,L.b,va)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return va};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=e.COLOR_BUFFER_BIT;if(b===void 0||b)d|=e.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=e.STENCIL_BUFFER_BIT;e.clear(d)};this.clearTarget=function(a,b,c,e){this.setRenderTarget(a);this.clear(b,c,e)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};
+this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};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];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);
+e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)e.deleteBuffer(c.__webglCustomAttributesList[d].buffer);
+E.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--};this.deallocateTexture=
+function(a){if(a.__webglInit)a.__webglInit=!1,e.deleteTexture(a.__webglTexture),E.info.memory.textures--};this.updateShadowMap=function(a,b){R=null;D=S=za=sa=oa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=e.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=e.createBuffer();a.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,a.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(b.attributes.position),
+e.vertexAttribPointer(b.attributes.position,3,e.FLOAT,!1,0,0));if(a.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,g,h,i,l,k,s,p,j,q=a.count*3;for(j=0;j<q;j+=9)c=a.normalArray,d=c[j],f=c[j+1],g=c[j+2],h=c[j+3],l=c[j+4],s=c[j+5],i=c[j+6],k=c[j+7],p=c[j+8],d=(d+h+i)/3,f=(f+l+k)/3,g=(g+s+p)/3,c[j]=d,c[j+1]=f,c[j+2]=g,c[j+3]=d,c[j+4]=f,c[j+5]=g,c[j+6]=d,c[j+7]=f,c[j+8]=g}e.bufferData(e.ARRAY_BUFFER,a.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(b.attributes.normal);
+e.vertexAttribPointer(b.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,a.count);a.count=0};this.renderBuffer=function(a,b,c,d,f,g){if(d.opacity!==0){var h,i,c=J(a,b,c,d,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(d.wireframe?1:0);c!==S&&(S=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,
+f.__webglMorphTargetsBuffers[g.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){h=0;var l=g.morphTargetForcedOrder;for(i=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<l.length;)e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[l[h]]),e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[h]=
+i[l[h]],h++}else{var l=[],k=-1,s=0;i=g.morphTargetInfluences;var p,j=i.length;h=0;for(g.morphTargetBase!==-1&&(l[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(p=0;p<j;p++)!l[p]&&i[p]>k&&(s=p,k=i[s]);e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[s]);e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=k;l[s]=1;k=-1;h++}}d.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){h=
 0;for(i=f.__webglCustomAttributesList.length;h<i;h++)c=f.__webglCustomAttributesList[h],b[c.buffer.belongsToAttribute]>=0&&(e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,e.FLOAT,!1,0,0))}b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,
 0;for(i=f.__webglCustomAttributesList.length;h<i;h++)c=f.__webglCustomAttributesList[h],b[c.buffer.belongsToAttribute]>=0&&(e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,e.FLOAT,!1,0,0))}b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,
 f.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
 f.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
 0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?
 0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?
-(d=d.wireframeLinewidth,d!==Aa&&(e.lineWidth(d),Aa=d),a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),e.drawElements(e.LINES,f.__webglLineCount,e.UNSIGNED_SHORT,0)):(a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),e.drawElements(e.TRIANGLES,f.__webglFaceCount,e.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=f.__webglFaceCount,E.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?e.LINE_STRIP:e.LINES,d=d.linewidth,d!==
-Aa&&(e.lineWidth(d),Aa=d),e.drawArrays(g,0,f.__webglLineCount),E.info.render.calls++):g instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,f.__webglParticleCount),E.info.render.calls++):g instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,f.__webglVertexCount),E.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,h,l,k=a.lights,n=a.fog;ua=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();if(this.renderPluginsPre.length){f=0;for(g=this.renderPluginsPre.length;f<g;f++)va=null,ua=N=ra=qa=S=-1,this.renderPluginsPre[f].render(a,b,Ha,Ia),va=null,ua=N=ra=qa=S=-1}E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=
-new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Ga.multiply(b.projectionMatrix,b.matrixWorldInverse);Ka.setFromMatrix(Ga);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=a.__webglObjects;f=0;for(g=d.length;f<g;f++)if(h=d[f],l=h.object,h.render=!1,l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||Ka.contains(l))){l.matrixWorld.flattenToArray(l._objectMatrixArray);K(l,b);var r=h,w=r.object,
-j=r.buffer,o=void 0,o=o=void 0,o=w.material;if(o instanceof THREE.MeshFaceMaterial){if(o=j.materialIndex,o>=0)o=w.geometry.materials[o],o.transparent?(r.transparent=o,r.opaque=null):(r.opaque=o,r.transparent=null)}else if(o)o.transparent?(r.transparent=o,r.opaque=null):(r.opaque=o,r.transparent=null);h.render=!0;if(this.sortObjects)l.renderDepth?h.z=l.renderDepth:(Ea.copy(l.position),Ga.multiplyVector3(Ea),h.z=Ea.z)}this.sortObjects&&d.sort(i);d=a.__webglObjectsImmediate;f=0;for(g=d.length;f<g;f++)if(h=
-d[f],l=h.object,l.visible)l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),K(l,b),l=h.object.material,l.transparent?(h.transparent=l,h.opaque=null):(h.opaque=l,h.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),ta(a.overrideMaterial.depthWrite),O(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),p(a.__webglObjects,!1,"",b,k,n,!0,a.overrideMaterial),
-q(a.__webglObjectsImmediate,"",b,k,n,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),p(a.__webglObjects,!0,"opaque",b,k,n,!1),q(a.__webglObjectsImmediate,"opaque",b,k,n,!1),p(a.__webglObjects,!1,"transparent",b,k,n,!0),q(a.__webglObjectsImmediate,"transparent",b,k,n,!0));if(this.renderPluginsPost.length){f=0;for(g=this.renderPluginsPost.length;f<g;f++)this.renderPluginsPost[f].render(a,b,Ha,Ia),va=null,ua=N=ra=qa=S=-1}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
-(c instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,c.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,f){var g=u(a,b,c,d,f);N=-1;E.setObjectFaces(f);f.immediateRenderCallback?f.immediateRenderCallback(g,e,Ka):f.render(function(a){E.renderBufferImmediate(a,g,d.shading)})};this.initWebGLObjects=
-function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var i=a.__objectsAdded[0],p=a,q=void 0,u=void 0,B=void 0;if(!i.__webglInit)if(i.__webglInit=!0,i._modelViewMatrix=new THREE.Matrix4,i._normalMatrixArray=new Float32Array(9),i._modelViewMatrixArray=new Float32Array(16),i._objectMatrixArray=new Float32Array(16),i.matrixWorld.flattenToArray(i._objectMatrixArray),i instanceof THREE.Mesh){u=i.geometry;
-if(u.geometryGroups===void 0){var B=u,C=void 0,l=void 0,I=void 0,$=void 0,r=void 0,Y=void 0,j=void 0,o={},H=B.morphTargets.length;B.geometryGroups={};C=0;for(l=B.faces.length;C<l;C++)I=B.faces[C],$=I.materialIndex,Y=$!==void 0?$:-1,o[Y]===void 0&&(o[Y]={hash:Y,counter:0}),j=o[Y].hash+"_"+o[Y].counter,B.geometryGroups[j]===void 0&&(B.geometryGroups[j]={faces3:[],faces4:[],materialIndex:$,vertices:0,numMorphTargets:H}),r=I instanceof THREE.Face3?3:4,B.geometryGroups[j].vertices+r>65535&&(o[Y].counter+=
-1,j=o[Y].hash+"_"+o[Y].counter,B.geometryGroups[j]===void 0&&(B.geometryGroups[j]={faces3:[],faces4:[],materialIndex:$,vertices:0,numMorphTargets:H})),I instanceof THREE.Face3?B.geometryGroups[j].faces3.push(C):B.geometryGroups[j].faces4.push(C),B.geometryGroups[j].vertices+=r;B.geometryGroupsList=[];C=void 0;for(C in B.geometryGroups)B.geometryGroups[C].id=xa++,B.geometryGroupsList.push(B.geometryGroups[C])}for(q in u.geometryGroups)if(B=u.geometryGroups[q],!B.__webglVertexBuffer){C=B;C.__webglVertexBuffer=
-e.createBuffer();C.__webglNormalBuffer=e.createBuffer();C.__webglTangentBuffer=e.createBuffer();C.__webglColorBuffer=e.createBuffer();C.__webglUVBuffer=e.createBuffer();C.__webglUV2Buffer=e.createBuffer();C.__webglSkinVertexABuffer=e.createBuffer();C.__webglSkinVertexBBuffer=e.createBuffer();C.__webglSkinIndicesBuffer=e.createBuffer();C.__webglSkinWeightsBuffer=e.createBuffer();C.__webglFaceBuffer=e.createBuffer();C.__webglLineBuffer=e.createBuffer();if(C.numMorphTargets){I=l=void 0;C.__webglMorphTargetsBuffers=
-[];l=0;for(I=C.numMorphTargets;l<I;l++)C.__webglMorphTargetsBuffers.push(e.createBuffer())}E.info.memory.geometries++;$=i;r=$.geometry;l=B.faces3;Y=B.faces4;C=l.length*3+Y.length*4;I=l.length*1+Y.length*2;Y=l.length*3+Y.length*4;l=c($,B);j=f(l);o=d(l);H=g(l);B.__vertexArray=new Float32Array(C*3);if(o)B.__normalArray=new Float32Array(C*3);if(r.hasTangents)B.__tangentArray=new Float32Array(C*4);if(H)B.__colorArray=new Float32Array(C*3);if(j){if(r.faceUvs.length>0||r.faceVertexUvs.length>0)B.__uvArray=
-new Float32Array(C*2);if(r.faceUvs.length>1||r.faceVertexUvs.length>1)B.__uv2Array=new Float32Array(C*2)}if($.geometry.skinWeights.length&&$.geometry.skinIndices.length)B.__skinVertexAArray=new Float32Array(C*4),B.__skinVertexBArray=new Float32Array(C*4),B.__skinIndexArray=new Float32Array(C*4),B.__skinWeightArray=new Float32Array(C*4);B.__faceArray=new Uint16Array(I*3);B.__lineArray=new Uint16Array(Y*2);if(B.numMorphTargets){B.__morphTargetsArrays=[];$=0;for(r=B.numMorphTargets;$<r;$++)B.__morphTargetsArrays.push(new Float32Array(C*
-3))}B.__webglFaceCount=I*3;B.__webglLineCount=Y*2;if(l.attributes){if(B.__webglCustomAttributesList===void 0)B.__webglCustomAttributesList=[];I=void 0;for(I in l.attributes){var $=l.attributes[I],r={},la;for(la in $)r[la]=$[la];if(!r.__webglInitialized||r.createUniqueBuffers)r.__webglInitialized=!0,Y=1,r.type==="v2"?Y=2:r.type==="v3"?Y=3:r.type==="v4"?Y=4:r.type==="c"&&(Y=3),r.size=Y,r.array=new Float32Array(C*Y),r.buffer=e.createBuffer(),r.buffer.belongsToAttribute=I,$.needsUpdate=!0,r.__original=
-$;B.__webglCustomAttributesList.push(r)}}B.__inittedArrays=!0;u.__dirtyVertices=!0;u.__dirtyMorphTargets=!0;u.__dirtyElements=!0;u.__dirtyUvs=!0;u.__dirtyNormals=!0;u.__dirtyTangents=!0;u.__dirtyColors=!0}}else if(i instanceof THREE.Ribbon){if(u=i.geometry,!u.__webglVertexBuffer)B=u,B.__webglVertexBuffer=e.createBuffer(),B.__webglColorBuffer=e.createBuffer(),E.info.memory.geometries++,B=u,C=B.vertices.length,B.__vertexArray=new Float32Array(C*3),B.__colorArray=new Float32Array(C*3),B.__webglVertexCount=
-C,u.__dirtyVertices=!0,u.__dirtyColors=!0}else if(i instanceof THREE.Line){if(u=i.geometry,!u.__webglVertexBuffer)B=u,B.__webglVertexBuffer=e.createBuffer(),B.__webglColorBuffer=e.createBuffer(),E.info.memory.geometries++,B=u,C=i,l=B.vertices.length,B.__vertexArray=new Float32Array(l*3),B.__colorArray=new Float32Array(l*3),B.__webglLineCount=l,b(B,C),u.__dirtyVertices=!0,u.__dirtyColors=!0}else if(i instanceof THREE.ParticleSystem&&(u=i.geometry,!u.__webglVertexBuffer))B=u,B.__webglVertexBuffer=e.createBuffer(),
-B.__webglColorBuffer=e.createBuffer(),E.info.geometries++,B=u,C=i,l=B.vertices.length,B.__vertexArray=new Float32Array(l*3),B.__colorArray=new Float32Array(l*3),B.__sortArray=[],B.__webglParticleCount=l,b(B,C),u.__dirtyVertices=!0,u.__dirtyColors=!0;if(!i.__webglActive){if(i instanceof THREE.Mesh)for(q in u=i.geometry,u.geometryGroups)B=u.geometryGroups[q],k(p.__webglObjects,B,i);else i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem?(u=i.geometry,k(p.__webglObjects,
-u,i)):THREE.MarchingCubes!==void 0&&i instanceof THREE.MarchingCubes||i.immediateRenderCallback?p.__webglObjectsImmediate.push({object:i,opaque:null,transparent:null}):i instanceof THREE.Sprite?p.__webglSprites.push(i):i instanceof THREE.LensFlare&&p.__webglFlares.push(i);i.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)i=a.__objectsRemoved[0],p=a,i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem||i instanceof THREE.Ribbon||i instanceof THREE.Line?x(p.__webglObjects,
-i):i instanceof THREE.Sprite?G(p.__webglSprites,i):i instanceof THREE.LensFlare?G(p.__webglFlares,i):(i instanceof THREE.MarchingCubes||i.immediateRenderCallback)&&x(p.__webglObjectsImmediate,i),i.__webglActive=!1,a.__objectsRemoved.splice(0,1);i=0;for(p=a.__webglObjects.length;i<p;i++)if(la=a.__webglObjects[i].object,q=la.geometry,u=I=l=void 0,la instanceof THREE.Mesh){B=0;for(C=q.geometryGroupsList.length;B<C;B++)if(l=q.geometryGroupsList[B],u=c(la,l),I=u.attributes&&n(u),q.__dirtyVertices||q.__dirtyMorphTargets||
-q.__dirtyElements||q.__dirtyUvs||q.__dirtyNormals||q.__dirtyColors||q.__dirtyTangents||I){var L=la,I=e.DYNAMIC_DRAW,$=!q.dynamic,j=u;if(l.__inittedArrays){var r=d(j),Y=g(j),K=f(j),N=r===THREE.SmoothShading,D=o=j=void 0,t=void 0,ca=void 0,M=void 0,v=void 0,T=void 0,O=void 0,S=D=void 0,y=void 0,z=void 0,A=void 0,da=t=void 0,fa=void 0,ma=void 0,U=t=O=void 0,V=void 0,P=A=z=y=v=void 0,F=t=A=z=y=P=A=z=y=P=A=z=y=void 0,J=void 0,R=M=void 0,ba=void 0,Z=void 0,ka=void 0,ga=void 0,ia=S=Z=J=0,ea=0,X=F=D=0,Q=
-v=da=0,s=0,ha=void 0,Q=l.__vertexArray,ba=l.__uvArray,s=l.__uv2Array,R=l.__normalArray,ca=l.__tangentArray,fa=l.__colorArray,U=l.__skinVertexAArray,V=l.__skinVertexBArray,T=l.__skinIndexArray,ja=l.__skinWeightArray,P=l.__morphTargetsArrays,H=l.__webglCustomAttributesList,m=void 0,m=l.__faceArray,ha=l.__lineArray,ma=L.geometry,ua=ma.__dirtyElements,ta=ma.__dirtyUvs,M=ma.__dirtyNormals,O=ma.__dirtyTangents,wa=ma.__dirtyColors,ka=ma.__dirtyMorphTargets,ga=ma.vertices,L=l.faces3,W=l.faces4,aa=ma.faces,
-sa=ma.faceVertexUvs[0],va=ma.faceVertexUvs[1],na=ma.skinVerticesA,oa=ma.skinVerticesB,qa=ma.skinIndices,pa=ma.skinWeights,ra=ma.morphTargets;if(ma.__dirtyVertices){j=0;for(o=L.length;j<o;j++)t=aa[L[j]],y=ga[t.a].position,z=ga[t.b].position,A=ga[t.c].position,Q[Z]=y.x,Q[Z+1]=y.y,Q[Z+2]=y.z,Q[Z+3]=z.x,Q[Z+4]=z.y,Q[Z+5]=z.z,Q[Z+6]=A.x,Q[Z+7]=A.y,Q[Z+8]=A.z,Z+=9;j=0;for(o=W.length;j<o;j++)t=aa[W[j]],y=ga[t.a].position,z=ga[t.b].position,A=ga[t.c].position,t=ga[t.d].position,Q[Z]=y.x,Q[Z+1]=y.y,Q[Z+2]=
-y.z,Q[Z+3]=z.x,Q[Z+4]=z.y,Q[Z+5]=z.z,Q[Z+6]=A.x,Q[Z+7]=A.y,Q[Z+8]=A.z,Q[Z+9]=t.x,Q[Z+10]=t.y,Q[Z+11]=t.z,Z+=12;e.bindBuffer(e.ARRAY_BUFFER,l.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Q,I)}if(ka){Z=0;for(ka=ra.length;Z<ka;Z++){j=Q=0;for(o=L.length;j<o;j++)t=aa[L[j]],y=ra[Z].vertices[t.a].position,z=ra[Z].vertices[t.b].position,A=ra[Z].vertices[t.c].position,ga=P[Z],ga[Q]=y.x,ga[Q+1]=y.y,ga[Q+2]=y.z,ga[Q+3]=z.x,ga[Q+4]=z.y,ga[Q+5]=z.z,ga[Q+6]=A.x,ga[Q+7]=A.y,ga[Q+8]=A.z,Q+=9;j=0;for(o=W.length;j<
-o;j++)t=aa[W[j]],y=ra[Z].vertices[t.a].position,z=ra[Z].vertices[t.b].position,A=ra[Z].vertices[t.c].position,t=ra[Z].vertices[t.d].position,ga=P[Z],ga[Q]=y.x,ga[Q+1]=y.y,ga[Q+2]=y.z,ga[Q+3]=z.x,ga[Q+4]=z.y,ga[Q+5]=z.z,ga[Q+6]=A.x,ga[Q+7]=A.y,ga[Q+8]=A.z,ga[Q+9]=t.x,ga[Q+10]=t.y,ga[Q+11]=t.z,Q+=12;e.bindBuffer(e.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[Z]);e.bufferData(e.ARRAY_BUFFER,P[Z],I)}}if(pa.length){j=0;for(o=L.length;j<o;j++)t=aa[L[j]],y=pa[t.a],z=pa[t.b],A=pa[t.c],ja[v]=y.x,ja[v+1]=y.y,
-ja[v+2]=y.z,ja[v+3]=y.w,ja[v+4]=z.x,ja[v+5]=z.y,ja[v+6]=z.z,ja[v+7]=z.w,ja[v+8]=A.x,ja[v+9]=A.y,ja[v+10]=A.z,ja[v+11]=A.w,y=qa[t.a],z=qa[t.b],A=qa[t.c],T[v]=y.x,T[v+1]=y.y,T[v+2]=y.z,T[v+3]=y.w,T[v+4]=z.x,T[v+5]=z.y,T[v+6]=z.z,T[v+7]=z.w,T[v+8]=A.x,T[v+9]=A.y,T[v+10]=A.z,T[v+11]=A.w,y=na[t.a],z=na[t.b],A=na[t.c],U[v]=y.x,U[v+1]=y.y,U[v+2]=y.z,U[v+3]=1,U[v+4]=z.x,U[v+5]=z.y,U[v+6]=z.z,U[v+7]=1,U[v+8]=A.x,U[v+9]=A.y,U[v+10]=A.z,U[v+11]=1,y=oa[t.a],z=oa[t.b],A=oa[t.c],V[v]=y.x,V[v+1]=y.y,V[v+2]=y.z,
-V[v+3]=1,V[v+4]=z.x,V[v+5]=z.y,V[v+6]=z.z,V[v+7]=1,V[v+8]=A.x,V[v+9]=A.y,V[v+10]=A.z,V[v+11]=1,v+=12;j=0;for(o=W.length;j<o;j++)t=aa[W[j]],y=pa[t.a],z=pa[t.b],A=pa[t.c],P=pa[t.d],ja[v]=y.x,ja[v+1]=y.y,ja[v+2]=y.z,ja[v+3]=y.w,ja[v+4]=z.x,ja[v+5]=z.y,ja[v+6]=z.z,ja[v+7]=z.w,ja[v+8]=A.x,ja[v+9]=A.y,ja[v+10]=A.z,ja[v+11]=A.w,ja[v+12]=P.x,ja[v+13]=P.y,ja[v+14]=P.z,ja[v+15]=P.w,y=qa[t.a],z=qa[t.b],A=qa[t.c],P=qa[t.d],T[v]=y.x,T[v+1]=y.y,T[v+2]=y.z,T[v+3]=y.w,T[v+4]=z.x,T[v+5]=z.y,T[v+6]=z.z,T[v+7]=z.w,
-T[v+8]=A.x,T[v+9]=A.y,T[v+10]=A.z,T[v+11]=A.w,T[v+12]=P.x,T[v+13]=P.y,T[v+14]=P.z,T[v+15]=P.w,y=na[t.a],z=na[t.b],A=na[t.c],P=na[t.d],U[v]=y.x,U[v+1]=y.y,U[v+2]=y.z,U[v+3]=1,U[v+4]=z.x,U[v+5]=z.y,U[v+6]=z.z,U[v+7]=1,U[v+8]=A.x,U[v+9]=A.y,U[v+10]=A.z,U[v+11]=1,U[v+12]=P.x,U[v+13]=P.y,U[v+14]=P.z,U[v+15]=1,y=oa[t.a],z=oa[t.b],A=oa[t.c],t=oa[t.d],V[v]=y.x,V[v+1]=y.y,V[v+2]=y.z,V[v+3]=1,V[v+4]=z.x,V[v+5]=z.y,V[v+6]=z.z,V[v+7]=1,V[v+8]=A.x,V[v+9]=A.y,V[v+10]=A.z,V[v+11]=1,V[v+12]=t.x,V[v+13]=t.y,V[v+14]=
-t.z,V[v+15]=1,v+=16;v>0&&(e.bindBuffer(e.ARRAY_BUFFER,l.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,U,I),e.bindBuffer(e.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,V,I),e.bindBuffer(e.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,T,I),e.bindBuffer(e.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ja,I))}if(wa&&Y){j=0;for(o=L.length;j<o;j++)t=aa[L[j]],v=t.vertexColors,T=t.color,v.length===3&&Y===THREE.VertexColors?(t=v[0],
-U=v[1],V=v[2]):V=U=t=T,fa[da]=t.r,fa[da+1]=t.g,fa[da+2]=t.b,fa[da+3]=U.r,fa[da+4]=U.g,fa[da+5]=U.b,fa[da+6]=V.r,fa[da+7]=V.g,fa[da+8]=V.b,da+=9;j=0;for(o=W.length;j<o;j++)t=aa[W[j]],v=t.vertexColors,T=t.color,v.length===4&&Y===THREE.VertexColors?(t=v[0],U=v[1],V=v[2],v=v[3]):v=V=U=t=T,fa[da]=t.r,fa[da+1]=t.g,fa[da+2]=t.b,fa[da+3]=U.r,fa[da+4]=U.g,fa[da+5]=U.b,fa[da+6]=V.r,fa[da+7]=V.g,fa[da+8]=V.b,fa[da+9]=v.r,fa[da+10]=v.g,fa[da+11]=v.b,da+=12;da>0&&(e.bindBuffer(e.ARRAY_BUFFER,l.__webglColorBuffer),
-e.bufferData(e.ARRAY_BUFFER,fa,I))}if(O&&ma.hasTangents){j=0;for(o=L.length;j<o;j++)t=aa[L[j]],O=t.vertexTangents,da=O[0],fa=O[1],ma=O[2],ca[F]=da.x,ca[F+1]=da.y,ca[F+2]=da.z,ca[F+3]=da.w,ca[F+4]=fa.x,ca[F+5]=fa.y,ca[F+6]=fa.z,ca[F+7]=fa.w,ca[F+8]=ma.x,ca[F+9]=ma.y,ca[F+10]=ma.z,ca[F+11]=ma.w,F+=12;j=0;for(o=W.length;j<o;j++)t=aa[W[j]],O=t.vertexTangents,da=O[0],fa=O[1],ma=O[2],O=O[3],ca[F]=da.x,ca[F+1]=da.y,ca[F+2]=da.z,ca[F+3]=da.w,ca[F+4]=fa.x,ca[F+5]=fa.y,ca[F+6]=fa.z,ca[F+7]=fa.w,ca[F+8]=ma.x,
-ca[F+9]=ma.y,ca[F+10]=ma.z,ca[F+11]=ma.w,ca[F+12]=O.x,ca[F+13]=O.y,ca[F+14]=O.z,ca[F+15]=O.w,F+=16;e.bindBuffer(e.ARRAY_BUFFER,l.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ca,I)}if(M&&r){j=0;for(o=L.length;j<o;j++)if(t=aa[L[j]],ca=t.vertexNormals,M=t.normal,ca.length===3&&N)for(F=0;F<3;F++)M=ca[F],R[D]=M.x,R[D+1]=M.y,R[D+2]=M.z,D+=3;else for(F=0;F<3;F++)R[D]=M.x,R[D+1]=M.y,R[D+2]=M.z,D+=3;j=0;for(o=W.length;j<o;j++)if(t=aa[W[j]],ca=t.vertexNormals,M=t.normal,ca.length===4&&N)for(F=0;F<4;F++)M=
-ca[F],R[D]=M.x,R[D+1]=M.y,R[D+2]=M.z,D+=3;else for(F=0;F<4;F++)R[D]=M.x,R[D+1]=M.y,R[D+2]=M.z,D+=3;e.bindBuffer(e.ARRAY_BUFFER,l.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,R,I)}if(ta&&sa&&K){j=0;for(o=L.length;j<o;j++)if(D=L[j],D=sa[D],D!==void 0)for(F=0;F<3;F++)R=D[F],ba[S]=R.u,ba[S+1]=R.v,S+=2;j=0;for(o=W.length;j<o;j++)if(D=W[j],D=sa[D],D!==void 0)for(F=0;F<4;F++)R=D[F],ba[S]=R.u,ba[S+1]=R.v,S+=2;S>0&&(e.bindBuffer(e.ARRAY_BUFFER,l.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ba,I))}if(ta&&
-va&&K){j=0;for(o=L.length;j<o;j++)if(D=L[j],S=va[D],S!==void 0)for(F=0;F<3;F++)ba=S[F],s[ia]=ba.u,s[ia+1]=ba.v,ia+=2;j=0;for(o=W.length;j<o;j++)if(D=W[j],S=va[D],S!==void 0)for(F=0;F<4;F++)ba=S[F],s[ia]=ba.u,s[ia+1]=ba.v,ia+=2;ia>0&&(e.bindBuffer(e.ARRAY_BUFFER,l.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,s,I))}if(ua){j=0;for(o=L.length;j<o;j++)m[ea]=J,m[ea+1]=J+1,m[ea+2]=J+2,ea+=3,ha[X]=J,ha[X+1]=J+1,ha[X+2]=J,ha[X+3]=J+2,ha[X+4]=J+1,ha[X+5]=J+2,X+=6,J+=3;j=0;for(o=W.length;j<o;j++)m[ea]=J,m[ea+
-1]=J+1,m[ea+2]=J+3,m[ea+3]=J+1,m[ea+4]=J+2,m[ea+5]=J+3,ea+=6,ha[X]=J,ha[X+1]=J+1,ha[X+2]=J,ha[X+3]=J+3,ha[X+4]=J+1,ha[X+5]=J+2,ha[X+6]=J+2,ha[X+7]=J+3,X+=8,J+=4;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,m,I);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha,I)}if(H){F=0;for(J=H.length;F<J;F++)if(m=H[F],m.__original.needsUpdate){s=0;if(m.size===1)if(m.boundTo===void 0||m.boundTo==="vertices"){j=0;for(o=
-L.length;j<o;j++)t=aa[L[j]],m.array[s]=m.value[t.a],m.array[s+1]=m.value[t.b],m.array[s+2]=m.value[t.c],s+=3;j=0;for(o=W.length;j<o;j++)t=aa[W[j]],m.array[s]=m.value[t.a],m.array[s+1]=m.value[t.b],m.array[s+2]=m.value[t.c],m.array[s+3]=m.value[t.d],s+=4}else{if(m.boundTo==="faces"){j=0;for(o=L.length;j<o;j++)ha=m.value[L[j]],m.array[s]=ha,m.array[s+1]=ha,m.array[s+2]=ha,s+=3;j=0;for(o=W.length;j<o;j++)ha=m.value[W[j]],m.array[s]=ha,m.array[s+1]=ha,m.array[s+2]=ha,m.array[s+3]=ha,s+=4}}else if(m.size===
-2)if(m.boundTo===void 0||m.boundTo==="vertices"){j=0;for(o=L.length;j<o;j++)t=aa[L[j]],y=m.value[t.a],z=m.value[t.b],A=m.value[t.c],m.array[s]=y.x,m.array[s+1]=y.y,m.array[s+2]=z.x,m.array[s+3]=z.y,m.array[s+4]=A.x,m.array[s+5]=A.y,s+=6;j=0;for(o=W.length;j<o;j++)t=aa[W[j]],y=m.value[t.a],z=m.value[t.b],A=m.value[t.c],t=m.value[t.d],m.array[s]=y.x,m.array[s+1]=y.y,m.array[s+2]=z.x,m.array[s+3]=z.y,m.array[s+4]=A.x,m.array[s+5]=A.y,m.array[s+6]=t.x,m.array[s+7]=t.y,s+=8}else{if(m.boundTo==="faces"){j=
-0;for(o=L.length;j<o;j++)A=z=y=ha=m.value[L[j]],m.array[s]=y.x,m.array[s+1]=y.y,m.array[s+2]=z.x,m.array[s+3]=z.y,m.array[s+4]=A.x,m.array[s+5]=A.y,s+=6;j=0;for(o=W.length;j<o;j++)t=A=z=y=ha=m.value[W[j]],m.array[s]=y.x,m.array[s+1]=y.y,m.array[s+2]=z.x,m.array[s+3]=z.y,m.array[s+4]=A.x,m.array[s+5]=A.y,m.array[s+6]=t.x,m.array[s+7]=t.y,s+=8}}else if(m.size===3)if(r=m.type==="c"?["r","g","b"]:["x","y","z"],m.boundTo===void 0||m.boundTo==="vertices"){j=0;for(o=L.length;j<o;j++)t=aa[L[j]],y=m.value[t.a],
-z=m.value[t.b],A=m.value[t.c],m.array[s]=y[r[0]],m.array[s+1]=y[r[1]],m.array[s+2]=y[r[2]],m.array[s+3]=z[r[0]],m.array[s+4]=z[r[1]],m.array[s+5]=z[r[2]],m.array[s+6]=A[r[0]],m.array[s+7]=A[r[1]],m.array[s+8]=A[r[2]],s+=9;j=0;for(o=W.length;j<o;j++)t=aa[W[j]],y=m.value[t.a],z=m.value[t.b],A=m.value[t.c],t=m.value[t.d],m.array[s]=y[r[0]],m.array[s+1]=y[r[1]],m.array[s+2]=y[r[2]],m.array[s+3]=z[r[0]],m.array[s+4]=z[r[1]],m.array[s+5]=z[r[2]],m.array[s+6]=A[r[0]],m.array[s+7]=A[r[1]],m.array[s+8]=A[r[2]],
-m.array[s+9]=t[r[0]],m.array[s+10]=t[r[1]],m.array[s+11]=t[r[2]],s+=12}else{if(m.boundTo==="faces"){j=0;for(o=L.length;j<o;j++)A=z=y=ha=m.value[L[j]],m.array[s]=y[r[0]],m.array[s+1]=y[r[1]],m.array[s+2]=y[r[2]],m.array[s+3]=z[r[0]],m.array[s+4]=z[r[1]],m.array[s+5]=z[r[2]],m.array[s+6]=A[r[0]],m.array[s+7]=A[r[1]],m.array[s+8]=A[r[2]],s+=9;j=0;for(o=W.length;j<o;j++)t=A=z=y=ha=m.value[W[j]],m.array[s]=y[r[0]],m.array[s+1]=y[r[1]],m.array[s+2]=y[r[2]],m.array[s+3]=z[r[0]],m.array[s+4]=z[r[1]],m.array[s+
-5]=z[r[2]],m.array[s+6]=A[r[0]],m.array[s+7]=A[r[1]],m.array[s+8]=A[r[2]],m.array[s+9]=t[r[0]],m.array[s+10]=t[r[1]],m.array[s+11]=t[r[2]],s+=12}}else if(m.size===4)if(m.boundTo===void 0||m.boundTo==="vertices"){j=0;for(o=L.length;j<o;j++)t=aa[L[j]],y=m.value[t.a],z=m.value[t.b],A=m.value[t.c],m.array[s]=y.x,m.array[s+1]=y.y,m.array[s+2]=y.z,m.array[s+3]=y.w,m.array[s+4]=z.x,m.array[s+5]=z.y,m.array[s+6]=z.z,m.array[s+7]=z.w,m.array[s+8]=A.x,m.array[s+9]=A.y,m.array[s+10]=A.z,m.array[s+11]=A.w,s+=
-12;j=0;for(o=W.length;j<o;j++)t=aa[W[j]],y=m.value[t.a],z=m.value[t.b],A=m.value[t.c],t=m.value[t.d],m.array[s]=y.x,m.array[s+1]=y.y,m.array[s+2]=y.z,m.array[s+3]=y.w,m.array[s+4]=z.x,m.array[s+5]=z.y,m.array[s+6]=z.z,m.array[s+7]=z.w,m.array[s+8]=A.x,m.array[s+9]=A.y,m.array[s+10]=A.z,m.array[s+11]=A.w,m.array[s+12]=t.x,m.array[s+13]=t.y,m.array[s+14]=t.z,m.array[s+15]=t.w,s+=16}else if(m.boundTo==="faces"){j=0;for(o=L.length;j<o;j++)A=z=y=ha=m.value[L[j]],m.array[s]=y.x,m.array[s+1]=y.y,m.array[s+
-2]=y.z,m.array[s+3]=y.w,m.array[s+4]=z.x,m.array[s+5]=z.y,m.array[s+6]=z.z,m.array[s+7]=z.w,m.array[s+8]=A.x,m.array[s+9]=A.y,m.array[s+10]=A.z,m.array[s+11]=A.w,s+=12;j=0;for(o=W.length;j<o;j++)t=A=z=y=ha=m.value[W[j]],m.array[s]=y.x,m.array[s+1]=y.y,m.array[s+2]=y.z,m.array[s+3]=y.w,m.array[s+4]=z.x,m.array[s+5]=z.y,m.array[s+6]=z.z,m.array[s+7]=z.w,m.array[s+8]=A.x,m.array[s+9]=A.y,m.array[s+10]=A.z,m.array[s+11]=A.w,m.array[s+12]=t.x,m.array[s+13]=t.y,m.array[s+14]=t.z,m.array[s+15]=t.w,s+=16}e.bindBuffer(e.ARRAY_BUFFER,
-m.buffer);e.bufferData(e.ARRAY_BUFFER,m.array,I)}}$&&(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)}}q.__dirtyVertices=!1;q.__dirtyMorphTargets=!1;q.__dirtyElements=!1;q.__dirtyUvs=!1;q.__dirtyNormals=!1;q.__dirtyColors=!1;q.__dirtyTangents=
-!1;u.attributes&&w(u)}else if(la instanceof THREE.Ribbon){if(q.__dirtyVertices||q.__dirtyColors){u=q;la=e.DYNAMIC_DRAW;r=B=r=$=$=void 0;Y=u.vertices;C=u.colors;j=Y.length;l=C.length;o=u.__vertexArray;I=u.__colorArray;H=u.__dirtyColors;if(u.__dirtyVertices){for($=0;$<j;$++)r=Y[$].position,B=$*3,o[B]=r.x,o[B+1]=r.y,o[B+2]=r.z;e.bindBuffer(e.ARRAY_BUFFER,u.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,o,la)}if(H){for($=0;$<l;$++)r=C[$],B=$*3,I[B]=r.r,I[B+1]=r.g,I[B+2]=r.b;e.bindBuffer(e.ARRAY_BUFFER,
-u.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,I,la)}}q.__dirtyVertices=!1;q.__dirtyColors=!1}else if(la instanceof THREE.Line){u=c(la,l);I=u.attributes&&n(u);if(q.__dirtyVertices||q.__dirtyColors||I){la=q;B=e.DYNAMIC_DRAW;j=C=N=Y=K=void 0;Y=la.vertices;l=la.colors;j=Y.length;I=l.length;o=la.__vertexArray;$=la.__colorArray;H=la.__dirtyColors;r=la.__webglCustomAttributesList;J=aa=W=L=N=K=void 0;if(la.__dirtyVertices){for(K=0;K<j;K++)N=Y[K].position,C=K*3,o[C]=N.x,o[C+1]=N.y,o[C+2]=N.z;e.bindBuffer(e.ARRAY_BUFFER,
-la.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,o,B)}if(H){for(Y=0;Y<I;Y++)j=l[Y],C=Y*3,$[C]=j.r,$[C+1]=j.g,$[C+2]=j.b;e.bindBuffer(e.ARRAY_BUFFER,la.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,$,B)}if(r){K=0;for(N=r.length;K<N;K++)if(J=r[K],J.needsUpdate&&(J.boundTo===void 0||J.boundTo==="vertices")){C=0;W=J.value.length;if(J.size===1)for(L=0;L<W;L++)J.array[L]=J.value[L];else if(J.size===2)for(L=0;L<W;L++)aa=J.value[L],J.array[C]=aa.x,J.array[C+1]=aa.y,C+=2;else if(J.size===3)if(J.type===
-"c")for(L=0;L<W;L++)aa=J.value[L],J.array[C]=aa.r,J.array[C+1]=aa.g,J.array[C+2]=aa.b,C+=3;else for(L=0;L<W;L++)aa=J.value[L],J.array[C]=aa.x,J.array[C+1]=aa.y,J.array[C+2]=aa.z,C+=3;else if(J.size===4)for(L=0;L<W;L++)aa=J.value[L],J.array[C]=aa.x,J.array[C+1]=aa.y,J.array[C+2]=aa.z,J.array[C+3]=aa.w,C+=4;e.bindBuffer(e.ARRAY_BUFFER,J.buffer);e.bufferData(e.ARRAY_BUFFER,J.array,B)}}}q.__dirtyVertices=!1;q.__dirtyColors=!1;u.attributes&&w(u)}else if(la instanceof THREE.ParticleSystem)u=c(la,l),I=u.attributes&&
-n(u),(q.__dirtyVertices||q.__dirtyColors||la.sortParticles||I)&&h(q,e.DYNAMIC_DRAW,la),q.__dirtyVertices=!1,q.__dirtyColors=!1,u.attributes&&w(u)};this.initMaterial=function(a,b,c,d){var f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&
-(i="particle_basic");if(i){var k=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var n,r,q;n=q=k=0;for(r=b.length;n<r;n++)h=b[n],h instanceof THREE.SpotLight&&q++,h instanceof THREE.DirectionalLight&&q++,h instanceof THREE.PointLight&&k++;k+q<=ya?n=q:(n=Math.ceil(ya*q/(k+q)),k=ya-n);h={directional:n,point:k};k=q=0;for(n=b.length;k<n;k++)r=b[k],r instanceof THREE.SpotLight&&r.castShadow&&q++;var j=50;if(d!==void 0&&
-d instanceof THREE.SkinnedMesh)j=d.bones.length;var o;a:{n=a.fragmentShader;r=a.vertexShader;var k=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:h.directional,maxPointLights:h.point,maxBones:j,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,
-shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];i?d.push(i):(d.push(n),d.push(r));for(p in c)d.push(p),d.push(c[p]);i=d.join();p=0;for(d=Ba.length;p<d;p++)if(Ba[p].code===i){o=Ba[p].program;break a}p=e.createProgram();d=[Ma?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.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");
-h=["#ifdef GL_ES","precision "+oa+" 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:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.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");e.attachShader(p,ia("fragment",h+n));e.attachShader(p,
-ia("vertex",d+r));e.linkProgram(p);e.getProgramParameter(p,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(p,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");p.uniforms={};p.attributes={};var u,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in k)d.push(u);u=d;d=0;for(k=u.length;d<k;d++)n=u[d],p.uniforms[n]=e.getUniformLocation(p,
-n);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)d.push("morphTarget"+u);for(o in b)d.push(o);o=d;u=0;for(b=o.length;u<b;u++)c=o[u],p.attributes[c]=e.getAttribLocation(p,c);p.id=Ba.length;Ba.push({program:p,code:i});E.info.memory.programs=Ba.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&e.enableVertexAttribArray(o.position);o.color>=0&&e.enableVertexAttribArray(o.color);o.normal>=0&&e.enableVertexAttribArray(o.normal);
-o.tangent>=0&&e.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(e.enableVertexAttribArray(o.skinVertexA),e.enableVertexAttribArray(o.skinVertexB),e.enableVertexAttribArray(o.skinIndex),e.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&e.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)u="morphTarget"+g,o[u]>=0&&(e.enableVertexAttribArray(o[u]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),a==="back"?e.cullFace(e.BACK):a==="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.setObjectFaces=function(a){if(ka!==a.doubleSided)a.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),ka=a.doubleSided;if(na!==a.flipSided)a.flipSided?e.frontFace(e.CW):
-e.frontFace(e.CCW),na=a.flipSided};this.setDepthTest=function(a){qa!==a&&(a?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),qa=a)};this.setBlending=function(a){if(a!==S){switch(a){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,
-e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}S=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=e.createTexture(),E.info.memory.textures++;e.activeTexture(e.TEXTURE0+b);e.bindTexture(e.TEXTURE_2D,a.__webglTexture);var c=ea(e.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,H(a.format),a.image.width,a.image.height,0,H(a.format),e.UNSIGNED_BYTE,a.image.data):e.texImage2D(e.TEXTURE_2D,
+(d=d.wireframeLinewidth,d!==ya&&(e.lineWidth(d),ya=d),a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),e.drawElements(e.LINES,f.__webglLineCount,e.UNSIGNED_SHORT,0)):(a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),e.drawElements(e.TRIANGLES,f.__webglFaceCount,e.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=f.__webglFaceCount,E.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?e.LINE_STRIP:e.LINES,d=d.linewidth,d!==
+ya&&(e.lineWidth(d),ya=d),e.drawArrays(g,0,f.__webglLineCount),E.info.render.calls++):g instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,f.__webglParticleCount),E.info.render.calls++):g instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,f.__webglVertexCount),E.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,h,o,l=a.lights,u=a.fog;D=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();p(this.renderPluginsPre,a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Fa.multiply(b.projectionMatrix,b.matrixWorldInverse);
+Ka.setFromMatrix(Fa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);o=a.__webglObjects;d=0;for(f=o.length;d<f;d++)if(g=o[d],h=g.object,g.render=!1,h.visible&&(!(h instanceof THREE.Mesh)||!h.frustumCulled||Ka.contains(h))){h.matrixWorld.flattenToArray(h._objectMatrixArray);qa(h,b);var s=g,w=s.object,j=s.buffer,q=void 0,q=q=void 0,q=w.material;if(q instanceof THREE.MeshFaceMaterial){if(q=j.materialIndex,q>=0)q=w.geometry.materials[q],
+q.transparent?(s.transparent=q,s.opaque=null):(s.opaque=q,s.transparent=null)}else if(q)q.transparent?(s.transparent=q,s.opaque=null):(s.opaque=q,s.transparent=null);g.render=!0;if(this.sortObjects)h.renderDepth?g.z=h.renderDepth:(Da.copy(h.position),Fa.multiplyVector3(Da),g.z=Da.z)}this.sortObjects&&o.sort(i);o=a.__webglObjectsImmediate;d=0;for(f=o.length;d<f;d++)if(g=o[d],h=g.object,h.visible)h.matrixAutoUpdate&&h.matrixWorld.flattenToArray(h._objectMatrixArray),qa(h,b),h=g.object.material,h.transparent?
+(g.transparent=h,g.opaque=null):(g.opaque=h,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),T(a.overrideMaterial.depthWrite),la(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),n(a.__webglObjects,!1,"",b,l,u,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,l,u,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),n(a.__webglObjects,!0,
+"opaque",b,l,u,!1),k(a.__webglObjectsImmediate,"opaque",b,l,u,!1),n(a.__webglObjects,!1,"transparent",b,l,u,!0),k(a.__webglObjectsImmediate,"transparent",b,l,u,!0));p(this.renderPluginsPost,a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,c.__webglTexture),e.generateMipmap(e.TEXTURE_2D),
+e.bindTexture(e.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,f){var g=J(a,b,c,d,f);S=-1;E.setObjectFaces(f);f.immediateRenderCallback?f.immediateRenderCallback(g,e,Ka):f.render(function(a){E.renderBufferImmediate(a,g,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var i=a.__objectsAdded[0],k=a,p=void 0,n=void 0,A=void 0;if(!i.__webglInit)if(i.__webglInit=
+!0,i._modelViewMatrix=new THREE.Matrix4,i._normalMatrixArray=new Float32Array(9),i._modelViewMatrixArray=new Float32Array(16),i._objectMatrixArray=new Float32Array(16),i.matrixWorld.flattenToArray(i._objectMatrixArray),i instanceof THREE.Mesh){n=i.geometry;if(n.geometryGroups===void 0){var A=n,B=void 0,o=void 0,H=void 0,aa=void 0,s=void 0,Y=void 0,j=void 0,q={},J=A.morphTargets.length;A.geometryGroups={};B=0;for(o=A.faces.length;B<o;B++)H=A.faces[B],aa=H.materialIndex,Y=aa!==void 0?aa:-1,q[Y]===void 0&&
+(q[Y]={hash:Y,counter:0}),j=q[Y].hash+"_"+q[Y].counter,A.geometryGroups[j]===void 0&&(A.geometryGroups[j]={faces3:[],faces4:[],materialIndex:aa,vertices:0,numMorphTargets:J}),s=H instanceof THREE.Face3?3:4,A.geometryGroups[j].vertices+s>65535&&(q[Y].counter+=1,j=q[Y].hash+"_"+q[Y].counter,A.geometryGroups[j]===void 0&&(A.geometryGroups[j]={faces3:[],faces4:[],materialIndex:aa,vertices:0,numMorphTargets:J})),H instanceof THREE.Face3?A.geometryGroups[j].faces3.push(B):A.geometryGroups[j].faces4.push(B),
+A.geometryGroups[j].vertices+=s;A.geometryGroupsList=[];B=void 0;for(B in A.geometryGroups)A.geometryGroups[B].id=pa++,A.geometryGroupsList.push(A.geometryGroups[B])}for(p in n.geometryGroups)if(A=n.geometryGroups[p],!A.__webglVertexBuffer){B=A;B.__webglVertexBuffer=e.createBuffer();B.__webglNormalBuffer=e.createBuffer();B.__webglTangentBuffer=e.createBuffer();B.__webglColorBuffer=e.createBuffer();B.__webglUVBuffer=e.createBuffer();B.__webglUV2Buffer=e.createBuffer();B.__webglSkinVertexABuffer=e.createBuffer();
+B.__webglSkinVertexBBuffer=e.createBuffer();B.__webglSkinIndicesBuffer=e.createBuffer();B.__webglSkinWeightsBuffer=e.createBuffer();B.__webglFaceBuffer=e.createBuffer();B.__webglLineBuffer=e.createBuffer();if(B.numMorphTargets){H=o=void 0;B.__webglMorphTargetsBuffers=[];o=0;for(H=B.numMorphTargets;o<H;o++)B.__webglMorphTargetsBuffers.push(e.createBuffer())}E.info.memory.geometries++;aa=i;s=aa.geometry;o=A.faces3;Y=A.faces4;B=o.length*3+Y.length*4;H=o.length*1+Y.length*2;Y=o.length*3+Y.length*4;o=
+c(aa,A);j=g(o);q=d(o);J=f(o);A.__vertexArray=new Float32Array(B*3);if(q)A.__normalArray=new Float32Array(B*3);if(s.hasTangents)A.__tangentArray=new Float32Array(B*4);if(J)A.__colorArray=new Float32Array(B*3);if(j){if(s.faceUvs.length>0||s.faceVertexUvs.length>0)A.__uvArray=new Float32Array(B*2);if(s.faceUvs.length>1||s.faceVertexUvs.length>1)A.__uv2Array=new Float32Array(B*2)}if(aa.geometry.skinWeights.length&&aa.geometry.skinIndices.length)A.__skinVertexAArray=new Float32Array(B*4),A.__skinVertexBArray=
+new Float32Array(B*4),A.__skinIndexArray=new Float32Array(B*4),A.__skinWeightArray=new Float32Array(B*4);A.__faceArray=new Uint16Array(H*3);A.__lineArray=new Uint16Array(Y*2);if(A.numMorphTargets){A.__morphTargetsArrays=[];aa=0;for(s=A.numMorphTargets;aa<s;aa++)A.__morphTargetsArrays.push(new Float32Array(B*3))}A.__webglFaceCount=H*3;A.__webglLineCount=Y*2;if(o.attributes){if(A.__webglCustomAttributesList===void 0)A.__webglCustomAttributesList=[];H=void 0;for(H in o.attributes){var aa=o.attributes[H],
+s={},ma;for(ma in aa)s[ma]=aa[ma];if(!s.__webglInitialized||s.createUniqueBuffers)s.__webglInitialized=!0,Y=1,s.type==="v2"?Y=2:s.type==="v3"?Y=3:s.type==="v4"?Y=4:s.type==="c"&&(Y=3),s.size=Y,s.array=new Float32Array(B*Y),s.buffer=e.createBuffer(),s.buffer.belongsToAttribute=H,aa.needsUpdate=!0,s.__original=aa;A.__webglCustomAttributesList.push(s)}}A.__inittedArrays=!0;n.__dirtyVertices=!0;n.__dirtyMorphTargets=!0;n.__dirtyElements=!0;n.__dirtyUvs=!0;n.__dirtyNormals=!0;n.__dirtyTangents=!0;n.__dirtyColors=
+!0}}else if(i instanceof THREE.Ribbon){if(n=i.geometry,!n.__webglVertexBuffer)A=n,A.__webglVertexBuffer=e.createBuffer(),A.__webglColorBuffer=e.createBuffer(),E.info.memory.geometries++,A=n,B=A.vertices.length,A.__vertexArray=new Float32Array(B*3),A.__colorArray=new Float32Array(B*3),A.__webglVertexCount=B,n.__dirtyVertices=!0,n.__dirtyColors=!0}else if(i instanceof THREE.Line){if(n=i.geometry,!n.__webglVertexBuffer)A=n,A.__webglVertexBuffer=e.createBuffer(),A.__webglColorBuffer=e.createBuffer(),
+E.info.memory.geometries++,A=n,B=i,o=A.vertices.length,A.__vertexArray=new Float32Array(o*3),A.__colorArray=new Float32Array(o*3),A.__webglLineCount=o,b(A,B),n.__dirtyVertices=!0,n.__dirtyColors=!0}else if(i instanceof THREE.ParticleSystem&&(n=i.geometry,!n.__webglVertexBuffer))A=n,A.__webglVertexBuffer=e.createBuffer(),A.__webglColorBuffer=e.createBuffer(),E.info.geometries++,A=n,B=i,o=A.vertices.length,A.__vertexArray=new Float32Array(o*3),A.__colorArray=new Float32Array(o*3),A.__sortArray=[],A.__webglParticleCount=
+o,b(A,B),n.__dirtyVertices=!0,n.__dirtyColors=!0;if(!i.__webglActive){if(i instanceof THREE.Mesh)for(p in n=i.geometry,n.geometryGroups)A=n.geometryGroups[p],l(k.__webglObjects,A,i);else i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem?(n=i.geometry,l(k.__webglObjects,n,i)):THREE.MarchingCubes!==void 0&&i instanceof THREE.MarchingCubes||i.immediateRenderCallback?k.__webglObjectsImmediate.push({object:i,opaque:null,transparent:null}):i instanceof THREE.Sprite?k.__webglSprites.push(i):
+i instanceof THREE.LensFlare&&k.__webglFlares.push(i);i.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)i=a.__objectsRemoved[0],k=a,i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem||i instanceof THREE.Ribbon||i instanceof THREE.Line?G(k.__webglObjects,i):i instanceof THREE.Sprite?C(k.__webglSprites,i):i instanceof THREE.LensFlare?C(k.__webglFlares,i):(i instanceof THREE.MarchingCubes||i.immediateRenderCallback)&&G(k.__webglObjectsImmediate,i),i.__webglActive=
+!1,a.__objectsRemoved.splice(0,1);i=0;for(k=a.__webglObjects.length;i<k;i++)if(ma=a.__webglObjects[i].object,p=ma.geometry,n=H=o=void 0,ma instanceof THREE.Mesh){A=0;for(B=p.geometryGroupsList.length;A<B;A++)if(o=p.geometryGroupsList[A],n=c(ma,o),H=n.attributes&&w(n),p.__dirtyVertices||p.__dirtyMorphTargets||p.__dirtyElements||p.__dirtyUvs||p.__dirtyNormals||p.__dirtyColors||p.__dirtyTangents||H){var M=ma,H=e.DYNAMIC_DRAW,aa=!p.dynamic,j=n;if(o.__inittedArrays){var s=d(j),Y=f(j),K=g(j),O=s===THREE.SmoothShading,
+D=q=j=void 0,t=void 0,ca=void 0,N=void 0,v=void 0,U=void 0,P=void 0,T=D=void 0,x=void 0,y=void 0,z=void 0,ea=t=void 0,fa=void 0,L=void 0,V=t=P=void 0,W=void 0,R=z=y=x=v=void 0,F=t=z=y=x=R=z=y=x=R=z=y=x=void 0,I=void 0,S=N=void 0,Z=void 0,$=void 0,la=void 0,ha=void 0,ja=T=$=I=0,ga=0,da=F=D=0,Q=v=ea=0,r=0,ia=void 0,Q=o.__vertexArray,Z=o.__uvArray,r=o.__uv2Array,S=o.__normalArray,ca=o.__tangentArray,fa=o.__colorArray,V=o.__skinVertexAArray,W=o.__skinVertexBArray,U=o.__skinIndexArray,ka=o.__skinWeightArray,
+R=o.__morphTargetsArrays,J=o.__webglCustomAttributesList,m=void 0,m=o.__faceArray,ia=o.__lineArray,L=M.geometry,ta=L.__dirtyElements,qa=L.__dirtyUvs,N=L.__dirtyNormals,P=L.__dirtyTangents,xa=L.__dirtyColors,la=L.__dirtyMorphTargets,ha=L.vertices,M=o.faces3,X=o.faces4,ba=L.faces,ua=L.faceVertexUvs[0],va=L.faceVertexUvs[1],na=L.skinVerticesA,oa=L.skinVerticesB,sa=L.skinIndices,ra=L.skinWeights,wa=L.morphTargets;if(L.__dirtyVertices){j=0;for(q=M.length;j<q;j++)t=ba[M[j]],x=ha[t.a].position,y=ha[t.b].position,
+z=ha[t.c].position,Q[$]=x.x,Q[$+1]=x.y,Q[$+2]=x.z,Q[$+3]=y.x,Q[$+4]=y.y,Q[$+5]=y.z,Q[$+6]=z.x,Q[$+7]=z.y,Q[$+8]=z.z,$+=9;j=0;for(q=X.length;j<q;j++)t=ba[X[j]],x=ha[t.a].position,y=ha[t.b].position,z=ha[t.c].position,t=ha[t.d].position,Q[$]=x.x,Q[$+1]=x.y,Q[$+2]=x.z,Q[$+3]=y.x,Q[$+4]=y.y,Q[$+5]=y.z,Q[$+6]=z.x,Q[$+7]=z.y,Q[$+8]=z.z,Q[$+9]=t.x,Q[$+10]=t.y,Q[$+11]=t.z,$+=12;e.bindBuffer(e.ARRAY_BUFFER,o.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Q,H)}if(la){$=0;for(la=wa.length;$<la;$++){j=Q=0;
+for(q=M.length;j<q;j++)t=ba[M[j]],x=wa[$].vertices[t.a].position,y=wa[$].vertices[t.b].position,z=wa[$].vertices[t.c].position,ha=R[$],ha[Q]=x.x,ha[Q+1]=x.y,ha[Q+2]=x.z,ha[Q+3]=y.x,ha[Q+4]=y.y,ha[Q+5]=y.z,ha[Q+6]=z.x,ha[Q+7]=z.y,ha[Q+8]=z.z,Q+=9;j=0;for(q=X.length;j<q;j++)t=ba[X[j]],x=wa[$].vertices[t.a].position,y=wa[$].vertices[t.b].position,z=wa[$].vertices[t.c].position,t=wa[$].vertices[t.d].position,ha=R[$],ha[Q]=x.x,ha[Q+1]=x.y,ha[Q+2]=x.z,ha[Q+3]=y.x,ha[Q+4]=y.y,ha[Q+5]=y.z,ha[Q+6]=z.x,ha[Q+
+7]=z.y,ha[Q+8]=z.z,ha[Q+9]=t.x,ha[Q+10]=t.y,ha[Q+11]=t.z,Q+=12;e.bindBuffer(e.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[$]);e.bufferData(e.ARRAY_BUFFER,R[$],H)}}if(ra.length){j=0;for(q=M.length;j<q;j++)t=ba[M[j]],x=ra[t.a],y=ra[t.b],z=ra[t.c],ka[v]=x.x,ka[v+1]=x.y,ka[v+2]=x.z,ka[v+3]=x.w,ka[v+4]=y.x,ka[v+5]=y.y,ka[v+6]=y.z,ka[v+7]=y.w,ka[v+8]=z.x,ka[v+9]=z.y,ka[v+10]=z.z,ka[v+11]=z.w,x=sa[t.a],y=sa[t.b],z=sa[t.c],U[v]=x.x,U[v+1]=x.y,U[v+2]=x.z,U[v+3]=x.w,U[v+4]=y.x,U[v+5]=y.y,U[v+6]=y.z,U[v+7]=y.w,
+U[v+8]=z.x,U[v+9]=z.y,U[v+10]=z.z,U[v+11]=z.w,x=na[t.a],y=na[t.b],z=na[t.c],V[v]=x.x,V[v+1]=x.y,V[v+2]=x.z,V[v+3]=1,V[v+4]=y.x,V[v+5]=y.y,V[v+6]=y.z,V[v+7]=1,V[v+8]=z.x,V[v+9]=z.y,V[v+10]=z.z,V[v+11]=1,x=oa[t.a],y=oa[t.b],z=oa[t.c],W[v]=x.x,W[v+1]=x.y,W[v+2]=x.z,W[v+3]=1,W[v+4]=y.x,W[v+5]=y.y,W[v+6]=y.z,W[v+7]=1,W[v+8]=z.x,W[v+9]=z.y,W[v+10]=z.z,W[v+11]=1,v+=12;j=0;for(q=X.length;j<q;j++)t=ba[X[j]],x=ra[t.a],y=ra[t.b],z=ra[t.c],R=ra[t.d],ka[v]=x.x,ka[v+1]=x.y,ka[v+2]=x.z,ka[v+3]=x.w,ka[v+4]=y.x,ka[v+
+5]=y.y,ka[v+6]=y.z,ka[v+7]=y.w,ka[v+8]=z.x,ka[v+9]=z.y,ka[v+10]=z.z,ka[v+11]=z.w,ka[v+12]=R.x,ka[v+13]=R.y,ka[v+14]=R.z,ka[v+15]=R.w,x=sa[t.a],y=sa[t.b],z=sa[t.c],R=sa[t.d],U[v]=x.x,U[v+1]=x.y,U[v+2]=x.z,U[v+3]=x.w,U[v+4]=y.x,U[v+5]=y.y,U[v+6]=y.z,U[v+7]=y.w,U[v+8]=z.x,U[v+9]=z.y,U[v+10]=z.z,U[v+11]=z.w,U[v+12]=R.x,U[v+13]=R.y,U[v+14]=R.z,U[v+15]=R.w,x=na[t.a],y=na[t.b],z=na[t.c],R=na[t.d],V[v]=x.x,V[v+1]=x.y,V[v+2]=x.z,V[v+3]=1,V[v+4]=y.x,V[v+5]=y.y,V[v+6]=y.z,V[v+7]=1,V[v+8]=z.x,V[v+9]=z.y,V[v+
+10]=z.z,V[v+11]=1,V[v+12]=R.x,V[v+13]=R.y,V[v+14]=R.z,V[v+15]=1,x=oa[t.a],y=oa[t.b],z=oa[t.c],t=oa[t.d],W[v]=x.x,W[v+1]=x.y,W[v+2]=x.z,W[v+3]=1,W[v+4]=y.x,W[v+5]=y.y,W[v+6]=y.z,W[v+7]=1,W[v+8]=z.x,W[v+9]=z.y,W[v+10]=z.z,W[v+11]=1,W[v+12]=t.x,W[v+13]=t.y,W[v+14]=t.z,W[v+15]=1,v+=16;v>0&&(e.bindBuffer(e.ARRAY_BUFFER,o.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,V,H),e.bindBuffer(e.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,W,H),e.bindBuffer(e.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),
+e.bufferData(e.ARRAY_BUFFER,U,H),e.bindBuffer(e.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ka,H))}if(xa&&Y){j=0;for(q=M.length;j<q;j++)t=ba[M[j]],v=t.vertexColors,U=t.color,v.length===3&&Y===THREE.VertexColors?(t=v[0],V=v[1],W=v[2]):W=V=t=U,fa[ea]=t.r,fa[ea+1]=t.g,fa[ea+2]=t.b,fa[ea+3]=V.r,fa[ea+4]=V.g,fa[ea+5]=V.b,fa[ea+6]=W.r,fa[ea+7]=W.g,fa[ea+8]=W.b,ea+=9;j=0;for(q=X.length;j<q;j++)t=ba[X[j]],v=t.vertexColors,U=t.color,v.length===4&&Y===THREE.VertexColors?(t=v[0],V=v[1],
+W=v[2],v=v[3]):v=W=V=t=U,fa[ea]=t.r,fa[ea+1]=t.g,fa[ea+2]=t.b,fa[ea+3]=V.r,fa[ea+4]=V.g,fa[ea+5]=V.b,fa[ea+6]=W.r,fa[ea+7]=W.g,fa[ea+8]=W.b,fa[ea+9]=v.r,fa[ea+10]=v.g,fa[ea+11]=v.b,ea+=12;ea>0&&(e.bindBuffer(e.ARRAY_BUFFER,o.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,fa,H))}if(P&&L.hasTangents){j=0;for(q=M.length;j<q;j++)t=ba[M[j]],P=t.vertexTangents,ea=P[0],fa=P[1],L=P[2],ca[F]=ea.x,ca[F+1]=ea.y,ca[F+2]=ea.z,ca[F+3]=ea.w,ca[F+4]=fa.x,ca[F+5]=fa.y,ca[F+6]=fa.z,ca[F+7]=fa.w,ca[F+8]=L.x,ca[F+9]=
+L.y,ca[F+10]=L.z,ca[F+11]=L.w,F+=12;j=0;for(q=X.length;j<q;j++)t=ba[X[j]],P=t.vertexTangents,ea=P[0],fa=P[1],L=P[2],P=P[3],ca[F]=ea.x,ca[F+1]=ea.y,ca[F+2]=ea.z,ca[F+3]=ea.w,ca[F+4]=fa.x,ca[F+5]=fa.y,ca[F+6]=fa.z,ca[F+7]=fa.w,ca[F+8]=L.x,ca[F+9]=L.y,ca[F+10]=L.z,ca[F+11]=L.w,ca[F+12]=P.x,ca[F+13]=P.y,ca[F+14]=P.z,ca[F+15]=P.w,F+=16;e.bindBuffer(e.ARRAY_BUFFER,o.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ca,H)}if(N&&s){j=0;for(q=M.length;j<q;j++)if(t=ba[M[j]],ca=t.vertexNormals,N=t.normal,ca.length===
+3&&O)for(F=0;F<3;F++)N=ca[F],S[D]=N.x,S[D+1]=N.y,S[D+2]=N.z,D+=3;else for(F=0;F<3;F++)S[D]=N.x,S[D+1]=N.y,S[D+2]=N.z,D+=3;j=0;for(q=X.length;j<q;j++)if(t=ba[X[j]],ca=t.vertexNormals,N=t.normal,ca.length===4&&O)for(F=0;F<4;F++)N=ca[F],S[D]=N.x,S[D+1]=N.y,S[D+2]=N.z,D+=3;else for(F=0;F<4;F++)S[D]=N.x,S[D+1]=N.y,S[D+2]=N.z,D+=3;e.bindBuffer(e.ARRAY_BUFFER,o.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,S,H)}if(qa&&ua&&K){j=0;for(q=M.length;j<q;j++)if(D=M[j],D=ua[D],D!==void 0)for(F=0;F<3;F++)S=D[F],
+Z[T]=S.u,Z[T+1]=S.v,T+=2;j=0;for(q=X.length;j<q;j++)if(D=X[j],D=ua[D],D!==void 0)for(F=0;F<4;F++)S=D[F],Z[T]=S.u,Z[T+1]=S.v,T+=2;T>0&&(e.bindBuffer(e.ARRAY_BUFFER,o.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,Z,H))}if(qa&&va&&K){j=0;for(q=M.length;j<q;j++)if(D=M[j],T=va[D],T!==void 0)for(F=0;F<3;F++)Z=T[F],r[ja]=Z.u,r[ja+1]=Z.v,ja+=2;j=0;for(q=X.length;j<q;j++)if(D=X[j],T=va[D],T!==void 0)for(F=0;F<4;F++)Z=T[F],r[ja]=Z.u,r[ja+1]=Z.v,ja+=2;ja>0&&(e.bindBuffer(e.ARRAY_BUFFER,o.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,
+r,H))}if(ta){j=0;for(q=M.length;j<q;j++)m[ga]=I,m[ga+1]=I+1,m[ga+2]=I+2,ga+=3,ia[da]=I,ia[da+1]=I+1,ia[da+2]=I,ia[da+3]=I+2,ia[da+4]=I+1,ia[da+5]=I+2,da+=6,I+=3;j=0;for(q=X.length;j<q;j++)m[ga]=I,m[ga+1]=I+1,m[ga+2]=I+3,m[ga+3]=I+1,m[ga+4]=I+2,m[ga+5]=I+3,ga+=6,ia[da]=I,ia[da+1]=I+1,ia[da+2]=I,ia[da+3]=I+3,ia[da+4]=I+1,ia[da+5]=I+2,ia[da+6]=I+2,ia[da+7]=I+3,da+=8,I+=4;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,m,H);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
+o.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,H)}if(J){F=0;for(I=J.length;F<I;F++)if(m=J[F],m.__original.needsUpdate){r=0;if(m.size===1)if(m.boundTo===void 0||m.boundTo==="vertices"){j=0;for(q=M.length;j<q;j++)t=ba[M[j]],m.array[r]=m.value[t.a],m.array[r+1]=m.value[t.b],m.array[r+2]=m.value[t.c],r+=3;j=0;for(q=X.length;j<q;j++)t=ba[X[j]],m.array[r]=m.value[t.a],m.array[r+1]=m.value[t.b],m.array[r+2]=m.value[t.c],m.array[r+3]=m.value[t.d],r+=4}else{if(m.boundTo==="faces"){j=0;for(q=M.length;j<
+q;j++)ia=m.value[M[j]],m.array[r]=ia,m.array[r+1]=ia,m.array[r+2]=ia,r+=3;j=0;for(q=X.length;j<q;j++)ia=m.value[X[j]],m.array[r]=ia,m.array[r+1]=ia,m.array[r+2]=ia,m.array[r+3]=ia,r+=4}}else if(m.size===2)if(m.boundTo===void 0||m.boundTo==="vertices"){j=0;for(q=M.length;j<q;j++)t=ba[M[j]],x=m.value[t.a],y=m.value[t.b],z=m.value[t.c],m.array[r]=x.x,m.array[r+1]=x.y,m.array[r+2]=y.x,m.array[r+3]=y.y,m.array[r+4]=z.x,m.array[r+5]=z.y,r+=6;j=0;for(q=X.length;j<q;j++)t=ba[X[j]],x=m.value[t.a],y=m.value[t.b],
+z=m.value[t.c],t=m.value[t.d],m.array[r]=x.x,m.array[r+1]=x.y,m.array[r+2]=y.x,m.array[r+3]=y.y,m.array[r+4]=z.x,m.array[r+5]=z.y,m.array[r+6]=t.x,m.array[r+7]=t.y,r+=8}else{if(m.boundTo==="faces"){j=0;for(q=M.length;j<q;j++)z=y=x=ia=m.value[M[j]],m.array[r]=x.x,m.array[r+1]=x.y,m.array[r+2]=y.x,m.array[r+3]=y.y,m.array[r+4]=z.x,m.array[r+5]=z.y,r+=6;j=0;for(q=X.length;j<q;j++)t=z=y=x=ia=m.value[X[j]],m.array[r]=x.x,m.array[r+1]=x.y,m.array[r+2]=y.x,m.array[r+3]=y.y,m.array[r+4]=z.x,m.array[r+5]=
+z.y,m.array[r+6]=t.x,m.array[r+7]=t.y,r+=8}}else if(m.size===3)if(s=m.type==="c"?["r","g","b"]:["x","y","z"],m.boundTo===void 0||m.boundTo==="vertices"){j=0;for(q=M.length;j<q;j++)t=ba[M[j]],x=m.value[t.a],y=m.value[t.b],z=m.value[t.c],m.array[r]=x[s[0]],m.array[r+1]=x[s[1]],m.array[r+2]=x[s[2]],m.array[r+3]=y[s[0]],m.array[r+4]=y[s[1]],m.array[r+5]=y[s[2]],m.array[r+6]=z[s[0]],m.array[r+7]=z[s[1]],m.array[r+8]=z[s[2]],r+=9;j=0;for(q=X.length;j<q;j++)t=ba[X[j]],x=m.value[t.a],y=m.value[t.b],z=m.value[t.c],
+t=m.value[t.d],m.array[r]=x[s[0]],m.array[r+1]=x[s[1]],m.array[r+2]=x[s[2]],m.array[r+3]=y[s[0]],m.array[r+4]=y[s[1]],m.array[r+5]=y[s[2]],m.array[r+6]=z[s[0]],m.array[r+7]=z[s[1]],m.array[r+8]=z[s[2]],m.array[r+9]=t[s[0]],m.array[r+10]=t[s[1]],m.array[r+11]=t[s[2]],r+=12}else{if(m.boundTo==="faces"){j=0;for(q=M.length;j<q;j++)z=y=x=ia=m.value[M[j]],m.array[r]=x[s[0]],m.array[r+1]=x[s[1]],m.array[r+2]=x[s[2]],m.array[r+3]=y[s[0]],m.array[r+4]=y[s[1]],m.array[r+5]=y[s[2]],m.array[r+6]=z[s[0]],m.array[r+
+7]=z[s[1]],m.array[r+8]=z[s[2]],r+=9;j=0;for(q=X.length;j<q;j++)t=z=y=x=ia=m.value[X[j]],m.array[r]=x[s[0]],m.array[r+1]=x[s[1]],m.array[r+2]=x[s[2]],m.array[r+3]=y[s[0]],m.array[r+4]=y[s[1]],m.array[r+5]=y[s[2]],m.array[r+6]=z[s[0]],m.array[r+7]=z[s[1]],m.array[r+8]=z[s[2]],m.array[r+9]=t[s[0]],m.array[r+10]=t[s[1]],m.array[r+11]=t[s[2]],r+=12}}else if(m.size===4)if(m.boundTo===void 0||m.boundTo==="vertices"){j=0;for(q=M.length;j<q;j++)t=ba[M[j]],x=m.value[t.a],y=m.value[t.b],z=m.value[t.c],m.array[r]=
+x.x,m.array[r+1]=x.y,m.array[r+2]=x.z,m.array[r+3]=x.w,m.array[r+4]=y.x,m.array[r+5]=y.y,m.array[r+6]=y.z,m.array[r+7]=y.w,m.array[r+8]=z.x,m.array[r+9]=z.y,m.array[r+10]=z.z,m.array[r+11]=z.w,r+=12;j=0;for(q=X.length;j<q;j++)t=ba[X[j]],x=m.value[t.a],y=m.value[t.b],z=m.value[t.c],t=m.value[t.d],m.array[r]=x.x,m.array[r+1]=x.y,m.array[r+2]=x.z,m.array[r+3]=x.w,m.array[r+4]=y.x,m.array[r+5]=y.y,m.array[r+6]=y.z,m.array[r+7]=y.w,m.array[r+8]=z.x,m.array[r+9]=z.y,m.array[r+10]=z.z,m.array[r+11]=z.w,
+m.array[r+12]=t.x,m.array[r+13]=t.y,m.array[r+14]=t.z,m.array[r+15]=t.w,r+=16}else if(m.boundTo==="faces"){j=0;for(q=M.length;j<q;j++)z=y=x=ia=m.value[M[j]],m.array[r]=x.x,m.array[r+1]=x.y,m.array[r+2]=x.z,m.array[r+3]=x.w,m.array[r+4]=y.x,m.array[r+5]=y.y,m.array[r+6]=y.z,m.array[r+7]=y.w,m.array[r+8]=z.x,m.array[r+9]=z.y,m.array[r+10]=z.z,m.array[r+11]=z.w,r+=12;j=0;for(q=X.length;j<q;j++)t=z=y=x=ia=m.value[X[j]],m.array[r]=x.x,m.array[r+1]=x.y,m.array[r+2]=x.z,m.array[r+3]=x.w,m.array[r+4]=y.x,
+m.array[r+5]=y.y,m.array[r+6]=y.z,m.array[r+7]=y.w,m.array[r+8]=z.x,m.array[r+9]=z.y,m.array[r+10]=z.z,m.array[r+11]=z.w,m.array[r+12]=t.x,m.array[r+13]=t.y,m.array[r+14]=t.z,m.array[r+15]=t.w,r+=16}e.bindBuffer(e.ARRAY_BUFFER,m.buffer);e.bufferData(e.ARRAY_BUFFER,m.array,H)}}aa&&(delete o.__inittedArrays,delete o.__colorArray,delete o.__normalArray,delete o.__tangentArray,delete o.__uvArray,delete o.__uv2Array,delete o.__faceArray,delete o.__vertexArray,delete o.__lineArray,delete o.__skinVertexAArray,
+delete o.__skinVertexBArray,delete o.__skinIndexArray,delete o.__skinWeightArray)}}p.__dirtyVertices=!1;p.__dirtyMorphTargets=!1;p.__dirtyElements=!1;p.__dirtyUvs=!1;p.__dirtyNormals=!1;p.__dirtyColors=!1;p.__dirtyTangents=!1;n.attributes&&u(n)}else if(ma instanceof THREE.Ribbon){if(p.__dirtyVertices||p.__dirtyColors){n=p;ma=e.DYNAMIC_DRAW;s=A=s=aa=aa=void 0;Y=n.vertices;B=n.colors;j=Y.length;o=B.length;q=n.__vertexArray;H=n.__colorArray;J=n.__dirtyColors;if(n.__dirtyVertices){for(aa=0;aa<j;aa++)s=
+Y[aa].position,A=aa*3,q[A]=s.x,q[A+1]=s.y,q[A+2]=s.z;e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,q,ma)}if(J){for(aa=0;aa<o;aa++)s=B[aa],A=aa*3,H[A]=s.r,H[A+1]=s.g,H[A+2]=s.b;e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,H,ma)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(ma instanceof THREE.Line){n=c(ma,o);H=n.attributes&&w(n);if(p.__dirtyVertices||p.__dirtyColors||H){ma=p;A=e.DYNAMIC_DRAW;j=B=O=Y=K=void 0;Y=ma.vertices;o=ma.colors;
+j=Y.length;H=o.length;q=ma.__vertexArray;aa=ma.__colorArray;J=ma.__dirtyColors;s=ma.__webglCustomAttributesList;I=ba=X=M=O=K=void 0;if(ma.__dirtyVertices){for(K=0;K<j;K++)O=Y[K].position,B=K*3,q[B]=O.x,q[B+1]=O.y,q[B+2]=O.z;e.bindBuffer(e.ARRAY_BUFFER,ma.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,q,A)}if(J){for(Y=0;Y<H;Y++)j=o[Y],B=Y*3,aa[B]=j.r,aa[B+1]=j.g,aa[B+2]=j.b;e.bindBuffer(e.ARRAY_BUFFER,ma.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,aa,A)}if(s){K=0;for(O=s.length;K<O;K++)if(I=
+s[K],I.needsUpdate&&(I.boundTo===void 0||I.boundTo==="vertices")){B=0;X=I.value.length;if(I.size===1)for(M=0;M<X;M++)I.array[M]=I.value[M];else if(I.size===2)for(M=0;M<X;M++)ba=I.value[M],I.array[B]=ba.x,I.array[B+1]=ba.y,B+=2;else if(I.size===3)if(I.type==="c")for(M=0;M<X;M++)ba=I.value[M],I.array[B]=ba.r,I.array[B+1]=ba.g,I.array[B+2]=ba.b,B+=3;else for(M=0;M<X;M++)ba=I.value[M],I.array[B]=ba.x,I.array[B+1]=ba.y,I.array[B+2]=ba.z,B+=3;else if(I.size===4)for(M=0;M<X;M++)ba=I.value[M],I.array[B]=
+ba.x,I.array[B+1]=ba.y,I.array[B+2]=ba.z,I.array[B+3]=ba.w,B+=4;e.bindBuffer(e.ARRAY_BUFFER,I.buffer);e.bufferData(e.ARRAY_BUFFER,I.array,A)}}}p.__dirtyVertices=!1;p.__dirtyColors=!1;n.attributes&&u(n)}else if(ma instanceof THREE.ParticleSystem)n=c(ma,o),H=n.attributes&&w(n),(p.__dirtyVertices||p.__dirtyColors||ma.sortParticles||H)&&h(p,e.DYNAMIC_DRAW,ma),p.__dirtyVertices=!1,p.__dirtyColors=!1,n.attributes&&u(n)};this.initMaterial=function(a,b,c,d){var f,g,h,i;a instanceof THREE.MeshDepthMaterial?
+i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var k=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var l,n,p;l=p=k=0;for(n=b.length;l<n;l++)h=
+b[l],h instanceof THREE.SpotLight&&p++,h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&k++;k+p<=wa?l=p:(l=Math.ceil(wa*p/(k+p)),k=wa-l);h={directional:l,point:k};k=p=0;for(l=b.length;k<l;k++)n=b[k],n instanceof THREE.SpotLight&&n.castShadow&&p++;var j=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)j=d.bones.length;var q;a:{l=a.fragmentShader;n=a.vertexShader;var k=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:h.directional,maxPointLights:h.point,maxBones:j,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},u,d=[];i?d.push(i):(d.push(l),d.push(n));for(u in c)d.push(u),d.push(c[u]);
+i=d.join();u=0;for(d=Aa.length;u<d;u++)if(Aa[u].code===i){q=Aa[u].program;break a}u=e.createProgram();d=[Ma?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.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");
+h=["#ifdef GL_ES","precision "+ua+" 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:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.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");e.attachShader(u,ga("fragment",h+l));e.attachShader(u,
+ga("vertex",d+n));e.linkProgram(u);e.getProgramParameter(u,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(u,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");u.uniforms={};u.attributes={};var w,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in k)d.push(w);w=d;d=0;for(k=w.length;d<k;d++)l=w[d],u.uniforms[l]=e.getUniformLocation(u,
+l);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)d.push("morphTarget"+w);for(q in b)d.push(q);q=d;w=0;for(b=q.length;w<b;w++)c=q[w],u.attributes[c]=e.getAttribLocation(u,c);u.id=Aa.length;Aa.push({program:u,code:i});E.info.memory.programs=Aa.length;q=u}a.program=q;q=a.program.attributes;q.position>=0&&e.enableVertexAttribArray(q.position);q.color>=0&&e.enableVertexAttribArray(q.color);q.normal>=0&&e.enableVertexAttribArray(q.normal);
+q.tangent>=0&&e.enableVertexAttribArray(q.tangent);a.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0&&(e.enableVertexAttribArray(q.skinVertexA),e.enableVertexAttribArray(q.skinVertexB),e.enableVertexAttribArray(q.skinIndex),e.enableVertexAttribArray(q.skinWeight));if(a.attributes)for(g in a.attributes)q[g]!==void 0&&q[g]>=0&&e.enableVertexAttribArray(q[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)w="morphTarget"+g,q[w]>=0&&(e.enableVertexAttribArray(q[w]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),a==="back"?e.cullFace(e.BACK):a==="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.setObjectFaces=function(a){if(xa!==a.doubleSided)a.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),xa=a.doubleSided;if(Z!==a.flipSided)a.flipSided?e.frontFace(e.CW):
+e.frontFace(e.CCW),Z=a.flipSided};this.setDepthTest=function(a){sa!==a&&(a?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),sa=a)};this.setBlending=function(a){if(a!==oa){switch(a){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,
+e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}oa=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=e.createTexture(),E.info.memory.textures++;e.activeTexture(e.TEXTURE0+b);e.bindTexture(e.TEXTURE_2D,a.__webglTexture);var c=K(e.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,O(a.format),a.image.width,a.image.height,0,O(a.format),e.UNSIGNED_BYTE,a.image.data):e.texImage2D(e.TEXTURE_2D,
 0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a.image);c&&e.generateMipmap(e.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else e.activeTexture(e.TEXTURE0+b),e.bindTexture(e.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(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=e.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];e.bindTexture(e.TEXTURE_CUBE_MAP,
 0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a.image);c&&e.generateMipmap(e.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else e.activeTexture(e.TEXTURE0+b),e.bindTexture(e.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(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=e.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];e.bindTexture(e.TEXTURE_CUBE_MAP,
-a.__webglTexture);ea(e.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=e.createFramebuffer();a.__webglRenderbuffer[c]=e.createRenderbuffer();e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,H(a.format),a.width,a.height,0,H(a.format),H(a.type),null);var d=a,f=e.TEXTURE_CUBE_MAP_POSITIVE_X+c;e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[c]);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,f,d.__webglTexture,0);D(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=
-e.createFramebuffer(),a.__webglRenderbuffer=e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,a.__webglTexture),ea(e.TEXTURE_2D,a,a),e.texImage2D(e.TEXTURE_2D,0,H(a.format),a.width,a.height,0,H(a.format),H(a.type),null),c=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,c,a.__webglTexture,0),D(a.__webglRenderbuffer,a);b?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,
-null);e.bindFramebuffer(e.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=d=0):(b=null,c=Ha,a=Ia,d=za,f=Ja);b!==X&&(e.bindFramebuffer(e.FRAMEBUFFER,b),e.viewport(d,f,c,a),X=b)};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+a.__webglTexture);K(e.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=e.createFramebuffer();a.__webglRenderbuffer[c]=e.createRenderbuffer();e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,O(a.format),a.width,a.height,0,O(a.format),O(a.type),null);var d=a,f=e.TEXTURE_CUBE_MAP_POSITIVE_X+c;e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[c]);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,f,d.__webglTexture,0);P(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=e.createFramebuffer(),
+a.__webglRenderbuffer=e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,a.__webglTexture),K(e.TEXTURE_2D,a,a),e.texImage2D(e.TEXTURE_2D,0,O(a.format),a.width,a.height,0,O(a.format),O(a.type),null),c=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,c,a.__webglTexture,0),P(a.__webglRenderbuffer,a);b?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,
+null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=d=0):(b=null,c=Ga,a=Ha,d=Ia,f=Ja);b!==na&&(e.bindFramebuffer(e.FRAMEBUFFER,b),e.viewport(d,f,c,a),na=b)};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};

+ 9 - 8
src/extras/plugins/ShadowMapPlugin.js

@@ -48,6 +48,7 @@ THREE.ShadowMapPlugin = function ( ) {
 		shadowMap, shadowMatrix,
 		shadowMap, shadowMatrix,
 		program, buffer, material,
 		program, buffer, material,
 		webglObject, object, light,
 		webglObject, object, light,
+		renderList,
 
 
 		shadowIndex = 0,
 		shadowIndex = 0,
 
 
@@ -130,11 +131,11 @@ THREE.ShadowMapPlugin = function ( ) {
 
 
 				// set matrices & frustum culling
 				// set matrices & frustum culling
 
 
-				jl = scene.__webglObjects.length;
+				renderList = scene.__webglObjects;
 
 
-				for ( j = 0; j < jl; j ++ ) {
+				for ( j = 0, jl = renderList.length; j < jl; j ++ ) {
 
 
-					webglObject = scene.__webglObjects[ j ];
+					webglObject = renderList[ j ];
 					object = webglObject.object;
 					object = webglObject.object;
 
 
 					webglObject.render = false;
 					webglObject.render = false;
@@ -161,9 +162,9 @@ THREE.ShadowMapPlugin = function ( ) {
 
 
 				//_gl.cullFace( _gl.FRONT );
 				//_gl.cullFace( _gl.FRONT );
 
 
-				for ( j = 0; j < jl; j ++ ) {
+				for ( j = 0, jl = renderList.length; j < jl; j ++ ) {
 
 
-					webglObject = scene.__webglObjects[ j ];
+					webglObject = renderList[ j ];
 
 
 					if ( webglObject.render ) {
 					if ( webglObject.render ) {
 
 
@@ -194,11 +195,11 @@ THREE.ShadowMapPlugin = function ( ) {
 
 
 				// set matrices and render immediate objects
 				// set matrices and render immediate objects
 
 
-				jl = scene.__webglObjectsImmediate.length;
+				renderList = scene.__webglObjectsImmediate;
 
 
-				for ( j = 0; j < jl; j ++ ) {
+				for ( j = 0, jl = renderList.length; j < jl; j ++ ) {
 
 
-					webglObject = scene.__webglObjectsImmediate[ j ];
+					webglObject = renderList[ j ];
 					object = webglObject.object;
 					object = webglObject.object;
 
 
 					if ( object.visible && object.castShadow ) {
 					if ( object.visible && object.castShadow ) {

+ 28 - 38
src/renderers/WebGLRenderer.js

@@ -3032,29 +3032,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		// custom render plugins (pre pass)
 		// custom render plugins (pre pass)
 
 
-		if ( this.renderPluginsPre.length ) {
-
-			for ( i = 0, il = this.renderPluginsPre.length; i < il; i ++ ) {
-
-				_currentProgram = null;
-				_oldBlending = -1;
-				_oldDepthTest = -1;
-				_oldDepthWrite = -1;
-				_currentGeometryGroupHash = -1;
-				_currentMaterialId = -1;
-
-				this.renderPluginsPre[ i ].render( scene, camera, _viewportWidth, _viewportHeight );
-
-				_currentProgram = null;
-				_oldBlending = -1;
-				_oldDepthTest = -1;
-				_oldDepthWrite = -1;
-				_currentGeometryGroupHash = -1;
-				_currentMaterialId = -1;
-
-			}
-
-		}
+		renderPlugins( this.renderPluginsPre, scene, camera );
 
 
 		_this.info.render.calls = 0;
 		_this.info.render.calls = 0;
 		_this.info.render.vertices = 0;
 		_this.info.render.vertices = 0;
@@ -3184,22 +3162,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		// custom render plugins (post pass)
 		// custom render plugins (post pass)
 
 
-		if ( this.renderPluginsPost.length ) {
-
-			for ( i = 0, il = this.renderPluginsPost.length; i < il; i ++ ) {
-
-				this.renderPluginsPost[ i ].render( scene, camera, _viewportWidth, _viewportHeight );
-
-				_currentProgram = null;
-				_oldBlending = -1;
-				_oldDepthTest = -1;
-				_oldDepthWrite = -1;
-				_currentGeometryGroupHash = -1;
-				_currentMaterialId = -1;
-
-			}
+		renderPlugins( this.renderPluginsPost, scene, camera );
 
 
-		}
 
 
 		// Generate mipmap if we're using any kind of mipmap filtering
 		// Generate mipmap if we're using any kind of mipmap filtering
 
 
@@ -3213,6 +3177,32 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
+	function renderPlugins( plugins, scene, camera ) {
+
+		if ( ! plugins.length ) return;
+
+		for ( var i = 0, il = plugins.length; i < il; i ++ ) {
+
+			_currentProgram = null;
+			_oldBlending = -1;
+			_oldDepthTest = -1;
+			_oldDepthWrite = -1;
+			_currentGeometryGroupHash = -1;
+			_currentMaterialId = -1;
+
+			plugins[ i ].render( scene, camera, _viewportWidth, _viewportHeight );
+
+			_currentProgram = null;
+			_oldBlending = -1;
+			_oldDepthTest = -1;
+			_oldDepthWrite = -1;
+			_currentGeometryGroupHash = -1;
+			_currentMaterialId = -1;
+
+		}
+
+	};
+
 	function renderObjects ( renderList, reverse, materialType, camera, lights, fog, useBlending, overrideMaterial ) {
 	function renderObjects ( renderList, reverse, materialType, camera, lights, fog, useBlending, overrideMaterial ) {
 
 
 		var webglObject, object, buffer, material, start, end, delta;
 		var webglObject, object, buffer, material, start, end, delta;