Browse Source

Changed Projector to use Frustum.

Also some bugfixes in ShadowMapPlugin and SpritePlugin.
alteredq 13 years ago
parent
commit
3ded4a408f

+ 355 - 357
build/Three.js

@@ -17,38 +17,38 @@ 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-
 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}};
-THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);s=o.dot(b);if(s<=0)return null;l=q.add(a,n.copy(b).multiplyScalar(s));return p=c.distanceTo(l)}function d(a,b,c,d){o.sub(d,b);q.sub(c,b);n.sub(a,b);r=o.dot(o);t=o.dot(q);v=o.dot(n);B=q.dot(q);I=q.dot(n);y=1/(r*B-t*t);G=(B*v-t*I)*y;u=(r*I-t*v)*y;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,j=new THREE.Vector3;this.intersectObject=function(n){for(var l,s=[],o=0,q=n.children.length;o<q;o++)Array.prototype.push.apply(s,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};s.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 s;var p,r=n.geometry,t=r.vertices,k;n.matrixRotationWorld.extractRotation(n.matrixWorld);o=0;for(q=r.faces.length;o<q;o++)if(l=r.faces[o],a.copy(this.origin),
-b.copy(this.direction),k=n.matrixWorld,i=k.multiplyVector3(i.copy(l.centroid)).subSelf(a),p=i.dot(b),!(p<=0)&&(e=k.multiplyVector3(e.copy(t[l.a].position)),g=k.multiplyVector3(g.copy(t[l.b].position)),f=k.multiplyVector3(f.copy(t[l.c].position)),l instanceof THREE.Face4&&(h=k.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,j.add(a,b.multiplyScalar(p)),l instanceof THREE.Face3)d(j,
-e,g,f)&&(l={distance:a.distanceTo(j),point:j.clone(),face:l,object:n},s.push(l));else if(l instanceof THREE.Face4&&(d(j,e,g,h)||d(j,g,f,h)))l={distance:a.distanceTo(j),point:j.clone(),face:l,object:n},s.push(l)}return s};var o=new THREE.Vector3,q=new THREE.Vector3,n=new THREE.Vector3,s,l,p,r,t,v,B,I,y,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,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,q,n){h?(h=!1,b=g<j?g<q?g:q:j<q?j:q,c=f<o?f<n?f:n:o<n?o:n,d=g>j?g>q?g:q:j>q?j:q,e=f>o?f>n?f:n:o>n?o:n):(b=g<j?g<q?g<b?g:b:q<b?q:b:j<q?j<b?j:b:q<b?q: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>j?g>q?g>d?g:d:q>d?q:d:j>q?j>d?j:d:q>d?q: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);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>
 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.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,j,o,q,n,s,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,j!==void 0?j:1,o||0,q||0,n||0,s||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,j,o,q,n,s,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=j;this.n34=o;this.n41=q;this.n42=n;this.n43=s;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,j=a.n31,o=a.n32,q=a.n33,n=a.n34,s=a.n41,l=a.n42,p=a.n43,
-r=a.n44,t=b.n11,v=b.n12,B=b.n13,I=b.n14,y=b.n21,G=b.n22,u=b.n23,F=b.n24,A=b.n31,x=b.n32,J=b.n33,z=b.n34,ca=b.n41,Z=b.n42,L=b.n43,k=b.n44;this.n11=c*t+d*y+e*A+g*ca;this.n12=c*v+d*G+e*x+g*Z;this.n13=c*B+d*u+e*J+g*L;this.n14=c*I+d*F+e*z+g*k;this.n21=f*t+h*y+i*A+m*ca;this.n22=f*v+h*G+i*x+m*Z;this.n23=f*B+h*u+i*J+m*L;this.n24=f*I+h*F+i*z+m*k;this.n31=j*t+o*y+q*A+n*ca;this.n32=j*v+o*G+q*x+n*Z;this.n33=j*B+o*u+q*J+n*L;this.n34=j*I+o*F+q*z+n*k;this.n41=s*t+l*y+p*A+r*ca;this.n42=s*v+l*G+p*x+r*Z;this.n43=s*
-B+l*u+p*J+r*L;this.n44=s*I+l*F+p*z+r*k;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,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*=
 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*
-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,j=this.n33,o=this.n34,q=this.n41,n=this.n42,s=this.n43,l=this.n44;return d*f*m*q-c*h*m*q-d*g*j*q+b*h*j*q+c*g*o*q-b*f*o*q-d*f*i*n+c*h*i*n+d*e*j*n-a*h*j*n-c*e*o*n+a*f*o*n+d*g*i*s-b*h*i*s-d*e*m*s+a*h*m*s+b*e*o*s-a*g*o*s-c*g*i*l+b*f*i*l+c*e*m*l-a*f*m*l-b*e*j*l+a*g*j*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,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=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
 a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
 a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},
 setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},
 setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,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,j=a.n32,o=a.n33,q=a.n34,n=a.n41,s=a.n42,l=a.n43,p=a.n44;this.n11=h*q*s-i*o*s+i*j*l-f*q*l-h*j*p+f*o*p;this.n12=e*o*s-d*q*s-e*j*l+c*q*l+d*j*p-c*o*p;this.n13=d*i*s-e*h*s+e*f*l-c*i*l-d*f*p+c*h*p;this.n14=e*h*j-d*i*j-e*f*o+c*i*o+d*f*q-c*h*q;this.n21=i*o*n-h*q*n-i*m*l+g*q*l+h*m*p-g*o*p;this.n22=d*q*n-e*o*n+
-e*m*l-b*q*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*q+b*h*q;this.n31=f*q*n-i*j*n+i*m*s-g*q*s-f*m*p+g*j*p;this.n32=e*j*n-c*q*n-e*m*s+b*q*s+c*m*p-b*j*p;this.n33=d*i*n-e*f*n+e*g*s-b*i*s-c*g*p+b*f*p;this.n34=e*f*m-c*i*m-e*g*j+b*i*j+c*g*q-b*f*q;this.n41=h*j*n-f*o*n-h*m*s+g*o*s+f*m*l-g*j*l;this.n42=c*o*n-d*j*n+d*m*s-b*o*s-c*m*l+b*j*l;this.n43=d*f*n-c*h*n-d*g*s+b*h*s+c*g*l-b*f*l;this.n44=c*h*m-d*f*m+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,m=f*e,j=d*h,o=d*e;this.n11=i+o*c;this.n12=j*c-m;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=m*c-j;this.n32=o+i*c;this.n33=g*f;break;case "ZXY":i=f*h;m=f*e;j=d*h;o=d*e;this.n11=i-o*c;this.n12=-g*e;this.n13=j+m*c;this.n21=m+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;m=g*e;j=c*h;o=c*e;this.n11=f*h;this.n12=j*d-m;this.n13=i*d+o;this.n21=f*e;this.n22=o*d+i;this.n23=m*d-j;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;m=g*d;j=c*f;o=c*d;this.n11=f*h;this.n12=o-i*e;this.n13=j*e+m;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=m*e+j;this.n33=i-o*e;break;case "XZY":i=g*f;m=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=m*e-j;this.n31=j*e-m;this.n32=c*h;this.n33=o*e+i;break;default:i=g*h,m=g*
-e,j=c*h,o=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=m+j*d,this.n22=i-o*d,this.n23=-c*f,this.n31=o-i*d,this.n32=j+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*=
+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=d*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*=
 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;
 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,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*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*j;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,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.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.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=
@@ -58,23 +58,21 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 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;
 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=[],
-j,o,q=[],n,s=[],l,p,r=[],t,v,B=[],I={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,G=new THREE.Vector4,u=new THREE.Matrix4,F=new THREE.Matrix4,A=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],x=new THREE.Vector4,J=new THREE.Vector4;this.computeFrustum=function(a){A[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);A[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);A[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);A[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);A[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);A[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=A[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);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){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=A[h].x*d.n14+A[h].y*d.n24+A[h].z*d.n34+A[h].w,c<=g){c=!1;break a}c=!0}c?(u.multiplyVector3(y.copy(b.position)),e=a(),e.object=b,e.z=y.z,I.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(u.multiplyVector3(y.copy(b.position)),e=a(),e.object=b,e.z=y.z,I.sprites.push(e)):b instanceof THREE.Light&&I.lights.push(b);c=0;for(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,k=e.far,A,y,M,C,O,ea,Y,fa,W,R,V,T,ba,$,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);this.computeFrustum(u);I=this.projectGraph(a,!1);a=0;for(A=I.objects.length;a<A;a++)if(W=I.objects[a].object,R=W.matrixWorld,
-T=W.material,i=0,W instanceof THREE.Mesh){V=W.geometry;ba=W.geometry.materials;C=V.vertices;$=V.faces;qa=V.faceVertexUvs;V=W.matrixRotationWorld.extractRotation(R);y=0;for(M=C.length;y<M;y++)h=b(),h.positionWorld.copy(C[y].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<k;C=0;for(y=$.length;C<y;C++){M=
-$[C];if(M instanceof THREE.Face3)if(O=m[M.a],ea=m[M.b],Y=m[M.c],O.visible&&ea.visible&&Y.visible&&(W.doubleSided||W.flipSided!=(Y.positionScreen.x-O.positionScreen.x)*(ea.positionScreen.y-O.positionScreen.y)-(Y.positionScreen.y-O.positionScreen.y)*(ea.positionScreen.x-O.positionScreen.x)<0))fa=q[o]=q[o]||new THREE.RenderableFace3,o++,j=fa,j.v1.copy(O),j.v2.copy(ea),j.v3.copy(Y);else continue;else if(M instanceof THREE.Face4)if(O=m[M.a],ea=m[M.b],Y=m[M.c],fa=m[M.d],O.visible&&ea.visible&&Y.visible&&
-fa.visible&&(W.doubleSided||W.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-Y.positionScreen.x)*(fa.positionScreen.y-Y.positionScreen.y)-(ea.positionScreen.y-Y.positionScreen.y)*(fa.positionScreen.x-Y.positionScreen.x)<0)))da=s[n]=s[n]||new THREE.RenderableFace4,n++,j=da,j.v1.copy(O),j.v2.copy(ea),j.v3.copy(Y),j.v4.copy(fa);else continue;j.normalWorld.copy(M.normal);
-V.multiplyVector3(j.normalWorld);j.centroidWorld.copy(M.centroid);R.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);u.multiplyVector3(j.centroidScreen);Y=M.vertexNormals;O=0;for(ea=Y.length;O<ea;O++)fa=j.vertexNormalsWorld[O],fa.copy(Y[O]),V.multiplyVector3(fa);O=0;for(ea=qa.length;O<ea;O++)if(da=qa[O][C]){Y=0;for(fa=da.length;Y<fa;Y++)j.uvs[O][Y]=da[Y]}j.material=T;j.faceMaterial=M.materialIndex!==null?ba[M.materialIndex]:null;j.z=j.centroidScreen.z;I.elements.push(j)}}else if(W instanceof
-THREE.Line){F.multiply(u,R);C=W.geometry.vertices;O=b();O.positionScreen.copy(C[0].position);F.multiplyVector4(O.positionScreen);y=1;for(M=C.length;y<M;y++)if(O=b(),O.positionScreen.copy(C[y].position),F.multiplyVector4(O.positionScreen),ea=m[i-2],x.copy(O.positionScreen),J.copy(ea.positionScreen),d(x,J))x.multiplyScalar(1/x.w),J.multiplyScalar(1/J.w),W=r[p]=r[p]||new THREE.RenderableLine,p++,l=W,l.v1.positionScreen.copy(x),l.v2.positionScreen.copy(J),l.z=Math.max(x.z,J.z),l.material=T,I.elements.push(l)}a=
-0;for(A=I.sprites.length;a<A;a++)if(W=I.sprites[a].object,R=W.matrixWorld,W 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=B[v]=B[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=W.rotation.z,t.scale.x=W.scale.x*Math.abs(t.x-(G.x+e.projectionMatrix.n11)/(G.w+e.projectionMatrix.n14)),t.scale.y=W.scale.y*Math.abs(t.y-(G.y+e.projectionMatrix.n22)/(G.w+e.projectionMatrix.n24)),t.material=W.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)};
+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.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.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,j=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+j*-h-o*-f;b.y=j*i+c*-f+o*-g-m*-h;b.z=o*i+c*-h+m*-f-j*-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,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}};
 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.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};
@@ -85,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=
 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,
-b,c,d,e,g,L){h=a.vertices[b].position;i=a.vertices[c].position;m=a.vertices[d].position;j=f[e];o=f[g];q=f[L];n=i.x-h.x;s=m.x-h.x;l=i.y-h.y;p=m.y-h.y;r=i.z-h.z;t=m.z-h.z;v=o.u-j.u;B=q.u-j.u;I=o.v-j.v;y=q.v-j.v;G=1/(v*y-B*I);x.set((y*n-I*s)*G,(y*l-I*p)*G,(y*r-I*t)*G);J.set((v*s-B*n)*G,(v*p-B*l)*G,(v*t-B*r)*G);F[b].addSelf(x);F[c].addSelf(x);F[d].addSelf(x);A[b].addSelf(J);A[c].addSelf(J);A[d].addSelf(J)}var b,c,d,e,g,f,h,i,m,j,o,q,n,s,l,p,r,t,v,B,I,y,G,u,F=[],A=[],x=new THREE.Vector3,J=new THREE.Vector3,
-z=new THREE.Vector3,ca=new THREE.Vector3,Z=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 L=["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++)Z.copy(g.vertexNormals[d]),e=g[L[d]],
-u=F[e],z.copy(u),z.subSelf(Z.multiplyScalar(Z.dot(u))).normalize(),ca.cross(g.vertexNormals[d],u),e=ca.dot(A[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(z.x,z.y,z.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;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=
 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=
 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,j,o,q;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]];j=this.points[c[1]];
-o=this.points[c[2]];q=this.points[c[3]];h=f*f;i=f*h;d.x=b(m.x,j.x,o.x,q.x,f,h,i);d.y=b(m.y,j.y,o.y,q.y,f,h,i);d.z=b(m.z,j.z,o.z,q.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=
+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=
 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.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;
@@ -150,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.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.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,j,o,q,n,s,l;a=b.projectScene(c,d);i=0;for(m=a.length;i<m;i++)if(q=a[i],q instanceof THREE.RenderableParticle){s=q.x*e+e;l=q.y*g+g;j=0;for(o=q.material.length;j<o;j++)if(n=q.material[j],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=s+"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(B!=a)l.strokeStyle=B=a}function e(a){if(I!=a)l.fillStyle=I=a}var g=this,f,h,i,m=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-o,q,n,s,l=j.getContext("2d"),p=new THREE.Color(0),r=0,t=1,v=0,B=null,I=null,y=null,G=null,u=null,F,A,x,J,z=new THREE.RenderableVertex,ca=new THREE.RenderableVertex,Z,L,k,X,K,M,C,O,ea,Y,fa,W,R=new THREE.Color,V=new THREE.Color,T=new THREE.Color,ba=new THREE.Color,$=new THREE.Color,qa=[],da=[],oa,sa,ja,la,ya,va,xa,Aa,ga,ma,S=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=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;q=b;n=Math.floor(o/2);s=Math.floor(q/2);j.width=o;j.height=q;S.set(-n,-s,n,s);ta.set(-n,-s,n,s);t=1;v=0;u=
-G=y=I=B=null};this.setClearColor=function(a,b){p.copy(a);r=b;ta.set(-n,-s,n,s)};this.setClearColorHex=function(a,b){p.setHex(a);r=b;ta.set(-n,-s,n,s)};this.clear=function(){l.setTransform(1,0,0,-1,n,s);ta.isEmpty()||(ta.minSelf(S),ta.inflate(2),r<1&&l.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight())),r>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")"),l.fillRect(Math.floor(ta.getX()),
-Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))),ta.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 q(a,b,c,d){var e,g,f,ga,h,k;e=0;for(g=a.length;e<g;e++)f=a[e],
-ga=f.color,f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),k=c.dot(h),k<=0||(k*=f.intensity,d.r+=ga.r*k,d.g+=ga.g*k,d.b+=ga.b*k)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),k=c.dot(ra.sub(h,b).normalize()),k<=0||(k*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),k!=0&&(k*=f.intensity,d.r+=ga.r*k,d.g+=ga.g*k,d.b+=ga.b*k)))}function p(a,g,f){b(f.opacity);c(f.blending);var ga,h,k,i,j,ma;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)i=f.map.image,
-j=i.width>>1,ma=i.height>>1,f=g.scale.x*n,k=g.scale.y*s,ga=f*j,h=k*ma,ua.set(a.x-ga,a.y-h,a.x+ga,a.y+h),S.intersects(ua)&&(l.save(),l.translate(a.x,a.y),l.rotate(-g.rotation),l.scale(f,-k),l.translate(-j,-ma),l.drawImage(i,0,0),l.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(ga=g.scale.x*n,h=g.scale.y*s,ua.set(a.x-ga,a.y-h,a.x+ga,a.y+h),S.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 r(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(y!=a)l.lineWidth=y=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,l,S){g.info.render.vertices+=3;g.info.render.faces++;b(S.opacity);c(S.blending);
-Z=a.positionScreen.x;L=a.positionScreen.y;k=d.positionScreen.x;X=d.positionScreen.y;K=e.positionScreen.x;M=e.positionScreen.y;B(Z,L,k,X,K,M);if(S instanceof THREE.MeshBasicMaterial)if(S.map)S.map.mapping instanceof THREE.UVMapping&&(la=l.uvs[0],Q(Z,L,k,X,K,M,la[f].u,la[f].v,la[h].u,la[h].v,la[n].u,la[n].v,S.map));else if(S.envMap){if(S.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,ra.copy(l.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(l.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(l.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(Z,L,k,X,K,M,ya,va,xa,Aa,ga,ma,S.envMap)}else S.wireframe?Ba(S.color,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):N(S.color);else if(S instanceof THREE.MeshLambertMaterial)S.map&&!S.wireframe&&
-(S.map.mapping instanceof THREE.UVMapping&&(la=l.uvs[0],Q(Z,L,k,X,K,M,la[f].u,la[f].v,la[h].u,la[h].v,la[n].u,la[n].v,S.map)),c(THREE.SubtractiveBlending)),Sa?!S.wireframe&&S.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==3?(V.r=T.r=ba.r=wa.r,V.g=T.g=ba.g=wa.g,V.b=T.b=ba.b=wa.b,q(i,l.v1.positionWorld,l.vertexNormalsWorld[0],V),q(i,l.v2.positionWorld,l.vertexNormalsWorld[1],T),q(i,l.v3.positionWorld,l.vertexNormalsWorld[2],ba),V.r=Math.max(0,Math.min(S.color.r*V.r,1)),V.g=Math.max(0,Math.min(S.color.g*
-V.g,1)),V.b=Math.max(0,Math.min(S.color.b*V.b,1)),T.r=Math.max(0,Math.min(S.color.r*T.r,1)),T.g=Math.max(0,Math.min(S.color.g*T.g,1)),T.b=Math.max(0,Math.min(S.color.b*T.b,1)),ba.r=Math.max(0,Math.min(S.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(S.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(S.color.b*ba.b,1)),$.r=(T.r+ba.r)*0.5,$.g=(T.g+ba.g)*0.5,$.b=(T.b+ba.b)*0.5,ja=Qa(V,T,ba,$),P(Z,L,k,X,K,M,0,0,1,0,0,1,ja)):(R.r=wa.r,R.g=wa.g,R.b=wa.b,q(i,l.centroidWorld,l.normalWorld,R),R.r=Math.max(0,Math.min(S.color.r*
-R.r,1)),R.g=Math.max(0,Math.min(S.color.g*R.g,1)),R.b=Math.max(0,Math.min(S.color.b*R.b,1)),S.wireframe?Ba(R,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):N(R)):S.wireframe?Ba(S.color,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):N(S.color);else if(S instanceof THREE.MeshDepthMaterial)oa=j.near,sa=j.far,V.r=V.g=V.b=1-Fa(a.positionScreen.z,oa,sa),T.r=T.g=T.b=1-Fa(d.positionScreen.z,oa,sa),ba.r=ba.g=ba.b=1-Fa(e.positionScreen.z,oa,sa),$.r=(T.r+ba.r)*0.5,$.g=(T.g+ba.g)*
-0.5,$.b=(T.b+ba.b)*0.5,ja=Qa(V,T,ba,$),P(Z,L,k,X,K,M,0,0,1,0,0,1,ja);else if(S instanceof THREE.MeshNormalMaterial)R.r=Ja(l.normalWorld.x),R.g=Ja(l.normalWorld.y),R.b=Ja(l.normalWorld.z),S.wireframe?Ba(R,S.wireframeLinewidth,S.wireframeLinecap,S.wireframeLinejoin):N(R)}function v(a,d,e,f,ga,h,S,l,n){g.info.render.vertices+=4;g.info.render.faces++;b(l.opacity);c(l.blending);if(l.map||l.envMap)t(a,d,f,0,1,3,S,l,n),t(ga,e,h,1,2,3,S,l,n);else if(Z=a.positionScreen.x,L=a.positionScreen.y,k=d.positionScreen.x,
-X=d.positionScreen.y,K=e.positionScreen.x,M=e.positionScreen.y,C=f.positionScreen.x,O=f.positionScreen.y,ea=ga.positionScreen.x,Y=ga.positionScreen.y,fa=h.positionScreen.x,W=h.positionScreen.y,l instanceof THREE.MeshBasicMaterial)I(Z,L,k,X,K,M,C,O),l.wireframe?Ba(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):N(l.color);else if(l instanceof THREE.MeshLambertMaterial)Sa?!l.wireframe&&l.shading==THREE.SmoothShading&&S.vertexNormalsWorld.length==4?(V.r=T.r=ba.r=$.r=wa.r,V.g=T.g=
-ba.g=$.g=wa.g,V.b=T.b=ba.b=$.b=wa.b,q(i,S.v1.positionWorld,S.vertexNormalsWorld[0],V),q(i,S.v2.positionWorld,S.vertexNormalsWorld[1],T),q(i,S.v4.positionWorld,S.vertexNormalsWorld[3],ba),q(i,S.v3.positionWorld,S.vertexNormalsWorld[2],$),V.r=Math.max(0,Math.min(l.color.r*V.r,1)),V.g=Math.max(0,Math.min(l.color.g*V.g,1)),V.b=Math.max(0,Math.min(l.color.b*V.b,1)),T.r=Math.max(0,Math.min(l.color.r*T.r,1)),T.g=Math.max(0,Math.min(l.color.g*T.g,1)),T.b=Math.max(0,Math.min(l.color.b*T.b,1)),ba.r=Math.max(0,
-Math.min(l.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(l.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(l.color.b*ba.b,1)),$.r=Math.max(0,Math.min(l.color.r*$.r,1)),$.g=Math.max(0,Math.min(l.color.g*$.g,1)),$.b=Math.max(0,Math.min(l.color.b*$.b,1)),ja=Qa(V,T,ba,$),B(Z,L,k,X,C,O),P(Z,L,k,X,C,O,0,0,1,0,0,1,ja),B(ea,Y,K,M,fa,W),P(ea,Y,K,M,fa,W,1,0,1,1,0,1,ja)):(R.r=wa.r,R.g=wa.g,R.b=wa.b,q(i,S.centroidWorld,S.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)),I(Z,L,k,X,K,M,C,O),l.wireframe?Ba(R,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):N(R)):(I(Z,L,k,X,K,M,C,O),l.wireframe?Ba(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):N(l.color));else if(l instanceof THREE.MeshNormalMaterial)R.r=Ja(S.normalWorld.x),R.g=Ja(S.normalWorld.y),R.b=Ja(S.normalWorld.z),I(Z,L,k,X,K,M,C,O),l.wireframe?Ba(R,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):N(R);else if(l instanceof
-THREE.MeshDepthMaterial)oa=j.near,sa=j.far,V.r=V.g=V.b=1-Fa(a.positionScreen.z,oa,sa),T.r=T.g=T.b=1-Fa(d.positionScreen.z,oa,sa),ba.r=ba.g=ba.b=1-Fa(f.positionScreen.z,oa,sa),$.r=$.g=$.b=1-Fa(e.positionScreen.z,oa,sa),ja=Qa(V,T,ba,$),B(Z,L,k,X,C,O),P(Z,L,k,X,C,O,0,0,1,0,0,1,ja),B(ea,Y,K,M,fa,W),P(ea,Y,K,M,fa,W,1,0,1,1,0,1,ja)}function B(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(y!=b)l.lineWidth=y=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 N(a){e(a.getContextStyle());l.fill()}function Q(a,b,c,d,g,f,ga,h,k,i,S,j,n){if(n.image.width!=0){if(n.needsUpdate==!0||qa[n.id]==void 0){var ma=n.wrapS==THREE.RepeatWrapping,m=n.wrapT==THREE.RepeatWrapping;qa[n.id]=l.createPattern(n.image,ma&&m?"repeat":ma&&!m?"repeat-x":!ma&&m?"repeat-y":"no-repeat");
-n.needsUpdate=!1}e(qa[n.id]);var ma=n.offset.x/n.repeat.x,m=n.offset.y/n.repeat.y,ta=n.image.width*n.repeat.x,o=n.image.height*n.repeat.y,ga=(ga+ma)*ta,h=(h+m)*o,k=(k+ma)*ta,i=(i+m)*o,S=(S+ma)*ta,j=(j+m)*o;c-=a;d-=b;g-=a;f-=b;k-=ga;i-=h;S-=ga;j-=h;ma=k*j-S*i;if(ma==0){if(da[n.id]==void 0)b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,a=b.getContext("2d"),a.drawImage(n.image,0,0),da[n.id]=a.getImageData(0,0,n.image.width,n.image.height).data,delete b;b=da[n.id];ga=
-(Math.floor(ga)+Math.floor(h)*n.image.width)*4;R.setRGB(b[ga]/255,b[ga+1]/255,b[ga+2]/255);N(R)}else ma=1/ma,n=(j*c-i*g)*ma,i=(j*d-i*f)*ma,c=(k*g-S*c)*ma,d=(k*f-S*d)*ma,a=a-n*ga-c*h,ga=b-i*ga-d*h,l.save(),l.transform(n,i,c,d,a,ga),l.fill(),l.restore()}}function P(a,b,c,d,e,g,f,ga,h,k,i,S,n){var j,ma;j=n.width-1;ma=n.height-1;f*=j;ga*=ma;h*=j;k*=ma;i*=j;S*=ma;c-=a;d-=b;e-=a;g-=b;h-=f;k-=ga;i-=f;S-=ga;ma=1/(h*S-i*k);j=(S*c-k*e)*ma;k=(S*d-k*g)*ma;c=(h*e-i*c)*ma;d=(h*g-i*d)*ma;a=a-j*f-c*ga;b=b-k*f-d*
-ga;l.save();l.transform(j,k,c,d,a,b);l.clip();l.drawImage(n,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),k=~~(c.g*255),c=~~(c.b*255),i=~~(d.r*255),l=~~(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]=k<0?0:k>255?255:k;za[10]=c<0?0:c>255?255:c;za[12]=i<0?
-0:i>255?255:i;za[13]=l<0?0:l>255?255:l;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,U,aa;this.autoClear?this.clear():l.setTransform(1,0,0,-1,n,s);g.info.render.vertices=0;g.info.render.faces=0;f=m.projectScene(a,j,this.sortElements);h=f.elements;
-i=f.lights;(Sa=i.length>0)&&o(i);Ra=0;for(Ta=h.length;Ra<Ta;Ra++)if(U=h[Ra],aa=U.material,aa=aa instanceof THREE.MeshFaceMaterial?U.faceMaterial:aa,!(aa==null||aa.opacity==0)){ua.empty();if(U instanceof THREE.RenderableParticle)F=U,F.x*=n,F.y*=s,p(F,U,aa,a);else if(U instanceof THREE.RenderableLine)F=U.v1,A=U.v2,F.positionScreen.x*=n,F.positionScreen.y*=s,A.positionScreen.x*=n,A.positionScreen.y*=s,ua.addPoint(F.positionScreen.x,F.positionScreen.y),ua.addPoint(A.positionScreen.x,A.positionScreen.y),
-S.intersects(ua)&&r(F,A,U,aa,a);else if(U instanceof THREE.RenderableFace3)F=U.v1,A=U.v2,x=U.v3,F.positionScreen.x*=n,F.positionScreen.y*=s,A.positionScreen.x*=n,A.positionScreen.y*=s,x.positionScreen.x*=n,x.positionScreen.y*=s,aa.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),S.intersects(ua)&&
-t(F,A,x,0,1,2,U,aa,a);else if(U instanceof THREE.RenderableFace4)F=U.v1,A=U.v2,x=U.v3,J=U.v4,F.positionScreen.x*=n,F.positionScreen.y*=s,A.positionScreen.x*=n,A.positionScreen.y*=s,x.positionScreen.x*=n,x.positionScreen.y*=s,J.positionScreen.x*=n,J.positionScreen.y*=s,z.positionScreen.copy(A.positionScreen),ca.positionScreen.copy(J.positionScreen),aa.overdraw&&(Ca(F.positionScreen,A.positionScreen),Ca(A.positionScreen,J.positionScreen),Ca(J.positionScreen,F.positionScreen),Ca(x.positionScreen,z.positionScreen),
-Ca(x.positionScreen,ca.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(J.positionScreen.x,J.positionScreen.y),S.intersects(ua)&&v(F,A,x,J,z,ca,U,aa,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,l;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),l=c.dot(i),l<=0||(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),l=c.dot(F.sub(i,b).normalize()),l<=0||(l*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),l!=0&&(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function b(a){A[a]==null&&(A[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),Z==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,j,o,q,n,s,l,p,r=new THREE.Rectangle,t=new THREE.Rectangle,v=!1,B=new THREE.Color,I=new THREE.Color,y=new THREE.Color,G=new THREE.Color,u,F=new THREE.Vector3,A=[],x=[],J,z,ca,Z=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":Z=1;break;case "low":Z=0}};this.setSize=function(a,b){m=a;j=b;o=m/2;q=j/2;i.setAttribute("viewBox",-o+" "+-q+" "+m+" "+j);i.setAttribute("width",m);i.setAttribute("height",j);r.set(-o,-q,o,q)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(j,k){var m,A,M,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,k,this.sortElements);g=e.elements;
-f=e.lights;ca=z=0;if(v=f.length>0){I.setRGB(0,0,0);y.setRGB(0,0,0);G.setRGB(0,0,0);m=0;for(A=f.length;m<A;m++)C=f[m],M=C.color,C instanceof THREE.AmbientLight?(I.r+=M.r,I.g+=M.g,I.b+=M.b):C instanceof THREE.DirectionalLight?(y.r+=M.r,y.g+=M.g,y.b+=M.b):C instanceof THREE.PointLight&&(G.r+=M.r,G.g+=M.g,G.b+=M.b)}m=0;for(A=g.length;m<A;m++)if(M=g[m],C=M.material,C=C instanceof THREE.MeshFaceMaterial?M.faceMaterial:C,!(C==null||C.opacity==0))if(t.empty(),M instanceof THREE.RenderableParticle)n=M,n.x*=
-o,n.y*=-q;else if(M instanceof THREE.RenderableLine){if(n=M.v1,s=M.v2,n.positionScreen.x*=o,n.positionScreen.y*=-q,s.positionScreen.x*=o,s.positionScreen.y*=-q,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),r.intersects(t)){M=n;var O=s,F=ca++;x[F]==null&&(x[F]=document.createElementNS("http://www.w3.org/2000/svg","line"),Z==0&&x[F].setAttribute("shape-rendering","crispEdges"));J=x[F];J.setAttribute("x1",M.positionScreen.x);J.setAttribute("y1",M.positionScreen.y);
-J.setAttribute("x2",O.positionScreen.x);J.setAttribute("y2",O.positionScreen.y);C instanceof THREE.LineBasicMaterial&&(J.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(J))}}else if(M instanceof THREE.RenderableFace3){if(n=M.v1,s=M.v2,l=M.v3,n.positionScreen.x*=o,n.positionScreen.y*=-q,s.positionScreen.x*=o,s.positionScreen.y*=-q,l.positionScreen.x*=
-o,l.positionScreen.y*=-q,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),t.addPoint(l.positionScreen.x,l.positionScreen.y),r.intersects(t)){var O=n,F=s,Y=l;d.info.render.vertices+=3;d.info.render.faces++;J=b(z++);J.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?B.copy(C.color):C instanceof THREE.MeshLambertMaterial?
-v?(B.r=I.r,B.g=I.g,B.b=I.b,a(f,M.centroidWorld,M.normalWorld,B),B.r=Math.max(0,Math.min(C.color.r*B.r,1)),B.g=Math.max(0,Math.min(C.color.g*B.g,1)),B.b=Math.max(0,Math.min(C.color.b*B.b,1))):B.copy(C.color):C instanceof THREE.MeshDepthMaterial?(u=1-C.__2near/(C.__farPlusNear-M.z*C.__farMinusNear),B.setRGB(u,u,u)):C instanceof THREE.MeshNormalMaterial&&B.setRGB(c(M.normalWorld.x),c(M.normalWorld.y),c(M.normalWorld.z));C.wireframe?J.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+
-C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):J.setAttribute("style","fill: "+B.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(J)}}else if(M instanceof THREE.RenderableFace4&&(n=M.v1,s=M.v2,l=M.v3,p=M.v4,n.positionScreen.x*=o,n.positionScreen.y*=-q,s.positionScreen.x*=o,s.positionScreen.y*=-q,l.positionScreen.x*=o,l.positionScreen.y*=-q,p.positionScreen.x*=o,p.positionScreen.y*=-q,t.addPoint(n.positionScreen.x,
-n.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),t.addPoint(l.positionScreen.x,l.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),r.intersects(t))){var O=n,F=s,Y=l,fa=p;d.info.render.vertices+=4;d.info.render.faces++;J=b(z++);J.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?
-B.copy(C.color):C instanceof THREE.MeshLambertMaterial?v?(B.r=I.r,B.g=I.g,B.b=I.b,a(f,M.centroidWorld,M.normalWorld,B),B.r=Math.max(0,Math.min(C.color.r*B.r,1)),B.g=Math.max(0,Math.min(C.color.g*B.g,1)),B.b=Math.max(0,Math.min(C.color.b*B.b,1))):B.copy(C.color):C instanceof THREE.MeshDepthMaterial?(u=1-C.__2near/(C.__farPlusNear-M.z*C.__farMinusNear),B.setRGB(u,u,u)):C instanceof THREE.MeshNormalMaterial&&B.setRGB(c(M.normalWorld.x),c(M.normalWorld.y),c(M.normalWorld.z));C.wireframe?J.setAttribute("style",
-"fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):J.setAttribute("style","fill: "+B.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(J)}}};
+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.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -223,115 +221,116 @@ 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.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(a){function 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)}}}
+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)}}}
 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,l=i.length,j=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,o=a.__dirtyVertices,q=a.__dirtyColors,s=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,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;for(d=0;d<l;d++)f=d*3,e=i[m[d][1]],n[f]=e.r,n[f+
-1]=e.g,n[f+2]=e.b;if(s){i=0;for(l=s.length;i<l;i++)if(h=s[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,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;if(q)for(d=0;d<l;d++)e=i[d],f=d*3,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(s){i=0;for(l=s.length;i<l;i++)if(h=s[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(q||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
-a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,n,b);if(s){i=0;for(l=s.length;i<l;i++)if(h=s[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,d,e,f,g,h){var k,i,l,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;l=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&L.setBlending(k.blending);L.setDepthTest(k.depthTest);r(k.depthWrite);t(k.polygonOffset,
-k.polygonOffsetFactor,k.polygonOffsetUnits)}L.setObjectFaces(i);L.renderBuffer(d,e,f,k,l,i)}}function m(a,b,c,d,e,f,g){for(var h,i,j,n,m=0,o=a.length;m<o;m++)if(h=a[m],i=h.object,i.visible){O=-1;if(g)j=g;else{j=h[b];if(!j)continue;f&&L.setBlending(j.blending);L.setDepthTest(j.depthTest);r(j.depthWrite);t(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}L.setObjectFaces(i);n=l(c,d,e,j,i);i.immediateRenderCallback?i.immediateRenderCallback(n,k,la):i.render(function(a){L.renderBufferImmediate(a,
-n,j.shading)})}}function j(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 q(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 s(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||L.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=
-new Float32Array(L.maxMorphTargets);for(var f=0,g=L.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==K&&(k.useProgram(f),K=f,h=!0);if(d.id!==C)C=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 l,j,n=0,m=0,o=0,q,s,p,r=xa,t=r.directional.colors,x=r.directional.positions,v=r.point.colors,A=r.point.positions,J=r.point.distances,z=0,y=0,c=l=p=0,h=b.length;c<h;c++)if(l=b[c],j=l.color,q=l.position,s=l.intensity,p=l.distance,l instanceof THREE.AmbientLight)L.gammaInput?(n+=j.r*j.r,m+=j.g*j.g,o+=j.b*j.b):(n+=j.r,m+=j.g,o+=j.b);else if(l instanceof THREE.DirectionalLight)p=z*3,L.gammaInput?(t[p]=j.r*j.r*s*s,t[p+1]=j.g*j.g*s*s,t[p+2]=j.b*j.b*
-s*s):(t[p]=j.r*s,t[p+1]=j.g*s,t[p+2]=j.b*s),x[p]=q.x,x[p+1]=q.y,x[p+2]=q.z,z+=1;else if(l instanceof THREE.SpotLight)p=z*3,L.gammaInput?(t[p]=j.r*j.r*s*s,t[p+1]=j.g*j.g*s*s,t[p+2]=j.b*j.b*s*s):(t[p]=j.r*s,t[p+1]=j.g*s,t[p+2]=j.b*s),j=1/q.length(),x[p]=q.x*j,x[p+1]=q.y*j,x[p+2]=q.z*j,z+=1;else if(l instanceof THREE.PointLight)l=y*3,L.gammaInput?(v[l]=j.r*j.r*s*s,v[l+1]=j.g*j.g*s*s,v[l+2]=j.b*j.b*s*s):(v[l]=j.r*s,v[l+1]=j.g*s,v[l+2]=j.b*s),A[l]=q.x,A[l+1]=q.y,A[l+2]=q.z,J[y]=p,y+=1;c=z*3;for(h=t.length;c<
-h;c++)t[c]=0;c=y*3;for(h=v.length;c<h;c++)v[c]=0;r.point.length=y;r.directional.length=z;r.ambient[0]=n;r.ambient[1]=m;r.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,L.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof
-THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=u.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=
-d.specular);else if(d instanceof THREE.MeshLambertMaterial)L.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<L.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=L.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=
-L.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=L.shadowMapDarkness;i.shadowBias.value=L.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(m=f.uniforms[b[i][1]])if(n=b[i][0],o=n.type,h=n.value,o==="i")k.uniform1i(m,h);else if(o==="f")k.uniform1f(m,h);else if(o==="v2")k.uniform2f(m,h.x,h.y);else if(o==="v3")k.uniform3f(m,h.x,h.y,h.z);else if(o==="v4")k.uniform4f(m,h.x,h.y,h.z,h.w);else if(o==="c")k.uniform3f(m,h.r,h.g,h.b);else if(o==="fv1")k.uniform1fv(m,h);else if(o==="fv")k.uniform3fv(m,
-h);else if(o==="v3v"){if(!n._array)n._array=new Float32Array(3*h.length);o=0;for(q=h.length;o<q;o++)r=o*3,n._array[r]=h[o].x,n._array[r+1]=h[o].y,n._array[r+2]=h[o].z;k.uniform3fv(m,n._array)}else if(o==="m4"){if(!n._array)n._array=new Float32Array(16);h.flattenToArray(n._array);k.uniformMatrix4fv(m,!1,n._array)}else if(o==="m4v"){if(!n._array)n._array=new Float32Array(16*h.length);o=0;for(q=h.length;o<q;o++)h[o].flattenToArrayOffset(n._array,o*16);k.uniformMatrix4fv(m,!1,n._array)}else if(o==="t"){if(k.uniform1i(m,
-h),m=n.texture)if(m.image instanceof Array&&m.image.length===6){if(n=m,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(m=0;m<6;m++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[m]);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 m instanceof THREE.WebGLRenderTargetCube?(n=m,k.activeTexture(k.TEXTURE0+h),k.bindTexture(k.TEXTURE_CUBE_MAP,n.__webglTexture)):L.setTexture(m,h)}else if(o==="tv"){if(!n._array){n._array=[];o=0;for(q=n.texture.length;o<q;o++)n._array[o]=h+o}k.uniform1iv(m,n._array);o=0;for(q=n.texture.length;o<q;o++)(m=n.texture[o])&&L.setTexture(m,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 p(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function r(a){V!==a&&(k.depthMask(a),V=a)}function t(a,b,c){T!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):
-k.disable(k.POLYGON_OFFSET_FILL),T=a);if(a&&(ba!==b||$!==c))k.polygonOffset(b,c),ba=b,$=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,G(b.wrapS)),k.texParameteri(a,
-k.TEXTURE_WRAP_T,G(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,G(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,G(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,y(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,y(b.minFilter)),!1)}function I(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 y(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}
-function G(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||{},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,J=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,z=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ca=a.clearAlpha!==void 0?a.clearAlpha:0,Z=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 L=this,k,X=[],K=null,M=null,C=-1,O=null,ea=0,Y=null,fa=null,W=null,R=null,V=null,T=null,ba=null,$=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:[]}};k=function(){var a;try{if(!(a=u.getContext("experimental-webgl",{antialias:A,stencil:x,preserveDrawingBuffer:J})))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(z.r,z.g,z.b,ca);this.context=k;var Aa=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0;this.getContext=function(){return k};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;k.viewport(da,oa,sa,ja)};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){z.setHex(a);ca=b;k.clearColor(z.r,z.g,z.b,ca)};this.setClearColor=
-function(a,b){z.copy(a);ca=b;k.clearColor(z.r,z.g,z.b,ca)};this.getClearColor=function(){return z};this.getClearAlpha=function(){return ca};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);L.info.memory.geometries--}else if(a instanceof
-THREE.Ribbon)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,
-k.deleteTexture(a.__webglTexture),L.info.memory.textures--};this.updateShadowMap=function(a,b){K=null;C=O=V=R=W=-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,l,j,n,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],j=c[m+5],h=c[m+6],l=c[m+7],n=c[m+8],d=(d+g+h)/3,e=(e+i+l)/3,f=(f+j+n)/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}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=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&&(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=[],j=-1,
-n=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]>j&&(n=m,j=h[n]);k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]);k.vertexAttribPointer(c["morphTarget"+g],3,k.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=j;i[n]=1;j=-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!==qa&&(k.lineWidth(d),qa=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)),L.info.render.calls++,L.info.render.vertices+=e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,d=d.linewidth,d!==
-qa&&(k.lineWidth(d),qa=d),k.drawArrays(f,0,e.__webglLineCount),L.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),L.info.render.calls++):f instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,g,j,l=a.lights,n=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++)K=null,C=O=V=R=W=-1,this.renderPluginsPre[e].render(a,b,sa,ja),K=null,C=O=V=R=W=-1}L.info.render.calls=0;L.info.render.vertices=0;L.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],j=g.object,g.render=!1,j.visible&&(!(j instanceof THREE.Mesh)||!j.frustumCulled||la.contains(j))){j.matrixWorld.flattenToArray(j._objectMatrixArray);p(j,b);var o=g,q=o.object,
-s=o.buffer,x=void 0,x=x=void 0,x=q.material;if(x instanceof THREE.MeshFaceMaterial){if(x=s.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)j.renderDepth?g.z=j.renderDepth:(va.copy(j.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],j=g.object,j.visible)j.matrixAutoUpdate&&j.matrixWorld.flattenToArray(j._objectMatrixArray),p(j,b),j=g.object.material,j.transparent?(g.transparent=j,g.opaque=null):(g.opaque=j,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),r(a.overrideMaterial.depthWrite),t(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,l,n,!0,a.overrideMaterial),
-m(a.__webglObjectsImmediate,"",b,l,n,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,l,n,!1),m(a.__webglObjectsImmediate,"opaque",b,l,n,!1),i(a.__webglObjects,!1,"transparent",b,l,n,!0),m(a.__webglObjectsImmediate,"transparent",b,l,n,!0));if(this.renderPluginsPost.length){e=0;for(f=this.renderPluginsPost.length;e<f;e++)this.renderPluginsPost[e].render(a,b,sa,ja),K=null,C=O=V=R=W=-1}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.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,r=void 0,t=void 0,x=void 0,v=void 0,A=void 0,J=void 0,D=void 0,z={},B=p.morphTargets.length;p.geometryGroups={};r=0;for(t=p.faces.length;r<t;r++)x=p.faces[r],v=x.materialIndex,
-J=v!==void 0?v:-1,z[J]===void 0&&(z[J]={hash:J,counter:0}),D=z[J].hash+"_"+z[J].counter,p.geometryGroups[D]===void 0&&(p.geometryGroups[D]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:B}),A=x instanceof THREE.Face3?3:4,p.geometryGroups[D].vertices+A>65535&&(z[J].counter+=1,D=z[J].hash+"_"+z[J].counter,p.geometryGroups[D]===void 0&&(p.geometryGroups[D]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:B})),x instanceof THREE.Face3?p.geometryGroups[D].faces3.push(r):
-p.geometryGroups[D].faces4.push(r),p.geometryGroups[D].vertices+=A;p.geometryGroupsList=[];r=void 0;for(r in p.geometryGroups)p.geometryGroups[r].id=ea++,p.geometryGroupsList.push(p.geometryGroups[r])}for(l in m.geometryGroups)if(p=m.geometryGroups[l],!p.__webglVertexBuffer){r=p;r.__webglVertexBuffer=k.createBuffer();r.__webglNormalBuffer=k.createBuffer();r.__webglTangentBuffer=k.createBuffer();r.__webglColorBuffer=k.createBuffer();r.__webglUVBuffer=k.createBuffer();r.__webglUV2Buffer=k.createBuffer();
-r.__webglSkinVertexABuffer=k.createBuffer();r.__webglSkinVertexBBuffer=k.createBuffer();r.__webglSkinIndicesBuffer=k.createBuffer();r.__webglSkinWeightsBuffer=k.createBuffer();r.__webglFaceBuffer=k.createBuffer();r.__webglLineBuffer=k.createBuffer();if(r.numMorphTargets){x=t=void 0;r.__webglMorphTargetsBuffers=[];t=0;for(x=r.numMorphTargets;t<x;t++)r.__webglMorphTargetsBuffers.push(k.createBuffer())}L.info.memory.geometries++;v=h;A=v.geometry;t=p.faces3;J=p.faces4;r=t.length*3+J.length*4;x=t.length*
-1+J.length*2;J=t.length*3+J.length*4;t=c(v,p);D=g(t);z=d(t);B=e(t);p.__vertexArray=new Float32Array(r*3);if(z)p.__normalArray=new Float32Array(r*3);if(A.hasTangents)p.__tangentArray=new Float32Array(r*4);if(B)p.__colorArray=new Float32Array(r*3);if(D){if(A.faceUvs.length>0||A.faceVertexUvs.length>0)p.__uvArray=new Float32Array(r*2);if(A.faceUvs.length>1||A.faceVertexUvs.length>1)p.__uv2Array=new Float32Array(r*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)p.__skinVertexAArray=
-new Float32Array(r*4),p.__skinVertexBArray=new Float32Array(r*4),p.__skinIndexArray=new Float32Array(r*4),p.__skinWeightArray=new Float32Array(r*4);p.__faceArray=new Uint16Array(x*3);p.__lineArray=new Uint16Array(J*2);if(p.numMorphTargets){p.__morphTargetsArrays=[];v=0;for(A=p.numMorphTargets;v<A;v++)p.__morphTargetsArrays.push(new Float32Array(r*3))}p.__webglFaceCount=x*3;p.__webglLineCount=J*2;if(t.attributes){if(p.__webglCustomAttributesList===void 0)p.__webglCustomAttributesList=[];x=void 0;for(x in t.attributes){var v=
-t.attributes[x],A={},y;for(y in v)A[y]=v[y];if(!A.__webglInitialized||A.createUniqueBuffers)A.__webglInitialized=!0,J=1,A.type==="v2"?J=2:A.type==="v3"?J=3:A.type==="v4"?J=4:A.type==="c"&&(J=3),A.size=J,A.array=new Float32Array(r*J),A.buffer=k.createBuffer(),A.buffer.belongsToAttribute=x,v.needsUpdate=!0,A.__original=v;p.__webglCustomAttributesList.push(A)}}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=k.createBuffer(),p.__webglColorBuffer=k.createBuffer(),L.info.memory.geometries++,p=m,r=p.vertices.length,p.__vertexArray=new Float32Array(r*3),p.__colorArray=new Float32Array(r*3),p.__webglVertexCount=r,m.__dirtyVertices=!0,m.__dirtyColors=!0}else if(h instanceof THREE.Line){if(m=h.geometry,!m.__webglVertexBuffer)p=m,p.__webglVertexBuffer=k.createBuffer(),p.__webglColorBuffer=
-k.createBuffer(),L.info.memory.geometries++,p=m,r=h,t=p.vertices.length,p.__vertexArray=new Float32Array(t*3),p.__colorArray=new Float32Array(t*3),p.__webglLineCount=t,b(p,r),m.__dirtyVertices=!0,m.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(m=h.geometry,!m.__webglVertexBuffer))p=m,p.__webglVertexBuffer=k.createBuffer(),p.__webglColorBuffer=k.createBuffer(),L.info.geometries++,p=m,r=h,t=p.vertices.length,p.__vertexArray=new Float32Array(t*3),p.__colorArray=new Float32Array(t*3),p.__sortArray=
-[],p.__webglParticleCount=t,b(p,r),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],j(i.__webglObjects,p,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(m=h.geometry,j(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?s(i.__webglSprites,h):h instanceof THREE.LensFlare?s(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(y=a.__webglObjects[h].object,l=y.geometry,m=x=t=void 0,y instanceof THREE.Mesh){p=0;for(r=l.geometryGroupsList.length;p<r;p++)if(t=l.geometryGroupsList[p],m=c(y,t),x=m.attributes&&o(m),l.__dirtyVertices||l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||x){var C=y,x=k.DYNAMIC_DRAW,v=!l.dynamic,D=m;if(t.__inittedArrays){var A=d(D),J=e(D),M=g(D),
-I=A===THREE.SmoothShading,O=z=D=void 0,H=void 0,F=void 0,G=void 0,u=void 0,K=void 0,ca=void 0,Z=O=void 0,N=void 0,Q=void 0,P=void 0,R=H=void 0,W=void 0,V=void 0,X=H=ca=void 0,T=void 0,Y=P=Q=N=u=void 0,U=H=P=Q=N=Y=P=Q=N=Y=P=Q=N=void 0,aa=void 0,ba=G=void 0,fa=void 0,$=void 0,qa=void 0,da=void 0,oa=Z=$=aa=0,la=0,ja=U=O=0,ha=u=R=0,E=0,na=void 0,ha=t.__vertexArray,fa=t.__uvArray,E=t.__uv2Array,ba=t.__normalArray,F=t.__tangentArray,W=t.__colorArray,X=t.__skinVertexAArray,T=t.__skinVertexBArray,K=t.__skinIndexArray,
-pa=t.__skinWeightArray,Y=t.__morphTargetsArrays,B=t.__webglCustomAttributesList,w=void 0,w=t.__faceArray,na=t.__lineArray,V=C.geometry,sa=V.__dirtyElements,va=V.__dirtyUvs,G=V.__dirtyNormals,ca=V.__dirtyTangents,ya=V.__dirtyColors,qa=V.__dirtyMorphTargets,da=V.vertices,C=t.faces3,ia=t.faces4,ka=V.faces,xa=V.faceVertexUvs[0],Aa=V.faceVertexUvs[1],Ga=V.skinVerticesA,Ha=V.skinVerticesB,Ia=V.skinIndices,Da=V.skinWeights,Ea=V.morphTargets;if(V.__dirtyVertices){D=0;for(z=C.length;D<z;D++)H=ka[C[D]],N=da[H.a].position,
-Q=da[H.b].position,P=da[H.c].position,ha[$]=N.x,ha[$+1]=N.y,ha[$+2]=N.z,ha[$+3]=Q.x,ha[$+4]=Q.y,ha[$+5]=Q.z,ha[$+6]=P.x,ha[$+7]=P.y,ha[$+8]=P.z,$+=9;D=0;for(z=ia.length;D<z;D++)H=ka[ia[D]],N=da[H.a].position,Q=da[H.b].position,P=da[H.c].position,H=da[H.d].position,ha[$]=N.x,ha[$+1]=N.y,ha[$+2]=N.z,ha[$+3]=Q.x,ha[$+4]=Q.y,ha[$+5]=Q.z,ha[$+6]=P.x,ha[$+7]=P.y,ha[$+8]=P.z,ha[$+9]=H.x,ha[$+10]=H.y,ha[$+11]=H.z,$+=12;k.bindBuffer(k.ARRAY_BUFFER,t.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,ha,x)}if(qa){$=
-0;for(qa=Ea.length;$<qa;$++){D=ha=0;for(z=C.length;D<z;D++)H=ka[C[D]],N=Ea[$].vertices[H.a].position,Q=Ea[$].vertices[H.b].position,P=Ea[$].vertices[H.c].position,da=Y[$],da[ha]=N.x,da[ha+1]=N.y,da[ha+2]=N.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(z=ia.length;D<z;D++)H=ka[ia[D]],N=Ea[$].vertices[H.a].position,Q=Ea[$].vertices[H.b].position,P=Ea[$].vertices[H.c].position,H=Ea[$].vertices[H.d].position,da=Y[$],da[ha]=N.x,da[ha+1]=N.y,da[ha+2]=N.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;k.bindBuffer(k.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[$]);k.bufferData(k.ARRAY_BUFFER,Y[$],x)}}if(Da.length){D=0;for(z=C.length;D<z;D++)H=ka[C[D]],N=Da[H.a],Q=Da[H.b],P=Da[H.c],pa[u]=N.x,pa[u+1]=N.y,pa[u+2]=N.z,pa[u+3]=N.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,N=Ia[H.a],Q=Ia[H.b],P=Ia[H.c],K[u]=N.x,K[u+1]=N.y,K[u+
-2]=N.z,K[u+3]=N.w,K[u+4]=Q.x,K[u+5]=Q.y,K[u+6]=Q.z,K[u+7]=Q.w,K[u+8]=P.x,K[u+9]=P.y,K[u+10]=P.z,K[u+11]=P.w,N=Ga[H.a],Q=Ga[H.b],P=Ga[H.c],X[u]=N.x,X[u+1]=N.y,X[u+2]=N.z,X[u+3]=1,X[u+4]=Q.x,X[u+5]=Q.y,X[u+6]=Q.z,X[u+7]=1,X[u+8]=P.x,X[u+9]=P.y,X[u+10]=P.z,X[u+11]=1,N=Ha[H.a],Q=Ha[H.b],P=Ha[H.c],T[u]=N.x,T[u+1]=N.y,T[u+2]=N.z,T[u+3]=1,T[u+4]=Q.x,T[u+5]=Q.y,T[u+6]=Q.z,T[u+7]=1,T[u+8]=P.x,T[u+9]=P.y,T[u+10]=P.z,T[u+11]=1,u+=12;D=0;for(z=ia.length;D<z;D++)H=ka[ia[D]],N=Da[H.a],Q=Da[H.b],P=Da[H.c],Y=Da[H.d],
-pa[u]=N.x,pa[u+1]=N.y,pa[u+2]=N.z,pa[u+3]=N.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]=Y.x,pa[u+13]=Y.y,pa[u+14]=Y.z,pa[u+15]=Y.w,N=Ia[H.a],Q=Ia[H.b],P=Ia[H.c],Y=Ia[H.d],K[u]=N.x,K[u+1]=N.y,K[u+2]=N.z,K[u+3]=N.w,K[u+4]=Q.x,K[u+5]=Q.y,K[u+6]=Q.z,K[u+7]=Q.w,K[u+8]=P.x,K[u+9]=P.y,K[u+10]=P.z,K[u+11]=P.w,K[u+12]=Y.x,K[u+13]=Y.y,K[u+14]=Y.z,K[u+15]=Y.w,N=Ga[H.a],Q=Ga[H.b],P=Ga[H.c],Y=Ga[H.d],X[u]=N.x,X[u+1]=N.y,X[u+2]=N.z,X[u+3]=1,X[u+4]=
-Q.x,X[u+5]=Q.y,X[u+6]=Q.z,X[u+7]=1,X[u+8]=P.x,X[u+9]=P.y,X[u+10]=P.z,X[u+11]=1,X[u+12]=Y.x,X[u+13]=Y.y,X[u+14]=Y.z,X[u+15]=1,N=Ha[H.a],Q=Ha[H.b],P=Ha[H.c],H=Ha[H.d],T[u]=N.x,T[u+1]=N.y,T[u+2]=N.z,T[u+3]=1,T[u+4]=Q.x,T[u+5]=Q.y,T[u+6]=Q.z,T[u+7]=1,T[u+8]=P.x,T[u+9]=P.y,T[u+10]=P.z,T[u+11]=1,T[u+12]=H.x,T[u+13]=H.y,T[u+14]=H.z,T[u+15]=1,u+=16;u>0&&(k.bindBuffer(k.ARRAY_BUFFER,t.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,X,x),k.bindBuffer(k.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,
-T,x),k.bindBuffer(k.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,K,x),k.bindBuffer(k.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,pa,x))}if(ya&&J){D=0;for(z=C.length;D<z;D++)H=ka[C[D]],u=H.vertexColors,K=H.color,u.length===3&&J===THREE.VertexColors?(H=u[0],X=u[1],T=u[2]):T=X=H=K,W[R]=H.r,W[R+1]=H.g,W[R+2]=H.b,W[R+3]=X.r,W[R+4]=X.g,W[R+5]=X.b,W[R+6]=T.r,W[R+7]=T.g,W[R+8]=T.b,R+=9;D=0;for(z=ia.length;D<z;D++)H=ka[ia[D]],u=H.vertexColors,K=H.color,u.length===
-4&&J===THREE.VertexColors?(H=u[0],X=u[1],T=u[2],u=u[3]):u=T=X=H=K,W[R]=H.r,W[R+1]=H.g,W[R+2]=H.b,W[R+3]=X.r,W[R+4]=X.g,W[R+5]=X.b,W[R+6]=T.r,W[R+7]=T.g,W[R+8]=T.b,W[R+9]=u.r,W[R+10]=u.g,W[R+11]=u.b,R+=12;R>0&&(k.bindBuffer(k.ARRAY_BUFFER,t.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,W,x))}if(ca&&V.hasTangents){D=0;for(z=C.length;D<z;D++)H=ka[C[D]],ca=H.vertexTangents,R=ca[0],W=ca[1],V=ca[2],F[U]=R.x,F[U+1]=R.y,F[U+2]=R.z,F[U+3]=R.w,F[U+4]=W.x,F[U+5]=W.y,F[U+6]=W.z,F[U+7]=W.w,F[U+8]=V.x,F[U+9]=
-V.y,F[U+10]=V.z,F[U+11]=V.w,U+=12;D=0;for(z=ia.length;D<z;D++)H=ka[ia[D]],ca=H.vertexTangents,R=ca[0],W=ca[1],V=ca[2],ca=ca[3],F[U]=R.x,F[U+1]=R.y,F[U+2]=R.z,F[U+3]=R.w,F[U+4]=W.x,F[U+5]=W.y,F[U+6]=W.z,F[U+7]=W.w,F[U+8]=V.x,F[U+9]=V.y,F[U+10]=V.z,F[U+11]=V.w,F[U+12]=ca.x,F[U+13]=ca.y,F[U+14]=ca.z,F[U+15]=ca.w,U+=16;k.bindBuffer(k.ARRAY_BUFFER,t.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,F,x)}if(G&&A){D=0;for(z=C.length;D<z;D++)if(H=ka[C[D]],F=H.vertexNormals,G=H.normal,F.length===3&&I)for(U=
-0;U<3;U++)G=F[U],ba[O]=G.x,ba[O+1]=G.y,ba[O+2]=G.z,O+=3;else for(U=0;U<3;U++)ba[O]=G.x,ba[O+1]=G.y,ba[O+2]=G.z,O+=3;D=0;for(z=ia.length;D<z;D++)if(H=ka[ia[D]],F=H.vertexNormals,G=H.normal,F.length===4&&I)for(U=0;U<4;U++)G=F[U],ba[O]=G.x,ba[O+1]=G.y,ba[O+2]=G.z,O+=3;else for(U=0;U<4;U++)ba[O]=G.x,ba[O+1]=G.y,ba[O+2]=G.z,O+=3;k.bindBuffer(k.ARRAY_BUFFER,t.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,ba,x)}if(va&&xa&&M){D=0;for(z=C.length;D<z;D++)if(O=C[D],O=xa[O],O!==void 0)for(U=0;U<3;U++)ba=O[U],
-fa[Z]=ba.u,fa[Z+1]=ba.v,Z+=2;D=0;for(z=ia.length;D<z;D++)if(O=ia[D],O=xa[O],O!==void 0)for(U=0;U<4;U++)ba=O[U],fa[Z]=ba.u,fa[Z+1]=ba.v,Z+=2;Z>0&&(k.bindBuffer(k.ARRAY_BUFFER,t.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,fa,x))}if(va&&Aa&&M){D=0;for(z=C.length;D<z;D++)if(O=C[D],Z=Aa[O],Z!==void 0)for(U=0;U<3;U++)fa=Z[U],E[oa]=fa.u,E[oa+1]=fa.v,oa+=2;D=0;for(z=ia.length;D<z;D++)if(O=ia[D],Z=Aa[O],Z!==void 0)for(U=0;U<4;U++)fa=Z[U],E[oa]=fa.u,E[oa+1]=fa.v,oa+=2;oa>0&&(k.bindBuffer(k.ARRAY_BUFFER,t.__webglUV2Buffer),
-k.bufferData(k.ARRAY_BUFFER,E,x))}if(sa){D=0;for(z=C.length;D<z;D++)w[la]=aa,w[la+1]=aa+1,w[la+2]=aa+2,la+=3,na[ja]=aa,na[ja+1]=aa+1,na[ja+2]=aa,na[ja+3]=aa+2,na[ja+4]=aa+1,na[ja+5]=aa+2,ja+=6,aa+=3;D=0;for(z=ia.length;D<z;D++)w[la]=aa,w[la+1]=aa+1,w[la+2]=aa+3,w[la+3]=aa+1,w[la+4]=aa+2,w[la+5]=aa+3,la+=6,na[ja]=aa,na[ja+1]=aa+1,na[ja+2]=aa,na[ja+3]=aa+3,na[ja+4]=aa+1,na[ja+5]=aa+2,na[ja+6]=aa+2,na[ja+7]=aa+3,ja+=8,aa+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,
-w,x);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,na,x)}if(B){U=0;for(aa=B.length;U<aa;U++)if(w=B[U],w.__original.needsUpdate){E=0;if(w.size===1)if(w.boundTo===void 0||w.boundTo==="vertices"){D=0;for(z=C.length;D<z;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(z=ia.length;D<z;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(z=C.length;D<z;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(z=ia.length;D<z;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(z=C.length;D<z;D++)H=ka[C[D]],N=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],w.array[E]=N.x,w.array[E+1]=N.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(z=ia.length;D<z;D++)H=ka[ia[D]],N=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],H=w.value[H.d],w.array[E]=N.x,w.array[E+1]=N.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(z=C.length;D<z;D++)P=Q=N=na=w.value[C[D]],w.array[E]=N.x,w.array[E+1]=N.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(z=ia.length;D<z;D++)H=P=Q=N=na=w.value[ia[D]],w.array[E]=N.x,w.array[E+1]=
-N.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(A=w.type==="c"?["r","g","b"]:["x","y","z"],w.boundTo===void 0||w.boundTo==="vertices"){D=0;for(z=C.length;D<z;D++)H=ka[C[D]],N=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],w.array[E]=N[A[0]],w.array[E+1]=N[A[1]],w.array[E+2]=N[A[2]],w.array[E+3]=Q[A[0]],w.array[E+4]=Q[A[1]],w.array[E+5]=Q[A[2]],w.array[E+6]=P[A[0]],w.array[E+7]=P[A[1]],w.array[E+8]=P[A[2]],E+=9;D=0;for(z=
-ia.length;D<z;D++)H=ka[ia[D]],N=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],H=w.value[H.d],w.array[E]=N[A[0]],w.array[E+1]=N[A[1]],w.array[E+2]=N[A[2]],w.array[E+3]=Q[A[0]],w.array[E+4]=Q[A[1]],w.array[E+5]=Q[A[2]],w.array[E+6]=P[A[0]],w.array[E+7]=P[A[1]],w.array[E+8]=P[A[2]],w.array[E+9]=H[A[0]],w.array[E+10]=H[A[1]],w.array[E+11]=H[A[2]],E+=12}else{if(w.boundTo==="faces"){D=0;for(z=C.length;D<z;D++)P=Q=N=na=w.value[C[D]],w.array[E]=N[A[0]],w.array[E+1]=N[A[1]],w.array[E+2]=N[A[2]],w.array[E+3]=
-Q[A[0]],w.array[E+4]=Q[A[1]],w.array[E+5]=Q[A[2]],w.array[E+6]=P[A[0]],w.array[E+7]=P[A[1]],w.array[E+8]=P[A[2]],E+=9;D=0;for(z=ia.length;D<z;D++)H=P=Q=N=na=w.value[ia[D]],w.array[E]=N[A[0]],w.array[E+1]=N[A[1]],w.array[E+2]=N[A[2]],w.array[E+3]=Q[A[0]],w.array[E+4]=Q[A[1]],w.array[E+5]=Q[A[2]],w.array[E+6]=P[A[0]],w.array[E+7]=P[A[1]],w.array[E+8]=P[A[2]],w.array[E+9]=H[A[0]],w.array[E+10]=H[A[1]],w.array[E+11]=H[A[2]],E+=12}}else if(w.size===4)if(w.boundTo===void 0||w.boundTo==="vertices"){D=0;
-for(z=C.length;D<z;D++)H=ka[C[D]],N=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],w.array[E]=N.x,w.array[E+1]=N.y,w.array[E+2]=N.z,w.array[E+3]=N.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(z=ia.length;D<z;D++)H=ka[ia[D]],N=w.value[H.a],Q=w.value[H.b],P=w.value[H.c],H=w.value[H.d],w.array[E]=N.x,w.array[E+1]=N.y,w.array[E+2]=N.z,w.array[E+3]=N.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(z=C.length;D<z;D++)P=Q=N=na=w.value[C[D]],w.array[E]=N.x,w.array[E+1]=N.y,w.array[E+2]=N.z,w.array[E+3]=N.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(z=ia.length;D<z;D++)H=P=Q=N=na=w.value[ia[D]],
-w.array[E]=N.x,w.array[E+1]=N.y,w.array[E+2]=N.z,w.array[E+3]=N.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}k.bindBuffer(k.ARRAY_BUFFER,w.buffer);k.bufferData(k.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&&q(m)}else if(y instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){m=l;y=k.DYNAMIC_DRAW;A=p=A=v=v=void 0;J=m.vertices;r=m.colors;D=J.length;t=r.length;z=m.__vertexArray;x=m.__colorArray;
-B=m.__dirtyColors;if(m.__dirtyVertices){for(v=0;v<D;v++)A=J[v].position,p=v*3,z[p]=A.x,z[p+1]=A.y,z[p+2]=A.z;k.bindBuffer(k.ARRAY_BUFFER,m.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,z,y)}if(B){for(v=0;v<t;v++)A=r[v],p=v*3,x[p]=A.r,x[p+1]=A.g,x[p+2]=A.b;k.bindBuffer(k.ARRAY_BUFFER,m.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,x,y)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(y instanceof THREE.Line){m=c(y,t);x=m.attributes&&o(m);if(l.__dirtyVertices||l.__dirtyColors||x){y=l;p=k.DYNAMIC_DRAW;
-D=r=I=J=M=void 0;J=y.vertices;t=y.colors;D=J.length;x=t.length;z=y.__vertexArray;v=y.__colorArray;B=y.__dirtyColors;A=y.__webglCustomAttributesList;aa=ka=ia=C=I=M=void 0;if(y.__dirtyVertices){for(M=0;M<D;M++)I=J[M].position,r=M*3,z[r]=I.x,z[r+1]=I.y,z[r+2]=I.z;k.bindBuffer(k.ARRAY_BUFFER,y.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,z,p)}if(B){for(J=0;J<x;J++)D=t[J],r=J*3,v[r]=D.r,v[r+1]=D.g,v[r+2]=D.b;k.bindBuffer(k.ARRAY_BUFFER,y.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,v,p)}if(A){M=
-0;for(I=A.length;M<I;M++)if(aa=A[M],aa.needsUpdate&&(aa.boundTo===void 0||aa.boundTo==="vertices")){r=0;ia=aa.value.length;if(aa.size===1)for(C=0;C<ia;C++)aa.array[C]=aa.value[C];else if(aa.size===2)for(C=0;C<ia;C++)ka=aa.value[C],aa.array[r]=ka.x,aa.array[r+1]=ka.y,r+=2;else if(aa.size===3)if(aa.type==="c")for(C=0;C<ia;C++)ka=aa.value[C],aa.array[r]=ka.r,aa.array[r+1]=ka.g,aa.array[r+2]=ka.b,r+=3;else for(C=0;C<ia;C++)ka=aa.value[C],aa.array[r]=ka.x,aa.array[r+1]=ka.y,aa.array[r+2]=ka.z,r+=3;else if(aa.size===
-4)for(C=0;C<ia;C++)ka=aa.value[C],aa.array[r]=ka.x,aa.array[r+1]=ka.y,aa.array[r+2]=ka.z,aa.array[r+3]=ka.w,r+=4;k.bindBuffer(k.ARRAY_BUFFER,aa.buffer);k.bufferData(k.ARRAY_BUFFER,aa.array,p)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;m.attributes&&q(m)}else if(y instanceof THREE.ParticleSystem)m=c(y,t),x=m.attributes&&o(m),(l.__dirtyVertices||l.__dirtyColors||y.sortParticles||x)&&f(l,k.DYNAMIC_DRAW,y),l.__dirtyVertices=!1,l.__dirtyColors=!1,m.attributes&&q(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 l,
-j,n;l=n=i=0;for(j=b.length;l<j;l++)g=b[l],g instanceof THREE.SpotLight&&n++,g instanceof THREE.DirectionalLight&&n++,g instanceof THREE.PointLight&&i++;i+n<=Z?l=n:(l=Math.ceil(Z*n/(i+n)),i=Z-l);g={directional:l,point:i};i=n=0;for(l=b.length;i<l;i++)j=b[i],j instanceof THREE.SpotLight&&j.castShadow&&n++;var m=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)m=d.bones.length;var o;a:{l=a.fragmentShader;j=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:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(l),d.push(j));for(p in c)d.push(p),
-d.push(c[p]);h=d.join();p=0;for(d=X.length;p<d;p++)if(X[p].code===h){o=X[p].program;break a}p=k.createProgram();d=[Aa?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",
-c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-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:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(p,v("fragment",g+l));k.attachShader(p,
-v("vertex",d+j));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++)l=q[d],p.uniforms[l]=k.getUniformLocation(p,
-l);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=X.length;X.push({program:p,code:h});L.info.memory.programs=X.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(Y!==a.doubleSided)a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),Y=a.doubleSided;if(fa!==a.flipSided)a.flipSided?k.frontFace(k.CW):
-k.frontFace(k.CCW),fa=a.flipSided};this.setDepthTest=function(a){R!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),R=a)};this.setBlending=function(a){if(a!==W){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)}W=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=k.createTexture(),L.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,G(a.format),a.image.width,a.image.height,0,G(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,G(a.format),a.width,a.height,0,G(a.format),G(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);I(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,G(a.format),a.width,a.height,0,G(a.format),G(a.type),null),c=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer),k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,c,a.__webglTexture,0),I(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=sa,a=ja,d=da,e=oa);b!==M&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),M=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,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)};
 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.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};
@@ -341,19 +340,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,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.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,j=a.faceVertexUvs[0],o=g.faceVertexUvs[0],q={},n=0;n<a.materials.length;n++)q[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,s=h.length;n<s;n++){var l=new THREE.Vertex(h[n].position.clone());c&&c.multiplyVector3(l.position);f.push(l)}n=
-0;for(s=m.length;n<s;n++){var f=m[n],p,r,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++)r=t[h].clone(),d&&d.multiplyVector3(r),p.vertexNormals.push(r);p.color.copy(f.color);h=0;for(l=v.length;h<l;h++)r=v[h],p.vertexColors.push(r.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
-l=q[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(s=o.length;n<s;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));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,m,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++)m=j[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,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<
 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+
-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=[],j,o,q,n;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,o=f[d.b].position,q=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,o,q);else if(d instanceof
-THREE.Face4)j=f[d.a].position,o=f[d.b].position,q=f[d.c].position,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,o,n),d._area2=THREE.GeometryUtils.triangleArea(o,q,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 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();
 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]+
-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,j=0;j<d;j++)for(var o=1;o<e;o++){var q=o-1<0?e-1:o-1,n=(o+1)%e,s=j-1<0?d-1:j-1,l=(j+1)%d,p=[],r=[0,0,h[(o*d+j)*4]/255*b];p.push([-1,0,h[(o*d+s)*4]/255*b]);p.push([-1,-1,h[(q*d+s)*4]/255*b]);p.push([0,-1,h[(q*d+j)*4]/255*b]);p.push([1,-1,h[(q*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+j)*4]/255*b]);p.push([-1,1,h[(n*d+s)*4]/255*b]);q=[];s=p.length;for(n=0;n<s;n++){var l=p[n],t=p[(n+1)%s],l=[l[0]-r[0],l[1]-r[1],l[2]-r[2]],t=[t[0]-r[0],t[1]-r[1],t[2]-r[2]];q.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<q.length;n++)p[0]+=q[n][0],p[1]+=q[n][1],p[2]+=q[n][2];p[0]/=q.length;p[1]/=q.length;p[2]/=q.length;r=(o*d+j)*4;m[r]=(p[0]+1)/2*255|0;m[r+1]=(p[1]+0.5)*
-255|0;m[r+2]=p[2]*255|0;m[r+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),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}};
 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=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,
@@ -398,36 +397,36 @@ 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.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.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,m,j,o,q,n,s,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];q=g[1];c.length>0?(f=c[c.length-1],n=f.x,s=f.y):(f=this.actions[d-1].args,n=f[f.length-2],s=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,s,q,
-i),c.push(new THREE.Vector2(g,l));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];o=g[0];q=g[1];m=g[2];j=g[3];c.length>0?(f=c[c.length-1],n=f.x,s=f.y):(f=this.actions[d-1].args,n=f[f.length-2],s=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,s,q,j,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];q=!!g[5];j=f[f.length-2];n=f[f.length-1];f.length==0&&(j=n=0);s=l-o;var p=a*2;for(f=1;f<=p;f++)l=f/p,q||(l=1-l),l=o+l*s,g=j+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,j,o;h=0;for(i=f.length;h<i;h++)m=f[h],j=m.x,o=m.y,m.x=a*j+b*o+c,m.y=d*o+e*j+g;return f};
+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.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()};
 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)};
 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.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,m,j,o,q,n,s=[];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++){q=m[e];n=[];for(o=0;o<c.length;o++)j=c[o],j=q.distanceToSquared(j),n.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: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]];q=THREE.FontUtils.Triangulate.area(p);n=h;j=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+q>l+p&&(h=n,f=j,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);q=c.slice(h);n=m.slice(f);j=m.slice(0,f);g=[m[f],m[g],c[h]];s.push([m[f],c[h],c[e]]);s.push(g);c=o.concat(n).concat(j).concat(q)}return{shape:c,
-isolatedPts:s,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,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)},
 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};
 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<
-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 j=
-{};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){j[m]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(j[m]=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*
+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*
 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};
 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.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,m,j=this.data.JIT.hierarchy,o,q;this.currentTime+=a*this.timeScale;q=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,s=this.hierarchy.length;n<s;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&j[n][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[n][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=j[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<=q){if(o<q)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<
+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&&j[0][m]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)j[n][m]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+"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.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]};
@@ -450,7 +449,7 @@ 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=
 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)};
-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,r=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++)r=d*h.chunks[f]/h.total,b.keys[f]={time:r,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(),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]=
 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=
 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;
@@ -468,42 +467,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.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()};
-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,j=0,o=0,q=0,n=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*o);this.rotateVertically(b*q)}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*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,
+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,
 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*
 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;q=(a.clientY-s)/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: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: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:j=0;break;case 70:j=0}},!1)};
+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)};
 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,j=new THREE.Vector2,o=new THREE.Vector2,q=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,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-
 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+(j.y-m.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?m=j:m.y+=(j.y-m.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=q.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=q:o.addSelf(a.sub(q,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=j=c.getMouseOnScreen(a.clientX,a.clientY),o=q=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&&(q=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=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=q=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
+-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));
+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",
 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,l){var n,o=d||1,p=e||1,q=h/2,r=i/2,k=m.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 s=o+1,t=p+1,v=h/o,C=i/p,O=new THREE.Vector3;O[n]=j>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[n]=j;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+k,i+s*(h+1)+k,i+1+s*(h+1)+k,i+1+s*h+k),a.normal.copy(O),a.vertexNormals.push(O.clone(),O.clone(),O.clone(),O.clone()),a.materialIndex=l,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,j=a/2,o=b/2,q=c/2,n,s,l,p,r,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;s=2;r=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,j,n);this.sides.nx&&i("z","y",1,-1,c,b,-j,p);this.sides.py&&i("x","z",1,1,a,c,o,s);this.sides.ny&&i("x","z",1,-1,a,c,-o,r);this.sides.pz&&i("x","y",1,-1,a,b,q,l);this.sides.nz&&i("x","y",-1,-1,a,b,-q,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,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.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=[],j=[];for(i=0;i<=e;i++){var o=[],q=[],n=i/e,s=n*(b-a)+a;for(h=0;h<=d;h++){var l=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(l*Math.PI*2),-n*c+f,s*Math.cos(l*Math.PI*2))));o.push(this.vertices.length-1);q.push(new THREE.UV(l,n))}m.push(o);j.push(q)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=m[i][h],o=m[i+1][h],q=m[i+1][h+1],n=m[i][h+1],s=
-this.vertices[c].position.clone().setY(0).normalize(),l=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[q].position.clone().setY(0).normalize(),r=this.vertices[n].position.clone().setY(0).normalize(),t=j[i][h].clone(),v=j[i+1][h].clone(),B=j[i+1][h+1].clone(),I=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,q,n,[s,l,p,r]));this.faceVertexUvs[0].push([t,v,B,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],q=this.vertices.length-1,s=new THREE.Vector3(0,1,0),l=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),t=j[0][h].clone(),v=j[0][h+1].clone(),B=new THREE.UV(v.u,0),this.faces.push(new THREE.Face3(c,o,q,[s,l,p])),this.faceVertexUvs[0].push([t,v,B])}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],q=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),l=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),t=j[i][h+1].clone(),v=j[i][h].clone(),
-B=new THREE.UV(v.u,1),this.faces.push(new THREE.Face3(c,o,q,[s,l,p])),this.faceVertexUvs[0].push([t,v,B])}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,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.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();
-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;Y=x-1;Y<0&&(Y=a.length-1);for(var b=
-0,c=n+j*2,b=0;b<c;b++){var d=k*b,e=k*(b+1),f=fa+ea+d,g=fa+ea+e,l=f,d=fa+Y+d,e=fa+Y+e,m=g;l+=A;d+=A;e+=A;m+=A;F.faces.push(new THREE.Face4(l,d,e,m,null,null,B));B&&(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,j=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,
-q=b.curveSegments!==void 0?b.curveSegments:12,n=b.steps!==void 0?b.steps:1,s=b.bendPath,l=b.extrudePath,p,r=!1,t=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,v=b.material,B=b.extrudeMaterial,I=this.shapebb;if(l)p=l.getPoints(q),n=p.length,r=!0,o=!1;o||(m=i=j=0);var y,G,u,F=this,A=this.vertices.length;s&&a.addWrapPath(s);q=t?a.extractAllSpacedPoints(q):a.extractAllPoints(q);s=q.shape;q=q.holes;if(l=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();G=0;for(u=q.length;G<u;G++)y=q[G],THREE.Shape.Utils.isClockWise(y)&&
-(q[G]=y.reverse());l=!1}l=THREE.Shape.Utils.triangulateShape(s,q);t=s;G=0;for(u=q.length;G<u;G++)y=q[G],s=s.concat(y);var x,J,z,ca,Z,L,k=s.length,X=l.length,K=[];x=0;J=t.length;ea=J-1;for(Y=x+1;x<J;x++,ea++,Y++)ea===J&&(ea=0),Y===J&&(Y=0),K[x]=d(t[x],t[ea],t[Y]);var M=[],C,O=K.concat();G=0;for(u=q.length;G<u;G++){y=q[G];C=[];x=0;J=y.length;ea=J-1;for(Y=x+1;x<J;x++,ea++,Y++)ea===J&&(ea=0),Y===J&&(Y=0),C[x]=d(y[x],y[ea],y[Y]);M.push(C);O=O.concat(C)}for(z=0;z<j;z++){ca=z/j;Z=i*(1-ca);ca=m*Math.sin(ca*
-Math.PI/2);x=0;for(J=t.length;x<J;x++)L=c(t[x],K[x],ca),g(L.x,L.y,-Z);G=0;for(u=q.length;G<u;G++){y=q[G];C=M[G];x=0;for(J=y.length;x<J;x++)L=c(y[x],C[x],ca),g(L.x,L.y,-Z)}}ca=m;for(x=0;x<k;x++)L=o?c(s[x],O[x],ca):s[x],r?g(L.x,L.y+p[0].y,p[0].x):g(L.x,L.y,0);for(z=1;z<=n;z++)for(x=0;x<k;x++)L=o?c(s[x],O[x],ca):s[x],r?g(L.x,L.y+p[z-1].y,p[z-1].x):g(L.x,L.y,h/n*z);for(z=j-1;z>=0;z--){ca=z/j;Z=i*(1-ca);ca=m*Math.sin(ca*Math.PI/2);x=0;for(J=t.length;x<J;x++)L=c(t[x],K[x],ca),g(L.x,L.y,h+Z);G=0;for(u=q.length;G<
-u;G++){y=q[G];C=M[G];x=0;for(J=y.length;x<J;x++)L=c(y[x],C[x],ca),r?g(L.x,L.y+p[n-1].y,p[n-1].x+Z):g(L.x,L.y,h+Z)}}if(o){o=k*0;for(x=0;x<X;x++)m=l[x],f(m[2]+o,m[1]+o,m[0]+o);o=k*(n+j*2);for(x=0;x<X;x++)m=l[x],f(m[0]+o,m[1]+o,m[2]+o)}else{for(x=0;x<X;x++)m=l[x],f(m[2],m[1],m[0]);for(x=0;x<X;x++)m=l[x],f(m[0]+k*n,m[1]+k*n,m[2]+k*n)}var ea,Y,fa=0;e(t);fa+=t.length;G=0;for(u=q.length;G<u;G++)y=q[G],e(y),fa+=y.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function 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;
 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-
 (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),j=d(g.faces[h].c,g.faces[h].a);c(g.faces[h].a,i,j,a);c(g.faces[h].b,m,i,a);c(g.faces[h].c,j,m,a);c(i,m,j,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),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=
 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);
 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;
@@ -511,34 +510,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===
 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;
-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,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*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(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,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/
 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=[],j=[];for(i=0;i<=c;i++){var o=[],q=[];for(h=0;h<=b;h++){var n=h/b,s=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+n*e)*Math.sin(g+s*f),a*Math.cos(g+s*f),a*Math.sin(d+n*e)*Math.sin(g+s*f))));o.push(this.vertices.length-1);q.push(new THREE.UV(n,s))}m.push(o);
-j.push(q)}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(),q=this.vertices[e].position.clone().normalize(),n=this.vertices[g].position.clone().normalize(),s=this.vertices[f].position.clone().normalize(),l=j[i][h+1].clone(),p=j[i][h].clone(),r=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,n,s])),this.faceVertexUvs[0].push([l,r,t])):Math.abs(this.vertices[g].position.y)==
-a?(this.faces.push(new THREE.Face3(d,e,g,[o,q,n])),this.faceVertexUvs[0].push([l,p,r])):(this.faces.push(new THREE.Face4(d,e,g,f,[o,q,n,s])),this.faceVertexUvs[0].push([l,p,r,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,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.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.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,j,o,q,n,s,l,p,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));m=b.length;for(a=0;a<m;)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;n=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(n,s,i,j);if(f=g[g.length-1]){o=f.x;q=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,q,s,j);g.push(new THREE.Vector2(v,t))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,n=b[a++]*c+d,s=b[a++]*-c,l=b[a++]*c+d,p=b[a++]*-c,e.bezierCurveTo(i,j,n,s,l,p),f=g[g.length-1]){o=f.x;q=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,q,s,p,j),g.push(new THREE.Vector2(v,t))}}}return{offset:r.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,j;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);j=m+1;e<=j&&(j=0);var q;a:{q=a;var n=i,s=m,l=j,p=e,r=f,t=void 0,v=void 0,B=void 0,
-I=void 0,y=void 0,G=void 0,u=void 0,F=void 0,A=void 0,v=q[r[n]].x,B=q[r[n]].y,I=q[r[s]].x,y=q[r[s]].y,G=q[r[l]].x,u=q[r[l]].y;if(1.0E-10>(I-v)*(u-B)-(y-B)*(G-v))q=!1;else{for(t=0;t<p;t++)if(!(t==n||t==s||t==l)){var F=q[r[t]].x,A=q[r[t]].y,x=void 0,J=void 0,z=void 0,ca=void 0,Z=void 0,L=void 0,k=void 0,X=void 0,K=void 0,M=void 0,C=void 0,O=void 0,x=z=Z=void 0,x=G-I,J=u-y,z=v-G,ca=B-u,Z=I-v,L=y-B,k=F-v,X=A-B,K=F-I,M=A-y,C=F-G,O=A-u,x=x*M-J*K,Z=Z*X-L*k,z=z*O-ca*C;if(x>=0&&z>=0&&Z>=0){q=!1;break a}}q=
-!0}}if(q){g.push([a[f[i]],a[f[m]],a[f[j]]]);h.push([f[i],f[m],f[j]]);i=m;for(j=m+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};
+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};
 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.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<
 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),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,m,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),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();
 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 j,n,m,o=0;o<4;o++){m=i[o];j=new THREE.Color;j.setRGB(0,0,0);for(var p=0;p<m.length;p++)n=h.vertexColors[m[p]-1],j.r+=n.r,j.g+=n.g,j.b+=n.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;l.vertexColors[o]=j}}e.push(l);(!f.supportUVs||q.length!=0)&&g.push([q[a],q[b],q[c],q[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=[],j={},o={},q=[],n,s,l,p,r,t=a.faceVertexUvs[0];n=0;for(s=t.length;n<s;n++){l=0;for(p=t[n].length;l<p;l++)r=d[n]["abcd".charAt(l)],q[r]||(q[r]=t[n][l])}var v;n=0;for(s=d.length;n<s;n++)if(r=d[n],m.push(r.centroid),i.push(new THREE.Vertex(r.centroid)),f.supportUVs&&q.length!=0){v=new THREE.UV;if(r instanceof THREE.Face3)v.u=q[r.a].u+q[r.b].u+q[r.c].u,v.v=q[r.a].v+q[r.b].v+q[r.c].v,v.u/=3,v.v/=3;else if(r instanceof THREE.Face4)v.u=
-q[r.a].u+q[r.b].u+q[r.c].u+q[r.d].u,v.v=q[r.a].v+q[r.b].v+q[r.c].v+q[r.d].v,v.u/=4,v.v/=4;q.push(v)}s=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 B=0,t=h.length,I,y,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 s){v=s[n];I=n.split("_");y=I[0];I=I[1];F(y,[y,I]);F(I,[y,I]);l=0;for(p=v.length;l<p;l++)r=v[l],A(y,r,n),A(I,r,n);v.length<2&&(o[n]=!0)}for(n in s)if(v=s[n],r=v[0],v=v[1],I=n.split("_"),y=I[0],I=I[1],p=new THREE.Vector3,o[n]?(p.addSelf(h[y].position),p.addSelf(h[I].position),p.multiplyScalar(0.5)):(p.addSelf(m[r]),p.addSelf(m[v]),p.addSelf(h[y].position),p.addSelf(h[I].position),p.multiplyScalar(0.25)),
-j[n]=t+d.length+B,i.push(new THREE.Vertex(p)),B++,f.supportUVs&&q.length!=0)v=new THREE.UV,v.u=q[y].u+q[I].u,v.v=q[y].v+q[I].v,v.u/=2,v.v/=2,q.push(v);var x,J;I=["123","12","2","23"];p=["123","23","3","31"];var F=["123","31","1","12"],A=["1234","12","2","23"],z=["1234","23","3","34"],ca=["1234","34","4","41"],Z=["1234","41","1","12"];n=0;for(s=m.length;n<s;n++)r=d[n],v=t+n,r instanceof THREE.Face3?(B=c(r.a,r.b),y=c(r.b,r.c),x=c(r.c,r.a),b(v,j[B],r.b,j[y],r,I),b(v,j[y],r.c,j[x],r,p),b(v,j[x],r.a,j[B],
-r,F)):r instanceof THREE.Face4?(B=c(r.a,r.b),y=c(r.b,r.c),x=c(r.c,r.d),J=c(r.d,r.a),b(v,j[B],r.b,j[y],r,A),b(v,j[y],r.c,j[x],r,z),b(v,j[x],r.d,j[J],r,ca),b(v,j[J],r.a,j[B],r,Z)):console.log("face should be a face!",r);d=i;i=new THREE.Vector3;j=new THREE.Vector3;n=0;for(s=h.length;n<s;n++)if(G[n]!==void 0){i.set(0,0,0);j.set(0,0,0);r=new THREE.Vector3(0,0,0);v=0;for(l in u[n])i.addSelf(m[l]),v++;B=0;t=G[n].length;for(l=0;l<t;l++)o[c(G[n][l][0],G[n][l][1])]&&B++;if(B!=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),j.addSelf(v);j.divideScalar(t);r.addSelf(h[n].position);r.multiplyScalar(t-3);r.addSelf(i);r.addSelf(j.multiplyScalar(2));r.divideScalar(t);d[n].position=r}}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 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.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/
 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)==
@@ -546,124 +545,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(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);
-a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var m=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(m.uniforms),o=f.color;h=f.specular;i=f.ambient;var q=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=q;if(f.opacity)j.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.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;
+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;
 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+"] ["+
 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);
 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,j,m,n=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=n[d*3];f=n[d*3+1];g=n[d*3+2];h=v[e*2];e=v[e*2+1];i=v[f*2];j=v[f*2+1];f=v[g*2];m=v[g*2+1];g=l.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,j));o.push(new THREE.UV(f,m));g.push(o)}}
-function j(b,c){var d,e,f,g,h,i,j,m,n,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];j=v[f*2];n=v[f*2+1];m=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(j,n));q.push(new THREE.UV(m,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 q(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],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,j,m,n,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];j=d[e*3];m=d[e*3+1];n=d[e*3+2];i=o[e];var p=t[m*3],q=t[m*3+1];m=t[m*3+2];var r=t[n*3],s=t[n*3+1];n=t[n*3+2];l.faces.push(new THREE.Face3(f,
-g,h,[new THREE.Vector3(t[j*3],t[j*3+1],t[j*3+2]),new THREE.Vector3(p,q,m),new THREE.Vector3(r,s,n)],null,i))}}function s(b,c,d,e){for(var f,g,h,i,j,m,n,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];m=d[e*4];n=d[e*4+1];o=d[e*4+2];p=d[e*4+3];j=q[e];var r=t[n*3],s=t[n*3+1];n=t[n*3+2];var u=t[o*3],v=t[o*3+1];o=t[o*3+2];var y=t[p*3],B=t[p*3+1];p=t[p*3+2];l.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(t[m*
-3],t[m*3+1],t[m*3+2]),new THREE.Vector3(r,s,n),new THREE.Vector3(u,v,o),new THREE.Vector3(y,B,p)],null,j))}}var l=this,p=0,r,t=[],v=[],B,I,y,G,u,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(l,d,b);r={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)};r.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=r.header_bytes;b=r.vertex_index_bytes*3+r.material_index_bytes;F=r.vertex_index_bytes*
-4+r.material_index_bytes;B=r.ntri_flat*b;I=r.ntri_smooth*(b+r.normal_index_bytes*3);y=r.ntri_flat_uv*(b+r.uv_index_bytes*3);G=r.ntri_smooth_uv*(b+r.normal_index_bytes*3+r.uv_index_bytes*3);u=r.nquad_flat*F;b=r.nquad_smooth*(F+r.normal_index_bytes*4);F=r.nquad_flat_uv*(F+r.uv_index_bytes*4);p+=function(b){var c=r.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=r.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(r.nnormals*3);p+=function(b){var c=r.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);B=p+B+c(r.ntri_flat*2);I=B+I+c(r.ntri_smooth*2);y=I+y+c(r.ntri_flat_uv*2);G=y+G+c(r.ntri_smooth_uv*2);u=G+u+c(r.nquad_flat*2);
-b=u+b+c(r.nquad_smooth*2);F=b+F+c(r.nquad_flat_uv*2);(function(a){var b=r.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=r.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)}})(y);(function(a){var b=r.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
-c)}})(b);(function(a){var b=r.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(F);(function(a){var b=r.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=r.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(B);(function(a){var b=r.nquad_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(G);(function(a){var b=
-r.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(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){W=a;d=d||T;e!==void 0&&(a=e.split("/"),a.pop(),ya=a.length<1?"":a.join("/")+"/");$=b("//dae:library_images/dae:image",f,"image");sa=b("//dae:library_materials/dae:material",u,"material");ja=b("//dae:library_effects/dae:effect",z,"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",Z,"animation");la=b(".//dae:library_visual_scenes/dae:visual_scene",
-j,"visual_scene");va=[];xa=[];(a=W.evaluate(".//dae:scene/dae:instance_visual_scene",W,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),V=la[a]):V=null;R=new THREE.Object3D;for(a=0;a<V.nodes.length;a++)R.add(g(V.nodes[a]));c();for(var i in qa);i={scene:R,morphs:va,skins:xa,dae:{images:$,materials:sa,effects:ja,geometries:oa,controllers:da,animations:qa,visualScenes:la,scene:V}};d&&d(i);return i}function b(a,b,c){for(var a=W.evaluate(a,W,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+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=V.getChildById(b.skeleton[0],!0)||V.getChildBySid(b.skeleton[0],!0),h,i,j,l,k=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(l=0;l<h.length;l++)if(j=h[l],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],l=j.index,j=j.weight,m=a.vertices[l],l=o[l],k.x=m.position.x,k.y=m.position.y,k.z=m.position.z,n[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=
+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 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 q(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function l(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function r(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 B(){this.source="";this.stride=this.count=0;this.params=[]}function I(){this.input={}}function y(){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 J(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function z(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function ca(){this.url=""}function Z(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function L(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 X(a){var b=a.getAttribute("id");
-if(ba[b]!=void 0)return ba[b];ba[b]=(new G(b)).parse(a);return ba[b]}function K(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function M(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 Y(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+=Y(a.x,b)+",";c+=Y(a.y,b)+",";c+=Y(a.z,b);return c}var W=null,R=null,V,T=null,ba={},$={},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=
+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 y).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=M(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 y).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};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 y).parse(g));break;case "v":c=C(g.textContent);break;case "vcount":d=C(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};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=
+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=
 function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
 b);if(d)return d}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
 this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new l).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=W.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",W,K,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 q).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];
+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];
 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[a].matrix)};q.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=M(a.textContent);this.updateMatrix();return this};q.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=W.evaluate(".//dae:instance_material",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new s).parse(d)),d=c.iterateNext()}}return this};s.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=W.evaluate(".//dae:instance_material",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).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 r(this)).parse(c)}}return this};r.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":X(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=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};r.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 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 y).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-C(c.textContent);break;case "p":this.p=C(c.textContent)}}return this};B.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 y).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};y.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=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=M(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 B).parse(c.childNodes[d]);break}}}return this};
+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 ca).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=M(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=W.evaluate(".//dae:float",c,K,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=$[this.effect.surface.init_from]))a.map=
+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};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};z.prototype.create=function(){if(this.shader==null)return null};z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
-z.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new x(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)}}};z.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};z.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new A(c.nodeName,this)).parse(c)}}};ca.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Z.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 k(this)).parse(c));break;case "channel":this.channel.push((new L(this)).parse(c))}}return this};L.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};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new y).parse(c))}}return this};
-k.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=
+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=
 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))T=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))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;
 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})):
 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,j,o,q,n,s,l,p,r,t,v,B=a.faces;o=a.vertices;var I=a.normals,y=a.colors,G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];m=0;for(j=o.length;m<
-j;)q=new THREE.Vertex,q.position.x=o[m++]*b,q.position.y=o[m++]*b,q.position.z=o[m++]*b,d.vertices.push(q);m=0;for(j=B.length;m<j;){b=B[m++];o=b&1;i=b&2;c=b&4;e=b&8;n=b&16;q=b&32;l=b&64;b&=128;o?(p=new THREE.Face4,p.a=B[m++],p.b=B[m++],p.c=B[m++],p.d=B[m++],o=4):(p=new THREE.Face3,p.a=B[m++],p.b=B[m++],p.c=B[m++],o=3);if(i)i=B[m++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<G;c++)r=a.uvs[c],s=B[m++],v=r[s*2],s=r[s*2+1],d.faceUvs[c][i]=new THREE.UV(v,s);if(e)for(c=0;c<G;c++){r=a.uvs[c];t=[];
-for(e=0;e<o;e++)s=B[m++],v=r[s*2],s=r[s*2+1],t[e]=new THREE.UV(v,s);d.faceVertexUvs[c][i]=t}if(n)n=B[m++]*3,e=new THREE.Vector3,e.x=I[n++],e.y=I[n++],e.z=I[n],p.normal=e;if(q)for(c=0;c<o;c++)n=B[m++]*3,e=new THREE.Vector3,e.x=I[n++],e.y=I[n++],e.z=I[n],p.vertexNormals.push(e);if(l)q=B[m++],q=new THREE.Color(y[q]),p.color=q;if(b)for(c=0;c<o;c++)q=B[m++],q=new THREE.Color(y[q]),p.vertexColors.push(q);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,j,o,q,n,s;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;
-s=a.morphTargets[c].vertices;i=0;for(m=s.length;i<m;i+=3)j=s[i]*b,o=s[i+1]*b,q=s[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,o,q)))}}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;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]),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,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)&&
 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+"]")};
 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(q in z.objects)if(!K.objects[q])if(r=z.objects[q],r.geometry!==void 0){if(F=K.geometries[r.geometry]){a=!1;for(C=0;C<r.materials.length;C++)J=K.materials[r.materials[C]],a=J instanceof THREE.ShaderMaterial;a&&F.computeTangents();B=r.position;I=r.rotation;y=r.quaternion;G=r.scale;y=0;J.length==0&&(J=new THREE.MeshFaceMaterial);J.length>1&&(J=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(F,J);a.name=q;a.position.set(B[0],B[1],B[2]);y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(I[0],I[1],I[2]);a.scale.set(G[0],G[1],G[2]);a.visible=r.visible;K.scene.add(a);K.objects[q]=a;if(r.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);K.scene.collisions.colliders.push(b)}if(r.castsShadow)b=new THREE.ShadowVolume(F),K.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;r.trigger&&r.trigger.toLowerCase()!="none"&&(b=
-{type:r.trigger,object:r},K.triggers[a.name]=b)}}else B=r.position,I=r.rotation,y=r.quaternion,G=r.scale,y=0,a=new THREE.Object3D,a.name=q,a.position.set(B[0],B[1],B[2]),y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(I[0],I[1],I[2]),a.scale.set(G[0],G[1],G[2]),a.visible=r.visible!==void 0?r.visible:!1,K.scene.add(a),K.objects[q]=a,K.empties[q]=a,r.trigger&&r.trigger.toLowerCase()!="none"&&(b={type:r.trigger,object:r},K.triggers[a.name]=b)}function g(a){return function(b){K.geometries[a]=
-b;e();Z-=1;i.onLoadComplete();h()}}function f(a){return function(b){K.geometries[a]=b}}function h(){i.callbackProgress({totalModels:k,totalTextures:X,loadedModels:k-Z,loadedTextures:X-L},K);i.onLoadProgress();Z==0&&L==0&&b(K)}var i=this,m=THREE.Loader.prototype.extractUrlbase(c),j,o,q,n,s,l,p,r,t,v,B,I,y,G,u,F,A,x,J,z,ca,Z,L,k,X,K;z=a;c=new THREE.BinaryLoader;ca=new THREE.JSONLoader;L=Z=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(q in z.objects)if(r=z.objects[q],r.meshCollider){a=!0;break}if(a)K.scene.collisions=new THREE.CollisionSystem;if(z.transform){a=z.transform.position;t=z.transform.rotation;var M=z.transform.scale;a&&K.scene.position.set(a[0],a[1],a[2]);t&&K.scene.rotation.set(t[0],t[1],t[2]);M&&K.scene.scale.set(M[0],M[1],M[2]);(a||t||M)&&K.scene.updateMatrix()}a=function(){L-=1;h();i.onLoadComplete()};for(s in z.cameras)t=z.cameras[s],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)),B=t.position,t=t.target,A.position.set(B[0],B[1],B[2]),A.target=new THREE.Vector3(t[0],t[1],t[2]),K.cameras[s]=A;for(n in z.lights)t=z.lights[n],s=t.color!==void 0?t.color:16777215,A=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(B=t.direction,v=new THREE.DirectionalLight(s,A),v.position.set(B[0],B[1],B[2]),v.position.normalize()):t.type=="point"?(B=t.position,v=t.distance,
-v=new THREE.PointLight(s,A,v),v.position.set(B[0],B[1],B[2])):t.type=="ambient"&&(v=new THREE.AmbientLight(s)),K.scene.add(v),K.lights[n]=v;for(l in z.fogs)n=z.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]),K.fogs[l]=x;if(K.cameras&&z.defaults.camera)K.currentCamera=K.cameras[z.defaults.camera];if(K.fogs&&z.defaults.fog)K.scene.fog=K.fogs[z.defaults.fog];t=z.defaults.bgcolor;K.bgColor=new THREE.Color;
-K.bgColor.setRGB(t[0],t[1],t[2]);K.bgColorAlpha=z.defaults.bgalpha;for(j in z.geometries)if(l=z.geometries[j],l.type=="bin_mesh"||l.type=="ascii_mesh")Z+=1,i.onLoadStart();k=Z;for(j in z.geometries)l=z.geometries[j],l.type=="cube"?(F=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides),K.geometries[j]=F):l.type=="plane"?(F=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight),K.geometries[j]=F):l.type=="sphere"?
-(F=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight),K.geometries[j]=F):l.type=="cylinder"?(F=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,l.heightSegs),K.geometries[j]=F):l.type=="torus"?(F=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT),K.geometries[j]=F):l.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(l.subdivisions),K.geometries[j]=F):l.type=="bin_mesh"?c.load(d(l.url,z.urlBaseType),g(j)):l.type=="ascii_mesh"?ca.load(d(l.url,z.urlBaseType),
-g(j)):l.type=="embedded_mesh"&&(l=z.embeds[l.id])&&ca.createModel(l,f(j),"");for(p in z.textures)if(j=z.textures[p],j.url instanceof Array){L+=j.url.length;for(l=0;l<j.url.length;l++)i.onLoadStart()}else L+=1,i.onLoadStart();X=L;for(p in z.textures){j=z.textures[p];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){l=[];for(var C=0;C<j.url.length;C++)l[C]=d(j.url[C],z.urlBaseType);l=THREE.ImageUtils.loadTextureCube(l,j.mapping,a)}else{l=THREE.ImageUtils.loadTexture(d(j.url,
-z.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)l.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)l.magFilter=THREE[j.magFilter];if(j.repeat){l.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)l.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)l.wrapT=THREE.RepeatWrapping}j.offset&&l.offset.set(j.offset[0],j.offset[1]);if(j.wrap){x={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(x[j.wrap[0]]!==void 0)l.wrapS=x[j.wrap[0]];if(x[j.wrap[1]]!==void 0)l.wrapT=
-x[j.wrap[1]]}}K.textures[p]=l}for(o in z.materials){p=z.materials[o];for(u in p.parameters)if(u=="envMap"||u=="map"||u=="lightMap")p.parameters[u]=K.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){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);l=p.parameters.color;x=p.parameters.specular;c=p.parameters.ambient;ca=p.parameters.shininess;a.tNormal.texture=K.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=K.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=ca;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
-vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);K.materials[o]=p}e();i.callbackSync(K);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: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.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]};
-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=[],j=[];(function(a,f,i){for(var j,l,m,r=a.length;i<r;i+=f)j=a[i],l=a[i+1],m=a[i+2],j=j/16383*c,l=l/16383*c,m=m/16383*c,j+=d,l+=e,m+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,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,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,m.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,t,v,B,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;B=e;i=f;t=d;var y=e,G=f,u=g.materials[0],F=m[y*3],A=m[y*3+1],y=m[y*3+2],x=m[G*3],J=m[G*3+1],G=m[G*3+2];t=new THREE.Vector3(m[t*3],m[t*3+1],m[t*3+2]);y=new THREE.Vector3(F,A,y);G=new THREE.Vector3(x,J,G);g.faces.push(new THREE.Face3(v,B,i,[t,y,G],null,u));g=j[d*2];d=j[d*2+
-1];i=j[e*2];t=j[e*2+1];v=j[f*2];B=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(v,B));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),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.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;
 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,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=m;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,m,j,o){f=(f-j)/(o-j);j=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(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,m,j,o){f=(f-j)/(o-j);j=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(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,m=g+this.yd,j=g+this.zd,o=i+this.yd,q=i+this.zd,n=g+this.yd+this.zd,s=i+this.yd+this.zd,l=0,p=this.field[g],r=this.field[i],t=this.field[m],v=this.field[o],B=this.field[j],I=this.field[q],y=this.field[n],G=this.field[s];p<f&&(l|=1);r<f&&(l|=2);t<f&&(l|=8);v<f&&(l|=4);B<f&&(l|=16);I<f&&(l|=32);y<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,r));u&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,A,b,e,r,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(j),this.compNorm(q),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,F,B,I));u&32&&(this.compNorm(q),
-this.compNorm(s),this.VIntY(q*3,this.vlist,this.nlist,15,f,A,b,F,I,G));u&64&&(this.compNorm(n),this.compNorm(s),this.VIntX(n*3,this.vlist,this.nlist,18,f,a,x,F,y,G));u&128&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,F,B,y));u&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,p,B));u&512&&(this.compNorm(i),this.compNorm(q),this.VIntZ(i*3,this.vlist,this.nlist,27,f,A,b,e,r,I));u&1024&&(this.compNorm(o),this.compNorm(s),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,y));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,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+
 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,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 q=Math.floor(m-h);q<1&&(q=1);m=Math.floor(m+h);m>this.size-1&&(m=this.size-1);var n=Math.floor(j-h);n<1&&(n=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
-1);for(var s,l,p,r,t,v;o<i;o++){j=this.size2*o;l=o/this.size-e;t=l*l;for(l=q;l<m;l++){p=j+this.size*l;s=l/this.size-b;v=s*s;for(s=n;s<h;s++)r=s/this.size-a,r=g/(1.0E-6+r*r+v+t)-f,r>0&&(this.field[p+s]+=r)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,m=this.size,j=this.yd,o=this.zd,q=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*j;for(f=0;f<m;f++)q[o*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,m,j=this.size,o=this.yd,q=
-this.zd,n=this.field,s=j*Math.sqrt(a/b);s>j&&(s=j);for(g=0;g<s;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++){m=i+e;for(f=0;f<j;f++)n[q*f+m]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,m,j=this.size,o=this.yd,q=this.zd,n=this.field,s=j*Math.sqrt(a/b);s>j&&(s=j);for(f=0;f<s;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=q*f;for(g=0;g<j;g++){m=i+g*o;for(e=0;e<j;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,j,o,q=this.size-2;for(f=1;f<q;f++){o=this.size2*f;m=(f-this.halfsize)/this.halfsize;for(g=1;g<q;g++){j=o+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<q;e++)h=(e-this.halfsize)/this.halfsize,b=j+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,j,o,q,n;for(f=0;f<g.count;f++)q=f*3,j=q+1,n=q+2,h=g.positionArray[q],i=g.positionArray[j],m=
-g.positionArray[n],o=new THREE.Vector3(h,i,m),h=g.normalArray[q],i=g.normalArray[j],m=g.normalArray[n],q=new THREE.Vector3(h,i,m),q.normalize(),j=new THREE.Vertex(o),b.vertices.push(j),e.push(q);o=g.count/3;for(f=0;f<o;f++)q=(a+f)*3,j=q+1,n=q+2,h=e[q],i=e[j],m=e[n],q=new THREE.Face3(q,j,n,[h,i,m]),b.faces.push(q);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,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;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -695,30 +694,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);
 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,
-"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,j=h/f,o=f*0.5,q=h*0.5,n=16/h,s=new THREE.Vector2(n*j,n),l=new THREE.Vector3(1,1,0),p=new THREE.Vector2(1,1),r=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(r.occlusionMap,0);b.uniform1i(r.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,B,I,y;for(t=0;t<i;t++)if(n=16/h,s.set(n*j,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*q+q,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(r.renderType,0);b.uniform2f(r.scale,s.x,s.y);b.uniform3f(r.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(r.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(r.renderType,2);b.enable(b.BLEND);v=0;for(B=I.lensFlares.length;v<B;v++)if(y=I.lensFlares[v],y.opacity>0.0010&&y.scale>0.0010)l.x=y.x,l.y=y.y,l.z=y.z,n=y.size*y.scale/
-h,s.x=n*j,s.y=n,b.uniform3f(r.screenPosition,l.x,l.y,l.z),b.uniform2f(r.scale,s.x,s.y),b.uniform1f(r.rotation,y.rotation),b.uniform1f(r.opacity,y.opacity),b.uniform3f(r.color,y.color.r,y.color.g,y.color.b),c.setBlending(y.blending),c.setTexture(y.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 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)}}};
 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,j,o,q,n,s,l,p=0,r=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(m=r.length;i<m;i++)if(l=r[i],l.castShadow&&l instanceof THREE.SpotLight){this.shadowMap[p]||(this.shadowMap[p]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
-format:THREE.RGBAFormat}),this.shadowMatrix[p]=new THREE.Matrix4);j=this.shadowMap[p];o=this.shadowMatrix[p];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);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);o=h.__webglObjects.length;for(j=0;j<o;j++)if(n=h.__webglObjects[j],l=n.object,n.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),n.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);for(j=0;j<o;j++)if(n=h.__webglObjects[j],n.render)l=n.object,n=n.buffer,b.setObjectFaces(l),s=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c,b.renderBuffer(e,r,null,s,n,l);o=h.__webglObjectsImmediate.length;
-for(j=0;j<o;j++)n=h.__webglObjectsImmediate[j],l=n.object,l.visible&&l.castShadow&&(_currentGeometryGroupHash=-1,l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.setObjectFaces(l),q=b.setProgram(e,r,null,c,l),l.immediateRenderCallback?l.immediateRenderCallback(q,a,g):l.render(function(a){b.renderBufferImmediate(a,q,c.shading)}));p++}}};
+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++}}};
 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);
 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,
-"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,j=d.uniforms,o=h/f;f*=0.5;var q=h*0.5,n=!0;b.useProgram(d.program);_currentProgram=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(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var s,l=[],m=0;m<i;m++)if(s=e[m],s.visible&&s.opacity!==0)s.useScreenCoordinates?s.z=-s.position.z:(s._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,s.matrixWorld,s._modelViewMatrixArray),s.z=-s._modelViewMatrix.n34);
-e.sort(a);for(m=0;m<i;m++)s=e[m],s.visible&&s.opacity!==0&&s.map&&s.map.image&&s.map.image.width&&(s.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(s.position.x-f)/f,(q-s.position.y)/q,Math.max(0,Math.min(1,s.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,s.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,s._modelViewMatrixArray)),g=s.map.image.width/(s.scaleByViewport?h:1),l[0]=g*o*s.scale.x,l[1]=g*
-s.scale.y,b.uniform2f(j.uvScale,s.uvScale.x,s.uvScale.y),b.uniform2f(j.uvOffset,s.uvOffset.x,s.uvOffset.y),b.uniform2f(j.alignment,s.alignment.x,s.alignment.y),b.uniform1f(j.opacity,s.opacity),b.uniform3f(j.color,s.color.r,s.color.g,s.color.b),b.uniform1f(j.rotation,s.rotation),b.uniform2fv(j.scale,l),s.mergeWith3D&&!n?(b.enable(b.DEPTH_TEST),n=!0):!s.mergeWith3D&&n&&(b.disable(b.DEPTH_TEST),n=!1),c.setBlending(s.blending),c.setTexture(s.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,j,o;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},q=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
-1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:q},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(s);this.setSize=function(a,d){c.call(b,a,d);q.width=a;q.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||m!==c.near||j!==c.far||o!==c.fov){i=c.aspect;m=c.near;j=c.far;o=c.fov;var t=c.projectionMatrix.clone(),v=125/30*0.5,B=v*m/125,I=m*Math.tan(o*Math.PI/360),y;f.n14=v;h.n14=-v;v=-I*i+B;y=I*i+B;t.n11=2*m/(y-v);t.n13=(y+v)/(y-v);e.projectionMatrix.copy(t);v=-I*i-B;y=I*i-B;t.n11=
-2*m/(y-v);t.n13=(y+v)/(y-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,q,!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,s)}};
+"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)}};
 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)}};
 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}"},

+ 60 - 62
build/custom/ThreeCanvas.js

@@ -14,31 +14,31 @@ 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-
 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}};
-THREE.Ray=function(a,b){function c(a,b,c){i.sub(c,a);p=i.dot(b);if(p<=0)return null;k=n.add(a,o.copy(b).multiplyScalar(p));return s=c.distanceTo(k)}function d(a,b,c,d){i.sub(d,b);n.sub(c,b);o.sub(a,b);K=i.dot(i);C=i.dot(n);Q=i.dot(o);O=n.dot(n);w=n.dot(o);F=1/(K*O-C*C);z=(O*Q-C*w)*F;D=(K*w-C*Q)*F;return z>=0&&D>=0&&z+D<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,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,m=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(k){for(var i,o=[],n=0,W=k.children.length;n<W;n++)Array.prototype.push.apply(o,this.intersectObject(k.children[n]));if(k instanceof THREE.Particle){n=
-c(this.origin,this.direction,k.matrixWorld.getPosition());if(n===null||n>k.scale.x)return[];i={distance:n,point:k.position,face:null,object:k};o.push(i)}else if(k instanceof THREE.Mesh){n=c(this.origin,this.direction,k.matrixWorld.getPosition());if(n===null||n>k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)))return o;var p,G=k.geometry,H=G.vertices,I;k.matrixRotationWorld.extractRotation(k.matrixWorld);n=0;for(W=G.faces.length;n<W;n++)if(i=G.faces[n],a.copy(this.origin),
-b.copy(this.direction),I=k.matrixWorld,m=I.multiplyVector3(m.copy(i.centroid)).subSelf(a),p=m.dot(b),!(p<=0)&&(f=I.multiplyVector3(f.copy(H[i.a].position)),e=I.multiplyVector3(e.copy(H[i.b].position)),g=I.multiplyVector3(g.copy(H[i.c].position)),i instanceof THREE.Face4&&(h=I.multiplyVector3(h.copy(H[i.d].position))),l=k.matrixRotationWorld.multiplyVector3(l.copy(i.normal)),p=b.dot(l),k.doubleSided||(k.flipSided?p>0:p<0)))if(p=l.dot(m.sub(f,a))/p,j.add(a,b.multiplyScalar(p)),i instanceof THREE.Face3)d(j,
-f,e,g)&&(i={distance:a.distanceTo(j),point:j.clone(),face:i,object:k},o.push(i));else if(i instanceof THREE.Face4&&(d(j,f,e,h)||d(j,e,g,h)))i={distance:a.distanceTo(j),point:j.clone(),face:i,object:k},o.push(i)}return o};var i=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3,p,k,s,K,C,Q,O,w,F,z,D};
+THREE.Ray=function(a,b){function c(a,b,c){i.sub(c,a);q=i.dot(b);if(q<=0)return null;k=n.add(a,o.copy(b).multiplyScalar(q));return r=c.distanceTo(k)}function d(a,b,c,d){i.sub(d,b);n.sub(c,b);o.sub(a,b);K=i.dot(i);C=i.dot(n);Q=i.dot(o);O=n.dot(n);v=n.dot(o);F=1/(K*O-C*C);y=(O*Q-C*v)*F;D=(K*v-C*Q)*F;return y>=0&&D>=0&&y+D<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,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,m=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(k){for(var i,o=[],n=0,q=k.children.length;n<q;n++)Array.prototype.push.apply(o,this.intersectObject(k.children[n]));if(k instanceof THREE.Particle){n=
+c(this.origin,this.direction,k.matrixWorld.getPosition());if(n===null||n>k.scale.x)return[];i={distance:n,point:k.position,face:null,object:k};o.push(i)}else if(k instanceof THREE.Mesh){n=c(this.origin,this.direction,k.matrixWorld.getPosition());if(n===null||n>k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)))return o;var V,H=k.geometry,I=H.vertices,G;k.matrixRotationWorld.extractRotation(k.matrixWorld);n=0;for(q=H.faces.length;n<q;n++)if(i=H.faces[n],a.copy(this.origin),
+b.copy(this.direction),G=k.matrixWorld,m=G.multiplyVector3(m.copy(i.centroid)).subSelf(a),V=m.dot(b),!(V<=0)&&(f=G.multiplyVector3(f.copy(I[i.a].position)),e=G.multiplyVector3(e.copy(I[i.b].position)),g=G.multiplyVector3(g.copy(I[i.c].position)),i instanceof THREE.Face4&&(h=G.multiplyVector3(h.copy(I[i.d].position))),l=k.matrixRotationWorld.multiplyVector3(l.copy(i.normal)),V=b.dot(l),k.doubleSided||(k.flipSided?V>0:V<0)))if(V=l.dot(m.sub(f,a))/V,j.add(a,b.multiplyScalar(V)),i instanceof THREE.Face3)d(j,
+f,e,g)&&(i={distance:a.distanceTo(j),point:j.clone(),face:i,object:k},o.push(i));else if(i instanceof THREE.Face4&&(d(j,f,e,h)||d(j,e,g,h)))i={distance:a.distanceTo(j),point:j.clone(),face:i,object:k},o.push(i)}return o};var i=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3,q,k,r,K,C,Q,O,v,F,y,D};
 THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,j,i){h=!1;b=e;c=g;d=j;f=i;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
 function(e,g,j,i,n,o){h?(h=!1,b=e<j?e<n?e:n:j<n?j:n,c=g<i?g<o?g:o:i<o?i:o,d=e>j?e>n?e:n:j>n?j:n,f=g>i?g>o?g:o:i>o?i:o):(b=e<j?e<n?e<b?e:b:n<b?n:b:j<n?j<b?j:b:n<b?n:b,c=g<i?g<o?g<c?g:c:o<c?o:c:i<o?i<c?i:c:o<c?o:c,d=e>j?e>n?e>d?e:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,f=g>i?g>o?g>f?g:f:o>f?o:f:i>o?i>f?i:f:o>f?o:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
 e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.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(){h=!0;f=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,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.Matrix4=function(a,b,c,d,f,e,g,h,m,l,j,i,n,o,p,k){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,m||0,l||0,j!==void 0?j:1,i||0,n||0,o||0,p||0,k!==void 0?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,m,l,j,i,n,o,p,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=m;this.n32=l;this.n33=j;this.n34=i;this.n41=n;this.n42=o;this.n43=p;this.n44=k;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,m=a.n23,l=a.n24,j=a.n31,i=a.n32,n=a.n33,o=a.n34,p=a.n41,k=a.n42,s=a.n43,
-K=a.n44,C=b.n11,Q=b.n12,O=b.n13,w=b.n14,F=b.n21,z=b.n22,D=b.n23,u=b.n24,r=b.n31,E=b.n32,N=b.n33,W=b.n34,da=b.n41,G=b.n42,H=b.n43,I=b.n44;this.n11=c*C+d*F+f*r+e*da;this.n12=c*Q+d*z+f*E+e*G;this.n13=c*O+d*D+f*N+e*H;this.n14=c*w+d*u+f*W+e*I;this.n21=g*C+h*F+m*r+l*da;this.n22=g*Q+h*z+m*E+l*G;this.n23=g*O+h*D+m*N+l*H;this.n24=g*w+h*u+m*W+l*I;this.n31=j*C+i*F+n*r+o*da;this.n32=j*Q+i*z+n*E+o*G;this.n33=j*O+i*D+n*N+o*H;this.n34=j*w+i*u+n*W+o*I;this.n41=p*C+k*F+s*r+K*da;this.n42=p*Q+k*z+s*E+K*G;this.n43=p*
-O+k*D+s*N+K*H;this.n44=p*w+k*u+s*W+K*I;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,e=this.n22,g=this.n23,h=this.n24,m=this.n31,l=this.n32,j=this.n33,i=this.n34,n=this.n41,o=this.n42,p=this.n43,k=this.n44;return d*g*l*n-c*h*l*n-d*e*j*n+b*h*j*n+c*e*i*n-b*g*i*n-d*g*m*o+c*h*m*o+d*f*j*o-a*h*j*o-c*f*i*o+a*g*i*o+d*e*m*p-b*h*m*p-d*f*l*p+a*h*l*p+b*f*i*p-a*e*i*p-c*e*m*k+b*g*m*k+c*f*l*k-a*g*l*k-b*f*j*k+a*e*j*k},transpose:function(){var a;
-a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
-a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.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,e=a.x,g=a.y,h=a.z,m=f*e,l=f*g;this.set(m*e+c,m*g-d*h,m*h+d*g,0,m*g+d*h,l*g+c,l*h-d*e,0,m*h-d*g,l*h+d*e,f*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,f=a.n14,e=a.n21,g=a.n22,h=a.n23,m=a.n24,l=a.n31,j=a.n32,i=a.n33,n=a.n34,o=a.n41,p=a.n42,k=a.n43,s=a.n44;this.n11=h*n*p-m*i*p+m*j*k-g*n*k-h*j*s+g*i*s;this.n12=f*i*p-d*n*p-f*j*k+c*n*k+d*j*s-c*i*s;this.n13=d*m*p-f*h*p+f*g*k-c*m*k-d*g*s+c*h*s;this.n14=f*h*j-d*m*j-f*g*i+c*m*i+d*g*n-c*h*n;this.n21=m*i*o-h*n*o-m*l*k+e*n*k+h*l*s-e*i*s;this.n22=d*n*o-f*i*o+
-f*l*k-b*n*k-d*l*s+b*i*s;this.n23=f*h*o-d*m*o-f*e*k+b*m*k+d*e*s-b*h*s;this.n24=d*m*l-f*h*l+f*e*i-b*m*i-d*e*n+b*h*n;this.n31=g*n*o-m*j*o+m*l*p-e*n*p-g*l*s+e*j*s;this.n32=f*j*o-c*n*o-f*l*p+b*n*p+c*l*s-b*j*s;this.n33=d*m*o-f*g*o+f*e*p-b*m*p-c*e*s+b*g*s;this.n34=f*g*l-c*m*l-f*e*j+b*m*j+c*e*n-b*g*n;this.n41=h*j*o-g*i*o-h*l*p+e*i*p+g*l*k-e*j*k;this.n42=c*i*o-d*j*o+d*l*p-b*i*p-c*l*k+b*j*k;this.n43=d*g*o-c*h*o-d*e*p+b*h*p+c*e*k-b*g*k;this.n44=c*h*l-d*g*l+d*e*j-b*h*j-c*e*i+b*g*i;this.multiplyScalar(1/a.determinant());
+THREE.Matrix4=function(a,b,c,d,f,e,g,h,m,l,j,i,n,o,q,k){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,m||0,l||0,j!==void 0?j:1,i||0,n||0,o||0,q||0,k!==void 0?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,m,l,j,i,n,o,q,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=m;this.n32=l;this.n33=j;this.n34=i;this.n41=n;this.n42=o;this.n43=q;this.n44=k;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,m=a.n23,l=a.n24,j=a.n31,i=a.n32,n=a.n33,o=a.n34,q=a.n41,k=a.n42,r=a.n43,
+K=a.n44,C=b.n11,Q=b.n12,O=b.n13,v=b.n14,F=b.n21,y=b.n22,D=b.n23,t=b.n24,A=b.n31,E=b.n32,N=b.n33,aa=b.n34,V=b.n41,H=b.n42,I=b.n43,G=b.n44;this.n11=c*C+d*F+f*A+e*V;this.n12=c*Q+d*y+f*E+e*H;this.n13=c*O+d*D+f*N+e*I;this.n14=c*v+d*t+f*aa+e*G;this.n21=g*C+h*F+m*A+l*V;this.n22=g*Q+h*y+m*E+l*H;this.n23=g*O+h*D+m*N+l*I;this.n24=g*v+h*t+m*aa+l*G;this.n31=j*C+i*F+n*A+o*V;this.n32=j*Q+i*y+n*E+o*H;this.n33=j*O+i*D+n*N+o*I;this.n34=j*v+i*t+n*aa+o*G;this.n41=q*C+k*F+r*A+K*V;this.n42=q*Q+k*y+r*E+K*H;this.n43=q*
+O+k*D+r*N+K*I;this.n44=q*v+k*t+r*aa+K*G;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,e=this.n22,g=this.n23,h=this.n24,m=this.n31,l=this.n32,j=this.n33,i=this.n34,n=this.n41,o=this.n42,q=this.n43,k=this.n44;return d*g*l*n-c*h*l*n-d*e*j*n+b*h*j*n+c*e*i*n-b*g*i*n-d*g*m*o+c*h*m*o+d*f*j*o-a*h*j*o-c*f*i*o+a*g*i*o+d*e*m*q-b*h*m*q-d*f*l*q+a*h*l*q+b*f*i*q-a*e*i*q-c*e*m*k+b*g*m*k+c*f*l*k-a*g*l*k-b*f*j*k+a*e*j*
+k},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;
+a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.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,e=a.x,g=a.y,h=a.z,m=f*e,l=f*g;this.set(m*e+c,m*g-d*h,m*h+d*g,0,m*g+d*h,l*g+c,l*h-d*e,0,m*h-d*g,l*h+d*e,f*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,f=a.n14,e=a.n21,g=a.n22,h=a.n23,m=a.n24,l=a.n31,j=a.n32,i=a.n33,n=a.n34,o=a.n41,q=a.n42,k=a.n43,r=a.n44;this.n11=h*n*q-m*i*q+m*j*k-g*n*k-h*j*r+g*i*r;this.n12=f*i*q-d*n*q-f*j*k+c*n*k+d*j*r-c*i*r;this.n13=d*m*q-f*h*q+f*g*k-c*m*k-d*g*r+c*h*r;this.n14=f*h*j-d*m*j-f*g*i+c*m*i+d*g*n-c*h*n;this.n21=m*i*o-h*n*o-m*l*k+e*n*k+h*l*r-e*i*r;this.n22=d*n*o-f*i*o+
+f*l*k-b*n*k-d*l*r+b*i*r;this.n23=f*h*o-d*m*o-f*e*k+b*m*k+d*e*r-b*h*r;this.n24=d*m*l-f*h*l+f*e*i-b*m*i-d*e*n+b*h*n;this.n31=g*n*o-m*j*o+m*l*q-e*n*q-g*l*r+e*j*r;this.n32=f*j*o-c*n*o-f*l*q+b*n*q+c*l*r-b*j*r;this.n33=d*m*o-f*g*o+f*e*q-b*m*q-c*e*r+b*g*r;this.n34=f*g*l-c*m*l-f*e*j+b*m*j+c*e*n-b*g*n;this.n41=h*j*o-g*i*o-h*l*q+e*i*q+g*l*k-e*j*k;this.n42=c*i*o-d*j*o+d*l*q-b*i*q-c*l*k+b*j*k;this.n43=d*g*o-c*h*o-d*e*q+b*h*q+c*e*k-b*g*k;this.n44=c*h*l-d*g*l+d*e*j-b*h*j-c*e*i+b*g*i;this.multiplyScalar(1/a.determinant());
 return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var m=g*h,l=g*f,j=d*h,i=d*f;this.n11=m+i*c;this.n12=j*c-l;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=l*c-j;this.n32=i+m*c;this.n33=e*g;break;case "ZXY":m=g*h;l=g*f;j=d*h;i=d*f;this.n11=m-i*c;this.n12=-e*f;this.n13=j+l*c;this.n21=l+j*c;this.n22=e*h;this.n23=i-m*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":m=
 e*h;l=e*f;j=c*h;i=c*f;this.n11=g*h;this.n12=j*d-l;this.n13=m*d+i;this.n21=g*f;this.n22=i*d+m;this.n23=l*d-j;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":m=e*g;l=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=i-m*f;this.n13=j*f+l;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*f+j;this.n33=m-i*f;break;case "XZY":m=e*g;l=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=m*f+i;this.n22=e*h;this.n23=l*f-j;this.n31=j*f-l;this.n32=c*h;this.n33=i*f+m;break;default:m=e*h,l=e*
 f,j=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=l+j*d,this.n22=m-i*d,this.n23=-c*g,this.n31=i-m*d,this.n32=j+l*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,h=d+d,a=b*e,m=b*g;b*=h;var l=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(l+d);this.n12=m-f;this.n13=b+g;this.n21=m+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;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*=
@@ -55,18 +55,16 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 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;
 THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=l[m]=l[m]||new THREE.RenderableVertex;m++;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 f,e,g=[],h,m,l=[],
-j,i,n=[],o,p=[],k,s,K=[],C,Q,O=[],w={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,z=new THREE.Vector4,D=new THREE.Matrix4,u=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,N=new THREE.Vector4;this.computeFrustum=function(a){r[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);r[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);r[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);r[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);r[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);r[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=r[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-D.multiply(b.matrixWorld,b.projectionMatrixInverse);D.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){e=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=r[h].x*d.n14+r[h].y*d.n24+r[h].z*d.n34+r[h].w,c<=e){c=!1;break a}c=!0}c?(D.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,w.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(D.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,w.sprites.push(f)):b instanceof THREE.Light&&w.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,r=e.far,F,L,B,S,v,R,P,V,J,t,A,x,y,M,la,fa;Q=s=o=i=0;w.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);D.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(D);w=this.projectGraph(a,!1);a=0;for(F=w.objects.length;a<F;a++)if(J=w.objects[a].object,t=J.matrixWorld,
-x=J.material,m=0,J instanceof THREE.Mesh){A=J.geometry;y=J.geometry.materials;S=A.vertices;M=A.faces;la=A.faceVertexUvs;A=J.matrixRotationWorld.extractRotation(t);L=0;for(B=S.length;L<B;L++)h=b(),h.positionWorld.copy(S[L].position),t.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<r;S=0;for(L=M.length;S<L;S++){B=
-M[S];if(B instanceof THREE.Face3)if(v=l[B.a],R=l[B.b],P=l[B.c],v.visible&&R.visible&&P.visible&&(J.doubleSided||J.flipSided!=(P.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(P.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0))V=n[i]=n[i]||new THREE.RenderableFace3,i++,j=V,j.v1.copy(v),j.v2.copy(R),j.v3.copy(P);else continue;else if(B instanceof THREE.Face4)if(v=l[B.a],R=l[B.b],P=l[B.c],V=l[B.d],v.visible&&R.visible&&P.visible&&V.visible&&
-(J.doubleSided||J.flipSided!=((V.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(V.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0||(R.positionScreen.x-P.positionScreen.x)*(V.positionScreen.y-P.positionScreen.y)-(R.positionScreen.y-P.positionScreen.y)*(V.positionScreen.x-P.positionScreen.x)<0)))fa=p[o]=p[o]||new THREE.RenderableFace4,o++,j=fa,j.v1.copy(v),j.v2.copy(R),j.v3.copy(P),j.v4.copy(V);else continue;j.normalWorld.copy(B.normal);
-A.multiplyVector3(j.normalWorld);j.centroidWorld.copy(B.centroid);t.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);D.multiplyVector3(j.centroidScreen);P=B.vertexNormals;v=0;for(R=P.length;v<R;v++)V=j.vertexNormalsWorld[v],V.copy(P[v]),A.multiplyVector3(V);v=0;for(R=la.length;v<R;v++)if(fa=la[v][S]){P=0;for(V=fa.length;P<V;P++)j.uvs[v][P]=fa[P]}j.material=x;j.faceMaterial=B.materialIndex!==null?y[B.materialIndex]:null;j.z=j.centroidScreen.z;w.elements.push(j)}}else if(J instanceof
-THREE.Line){u.multiply(D,t);S=J.geometry.vertices;v=b();v.positionScreen.copy(S[0].position);u.multiplyVector4(v.positionScreen);L=1;for(B=S.length;L<B;L++)if(v=b(),v.positionScreen.copy(S[L].position),u.multiplyVector4(v.positionScreen),R=l[m-2],E.copy(v.positionScreen),N.copy(R.positionScreen),d(E,N))E.multiplyScalar(1/E.w),N.multiplyScalar(1/N.w),J=K[s]=K[s]||new THREE.RenderableLine,s++,k=J,k.v1.positionScreen.copy(E),k.v2.positionScreen.copy(N),k.z=Math.max(E.z,N.z),k.material=x,w.elements.push(k)}a=
-0;for(F=w.sprites.length;a<F;a++)if(J=w.sprites[a].object,t=J.matrixWorld,J instanceof THREE.Particle&&(z.set(t.n14,t.n24,t.n34,1),D.multiplyVector4(z),z.z/=z.w,z.z>0&&z.z<1))g=O[Q]=O[Q]||new THREE.RenderableParticle,Q++,C=g,C.x=z.x/z.w,C.y=z.y/z.w,C.z=z.z,C.rotation=J.rotation.z,C.scale.x=J.scale.x*Math.abs(C.x-(z.x+e.projectionMatrix.n11)/(z.w+e.projectionMatrix.n14)),C.scale.y=J.scale.y*Math.abs(C.y-(z.y+e.projectionMatrix.n22)/(z.w+e.projectionMatrix.n24)),C.material=J.material,w.elements.push(C);
-f&&w.elements.sort(c);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+j,i,n=[],o,q=[],k,r,K=[],C,Q,O=[],v={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,y=new THREE.Vector4,D=new THREE.Matrix4,t=new THREE.Matrix4,A=new THREE.Frustum,E=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);D.multiply(b.matrixWorld,
+b.projectionMatrixInverse);D.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){e=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var g=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||A.contains(b))?(D.multiplyVector3(F.copy(b.position)),f=a(),f.object=
+b,f.z=F.z,v.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(D.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,v.sprites.push(f)):b instanceof THREE.Light&&v.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&v.objects.sort(c);return v};this.projectScene=function(a,e,f){var g=e.near,G=e.far,F,L,B,S,u,R,P,W,J,s,z,w,x,M,la,fa;Q=r=o=i=0;v.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);D.multiply(e.projectionMatrix,e.matrixWorldInverse);A.setFromMatrix(D);v=this.projectGraph(a,!1);a=0;for(F=v.objects.length;a<F;a++)if(J=v.objects[a].object,s=J.matrixWorld,w=J.material,m=0,J instanceof THREE.Mesh){z=J.geometry;x=J.geometry.materials;S=z.vertices;M=z.faces;la=z.faceVertexUvs;z=J.matrixRotationWorld.extractRotation(s);L=0;for(B=S.length;L<B;L++)h=b(),h.positionWorld.copy(S[L].position),s.multiplyVector3(h.positionWorld),
+h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<G;S=0;for(L=M.length;S<L;S++){B=M[S];if(B instanceof THREE.Face3)if(u=l[B.a],R=l[B.b],P=l[B.c],u.visible&&R.visible&&P.visible&&(J.doubleSided||J.flipSided!=(P.positionScreen.x-u.positionScreen.x)*(R.positionScreen.y-u.positionScreen.y)-(P.positionScreen.y-u.positionScreen.y)*(R.positionScreen.x-
+u.positionScreen.x)<0))W=n[i]=n[i]||new THREE.RenderableFace3,i++,j=W,j.v1.copy(u),j.v2.copy(R),j.v3.copy(P);else continue;else if(B instanceof THREE.Face4)if(u=l[B.a],R=l[B.b],P=l[B.c],W=l[B.d],u.visible&&R.visible&&P.visible&&W.visible&&(J.doubleSided||J.flipSided!=((W.positionScreen.x-u.positionScreen.x)*(R.positionScreen.y-u.positionScreen.y)-(W.positionScreen.y-u.positionScreen.y)*(R.positionScreen.x-u.positionScreen.x)<0||(R.positionScreen.x-P.positionScreen.x)*(W.positionScreen.y-P.positionScreen.y)-
+(R.positionScreen.y-P.positionScreen.y)*(W.positionScreen.x-P.positionScreen.x)<0)))fa=q[o]=q[o]||new THREE.RenderableFace4,o++,j=fa,j.v1.copy(u),j.v2.copy(R),j.v3.copy(P),j.v4.copy(W);else continue;j.normalWorld.copy(B.normal);z.multiplyVector3(j.normalWorld);j.centroidWorld.copy(B.centroid);s.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);D.multiplyVector3(j.centroidScreen);P=B.vertexNormals;u=0;for(R=P.length;u<R;u++)W=j.vertexNormalsWorld[u],W.copy(P[u]),z.multiplyVector3(W);
+u=0;for(R=la.length;u<R;u++)if(fa=la[u][S]){P=0;for(W=fa.length;P<W;P++)j.uvs[u][P]=fa[P]}j.material=w;j.faceMaterial=B.materialIndex!==null?x[B.materialIndex]:null;j.z=j.centroidScreen.z;v.elements.push(j)}}else if(J instanceof THREE.Line){t.multiply(D,s);S=J.geometry.vertices;u=b();u.positionScreen.copy(S[0].position);t.multiplyVector4(u.positionScreen);L=1;for(B=S.length;L<B;L++)if(u=b(),u.positionScreen.copy(S[L].position),t.multiplyVector4(u.positionScreen),R=l[m-2],E.copy(u.positionScreen),
+N.copy(R.positionScreen),d(E,N))E.multiplyScalar(1/E.w),N.multiplyScalar(1/N.w),J=K[r]=K[r]||new THREE.RenderableLine,r++,k=J,k.v1.positionScreen.copy(E),k.v2.positionScreen.copy(N),k.z=Math.max(E.z,N.z),k.material=w,v.elements.push(k)}a=0;for(F=v.sprites.length;a<F;a++)if(J=v.sprites[a].object,s=J.matrixWorld,J instanceof THREE.Particle&&(y.set(s.n14,s.n24,s.n34,1),D.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))g=O[Q]=O[Q]||new THREE.RenderableParticle,Q++,C=g,C.x=y.x/y.w,C.y=y.y/y.w,C.z=y.z,C.rotation=
+J.rotation.z,C.scale.x=J.scale.x*Math.abs(C.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),C.scale.y=J.scale.y*Math.abs(C.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),C.material=J.material,v.elements.push(C);f&&v.elements.sort(c);return v}};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),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-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.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=
@@ -82,9 +80,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 b,c,d,f,e,g=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],f=this.vertices[c.b],e=this.vertices[c.c],g.sub(e.position,f.position),h.sub(d.position,f.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},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),
 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,f,D){h=a.vertices[b].position;m=a.vertices[c].position;l=a.vertices[d].position;j=g[e];i=g[f];n=g[D];o=m.x-h.x;p=l.x-h.x;k=m.y-h.y;s=l.y-h.y;K=m.z-h.z;C=l.z-h.z;Q=i.u-j.u;O=n.u-j.u;w=i.v-j.v;F=n.v-j.v;z=1/(Q*F-O*w);E.set((F*o-w*p)*z,(F*k-w*s)*z,(F*K-w*C)*z);N.set((Q*p-O*o)*z,(Q*s-O*k)*z,(Q*C-O*K)*z);u[b].addSelf(E);u[c].addSelf(E);u[d].addSelf(E);r[b].addSelf(N);r[c].addSelf(N);r[d].addSelf(N)}var b,c,d,f,e,g,h,m,l,j,i,n,o,p,k,s,K,C,Q,O,w,F,z,D,u=[],r=[],E=new THREE.Vector3,N=new THREE.Vector3,
-W=new THREE.Vector3,da=new THREE.Vector3,G=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,r[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var H=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)G.copy(e.vertexNormals[d]),f=e[H[d]],
-D=u[f],W.copy(D),W.subSelf(G.multiplyScalar(G.dot(D))).normalize(),da.cross(e.vertexNormals[d],D),f=da.dot(r[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(W.x,W.y,W.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=
+b,c,d,e,f,D){h=a.vertices[b].position;m=a.vertices[c].position;l=a.vertices[d].position;j=g[e];i=g[f];n=g[D];o=m.x-h.x;q=l.x-h.x;k=m.y-h.y;r=l.y-h.y;K=m.z-h.z;C=l.z-h.z;Q=i.u-j.u;O=n.u-j.u;v=i.v-j.v;F=n.v-j.v;y=1/(Q*F-O*v);E.set((F*o-v*q)*y,(F*k-v*r)*y,(F*K-v*C)*y);N.set((Q*q-O*o)*y,(Q*r-O*k)*y,(Q*C-O*K)*y);t[b].addSelf(E);t[c].addSelf(E);t[d].addSelf(E);A[b].addSelf(N);A[c].addSelf(N);A[d].addSelf(N)}var b,c,d,f,e,g,h,m,l,j,i,n,o,q,k,r,K,C,Q,O,v,F,y,D,t=[],A=[],E=new THREE.Vector3,N=new THREE.Vector3,
+aa=new THREE.Vector3,V=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)t[b]=new THREE.Vector3,A[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)H.copy(e.vertexNormals[d]),f=e[I[d]],
+D=t[f],aa.copy(D),aa.subSelf(H.multiplyScalar(H.dot(D))).normalize(),V.cross(e.vertexNormals[d],D),f=V.dot(A[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(aa.x,aa.y,aa.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=
 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),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],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;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};
@@ -127,34 +125,34 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 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.CanvasRenderer=function(a){function b(a){if(C!=a)k.globalAlpha=C=a}function c(a){if(Q!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}Q=a}}function d(a){if(O!=a)k.strokeStyle=O=a}function f(a){if(w!=a)k.fillStyle=w=a}var e=this,g,h,m,l=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-i,n,o,p,k=j.getContext("2d"),s=new THREE.Color(0),K=0,C=1,Q=0,O=null,w=null,F=null,z=null,D=null,u,r,E,N,W=new THREE.RenderableVertex,da=new THREE.RenderableVertex,G,H,I,Y,L,B,S,v,R,P,V,J,t=new THREE.Color,A=new THREE.Color,x=new THREE.Color,y=new THREE.Color,M=new THREE.Color,la=[],fa=[],ga,ha,ea,aa,Ba,Ca,Da,Ea,Fa,Ga,ma=new THREE.Rectangle,Z=new THREE.Rectangle,X=new THREE.Rectangle,ya=!1,$=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,T=new THREE.Vector3,qa,ra,za,ba,sa,va,a=16;qa=document.createElement("canvas");
-qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);za=ra.getImageData(0,0,2,2);ba=za.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.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){i=a;n=b;o=Math.floor(i/2);p=Math.floor(n/2);j.width=i;j.height=n;ma.set(-o,-p,o,p);Z.set(-o,-p,o,p);C=1;Q=0;
-D=z=F=w=O=null};this.setClearColor=function(a,b){s.copy(a);K=b;Z.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){s.setHex(a);K=b;Z.set(-o,-p,o,p)};this.clear=function(){k.setTransform(1,0,0,-1,o,p);Z.isEmpty()||(Z.minSelf(ma),Z.inflate(2),K<1&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),K>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+K+")"),k.fillRect(Math.floor(Z.getX()),
+THREE.CanvasRenderer=function(a){function b(a){if(C!=a)k.globalAlpha=C=a}function c(a){if(Q!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}Q=a}}function d(a){if(O!=a)k.strokeStyle=O=a}function f(a){if(v!=a)k.fillStyle=v=a}var e=this,g,h,m,l=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+i,n,o,q,k=j.getContext("2d"),r=new THREE.Color(0),K=0,C=1,Q=0,O=null,v=null,F=null,y=null,D=null,t,A,E,N,aa=new THREE.RenderableVertex,V=new THREE.RenderableVertex,H,I,G,Y,L,B,S,u,R,P,W,J,s=new THREE.Color,z=new THREE.Color,w=new THREE.Color,x=new THREE.Color,M=new THREE.Color,la=[],fa=[],ga,ha,ea,ba,Ba,Ca,Da,Ea,Fa,Ga,ma=new THREE.Rectangle,Z=new THREE.Rectangle,X=new THREE.Rectangle,ya=!1,$=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,T=new THREE.Vector3,qa,ra,za,ca,sa,va,a=16;qa=document.createElement("canvas");
+qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);za=ra.getImageData(0,0,2,2);ca=za.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.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){i=a;n=b;o=Math.floor(i/2);q=Math.floor(n/2);j.width=i;j.height=n;ma.set(-o,-q,o,q);Z.set(-o,-q,o,q);C=1;Q=0;
+D=y=F=v=O=null};this.setClearColor=function(a,b){r.copy(a);K=b;Z.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);K=b;Z.set(-o,-q,o,q)};this.clear=function(){k.setTransform(1,0,0,-1,o,q);Z.isEmpty()||(Z.minSelf(ma),Z.inflate(2),K<1&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),K>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+K+")"),k.fillRect(Math.floor(Z.getX()),
 Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,j){function i(a){var b,c,d,e;$.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?($.r+=e.r,$.g+=e.g,$.b+=e.b):d instanceof THREE.DirectionalLight?(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b):d instanceof THREE.PointLight&&(ua.r+=e.r,ua.g+=e.g,ua.b+=e.b)}function n(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
-g instanceof THREE.DirectionalLight?(k=g.matrixWorld.getPosition(),j=c.dot(k),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(k=g.matrixWorld.getPosition(),j=c.dot(T.sub(k,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(k)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function s(a,e,g){b(g.opacity);c(g.blending);var h,j,i,m,q,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)m=g.map.image,q=m.width>>1,n=m.height>>
-1,g=e.scale.x*o,i=e.scale.y*p,h=g*q,j=i*n,X.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(X)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-i),k.translate(-q,-n),k.drawImage(m,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*o,j=e.scale.y*p,X.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(X)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,j),g.program(k),k.restore()))}function w(a,e,
-f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!=a)k.lineWidth=F=a;a=g.linecap;if(z!=a)k.lineCap=z=a;a=g.linejoin;if(D!=a)k.lineJoin=D=a;d(g.color.getContextStyle());k.stroke();X.inflate(g.linewidth*2)}}function C(a,d,f,g,h,k,i,q){e.info.render.vertices+=3;e.info.render.faces++;b(q.opacity);c(q.blending);G=a.positionScreen.x;H=a.positionScreen.y;
-I=d.positionScreen.x;Y=d.positionScreen.y;L=f.positionScreen.x;B=f.positionScreen.y;K(G,H,I,Y,L,B);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(aa=i.uvs[0],Aa(G,H,I,Y,L,B,aa[g].u,aa[g].v,aa[h].u,aa[h].v,aa[k].u,aa[k].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,T.copy(i.vertexNormalsWorld[g]),Ba=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ca=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[h]),
-Da=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ea=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[k]),Fa=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ga=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,Aa(G,H,I,Y,L,B,Ba,Ca,Da,Ea,Fa,Ga,q.envMap)}else q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)q.map&&!q.wireframe&&(q.map.mapping instanceof THREE.UVMapping&&(aa=i.uvs[0],Aa(G,H,I,Y,L,B,aa[g].u,aa[g].v,
-aa[h].u,aa[h].v,aa[k].u,aa[k].v,q.map)),c(THREE.SubtractiveBlending)),ya?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(A.r=x.r=y.r=$.r,A.g=x.g=y.g=$.g,A.b=x.b=y.b=$.b,n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],A),n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],x),n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],y),A.r=Math.max(0,Math.min(q.color.r*A.r,1)),A.g=Math.max(0,Math.min(q.color.g*A.g,1)),A.b=Math.max(0,Math.min(q.color.b*A.b,1)),x.r=Math.max(0,Math.min(q.color.r*
-x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),y.r=Math.max(0,Math.min(q.color.r*y.r,1)),y.g=Math.max(0,Math.min(q.color.g*y.g,1)),y.b=Math.max(0,Math.min(q.color.b*y.b,1)),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,ea=wa(A,x,y,M),oa(G,H,I,Y,L,B,0,0,1,0,0,1,ea)):(t.r=$.r,t.g=$.g,t.b=$.b,n(m,i.centroidWorld,i.normalWorld,t),t.r=Math.max(0,Math.min(q.color.r*t.r,1)),t.g=Math.max(0,Math.min(q.color.g*t.g,1)),t.b=Math.max(0,Math.min(q.color.b*t.b,
-1)),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)):q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)ga=j.near,ha=j.far,A.r=A.g=A.b=1-na(a.positionScreen.z,ga,ha),x.r=x.g=x.b=1-na(d.positionScreen.z,ga,ha),y.r=y.g=y.b=1-na(f.positionScreen.z,ga,ha),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,ea=wa(A,x,y,M),oa(G,H,I,Y,L,B,0,0,1,0,0,1,ea);else if(q instanceof THREE.MeshNormalMaterial)t.r=
-pa(i.normalWorld.x),t.g=pa(i.normalWorld.y),t.b=pa(i.normalWorld.z),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)}function Q(a,d,f,g,h,k,i,q,o){e.info.render.vertices+=4;e.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)C(a,d,g,0,1,3,i,q,o),C(h,f,k,1,2,3,i,q,o);else if(G=a.positionScreen.x,H=a.positionScreen.y,I=d.positionScreen.x,Y=d.positionScreen.y,L=f.positionScreen.x,B=f.positionScreen.y,S=g.positionScreen.x,v=g.positionScreen.y,R=h.positionScreen.x,
-P=h.positionScreen.y,V=k.positionScreen.x,J=k.positionScreen.y,q instanceof THREE.MeshBasicMaterial)O(G,H,I,Y,L,B,S,v),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)ya?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(A.r=x.r=y.r=M.r=$.r,A.g=x.g=y.g=M.g=$.g,A.b=x.b=y.b=M.b=$.b,n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],A),n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],x),
-n(m,i.v4.positionWorld,i.vertexNormalsWorld[3],y),n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],M),A.r=Math.max(0,Math.min(q.color.r*A.r,1)),A.g=Math.max(0,Math.min(q.color.g*A.g,1)),A.b=Math.max(0,Math.min(q.color.b*A.b,1)),x.r=Math.max(0,Math.min(q.color.r*x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),y.r=Math.max(0,Math.min(q.color.r*y.r,1)),y.g=Math.max(0,Math.min(q.color.g*y.g,1)),y.b=Math.max(0,Math.min(q.color.b*y.b,1)),M.r=Math.max(0,Math.min(q.color.r*
-M.r,1)),M.g=Math.max(0,Math.min(q.color.g*M.g,1)),M.b=Math.max(0,Math.min(q.color.b*M.b,1)),ea=wa(A,x,y,M),K(G,H,I,Y,S,v),oa(G,H,I,Y,S,v,0,0,1,0,0,1,ea),K(R,P,L,B,V,J),oa(R,P,L,B,V,J,1,0,1,1,0,1,ea)):(t.r=$.r,t.g=$.g,t.b=$.b,n(m,i.centroidWorld,i.normalWorld,t),t.r=Math.max(0,Math.min(q.color.r*t.r,1)),t.g=Math.max(0,Math.min(q.color.g*t.g,1)),t.b=Math.max(0,Math.min(q.color.b*t.b,1)),O(G,H,I,Y,L,B,S,v),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)):(O(G,H,I,
-Y,L,B,S,v),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)t.r=pa(i.normalWorld.x),t.g=pa(i.normalWorld.y),t.b=pa(i.normalWorld.z),O(G,H,I,Y,L,B,S,v),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t);else if(q instanceof THREE.MeshDepthMaterial)ga=j.near,ha=j.far,A.r=A.g=A.b=1-na(a.positionScreen.z,ga,ha),x.r=x.g=x.b=1-na(d.positionScreen.z,ga,ha),y.r=y.g=y.b=1-na(g.positionScreen.z,
-ga,ha),M.r=M.g=M.b=1-na(f.positionScreen.z,ga,ha),ea=wa(A,x,y,M),K(G,H,I,Y,S,v),oa(G,H,I,Y,S,v,0,0,1,0,0,1,ea),K(R,P,L,B,V,J),oa(R,P,L,B,V,J,1,0,1,1,0,1,ea)}function K(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function O(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ja(a,b,c,e){if(F!=b)k.lineWidth=F=b;if(z!=c)k.lineCap=z=c;if(D!=e)k.lineJoin=D=e;d(a.getContextStyle());
-k.stroke();X.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function Aa(a,b,c,d,e,g,h,i,j,m,o,n,l){if(l.image.width!=0){if(l.needsUpdate==!0||la[l.id]==void 0){var p=l.wrapS==THREE.RepeatWrapping,r=l.wrapT==THREE.RepeatWrapping;la[l.id]=k.createPattern(l.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");l.needsUpdate=!1}f(la[l.id]);var p=l.offset.x/l.repeat.x,r=l.offset.y/l.repeat.y,s=l.image.width*l.repeat.x,u=l.image.height*l.repeat.y,h=(h+p)*s,i=(i+r)*u,j=(j+p)*s,
-m=(m+r)*u,o=(o+p)*s,n=(n+r)*u;c-=a;d-=b;e-=a;g-=b;j-=h;m-=i;o-=h;n-=i;p=j*n-o*m;if(p==0){if(fa[l.id]==void 0)b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,a=b.getContext("2d"),a.drawImage(l.image,0,0),fa[l.id]=a.getImageData(0,0,l.image.width,l.image.height).data,delete b;b=fa[l.id];h=(Math.floor(h)+Math.floor(i)*l.image.width)*4;t.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ia(t)}else p=1/p,l=(n*c-m*e)*p,m=(n*d-m*g)*p,c=(j*e-o*c)*p,d=(j*g-o*d)*p,a=a-l*h-c*i,h=b-m*h-
-d*i,k.save(),k.transform(l,m,c,d,a,h),k.fill(),k.restore()}}function oa(a,b,c,d,e,f,g,h,i,j,l,m,o){var n,p;n=o.width-1;p=o.height-1;g*=n;h*=p;i*=n;j*=p;l*=n;m*=p;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;p=1/(i*m-l*j);n=(m*c-j*e)*p;j=(m*d-j*f)*p;c=(i*e-l*c)*p;d=(i*f-l*d)*p;a=a-n*g-c*h;b=b-j*g-d*h;k.save();k.transform(n,j,c,d,a,b);k.clip();k.drawImage(o,0,0);k.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*
-255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ba[0]=e<0?0:e>255?255:e;ba[1]=f<0?0:f>255?255:f;ba[2]=a<0?0:a>255?255:a;ba[4]=g<0?0:g>255?255:g;ba[5]=h<0?0:h>255?255:h;ba[6]=b<0?0:b>255?255:b;ba[8]=i<0?0:i>255?255:i;ba[9]=j<0?0:j>255?255:j;ba[10]=c<0?0:c>255?255:c;ba[12]=k<0?0:k>255?255:k;ba[13]=l<0?0:l>255?255:l;ba[14]=d<0?0:d>255?255:d;ra.putImageData(za,0,0);va.drawImage(qa,0,0);return sa}function na(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function pa(a){a=(a+1)*0.5;return a<0?0:a>
-1?1:a}function ka(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 xa,Ha,U,ca;this.autoClear?this.clear():k.setTransform(1,0,0,-1,o,p);e.info.render.vertices=0;e.info.render.faces=0;g=l.projectScene(a,j,this.sortElements);h=g.elements;m=g.lights;(ya=m.length>0)&&i(m);xa=0;for(Ha=h.length;xa<Ha;xa++)if(U=h[xa],ca=U.material,ca=ca instanceof THREE.MeshFaceMaterial?U.faceMaterial:ca,!(ca==null||ca.opacity==0)){X.empty();if(U instanceof THREE.RenderableParticle)u=
-U,u.x*=o,u.y*=p,s(u,U,ca,a);else if(U instanceof THREE.RenderableLine)u=U.v1,r=U.v2,u.positionScreen.x*=o,u.positionScreen.y*=p,r.positionScreen.x*=o,r.positionScreen.y*=p,X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),ma.intersects(X)&&w(u,r,U,ca,a);else if(U instanceof THREE.RenderableFace3)u=U.v1,r=U.v2,E=U.v3,u.positionScreen.x*=o,u.positionScreen.y*=p,r.positionScreen.x*=o,r.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=p,ca.overdraw&&
-(ka(u.positionScreen,r.positionScreen),ka(r.positionScreen,E.positionScreen),ka(E.positionScreen,u.positionScreen)),X.add3Points(u.positionScreen.x,u.positionScreen.y,r.positionScreen.x,r.positionScreen.y,E.positionScreen.x,E.positionScreen.y),ma.intersects(X)&&C(u,r,E,0,1,2,U,ca,a);else if(U instanceof THREE.RenderableFace4)u=U.v1,r=U.v2,E=U.v3,N=U.v4,u.positionScreen.x*=o,u.positionScreen.y*=p,r.positionScreen.x*=o,r.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=p,N.positionScreen.x*=
-o,N.positionScreen.y*=p,W.positionScreen.copy(r.positionScreen),da.positionScreen.copy(N.positionScreen),ca.overdraw&&(ka(u.positionScreen,r.positionScreen),ka(r.positionScreen,N.positionScreen),ka(N.positionScreen,u.positionScreen),ka(E.positionScreen,W.positionScreen),ka(E.positionScreen,da.positionScreen)),X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),X.addPoint(E.positionScreen.x,E.positionScreen.y),X.addPoint(N.positionScreen.x,N.positionScreen.y),
-ma.intersects(X)&&Q(u,r,E,N,W,da,U,ca,a);Z.addRectangle(X)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+g instanceof THREE.DirectionalLight?(k=g.matrixWorld.getPosition(),j=c.dot(k),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(k=g.matrixWorld.getPosition(),j=c.dot(T.sub(k,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(k)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function r(a,e,g){b(g.opacity);c(g.blending);var h,j,i,m,p,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)m=g.map.image,p=m.width>>1,n=m.height>>
+1,g=e.scale.x*o,i=e.scale.y*q,h=g*p,j=i*n,X.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(X)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-i),k.translate(-p,-n),k.drawImage(m,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*o,j=e.scale.y*q,X.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(X)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,j),g.program(k),k.restore()))}function v(a,e,
+f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!=a)k.lineWidth=F=a;a=g.linecap;if(y!=a)k.lineCap=y=a;a=g.linejoin;if(D!=a)k.lineJoin=D=a;d(g.color.getContextStyle());k.stroke();X.inflate(g.linewidth*2)}}function C(a,d,f,g,h,k,i,p){e.info.render.vertices+=3;e.info.render.faces++;b(p.opacity);c(p.blending);H=a.positionScreen.x;I=a.positionScreen.y;
+G=d.positionScreen.x;Y=d.positionScreen.y;L=f.positionScreen.x;B=f.positionScreen.y;K(H,I,G,Y,L,B);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ba=i.uvs[0],Aa(H,I,G,Y,L,B,ba[g].u,ba[g].v,ba[h].u,ba[h].v,ba[k].u,ba[k].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,T.copy(i.vertexNormalsWorld[g]),Ba=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ca=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[h]),
+Da=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ea=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[k]),Fa=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ga=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,Aa(H,I,G,Y,L,B,Ba,Ca,Da,Ea,Fa,Ga,p.envMap)}else p.wireframe?ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ba=i.uvs[0],Aa(H,I,G,Y,L,B,ba[g].u,ba[g].v,
+ba[h].u,ba[h].v,ba[k].u,ba[k].v,p.map)),c(THREE.SubtractiveBlending)),ya?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(z.r=w.r=x.r=$.r,z.g=w.g=x.g=$.g,z.b=w.b=x.b=$.b,n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],z),n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],w),n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],x),z.r=Math.max(0,Math.min(p.color.r*z.r,1)),z.g=Math.max(0,Math.min(p.color.g*z.g,1)),z.b=Math.max(0,Math.min(p.color.b*z.b,1)),w.r=Math.max(0,Math.min(p.color.r*
+w.r,1)),w.g=Math.max(0,Math.min(p.color.g*w.g,1)),w.b=Math.max(0,Math.min(p.color.b*w.b,1)),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),M.r=(w.r+x.r)*0.5,M.g=(w.g+x.g)*0.5,M.b=(w.b+x.b)*0.5,ea=wa(z,w,x,M),oa(H,I,G,Y,L,B,0,0,1,0,0,1,ea)):(s.r=$.r,s.g=$.g,s.b=$.b,n(m,i.centroidWorld,i.normalWorld,s),s.r=Math.max(0,Math.min(p.color.r*s.r,1)),s.g=Math.max(0,Math.min(p.color.g*s.g,1)),s.b=Math.max(0,Math.min(p.color.b*s.b,
+1)),p.wireframe?ja(s,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(s)):p.wireframe?ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshDepthMaterial)ga=j.near,ha=j.far,z.r=z.g=z.b=1-na(a.positionScreen.z,ga,ha),w.r=w.g=w.b=1-na(d.positionScreen.z,ga,ha),x.r=x.g=x.b=1-na(f.positionScreen.z,ga,ha),M.r=(w.r+x.r)*0.5,M.g=(w.g+x.g)*0.5,M.b=(w.b+x.b)*0.5,ea=wa(z,w,x,M),oa(H,I,G,Y,L,B,0,0,1,0,0,1,ea);else if(p instanceof THREE.MeshNormalMaterial)s.r=
+pa(i.normalWorld.x),s.g=pa(i.normalWorld.y),s.b=pa(i.normalWorld.z),p.wireframe?ja(s,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(s)}function Q(a,d,f,g,h,k,i,p,o){e.info.render.vertices+=4;e.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)C(a,d,g,0,1,3,i,p,o),C(h,f,k,1,2,3,i,p,o);else if(H=a.positionScreen.x,I=a.positionScreen.y,G=d.positionScreen.x,Y=d.positionScreen.y,L=f.positionScreen.x,B=f.positionScreen.y,S=g.positionScreen.x,u=g.positionScreen.y,R=h.positionScreen.x,
+P=h.positionScreen.y,W=k.positionScreen.x,J=k.positionScreen.y,p instanceof THREE.MeshBasicMaterial)O(H,I,G,Y,L,B,S,u),p.wireframe?ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color);else if(p instanceof THREE.MeshLambertMaterial)ya?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(z.r=w.r=x.r=M.r=$.r,z.g=w.g=x.g=M.g=$.g,z.b=w.b=x.b=M.b=$.b,n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],z),n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],w),
+n(m,i.v4.positionWorld,i.vertexNormalsWorld[3],x),n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],M),z.r=Math.max(0,Math.min(p.color.r*z.r,1)),z.g=Math.max(0,Math.min(p.color.g*z.g,1)),z.b=Math.max(0,Math.min(p.color.b*z.b,1)),w.r=Math.max(0,Math.min(p.color.r*w.r,1)),w.g=Math.max(0,Math.min(p.color.g*w.g,1)),w.b=Math.max(0,Math.min(p.color.b*w.b,1)),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),M.r=Math.max(0,Math.min(p.color.r*
+M.r,1)),M.g=Math.max(0,Math.min(p.color.g*M.g,1)),M.b=Math.max(0,Math.min(p.color.b*M.b,1)),ea=wa(z,w,x,M),K(H,I,G,Y,S,u),oa(H,I,G,Y,S,u,0,0,1,0,0,1,ea),K(R,P,L,B,W,J),oa(R,P,L,B,W,J,1,0,1,1,0,1,ea)):(s.r=$.r,s.g=$.g,s.b=$.b,n(m,i.centroidWorld,i.normalWorld,s),s.r=Math.max(0,Math.min(p.color.r*s.r,1)),s.g=Math.max(0,Math.min(p.color.g*s.g,1)),s.b=Math.max(0,Math.min(p.color.b*s.b,1)),O(H,I,G,Y,L,B,S,u),p.wireframe?ja(s,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(s)):(O(H,I,G,
+Y,L,B,S,u),p.wireframe?ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(p.color));else if(p instanceof THREE.MeshNormalMaterial)s.r=pa(i.normalWorld.x),s.g=pa(i.normalWorld.y),s.b=pa(i.normalWorld.z),O(H,I,G,Y,L,B,S,u),p.wireframe?ja(s,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ia(s);else if(p instanceof THREE.MeshDepthMaterial)ga=j.near,ha=j.far,z.r=z.g=z.b=1-na(a.positionScreen.z,ga,ha),w.r=w.g=w.b=1-na(d.positionScreen.z,ga,ha),x.r=x.g=x.b=1-na(g.positionScreen.z,
+ga,ha),M.r=M.g=M.b=1-na(f.positionScreen.z,ga,ha),ea=wa(z,w,x,M),K(H,I,G,Y,S,u),oa(H,I,G,Y,S,u,0,0,1,0,0,1,ea),K(R,P,L,B,W,J),oa(R,P,L,B,W,J,1,0,1,1,0,1,ea)}function K(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function O(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ja(a,b,c,e){if(F!=b)k.lineWidth=F=b;if(y!=c)k.lineCap=y=c;if(D!=e)k.lineJoin=D=e;d(a.getContextStyle());
+k.stroke();X.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function Aa(a,b,c,d,e,g,h,i,j,m,o,n,l){if(l.image.width!=0){if(l.needsUpdate==!0||la[l.id]==void 0){var q=l.wrapS==THREE.RepeatWrapping,r=l.wrapT==THREE.RepeatWrapping;la[l.id]=k.createPattern(l.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");l.needsUpdate=!1}f(la[l.id]);var q=l.offset.x/l.repeat.x,r=l.offset.y/l.repeat.y,t=l.image.width*l.repeat.x,u=l.image.height*l.repeat.y,h=(h+q)*t,i=(i+r)*u,j=(j+q)*t,
+m=(m+r)*u,o=(o+q)*t,n=(n+r)*u;c-=a;d-=b;e-=a;g-=b;j-=h;m-=i;o-=h;n-=i;q=j*n-o*m;if(q==0){if(fa[l.id]==void 0)b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,a=b.getContext("2d"),a.drawImage(l.image,0,0),fa[l.id]=a.getImageData(0,0,l.image.width,l.image.height).data,delete b;b=fa[l.id];h=(Math.floor(h)+Math.floor(i)*l.image.width)*4;s.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ia(s)}else q=1/q,l=(n*c-m*e)*q,m=(n*d-m*g)*q,c=(j*e-o*c)*q,d=(j*g-o*d)*q,a=a-l*h-c*i,h=b-m*h-
+d*i,k.save(),k.transform(l,m,c,d,a,h),k.fill(),k.restore()}}function oa(a,b,c,d,e,f,g,h,i,j,l,m,o){var n,q;n=o.width-1;q=o.height-1;g*=n;h*=q;i*=n;j*=q;l*=n;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;q=1/(i*m-l*j);n=(m*c-j*e)*q;j=(m*d-j*f)*q;c=(i*e-l*c)*q;d=(i*f-l*d)*q;a=a-n*g-c*h;b=b-j*g-d*h;k.save();k.transform(n,j,c,d,a,b);k.clip();k.drawImage(o,0,0);k.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*
+255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ca[0]=e<0?0:e>255?255:e;ca[1]=f<0?0:f>255?255:f;ca[2]=a<0?0:a>255?255:a;ca[4]=g<0?0:g>255?255:g;ca[5]=h<0?0:h>255?255:h;ca[6]=b<0?0:b>255?255:b;ca[8]=i<0?0:i>255?255:i;ca[9]=j<0?0:j>255?255:j;ca[10]=c<0?0:c>255?255:c;ca[12]=k<0?0:k>255?255:k;ca[13]=l<0?0:l>255?255:l;ca[14]=d<0?0:d>255?255:d;ra.putImageData(za,0,0);va.drawImage(qa,0,0);return sa}function na(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function pa(a){a=(a+1)*0.5;return a<0?0:a>
+1?1:a}function ka(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 xa,Ha,U,da;this.autoClear?this.clear():k.setTransform(1,0,0,-1,o,q);e.info.render.vertices=0;e.info.render.faces=0;g=l.projectScene(a,j,this.sortElements);h=g.elements;m=g.lights;(ya=m.length>0)&&i(m);xa=0;for(Ha=h.length;xa<Ha;xa++)if(U=h[xa],da=U.material,da=da instanceof THREE.MeshFaceMaterial?U.faceMaterial:da,!(da==null||da.opacity==0)){X.empty();if(U instanceof THREE.RenderableParticle)t=
+U,t.x*=o,t.y*=q,r(t,U,da,a);else if(U instanceof THREE.RenderableLine)t=U.v1,A=U.v2,t.positionScreen.x*=o,t.positionScreen.y*=q,A.positionScreen.x*=o,A.positionScreen.y*=q,X.addPoint(t.positionScreen.x,t.positionScreen.y),X.addPoint(A.positionScreen.x,A.positionScreen.y),ma.intersects(X)&&v(t,A,U,da,a);else if(U instanceof THREE.RenderableFace3)t=U.v1,A=U.v2,E=U.v3,t.positionScreen.x*=o,t.positionScreen.y*=q,A.positionScreen.x*=o,A.positionScreen.y*=q,E.positionScreen.x*=o,E.positionScreen.y*=q,da.overdraw&&
+(ka(t.positionScreen,A.positionScreen),ka(A.positionScreen,E.positionScreen),ka(E.positionScreen,t.positionScreen)),X.add3Points(t.positionScreen.x,t.positionScreen.y,A.positionScreen.x,A.positionScreen.y,E.positionScreen.x,E.positionScreen.y),ma.intersects(X)&&C(t,A,E,0,1,2,U,da,a);else if(U instanceof THREE.RenderableFace4)t=U.v1,A=U.v2,E=U.v3,N=U.v4,t.positionScreen.x*=o,t.positionScreen.y*=q,A.positionScreen.x*=o,A.positionScreen.y*=q,E.positionScreen.x*=o,E.positionScreen.y*=q,N.positionScreen.x*=
+o,N.positionScreen.y*=q,aa.positionScreen.copy(A.positionScreen),V.positionScreen.copy(N.positionScreen),da.overdraw&&(ka(t.positionScreen,A.positionScreen),ka(A.positionScreen,N.positionScreen),ka(N.positionScreen,t.positionScreen),ka(E.positionScreen,aa.positionScreen),ka(E.positionScreen,V.positionScreen)),X.addPoint(t.positionScreen.x,t.positionScreen.y),X.addPoint(A.positionScreen.x,A.positionScreen.y),X.addPoint(E.positionScreen.x,E.positionScreen.y),X.addPoint(N.positionScreen.x,N.positionScreen.y),
+ma.intersects(X)&&Q(t,A,E,N,aa,V,U,da,a);Z.addRectangle(X)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};

+ 20 - 22
build/custom/ThreeDOM.js

@@ -14,11 +14,11 @@ 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-
 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}};
-THREE.Ray=function(a,b){function c(a,b,c){i.sub(c,a);p=i.dot(b);if(p<=0)return null;o=l.add(a,n.copy(b).multiplyScalar(p));return r=c.distanceTo(o)}function d(a,b,c,d){i.sub(d,b);l.sub(c,b);n.sub(a,b);I=i.dot(i);u=i.dot(l);D=i.dot(n);J=l.dot(l);s=l.dot(n);A=1/(I*J-u*u);t=(J*D-u*s)*A;w=(I*s-u*D)*A;return t>=0&&w>=0&&t+w<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,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(i){for(var l,n=[],o=0,P=i.children.length;o<P;o++)Array.prototype.push.apply(n,this.intersectObject(i.children[o]));if(i instanceof THREE.Particle){o=
-c(this.origin,this.direction,i.matrixWorld.getPosition());if(o===null||o>i.scale.x)return[];l={distance:o,point:i.position,face:null,object:i};n.push(l)}else if(i instanceof THREE.Mesh){o=c(this.origin,this.direction,i.matrixWorld.getPosition());if(o===null||o>i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)))return n;var E,p=i.geometry,M=p.vertices,K;i.matrixRotationWorld.extractRotation(i.matrixWorld);o=0;for(P=p.faces.length;o<P;o++)if(l=p.faces[o],a.copy(this.origin),
-b.copy(this.direction),K=i.matrixWorld,k=K.multiplyVector3(k.copy(l.centroid)).subSelf(a),E=k.dot(b),!(E<=0)&&(e=K.multiplyVector3(e.copy(M[l.a].position)),f=K.multiplyVector3(f.copy(M[l.b].position)),g=K.multiplyVector3(g.copy(M[l.c].position)),l instanceof THREE.Face4&&(h=K.multiplyVector3(h.copy(M[l.d].position))),m=i.matrixRotationWorld.multiplyVector3(m.copy(l.normal)),E=b.dot(m),i.doubleSided||(i.flipSided?E>0:E<0)))if(E=m.dot(k.sub(e,a))/E,j.add(a,b.multiplyScalar(E)),l instanceof THREE.Face3)d(j,
-e,f,g)&&(l={distance:a.distanceTo(j),point:j.clone(),face:l,object:i},n.push(l));else if(l instanceof THREE.Face4&&(d(j,e,f,h)||d(j,f,g,h)))l={distance:a.distanceTo(j),point:j.clone(),face:l,object:i},n.push(l)}return n};var i=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,p,o,r,I,u,D,J,s,A,t,w};
+THREE.Ray=function(a,b){function c(a,b,c){i.sub(c,a);p=i.dot(b);if(p<=0)return null;o=l.add(a,n.copy(b).multiplyScalar(p));return q=c.distanceTo(o)}function d(a,b,c,d){i.sub(d,b);l.sub(c,b);n.sub(a,b);H=i.dot(i);u=i.dot(l);C=i.dot(n);I=l.dot(l);s=l.dot(n);A=1/(H*I-u*u);t=(I*C-u*s)*A;w=(H*s-u*C)*A;return t>=0&&w>=0&&t+w<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,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(i){for(var l,n=[],o=0,N=i.children.length;o<N;o++)Array.prototype.push.apply(n,this.intersectObject(i.children[o]));if(i instanceof THREE.Particle){o=
+c(this.origin,this.direction,i.matrixWorld.getPosition());if(o===null||o>i.scale.x)return[];l={distance:o,point:i.position,face:null,object:i};n.push(l)}else if(i instanceof THREE.Mesh){o=c(this.origin,this.direction,i.matrixWorld.getPosition());if(o===null||o>i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)))return n;var D,p=i.geometry,K=p.vertices,q;i.matrixRotationWorld.extractRotation(i.matrixWorld);o=0;for(N=p.faces.length;o<N;o++)if(l=p.faces[o],a.copy(this.origin),
+b.copy(this.direction),q=i.matrixWorld,k=q.multiplyVector3(k.copy(l.centroid)).subSelf(a),D=k.dot(b),!(D<=0)&&(e=q.multiplyVector3(e.copy(K[l.a].position)),f=q.multiplyVector3(f.copy(K[l.b].position)),g=q.multiplyVector3(g.copy(K[l.c].position)),l instanceof THREE.Face4&&(h=q.multiplyVector3(h.copy(K[l.d].position))),m=i.matrixRotationWorld.multiplyVector3(m.copy(l.normal)),D=b.dot(m),i.doubleSided||(i.flipSided?D>0:D<0)))if(D=m.dot(k.sub(e,a))/D,j.add(a,b.multiplyScalar(D)),l instanceof THREE.Face3)d(j,
+e,f,g)&&(l={distance:a.distanceTo(j),point:j.clone(),face:l,object:i},n.push(l));else if(l instanceof THREE.Face4&&(d(j,e,f,h)||d(j,f,g,h)))l={distance:a.distanceTo(j),point:j.clone(),face:l,object:i},n.push(l)}return n};var i=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,p,o,q,H,u,C,I,s,A,t,w};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,f,g,i){h=!1;b=k;c=f;d=g;e=i;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
 function(f,g,j,i,l,n){h?(h=!1,b=f<j?f<l?f:l:j<l?j:l,c=g<i?g<n?g:n:i<n?i:n,d=f>j?f>l?f:l:j>l?j:l,e=g>i?g>n?g:n:i>n?i:n):(b=f<j?f<l?f<b?f:b:l<b?l:b:j<l?j<b?j:b:l<b?l:b,c=g<i?g<n?g<c?g:c:n<c?n:c:i<n?i<c?i:c:n<c?n:c,d=f>j?f>l?f>d?f:d:l>d?l:d:j>l?j>d?j:d:l>d?l:d,e=g>i?g>n?g>e?g:e:n>e?n:e:i>n?i>e?i:e:n>e?n:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
 f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=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();e=e<f.getBottom()?e:f.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}};
@@ -26,9 +26,9 @@ THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b
 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,f,g,h,k,m,j,i,l,n,p,o){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,k||0,m||0,j!==void 0?j:1,i||0,l||0,n||0,p||0,o!==void 0?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,m,j,i,l,n,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=k;this.n32=m;this.n33=j;this.n34=i;this.n41=l;this.n42=n;this.n43=p;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();d.length()===0&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,k=a.n23,m=a.n24,j=a.n31,i=a.n32,l=a.n33,n=a.n34,p=a.n41,o=a.n42,r=a.n43,
-I=a.n44,u=b.n11,D=b.n12,J=b.n13,s=b.n14,A=b.n21,t=b.n22,w=b.n23,O=b.n24,z=b.n31,G=b.n32,H=b.n33,P=b.n34,E=b.n41,S=b.n42,M=b.n43,K=b.n44;this.n11=c*u+d*A+e*z+f*E;this.n12=c*D+d*t+e*G+f*S;this.n13=c*J+d*w+e*H+f*M;this.n14=c*s+d*O+e*P+f*K;this.n21=g*u+h*A+k*z+m*E;this.n22=g*D+h*t+k*G+m*S;this.n23=g*J+h*w+k*H+m*M;this.n24=g*s+h*O+k*P+m*K;this.n31=j*u+i*A+l*z+n*E;this.n32=j*D+i*t+l*G+n*S;this.n33=j*J+i*w+l*H+n*M;this.n34=j*s+i*O+l*P+n*K;this.n41=p*u+o*A+r*z+I*E;this.n42=p*D+o*t+r*G+I*S;this.n43=p*J+o*
-w+r*H+I*M;this.n44=p*s+o*O+r*P+I*K;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*=
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();d.length()===0&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,k=a.n23,m=a.n24,j=a.n31,i=a.n32,l=a.n33,n=a.n34,p=a.n41,o=a.n42,q=a.n43,
+H=a.n44,u=b.n11,C=b.n12,I=b.n13,s=b.n14,A=b.n21,t=b.n22,w=b.n23,M=b.n24,O=b.n31,F=b.n32,G=b.n33,N=b.n34,D=b.n41,R=b.n42,K=b.n43,S=b.n44;this.n11=c*u+d*A+e*O+f*D;this.n12=c*C+d*t+e*F+f*R;this.n13=c*I+d*w+e*G+f*K;this.n14=c*s+d*M+e*N+f*S;this.n21=g*u+h*A+k*O+m*D;this.n22=g*C+h*t+k*F+m*R;this.n23=g*I+h*w+k*G+m*K;this.n24=g*s+h*M+k*N+m*S;this.n31=j*u+i*A+l*O+n*D;this.n32=j*C+i*t+l*F+n*R;this.n33=j*I+i*w+l*G+n*K;this.n34=j*s+i*M+l*N+n*S;this.n41=p*u+o*A+q*O+H*D;this.n42=p*C+o*t+q*F+H*R;this.n43=p*I+o*
+w+q*G+H*K;this.n44=p*s+o*M+q*N+H*S;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*
 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,f=this.n22,g=this.n23,h=this.n24,k=this.n31,m=this.n32,j=this.n33,i=this.n34,l=this.n41,n=this.n42,p=this.n43,o=this.n44;return d*g*m*l-c*h*m*l-d*f*j*l+b*h*j*l+c*f*i*l-b*g*i*l-d*g*k*n+c*h*k*n+d*e*j*n-a*h*j*n-c*e*i*n+a*g*i*n+d*f*k*p-b*h*k*p-d*e*m*p+a*h*m*p+b*e*i*p-a*f*i*p-c*f*k*o+b*g*k*o+c*e*m*o-a*g*m*o-b*e*j*o+a*f*j*o},transpose:function(){var a;
@@ -37,8 +37,8 @@ a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11
 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),e=1-c,f=a.x,g=a.y,h=a.z,k=e*f,m=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,m*g+c,m*h-d*f,0,k*h-d*g,m*h+d*f,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,f=a.n21,g=a.n22,h=a.n23,k=a.n24,m=a.n31,j=a.n32,i=a.n33,l=a.n34,n=a.n41,p=a.n42,o=a.n43,r=a.n44;this.n11=h*l*p-k*i*p+k*j*o-g*l*o-h*j*r+g*i*r;this.n12=e*i*p-d*l*p-e*j*o+c*l*o+d*j*r-c*i*r;this.n13=d*k*p-e*h*p+e*g*o-c*k*o-d*g*r+c*h*r;this.n14=e*h*j-d*k*j-e*g*i+c*k*i+d*g*l-c*h*l;this.n21=k*i*n-h*l*n-k*m*o+f*l*o+h*m*r-f*i*r;this.n22=d*l*n-e*i*n+
-e*m*o-b*l*o-d*m*r+b*i*r;this.n23=e*h*n-d*k*n-e*f*o+b*k*o+d*f*r-b*h*r;this.n24=d*k*m-e*h*m+e*f*i-b*k*i-d*f*l+b*h*l;this.n31=g*l*n-k*j*n+k*m*p-f*l*p-g*m*r+f*j*r;this.n32=e*j*n-c*l*n-e*m*p+b*l*p+c*m*r-b*j*r;this.n33=d*k*n-e*g*n+e*f*p-b*k*p-c*f*r+b*g*r;this.n34=e*g*m-c*k*m-e*f*j+b*k*j+c*f*l-b*g*l;this.n41=h*j*n-g*i*n-h*m*p+f*i*p+g*m*o-f*j*o;this.n42=c*i*n-d*j*n+d*m*p-b*i*p-c*m*o+b*j*o;this.n43=d*g*n-c*h*n-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*m-d*g*m+d*f*j-b*h*j-c*f*i+b*g*i;this.multiplyScalar(1/a.determinant());
+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,f=a.n21,g=a.n22,h=a.n23,k=a.n24,m=a.n31,j=a.n32,i=a.n33,l=a.n34,n=a.n41,p=a.n42,o=a.n43,q=a.n44;this.n11=h*l*p-k*i*p+k*j*o-g*l*o-h*j*q+g*i*q;this.n12=e*i*p-d*l*p-e*j*o+c*l*o+d*j*q-c*i*q;this.n13=d*k*p-e*h*p+e*g*o-c*k*o-d*g*q+c*h*q;this.n14=e*h*j-d*k*j-e*g*i+c*k*i+d*g*l-c*h*l;this.n21=k*i*n-h*l*n-k*m*o+f*l*o+h*m*q-f*i*q;this.n22=d*l*n-e*i*n+
+e*m*o-b*l*o-d*m*q+b*i*q;this.n23=e*h*n-d*k*n-e*f*o+b*k*o+d*f*q-b*h*q;this.n24=d*k*m-e*h*m+e*f*i-b*k*i-d*f*l+b*h*l;this.n31=g*l*n-k*j*n+k*m*p-f*l*p-g*m*q+f*j*q;this.n32=e*j*n-c*l*n-e*m*p+b*l*p+c*m*q-b*j*q;this.n33=d*k*n-e*g*n+e*f*p-b*k*p-c*f*q+b*g*q;this.n34=e*g*m-c*k*m-e*f*j+b*k*j+c*f*l-b*g*l;this.n41=h*j*n-g*i*n-h*m*p+f*i*p+g*m*o-f*j*o;this.n42=c*i*n-d*j*n+d*m*p-b*i*p-c*m*o+b*j*o;this.n43=d*g*n-c*h*n-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*m-d*g*m+d*f*j-b*h*j-c*f*i+b*g*i;this.multiplyScalar(1/a.determinant());
 return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=g*h,m=g*e,j=d*h,i=d*e;this.n11=k+i*c;this.n12=j*c-m;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=m*c-j;this.n32=i+k*c;this.n33=f*g;break;case "ZXY":k=g*h;m=g*e;j=d*h;i=d*e;this.n11=k-i*c;this.n12=-f*e;this.n13=j+m*c;this.n21=m+j*c;this.n22=f*h;this.n23=i-k*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":k=
 f*h;m=f*e;j=c*h;i=c*e;this.n11=g*h;this.n12=j*d-m;this.n13=k*d+i;this.n21=g*e;this.n22=i*d+k;this.n23=m*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":k=f*g;m=f*d;j=c*g;i=c*d;this.n11=g*h;this.n12=i-k*e;this.n13=j*e+m;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=m*e+j;this.n33=k-i*e;break;case "XZY":k=f*g;m=f*d;j=c*g;i=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=k*e+i;this.n22=f*h;this.n23=m*e-j;this.n31=j*e-m;this.n32=c*h;this.n33=i*e+k;break;default:k=f*h,m=f*
 e,j=c*h,i=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=m+j*d,this.n22=k-i*d,this.n23=-c*g,this.n31=i-k*d,this.n32=j+m*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,k=b*g;b*=h;var m=c*g;c*=h;d*=h;f*=e;g*=e;e*=h;this.n11=1-(m+d);this.n12=k-e;this.n13=b+g;this.n21=k+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;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*=
@@ -55,18 +55,16 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 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;
 THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=m[k]=m[k]||new THREE.RenderableVertex;k++;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 e,f,g=[],h,k,m=[],
-j,i,l=[],n,p=[],o,r,I=[],u,D,J=[],s={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,t=new THREE.Vector4,w=new THREE.Matrix4,O=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,H=new THREE.Vector4;this.computeFrustum=function(a){z[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);z[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);z[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);z[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);z[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);z[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=z[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);w.multiply(b.projectionMatrix,b.matrixWorldInverse);w.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-w.multiply(b.matrixWorld,b.projectionMatrixInverse);w.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;s.objects.length=0;s.sprites.length=0;s.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=z[h].x*d.n14+z[h].y*d.n24+z[h].z*d.n34+z[h].w,c<=f){c=!1;break a}c=!0}c?(w.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,s.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(w.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,s.sprites.push(e)):b instanceof THREE.Light&&s.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-s.objects.sort(c);return s};this.projectScene=function(a,e,f){var g=e.near,z=e.far,A,L,y,F,q,B,x,C,v,N,Q,T,W,U,V,R;D=r=n=i=0;s.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);w.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(w);s=this.projectGraph(a,!1);a=0;for(A=s.objects.length;a<A;a++)if(v=s.objects[a].object,N=v.matrixWorld,T=
-v.material,k=0,v instanceof THREE.Mesh){Q=v.geometry;W=v.geometry.materials;F=Q.vertices;U=Q.faces;V=Q.faceVertexUvs;Q=v.matrixRotationWorld.extractRotation(N);L=0;for(y=F.length;L<y;L++)h=b(),h.positionWorld.copy(F[L].position),N.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),w.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<z;F=0;for(L=U.length;F<L;F++){y=U[F];
-if(y instanceof THREE.Face3)if(q=m[y.a],B=m[y.b],x=m[y.c],q.visible&&B.visible&&x.visible&&(v.doubleSided||v.flipSided!=(x.positionScreen.x-q.positionScreen.x)*(B.positionScreen.y-q.positionScreen.y)-(x.positionScreen.y-q.positionScreen.y)*(B.positionScreen.x-q.positionScreen.x)<0))C=l[i]=l[i]||new THREE.RenderableFace3,i++,j=C,j.v1.copy(q),j.v2.copy(B),j.v3.copy(x);else continue;else if(y instanceof THREE.Face4)if(q=m[y.a],B=m[y.b],x=m[y.c],C=m[y.d],q.visible&&B.visible&&x.visible&&C.visible&&(v.doubleSided||
-v.flipSided!=((C.positionScreen.x-q.positionScreen.x)*(B.positionScreen.y-q.positionScreen.y)-(C.positionScreen.y-q.positionScreen.y)*(B.positionScreen.x-q.positionScreen.x)<0||(B.positionScreen.x-x.positionScreen.x)*(C.positionScreen.y-x.positionScreen.y)-(B.positionScreen.y-x.positionScreen.y)*(C.positionScreen.x-x.positionScreen.x)<0)))R=p[n]=p[n]||new THREE.RenderableFace4,n++,j=R,j.v1.copy(q),j.v2.copy(B),j.v3.copy(x),j.v4.copy(C);else continue;j.normalWorld.copy(y.normal);Q.multiplyVector3(j.normalWorld);
-j.centroidWorld.copy(y.centroid);N.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);w.multiplyVector3(j.centroidScreen);x=y.vertexNormals;q=0;for(B=x.length;q<B;q++)C=j.vertexNormalsWorld[q],C.copy(x[q]),Q.multiplyVector3(C);q=0;for(B=V.length;q<B;q++)if(R=V[q][F]){x=0;for(C=R.length;x<C;x++)j.uvs[q][x]=R[x]}j.material=T;j.faceMaterial=y.materialIndex!==null?W[y.materialIndex]:null;j.z=j.centroidScreen.z;s.elements.push(j)}}else if(v instanceof THREE.Line){O.multiply(w,N);F=
-v.geometry.vertices;q=b();q.positionScreen.copy(F[0].position);O.multiplyVector4(q.positionScreen);L=1;for(y=F.length;L<y;L++)if(q=b(),q.positionScreen.copy(F[L].position),O.multiplyVector4(q.positionScreen),B=m[k-2],G.copy(q.positionScreen),H.copy(B.positionScreen),d(G,H))G.multiplyScalar(1/G.w),H.multiplyScalar(1/H.w),v=I[r]=I[r]||new THREE.RenderableLine,r++,o=v,o.v1.positionScreen.copy(G),o.v2.positionScreen.copy(H),o.z=Math.max(G.z,H.z),o.material=T,s.elements.push(o)}a=0;for(A=s.sprites.length;a<
-A;a++)if(v=s.sprites[a].object,N=v.matrixWorld,v instanceof THREE.Particle&&(t.set(N.n14,N.n24,N.n34,1),w.multiplyVector4(t),t.z/=t.w,t.z>0&&t.z<1))g=J[D]=J[D]||new THREE.RenderableParticle,D++,u=g,u.x=t.x/t.w,u.y=t.y/t.w,u.z=t.z,u.rotation=v.rotation.z,u.scale.x=v.scale.x*Math.abs(u.x-(t.x+e.projectionMatrix.n11)/(t.w+e.projectionMatrix.n14)),u.scale.y=v.scale.y*Math.abs(u.y-(t.y+e.projectionMatrix.n22)/(t.w+e.projectionMatrix.n24)),u.material=v.material,s.elements.push(u);f&&s.elements.sort(c);
-return s}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+j,i,l=[],n,p=[],o,q,H=[],u,C,I=[],s={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,t=new THREE.Vector4,w=new THREE.Matrix4,M=new THREE.Matrix4,O=new THREE.Frustum,F=new THREE.Vector4,G=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);w.multiply(b.projectionMatrix,b.matrixWorldInverse);w.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);w.multiply(b.matrixWorld,
+b.projectionMatrixInverse);w.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;s.objects.length=0;s.sprites.length=0;s.lights.length=0;var g=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||O.contains(b))?(w.multiplyVector3(A.copy(b.position)),e=a(),e.object=
+b,e.z=A.z,s.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(w.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,s.sprites.push(e)):b instanceof THREE.Light&&s.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&s.objects.sort(c);return s};this.projectScene=function(a,e,f){var g=e.near,A=e.far,T,J,y,E,r,z,x,B,v,L,P,U,X,V,W,Q;C=q=n=i=0;s.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);w.multiply(e.projectionMatrix,e.matrixWorldInverse);O.setFromMatrix(w);s=this.projectGraph(a,!1);a=0;for(T=s.objects.length;a<T;a++)if(v=s.objects[a].object,L=v.matrixWorld,U=v.material,k=0,v instanceof THREE.Mesh){P=v.geometry;X=v.geometry.materials;E=P.vertices;V=P.faces;W=P.faceVertexUvs;P=v.matrixRotationWorld.extractRotation(L);J=0;for(y=E.length;J<y;J++)h=b(),h.positionWorld.copy(E[J].position),L.multiplyVector3(h.positionWorld),
+h.positionScreen.copy(h.positionWorld),w.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<A;E=0;for(J=V.length;E<J;E++){y=V[E];if(y instanceof THREE.Face3)if(r=m[y.a],z=m[y.b],x=m[y.c],r.visible&&z.visible&&x.visible&&(v.doubleSided||v.flipSided!=(x.positionScreen.x-r.positionScreen.x)*(z.positionScreen.y-r.positionScreen.y)-(x.positionScreen.y-r.positionScreen.y)*(z.positionScreen.x-
+r.positionScreen.x)<0))B=l[i]=l[i]||new THREE.RenderableFace3,i++,j=B,j.v1.copy(r),j.v2.copy(z),j.v3.copy(x);else continue;else if(y instanceof THREE.Face4)if(r=m[y.a],z=m[y.b],x=m[y.c],B=m[y.d],r.visible&&z.visible&&x.visible&&B.visible&&(v.doubleSided||v.flipSided!=((B.positionScreen.x-r.positionScreen.x)*(z.positionScreen.y-r.positionScreen.y)-(B.positionScreen.y-r.positionScreen.y)*(z.positionScreen.x-r.positionScreen.x)<0||(z.positionScreen.x-x.positionScreen.x)*(B.positionScreen.y-x.positionScreen.y)-
+(z.positionScreen.y-x.positionScreen.y)*(B.positionScreen.x-x.positionScreen.x)<0)))Q=p[n]=p[n]||new THREE.RenderableFace4,n++,j=Q,j.v1.copy(r),j.v2.copy(z),j.v3.copy(x),j.v4.copy(B);else continue;j.normalWorld.copy(y.normal);P.multiplyVector3(j.normalWorld);j.centroidWorld.copy(y.centroid);L.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);w.multiplyVector3(j.centroidScreen);x=y.vertexNormals;r=0;for(z=x.length;r<z;r++)B=j.vertexNormalsWorld[r],B.copy(x[r]),P.multiplyVector3(B);
+r=0;for(z=W.length;r<z;r++)if(Q=W[r][E]){x=0;for(B=Q.length;x<B;x++)j.uvs[r][x]=Q[x]}j.material=U;j.faceMaterial=y.materialIndex!==null?X[y.materialIndex]:null;j.z=j.centroidScreen.z;s.elements.push(j)}}else if(v instanceof THREE.Line){M.multiply(w,L);E=v.geometry.vertices;r=b();r.positionScreen.copy(E[0].position);M.multiplyVector4(r.positionScreen);J=1;for(y=E.length;J<y;J++)if(r=b(),r.positionScreen.copy(E[J].position),M.multiplyVector4(r.positionScreen),z=m[k-2],F.copy(r.positionScreen),G.copy(z.positionScreen),
+d(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),v=H[q]=H[q]||new THREE.RenderableLine,q++,o=v,o.v1.positionScreen.copy(F),o.v2.positionScreen.copy(G),o.z=Math.max(F.z,G.z),o.material=U,s.elements.push(o)}a=0;for(T=s.sprites.length;a<T;a++)if(v=s.sprites[a].object,L=v.matrixWorld,v instanceof THREE.Particle&&(t.set(L.n14,L.n24,L.n34,1),w.multiplyVector4(t),t.z/=t.w,t.z>0&&t.z<1))g=I[C]=I[C]||new THREE.RenderableParticle,C++,u=g,u.x=t.x/t.w,u.y=t.y/t.w,u.z=t.z,u.rotation=v.rotation.z,u.scale.x=
+v.scale.x*Math.abs(u.x-(t.x+e.projectionMatrix.n11)/(t.w+e.projectionMatrix.n14)),u.scale.y=v.scale.y*Math.abs(u.y-(t.y+e.projectionMatrix.n22)/(t.w+e.projectionMatrix.n24)),u.material=v.material,s.elements.push(u);f&&s.elements.sort(c);return s}};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),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-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.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=

+ 116 - 117
build/custom/ThreeExtras.js

@@ -1,9 +1,9 @@
 // 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.__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,q=h.length;m<q;m++){var l=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(l.position);f.push(l)}m=
-0;for(q=k.length;m<q;m++){var f=k[m],p,n,s=f.vertexNormals,t=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=s.length;h<l;h++)n=s[h].clone(),d&&d.multiplyVector3(n),p.vertexNormals.push(n);p.color.copy(f.color);h=0;for(l=t.length;h<l;h++)n=t[h],p.vertexColors.push(n.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
-l=o[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)}m=0;for(q=r.length;m<q;m++){c=r[m];d=[];h=0;for(l=c.length;h<l;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={},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;
 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,
 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+
@@ -11,9 +11,9 @@ f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.random
 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();
 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]+
-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,q=j-1<0?d-1:j-1,l=(j+1)%d,p=[],n=[0,0,h[(r*d+j)*4]/255*b];p.push([-1,0,h[(r*d+q)*4]/255*b]);p.push([-1,-1,h[(o*d+q)*4]/255*b]);p.push([0,-1,h[(o*d+j)*4]/255*b]);p.push([1,-1,h[(o*d+l)*4]/255*b]);
-p.push([1,0,h[(r*d+l)*4]/255*b]);p.push([1,1,h[(m*d+l)*4]/255*b]);p.push([0,1,h[(m*d+j)*4]/255*b]);p.push([-1,1,h[(m*d+q)*4]/255*b]);o=[];q=p.length;for(m=0;m<q;m++){var l=p[m],s=p[(m+1)%q],l=[l[0]-n[0],l[1]-n[1],l[2]-n[2]],s=[s[0]-n[0],s[1]-n[1],s[2]-n[2]];o.push(c([l[1]*s[2]-l[2]*s[1],l[2]*s[0]-l[0]*s[2],l[0]*s[1]-l[1]*s[0]]))}p=[0,0,0];for(m=0;m<o.length;m++)p[0]+=o[m][0],p[1]+=o[m][1],p[2]+=o[m][2];p[0]/=o.length;p[1]/=o.length;p[2]/=o.length;n=(r*d+j)*4;k[n]=(p[0]+1)/2*255|0;k[n+1]=(p[1]+0.5)*
-255|0;k[n+2]=p[2]*255|0;k[n+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),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)*
+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),
 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,
@@ -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.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.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,r,o,m,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];r=g[0];o=g[1];c.length>0?(f=c[c.length-1],m=f.x,q=f.y):(f=this.actions[d-1].args,m=f[f.length-2],q=f[f.length-1]);for(f=1;f<=a;f++)l=f/a,g=THREE.Shape.Utils.b2(l,m,r,h),l=THREE.Shape.Utils.b2(l,q,o,
-i),c.push(new THREE.Vector2(g,l));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,q=f.y):(f=this.actions[d-1].args,m=f[f.length-2],q=f[f.length-1]);for(f=1;f<=a;f++)l=f/a,g=THREE.Shape.Utils.b3(l,m,r,k,h),l=THREE.Shape.Utils.b3(l,q,o,j,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];k=g[2];r=g[3];l=g[4];o=!!g[5];j=f[f.length-2];m=f[f.length-1];f.length==0&&(j=m=0);q=l-r;var p=a*2;for(f=1;f<=p;f++)l=f/p,o||(l=1-l),l=r+l*q,g=j+h+k*Math.cos(l),l=m+i+k*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.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.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=
 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)};
 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.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,r,o,m,q=[];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 l=[k[f],c[h],c[e]];r=THREE.FontUtils.Triangulate.area(l);var p=[k[f],k[g],c[h]];o=THREE.FontUtils.Triangulate.area(p);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;l=[k[f],c[h],c[e]];l=THREE.FontUtils.Triangulate.area(l);p=[k[f],k[g],c[h]];p=THREE.FontUtils.Triangulate.area(p);r+o>l+p&&(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]];q.push([k[f],c[h],c[e]]);q.push(g);c=r.concat(m).concat(j).concat(o)}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,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,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)},
 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};
 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,8 +83,8 @@ 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.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,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,q=this.hierarchy.length;m<q;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 l=0;l<3;l++){c=b[l];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<
+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()}}};
@@ -110,7 +110,7 @@ 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=
 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)};
-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,n=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++)n=d*h.chunks[f]/h.total,b.keys[f]={time:n,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,p=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++)p=d*h.chunks[f]/h.total,b.keys[f]={time:p,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=
 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;
@@ -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.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()};
-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,q=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,m=window.innerWidth/2,l=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,
 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*
 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-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){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){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];
 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.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)};
-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,r=i/2,q=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-r)*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+q,i+s*(h+1)+q,i+1+s*(h+1)+q,i+1+s*h+q),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,m,q,l,p,n,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;p=1;q=2;n=
-3;l=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,p);this.sides.py&&i("x","z",1,1,a,c,r,q);this.sides.ny&&i("x","z",1,-1,a,c,-r,n);this.sides.pz&&i("x","y",1,-1,a,b,o,l);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,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.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,q=m*(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),-m*c+f,q*Math.cos(l*Math.PI*2))));r.push(this.vertices.length-1);o.push(new THREE.UV(l,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],q=
-this.vertices[c].position.clone().setY(0).normalize(),l=this.vertices[r].position.clone().setY(0).normalize(),p=this.vertices[o].position.clone().setY(0).normalize(),n=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,[q,l,p,n]));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,q=new THREE.Vector3(0,1,0),l=new THREE.Vector3(0,1,0),p=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,[q,l,p])),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,q=new THREE.Vector3(0,-1,0),l=new THREE.Vector3(0,-1,0),p=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,[q,l,p])),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=[],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.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();
 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,l=g;k+=F;d+=F;e+=F;l+=F;A.faces.push(new THREE.Face4(k,d,e,l,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=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,
 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,q=b.bendPath,l=b.extrudePath,p,n=!1,s=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,w=b.extrudeMaterial,y=this.shapebb;if(l)p=l.getPoints(o),m=p.length,n=!0,r=!1;r||(k=i=j=0);var u,x,z,A=this,F=this.vertices.length;q&&a.addWrapPath(q);o=s?a.extractAllSpacedPoints(o):a.extractAllPoints(o);q=o.shape;o=o.holes;if(l=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();x=0;for(z=o.length;x<z;x++)u=o[x],THREE.Shape.Utils.isClockWise(u)&&
-(o[x]=u.reverse());l=!1}l=THREE.Shape.Utils.triangulateShape(q,o);s=q;x=0;for(z=o.length;x<z;x++)u=o[x],q=q.concat(u);var v,D,B,G,I,E,K=q.length,O=l.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(q[v],M[v],G):q[v],n?g(E.x,E.y+p[0].y,p[0].x):g(E.x,E.y,0);for(B=1;B<=m;B++)for(v=0;v<K;v++)E=r?c(q[v],M[v],G):q[v],n?g(E.x,E.y+p[B-1].y,p[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),n?g(E.x,E.y+p[m-1].y,p[m-1].x+I):g(E.x,E.y,h+I)}}if(r){r=K*0;for(v=0;v<O;v++)k=l[v],f(k[2]+r,k[1]+r,k[0]+r);r=K*(m+j*2);for(v=0;v<O;v++)k=l[v],f(k[0]+r,k[1]+r,k[2]+r)}else{for(v=0;v<O;v++)k=l[v],f(k[2],k[1],k[0]);for(v=0;v<O;v++)k=l[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,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;
 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-
 (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;
 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;
-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,q=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+q*f),a*Math.cos(g+q*f),a*Math.sin(d+m*e)*Math.sin(g+q*f))));r.push(this.vertices.length-1);o.push(new THREE.UV(m,q))}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(),q=this.vertices[f].position.clone().normalize(),l=j[i][h+1].clone(),p=j[i][h].clone(),n=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,q])),this.faceVertexUvs[0].push([l,n,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([l,p,n])):(this.faces.push(new THREE.Face4(d,e,g,f,[r,o,m,q])),this.faceVertexUvs[0].push([l,p,n,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 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.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.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,q,l,p,n=b.glyphs[a]||b.glyphs["?"];if(n){if(n.o){b=n._cachedOutline||(n._cachedOutline=n.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;q=b[a++]*c;e.quadraticCurveTo(m,q,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,q,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,q=b[a++]*-c,l=b[a++]*c+d,p=b[a++]*-c,e.bezierCurveTo(i,j,m,q,l,p),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,
-l,i),s=THREE.Shape.Utils.b3(s,o,q,p,j),g.push(new THREE.Vector2(t,s))}}}return{offset:n.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,q=k,l=j,p=e,n=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[n[m]].x,w=o[n[m]].y,y=o[n[q]].x,u=o[n[q]].y,x=o[n[l]].x,z=o[n[l]].y;if(1.0E-10>(y-t)*(z-w)-(u-w)*(x-t))o=!1;else{for(s=0;s<p;s++)if(!(s==m||s==q||s==l)){var A=o[n[s]].x,F=o[n[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,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]],
 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=
 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,
 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)};
-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 l,k,m,n=0;n<4;n++){m=i[n];l=new THREE.Color;l.setRGB(0,0,0);for(var p=0;p<m.length;p++)k=h.vertexColors[m[p]-1],l.r+=k.r,l.g+=k.g,l.b+=k.b;l.r/=m.length;l.g/=m.length;l.b/=m.length;j.vertexColors[n]=l}}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,q,l,p,n,s=a.faceVertexUvs[0];m=0;for(q=s.length;m<q;m++){l=0;for(p=s[m].length;l<p;l++)n=d[m]["abcd".charAt(l)],o[n]||(o[n]=s[m][l])}var t;m=0;for(q=d.length;m<q;m++)if(n=d[m],k.push(n.centroid),i.push(new THREE.Vertex(n.centroid)),f.supportUVs&&o.length!=0){t=new THREE.UV;if(n instanceof THREE.Face3)t.u=o[n.a].u+o[n.b].u+o[n.c].u,t.v=o[n.a].v+o[n.b].v+o[n.c].v,t.u/=3,t.v/=3;else if(n instanceof THREE.Face4)t.u=
-o[n.a].u+o[n.b].u+o[n.c].u+o[n.d].u,t.v=o[n.a].v+o[n.b].v+o[n.c].v+o[n.d].v,t.u/=4,t.v/=4;o.push(t)}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 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 q){t=q[m];y=m.split("_");u=y[0];y=y[1];A(u,[u,y]);A(y,[u,y]);l=0;for(p=t.length;l<p;l++)n=t[l],F(u,n,m),F(y,n,m);t.length<2&&(r[m]=!0)}for(m in q)if(t=q[m],n=t[0],t=t[1],y=m.split("_"),u=y[0],y=y[1],p=new THREE.Vector3,r[m]?(p.addSelf(h[u].position),p.addSelf(h[y].position),p.multiplyScalar(0.5)):(p.addSelf(k[n]),p.addSelf(k[t]),p.addSelf(h[u].position),p.addSelf(h[y].position),p.multiplyScalar(0.25)),
-j[m]=s+d.length+w,i.push(new THREE.Vertex(p)),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"];p=["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(q=k.length;m<q;m++)n=d[m],t=s+m,n instanceof THREE.Face3?(w=c(n.a,n.b),u=c(n.b,n.c),v=c(n.c,n.a),b(t,j[w],n.b,j[u],n,y),b(t,j[u],n.c,j[v],n,p),b(t,j[v],n.a,j[w],
-n,A)):n instanceof THREE.Face4?(w=c(n.a,n.b),u=c(n.b,n.c),v=c(n.c,n.d),D=c(n.d,n.a),b(t,j[w],n.b,j[u],n,F),b(t,j[u],n.c,j[v],n,B),b(t,j[v],n.d,j[D],n,G),b(t,j[D],n.a,j[w],n,I)):console.log("face should be a face!",n);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(q=h.length;m<q;m++)if(x[m]!==void 0){i.set(0,0,0);j.set(0,0,0);n=new THREE.Vector3(0,0,0);t=0;for(l in z[m])i.addSelf(k[l]),t++;w=0;s=x[m].length;for(l=0;l<s;l++)r[c(x[m][l][0],x[m][l][1])]&&w++;if(w!=2){i.divideScalar(t);for(l=0;l<
-s;l++)t=x[m][l],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(s);n.addSelf(h[m].position);n.multiplyScalar(s-3);n.addSelf(i);n.addSelf(j.multiplyScalar(2));n.divideScalar(s);d[m].position=n}}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,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.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/
 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)};
 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)};
-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=l.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,m,n,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=t[e*2];e=t[e*2+1];j=t[f*2];m=t[f*2+1];k=t[g*2];n=t[g*2+1];g=t[h*2];f=t[h*2+1];h=l.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,m));p.push(new THREE.UV(k,n));p.push(new THREE.UV(g,f));h.push(p)}}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],l.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],l.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),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];m=d[e*3+2];i=n[e];var o=s[k*3],p=s[k*3+1];k=s[k*3+2];var q=s[m*3],r=s[m*3+1];m=s[m*3+2];l.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(o,p,k),new THREE.Vector3(q,r,m)],null,i))}}function q(b,c,d,e){for(var f,g,h,i,j,k,m,n,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];k=d[e*4];m=d[e*4+1];n=d[e*4+2];o=d[e*4+3];j=p[e];var q=s[m*3],r=s[m*3+1];m=s[m*3+2];var t=s[n*3],u=s[n*3+1];n=s[n*3+2];var w=s[o*3],x=s[o*3+1];o=s[o*3+2];l.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,n),new THREE.Vector3(w,x,o)],null,j))}}var l=this,p=0,n,s=[],t=[],w,y,u,x,z,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(l,d,b);n={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)};n.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=n.header_bytes;b=n.vertex_index_bytes*3+n.material_index_bytes;A=n.vertex_index_bytes*
-4+n.material_index_bytes;w=n.ntri_flat*b;y=n.ntri_smooth*(b+n.normal_index_bytes*3);u=n.ntri_flat_uv*(b+n.uv_index_bytes*3);x=n.ntri_smooth_uv*(b+n.normal_index_bytes*3+n.uv_index_bytes*3);z=n.nquad_flat*A;b=n.nquad_smooth*(A+n.normal_index_bytes*4);A=n.nquad_flat_uv*(A+n.uv_index_bytes*4);p+=function(b){var c=n.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=n.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}(p);p+=c(n.nnormals*3);p+=function(b){var c=n.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}(p);w=p+w+c(n.ntri_flat*2);y=w+y+c(n.ntri_smooth*2);u=y+u+c(n.ntri_flat_uv*2);x=u+x+c(n.ntri_smooth_uv*2);z=x+z+c(n.nquad_flat*2);
-b=z+b+c(n.nquad_smooth*2);A=b+A+c(n.nquad_flat_uv*2);(function(a){var b=n.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=n.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=n.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=n.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);j(b,d)}})(A);(function(a){var b=n.ntri_flat;b&&r(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=n.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=n.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
-n.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(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",p,"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.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,
+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);
+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))};
+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,
 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,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=R[a.controllers[f].url];switch(i.type){case "skin":if(S[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(R[i.skin.source]&&(d=i=R[i.skin.source],i.morph&&S[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(S[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=S[i.url],k={},n=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;n++}j=o||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 m?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(p=S[k.targets[n]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
+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 q(){this.target=this.symbol=""}function l(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function n(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.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=
 "";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");
 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,
@@ -244,23 +244,23 @@ c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute(
 0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new u).parse(d))}}return b};
 k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=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 x).parse(f);b[f.id]=f;break;case "joints":c=
 f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new u).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
-a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new u).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var 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=
+a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new u).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var n=e[l],m=c[g+n.offset];switch(n.semantic){case "JOINT":k.joint=m;break;case "WEIGHT":k.weight=b[n.source].data[m]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=
 0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new 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,
 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 l).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 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=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=
 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;
 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 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=P.evaluate(".//dae:instance_material",c,C,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 n(this)).parse(c)}}return this};n.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=
+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=
+(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();
-return this};n.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,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&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=V[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=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;n==3?t=new THREE.Face3(o[0],o[1],o[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):n==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],
-e[1],e[2]]);d+=h.length*n}};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=
+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],
+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==
 "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+/),
 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=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};
@@ -281,32 +281,32 @@ 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.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)};
-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,q,l,p,n,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;l=b&64;b&=128;r?(p=new THREE.Face4,p.a=w[k++],p.b=w[k++],p.c=w[k++],p.d=w[k++],r=4):(p=new THREE.Face3,p.a=w[k++],p.b=w[k++],p.c=w[k++],r=3);if(i)i=w[k++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)n=a.uvs[c],q=w[k++],t=n[q*2],q=n[q*2+1],d.faceUvs[c][i]=new THREE.UV(t,q);if(e)for(c=0;c<x;c++){n=a.uvs[c];s=[];
-for(e=0;e<r;e++)q=w[k++],t=n[q*2],q=n[q*2+1],s[e]=new THREE.UV(t,q);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],p.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],p.vertexNormals.push(e);if(l)o=w[k++],o=new THREE.Color(u[o]),p.color=o;if(b)for(c=0;c<r;c++)o=w[k++],o=new THREE.Color(u[o]),p.vertexColors.push(o);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,k,j,r,o,m,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=[];m=d.morphTargets[c].vertices;
-q=a.morphTargets[c].vertices;i=0;for(k=q.length;i<k;i+=3)j=q[i]*b,r=q[i+1]*b,o=q[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,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)&&
 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+"]")};
 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(n=B.objects[o],n.geometry!==void 0){if(A=C.geometries[n.geometry]){a=!1;for(H=0;H<n.materials.length;H++)D=C.materials[n.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=n.position;y=n.rotation;u=n.quaternion;x=n.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=n.visible;C.scene.add(a);C.objects[o]=a;if(n.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(n.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;n.trigger&&n.trigger.toLowerCase()!="none"&&(b=
-{type:n.trigger,object:n},C.triggers[a.name]=b)}}else w=n.position,y=n.rotation,u=n.quaternion,x=n.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=n.visible!==void 0?n.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,n.trigger&&n.trigger.toLowerCase()!="none"&&(b={type:n.trigger,object:n},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,q,l,p,n,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(n=B.objects[o],n.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(q in B.cameras)s=B.cameras[q],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[q]=F;for(m in B.lights)s=B.lights[m],q=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(q,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(q,F,t),t.position.set(w[0],w[1],w[2])):s.type=="ambient"&&(t=new THREE.AmbientLight(q)),C.scene.add(t),C.lights[m]=t;for(l in B.fogs)m=B.fogs[l],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[l]=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(l=B.geometries[j],l.type=="bin_mesh"||l.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in B.geometries)l=B.geometries[j],l.type=="cube"?(A=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides),C.geometries[j]=A):l.type=="plane"?(A=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight),C.geometries[j]=A):l.type=="sphere"?
-(A=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight),C.geometries[j]=A):l.type=="cylinder"?(A=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,l.heightSegs),C.geometries[j]=A):l.type=="torus"?(A=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT),C.geometries[j]=A):l.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(l.subdivisions),C.geometries[j]=A):l.type=="bin_mesh"?c.load(d(l.url,B.urlBaseType),g(j)):l.type=="ascii_mesh"?G.load(d(l.url,B.urlBaseType),
-g(j)):l.type=="embedded_mesh"&&(l=B.embeds[l.id])&&G.createModel(l,f(j),"");for(p in B.textures)if(j=B.textures[p],j.url instanceof Array){E+=j.url.length;for(l=0;l<j.url.length;l++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(p in B.textures){j=B.textures[p];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){l=[];for(var H=0;H<j.url.length;H++)l[H]=d(j.url[H],B.urlBaseType);l=THREE.ImageUtils.loadTextureCube(l,j.mapping,a)}else{l=THREE.ImageUtils.loadTexture(d(j.url,
-B.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)l.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)l.magFilter=THREE[j.magFilter];if(j.repeat){l.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)l.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)l.wrapT=THREE.RepeatWrapping}j.offset&&l.offset.set(j.offset[0],j.offset[1]);if(j.wrap){v={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(v[j.wrap[0]]!==void 0)l.wrapS=v[j.wrap[0]];if(v[j.wrap[1]]!==void 0)l.wrapT=
-v[j.wrap[1]]}}C.textures[p]=l}for(r in B.materials){p=B.materials[r];for(z in p.parameters)if(z=="envMap"||z=="map"||z=="lightMap")p.parameters[z]=C.textures[p.parameters[z]];else if(z=="shading")p.parameters[z]=p.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z=="blending")p.parameters[z]=THREE[p.parameters[z]]?THREE[p.parameters[z]]:THREE.NormalBlending;else if(z=="combine")p.parameters[z]=p.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==
-"vertexColors")if(p.parameters[z]=="face")p.parameters[z]=THREE.FaceColors;else if(p.parameters[z])p.parameters[z]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);l=p.parameters.color;v=p.parameters.specular;c=p.parameters.ambient;G=p.parameters.shininess;a.tNormal.texture=C.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=C.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(v);a.uAmbientColor.value.setHex(c);a.uShininess.value=G;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
-vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);C.materials[r]=p}e();i.callbackSync(C);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: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=
+{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,
+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,
 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),k=[],j=[];(function(a,f,i){for(var j,k,p,n=a.length;i<n;i+=f)j=a[i],k=a[i+1],p=a[i+2],j=j/16383*c,k=k/16383*c,p=p/16383*c,j+=d,k+=e,p+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))})(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,
+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),k=[],j=[];(function(a,f,i){for(var j,k,q,p=a.length;i<p;i+=f)j=a[i],k=a[i+1],q=a[i+2],j=j/16383*c,k=k/16383*c,q=q/16383*c,j+=d,k+=e,q+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,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,k.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,s,t,w,y=a.length;for(c=0;c<y;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;w=e;i=f;s=d;var u=e,x=f,z=g.materials[0],A=k[u*3],F=k[u*3+1],u=k[u*3+2],v=k[x*3],D=k[x*3+1],x=k[x*3+2];s=new THREE.Vector3(k[s*3],k[s*3+1],k[s*3+2]);u=new THREE.Vector3(A,F,u);x=new THREE.Vector3(v,D,x);g.faces.push(new THREE.Face3(t,w,i,[s,u,x],null,z));g=j[d*2];d=j[d*2+
 1];i=j[e*2];s=j[e*2+1];t=j[f*2];w=j[f*2+1];f=b.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(t,w));f.push(s)}})(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);
@@ -314,14 +314,14 @@ 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=
 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],
-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,q=i+this.yd+this.zd,l=0,p=this.field[g],n=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[q];p<f&&(l|=1);n<f&&(l|=2);s<f&&(l|=8);t<f&&(l|=4);w<f&&(l|=16);y<f&&(l|=32);u<f&&(l|=128);x<f&&(l|=64);var z=THREE.edgeTable[l];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,p,n));z&2&&(this.compNorm(i),this.compNorm(r),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,b,e,n,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,p,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(q),this.VIntY(o*3,this.vlist,this.nlist,15,f,F,b,A,y,x));z&64&&(this.compNorm(m),this.compNorm(q),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,p,w));z&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,b,e,n,y));z&1024&&(this.compNorm(r),this.compNorm(q),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));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.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+
+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+
 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 q,l,p,n,s,t;r<i;r++){j=this.size2*r;l=r/this.size-e;s=l*l;for(l=o;l<k;l++){p=j+this.size*l;q=l/this.size-b;t=q*q;for(q=m;q<h;q++)n=q/this.size-a,n=g/(1.0E-6+n*n+t+s)-f,n>0&&(this.field[p+q]+=n)}}};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,q=j*Math.sqrt(a/b);q>j&&(q=j);for(g=0;g<q;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,q=j*Math.sqrt(a/b);q>j&&(q=j);for(f=0;f<q;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=
+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;
 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,
@@ -355,30 +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);
 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,
-"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,q=new THREE.Vector2(m*j,m),l=new THREE.Vector3(1,1,0),p=new THREE.Vector2(1,1),n=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(n.occlusionMap,0);b.uniform1i(n.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,q.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),l.copy(k),p.x=l.x*r+r,p.y=l.y*o+o,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(n.renderType,0);b.uniform2f(n.scale,q.x,q.y);b.uniform3f(n.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(n.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(l);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(n.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)l.x=u.x,l.y=u.y,l.z=u.z,m=u.size*u.scale/
-h,q.x=m*j,q.y=m,b.uniform3f(n.screenPosition,l.x,l.y,l.z),b.uniform2f(n.scale,q.x,q.y),b.uniform1f(n.rotation,u.rotation),b.uniform1f(n.opacity,u.opacity),b.uniform3f(n.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,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)}}};
 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,q,l,p=0,n=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(k=n.length;i<k;i++)if(l=n[i],l.castShadow&&l instanceof THREE.SpotLight){this.shadowMap[p]||(this.shadowMap[p]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
-format:THREE.RGBAFormat}),this.shadowMatrix[p]=new THREE.Matrix4);j=this.shadowMap[p];r=this.shadowMatrix[p];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(m=h.__webglObjects[j],l=m.object,m.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),m.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);for(j=0;j<r;j++)if(m=h.__webglObjects[j],m.render)l=m.object,m=m.buffer,b.setObjectFaces(l),q=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c,b.renderBuffer(e,n,null,q,m,l);r=h.__webglObjectsImmediate.length;
-for(j=0;j<r;j++)m=h.__webglObjectsImmediate[j],l=m.object,l.visible&&l.castShadow&&(_currentGeometryGroupHash=-1,l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.setObjectFaces(l),o=b.setProgram(e,n,null,c,l),l.immediateRenderCallback?l.immediateRenderCallback(o,a,g):l.render(function(a){b.renderBufferImmediate(a,o,c.shading)}));p++}}};
+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++}}};
 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);
 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,
-"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);_currentProgram=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 q,l=[],k=0;k<i;k++)if(q=e[k],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(k=0;k<i;k++)q=e[k],q.visible&&q.opacity!==0&&q.map&&q.map.image&&q.map.image.width&&(q.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(q.position.x-f)/f,(o-q.position.y)/o,Math.max(0,Math.min(1,q.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,q.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,q._modelViewMatrixArray)),g=q.map.image.width/(q.scaleByViewport?h:1),l[0]=g*r*q.scale.x,l[1]=g*
-q.scale.y,b.uniform2f(j.uvScale,q.uvScale.x,q.uvScale.y),b.uniform2f(j.uvOffset,q.uvOffset.x,q.uvOffset.y),b.uniform2f(j.alignment,q.alignment.x,q.alignment.y),b.uniform1f(j.opacity,q.opacity),b.uniform3f(j.color,q.color.r,q.color.g,q.color.b),b.uniform1f(j.rotation,q.rotation),b.uniform2fv(j.scale,l),q.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!q.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!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,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),q=new THREE.PerspectiveCamera(53,
-1,1,1E4);q.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}"}),
-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);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);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 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)}};
 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)}};
 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}"},

+ 32 - 34
build/custom/ThreeSVG.js

@@ -14,11 +14,11 @@ 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-
 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}};
-THREE.Ray=function(a,b){function c(a,b,c){j.sub(c,a);o=j.dot(b);if(o<=0)return null;p=n.add(a,k.copy(b).multiplyScalar(o));return u=c.distanceTo(p)}function d(a,b,c,d){j.sub(d,b);n.sub(c,b);k.sub(a,b);I=j.dot(j);v=j.dot(n);E=j.dot(k);s=n.dot(n);t=n.dot(k);C=1/(I*s-v*v);y=(s*E-v*t)*C;z=(I*t-v*E)*C;return y>=0&&z>=0&&y+z<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,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector3,i=new THREE.Vector3;this.intersectObject=function(j){for(var k,n=[],o=0,K=j.children.length;o<K;o++)Array.prototype.push.apply(n,this.intersectObject(j.children[o]));if(j instanceof THREE.Particle){o=
-c(this.origin,this.direction,j.matrixWorld.getPosition());if(o===null||o>j.scale.x)return[];k={distance:o,point:j.position,face:null,object:j};n.push(k)}else if(j instanceof THREE.Mesh){o=c(this.origin,this.direction,j.matrixWorld.getPosition());if(o===null||o>j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)))return n;var J,p=j.geometry,N=p.vertices,s;j.matrixRotationWorld.extractRotation(j.matrixWorld);o=0;for(K=p.faces.length;o<K;o++)if(k=p.faces[o],a.copy(this.origin),
-b.copy(this.direction),s=j.matrixWorld,l=s.multiplyVector3(l.copy(k.centroid)).subSelf(a),J=l.dot(b),!(J<=0)&&(f=s.multiplyVector3(f.copy(N[k.a].position)),e=s.multiplyVector3(e.copy(N[k.b].position)),g=s.multiplyVector3(g.copy(N[k.c].position)),k instanceof THREE.Face4&&(h=s.multiplyVector3(h.copy(N[k.d].position))),m=j.matrixRotationWorld.multiplyVector3(m.copy(k.normal)),J=b.dot(m),j.doubleSided||(j.flipSided?J>0:J<0)))if(J=m.dot(l.sub(f,a))/J,i.add(a,b.multiplyScalar(J)),k instanceof THREE.Face3)d(i,
-f,e,g)&&(k={distance:a.distanceTo(i),point:i.clone(),face:k,object:j},n.push(k));else if(k instanceof THREE.Face4&&(d(i,f,e,h)||d(i,e,g,h)))k={distance:a.distanceTo(i),point:i.clone(),face:k,object:j},n.push(k)}return n};var j=new THREE.Vector3,n=new THREE.Vector3,k=new THREE.Vector3,o,p,u,I,v,E,s,t,C,y,z};
+THREE.Ray=function(a,b){function c(a,b,c){j.sub(c,a);o=j.dot(b);if(o<=0)return null;p=n.add(a,k.copy(b).multiplyScalar(o));return u=c.distanceTo(p)}function d(a,b,c,d){j.sub(d,b);n.sub(c,b);k.sub(a,b);I=j.dot(j);v=j.dot(n);E=j.dot(k);s=n.dot(n);t=n.dot(k);C=1/(I*s-v*v);x=(s*E-v*t)*C;y=(I*t-v*E)*C;return x>=0&&y>=0&&x+y<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,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector3,i=new THREE.Vector3;this.intersectObject=function(j){for(var k,n=[],o=0,p=j.children.length;o<p;o++)Array.prototype.push.apply(n,this.intersectObject(j.children[o]));if(j instanceof THREE.Particle){o=
+c(this.origin,this.direction,j.matrixWorld.getPosition());if(o===null||o>j.scale.x)return[];k={distance:o,point:j.position,face:null,object:j};n.push(k)}else if(j instanceof THREE.Mesh){o=c(this.origin,this.direction,j.matrixWorld.getPosition());if(o===null||o>j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)))return n;var J,s=j.geometry,N=s.vertices,t;j.matrixRotationWorld.extractRotation(j.matrixWorld);o=0;for(p=s.faces.length;o<p;o++)if(k=s.faces[o],a.copy(this.origin),
+b.copy(this.direction),t=j.matrixWorld,l=t.multiplyVector3(l.copy(k.centroid)).subSelf(a),J=l.dot(b),!(J<=0)&&(f=t.multiplyVector3(f.copy(N[k.a].position)),e=t.multiplyVector3(e.copy(N[k.b].position)),g=t.multiplyVector3(g.copy(N[k.c].position)),k instanceof THREE.Face4&&(h=t.multiplyVector3(h.copy(N[k.d].position))),m=j.matrixRotationWorld.multiplyVector3(m.copy(k.normal)),J=b.dot(m),j.doubleSided||(j.flipSided?J>0:J<0)))if(J=m.dot(l.sub(f,a))/J,i.add(a,b.multiplyScalar(J)),k instanceof THREE.Face3)d(i,
+f,e,g)&&(k={distance:a.distanceTo(i),point:i.clone(),face:k,object:j},n.push(k));else if(k instanceof THREE.Face4&&(d(i,f,e,h)||d(i,e,g,h)))k={distance:a.distanceTo(i),point:i.clone(),face:k,object:j},n.push(k)}return n};var j=new THREE.Vector3,n=new THREE.Vector3,k=new THREE.Vector3,o,p,u,I,v,E,s,t,C,x,y};
 THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,i,j){h=!1;b=e;c=g;d=i;f=j;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
 function(e,g,i,j,n,k){h?(h=!1,b=e<i?e<n?e:n:i<n?i:n,c=g<j?g<k?g:k:j<k?j:k,d=e>i?e>n?e:n:i>n?i:n,f=g>j?g>k?g:k:j>k?j:k):(b=e<i?e<n?e<b?e:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b,c=g<j?g<k?g<c?g:c:k<c?k:c:j<k?j<c?j:c:k<c?k:c,d=e>i?e>n?e>d?e:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d,f=g>j?g>k?g>f?g:f:k>f?k:f:j>k?j>f?j:f:k>f?k:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
 e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.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(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};
@@ -27,8 +27,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 THREE.Matrix4=function(a,b,c,d,f,e,g,h,l,m,i,j,n,k,o,p){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,l||0,m||0,i!==void 0?i:1,j||0,n||0,k||0,o||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,l,m,i,j,n,k,o,p){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=l;this.n32=m;this.n33=i;this.n34=j;this.n41=n;this.n42=k;this.n43=o;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,l=a.n23,m=a.n24,i=a.n31,j=a.n32,n=a.n33,k=a.n34,o=a.n41,p=a.n42,u=a.n43,
-I=a.n44,v=b.n11,E=b.n12,s=b.n13,t=b.n14,C=b.n21,y=b.n22,z=b.n23,G=b.n24,x=b.n31,H=b.n32,A=b.n33,K=b.n34,J=b.n41,M=b.n42,N=b.n43,S=b.n44;this.n11=c*v+d*C+f*x+e*J;this.n12=c*E+d*y+f*H+e*M;this.n13=c*s+d*z+f*A+e*N;this.n14=c*t+d*G+f*K+e*S;this.n21=g*v+h*C+l*x+m*J;this.n22=g*E+h*y+l*H+m*M;this.n23=g*s+h*z+l*A+m*N;this.n24=g*t+h*G+l*K+m*S;this.n31=i*v+j*C+n*x+k*J;this.n32=i*E+j*y+n*H+k*M;this.n33=i*s+j*z+n*A+k*N;this.n34=i*t+j*G+n*K+k*S;this.n41=o*v+p*C+u*x+I*J;this.n42=o*E+p*y+u*H+I*M;this.n43=o*s+p*
-z+u*A+I*N;this.n44=o*t+p*G+u*K+I*S;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*=
+I=a.n44,v=b.n11,E=b.n12,s=b.n13,t=b.n14,C=b.n21,x=b.n22,y=b.n23,G=b.n24,B=b.n31,H=b.n32,z=b.n33,L=b.n34,J=b.n41,M=b.n42,N=b.n43,S=b.n44;this.n11=c*v+d*C+f*B+e*J;this.n12=c*E+d*x+f*H+e*M;this.n13=c*s+d*y+f*z+e*N;this.n14=c*t+d*G+f*L+e*S;this.n21=g*v+h*C+l*B+m*J;this.n22=g*E+h*x+l*H+m*M;this.n23=g*s+h*y+l*z+m*N;this.n24=g*t+h*G+l*L+m*S;this.n31=i*v+j*C+n*B+k*J;this.n32=i*E+j*x+n*H+k*M;this.n33=i*s+j*y+n*z+k*N;this.n34=i*t+j*G+n*L+k*S;this.n41=o*v+p*C+u*B+I*J;this.n42=o*E+p*x+u*H+I*M;this.n43=o*s+p*
+y+u*z+I*N;this.n44=o*t+p*G+u*L+I*S;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,e=this.n22,g=this.n23,h=this.n24,l=this.n31,m=this.n32,i=this.n33,j=this.n34,n=this.n41,k=this.n42,o=this.n43,p=this.n44;return d*g*m*n-c*h*m*n-d*e*i*n+b*h*i*n+c*e*j*n-b*g*j*n-d*g*l*k+c*h*l*k+d*f*i*k-a*h*i*k-c*f*j*k+a*g*j*k+d*e*l*o-b*h*l*o-d*f*m*o+a*h*m*o+b*f*j*o-a*e*j*o-c*e*l*p+b*g*l*p+c*f*m*p-a*g*m*p-b*f*i*p+a*e*i*p},transpose:function(){var a;
@@ -55,18 +55,16 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 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;
 THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=m[l]=m[l]||new THREE.RenderableVertex;l++;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 f,e,g=[],h,l,m=[],
-i,j,n=[],k,o=[],p,u,I=[],v,E,s=[],t={objects:[],sprites:[],lights:[],elements:[]},C=new THREE.Vector3,y=new THREE.Vector4,z=new THREE.Matrix4,G=new THREE.Matrix4,x=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,A=new THREE.Vector4;this.computeFrustum=function(a){x[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);x[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);x[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);x[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);x[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);x[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=x[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.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){e=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=x[h].x*d.n14+x[h].y*d.n24+x[h].z*d.n34+x[h].w,c<=e){c=!1;break a}c=!0}c?(z.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.z,t.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.z,t.sprites.push(f)):b instanceof THREE.Light&&t.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,x=e.far,C,O,r,q,w,B,D,L,F,P,Q,T,W,U,V,R;E=u=k=j=0;t.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);z.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(z);t=this.projectGraph(a,!1);a=0;for(C=t.objects.length;a<C;a++)if(F=t.objects[a].object,P=F.matrixWorld,T=
-F.material,l=0,F instanceof THREE.Mesh){Q=F.geometry;W=F.geometry.materials;q=Q.vertices;U=Q.faces;V=Q.faceVertexUvs;Q=F.matrixRotationWorld.extractRotation(P);O=0;for(r=q.length;O<r;O++)h=b(),h.positionWorld.copy(q[O].position),P.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),z.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<x;q=0;for(O=U.length;q<O;q++){r=U[q];
-if(r instanceof THREE.Face3)if(w=m[r.a],B=m[r.b],D=m[r.c],w.visible&&B.visible&&D.visible&&(F.doubleSided||F.flipSided!=(D.positionScreen.x-w.positionScreen.x)*(B.positionScreen.y-w.positionScreen.y)-(D.positionScreen.y-w.positionScreen.y)*(B.positionScreen.x-w.positionScreen.x)<0))L=n[j]=n[j]||new THREE.RenderableFace3,j++,i=L,i.v1.copy(w),i.v2.copy(B),i.v3.copy(D);else continue;else if(r instanceof THREE.Face4)if(w=m[r.a],B=m[r.b],D=m[r.c],L=m[r.d],w.visible&&B.visible&&D.visible&&L.visible&&(F.doubleSided||
-F.flipSided!=((L.positionScreen.x-w.positionScreen.x)*(B.positionScreen.y-w.positionScreen.y)-(L.positionScreen.y-w.positionScreen.y)*(B.positionScreen.x-w.positionScreen.x)<0||(B.positionScreen.x-D.positionScreen.x)*(L.positionScreen.y-D.positionScreen.y)-(B.positionScreen.y-D.positionScreen.y)*(L.positionScreen.x-D.positionScreen.x)<0)))R=o[k]=o[k]||new THREE.RenderableFace4,k++,i=R,i.v1.copy(w),i.v2.copy(B),i.v3.copy(D),i.v4.copy(L);else continue;i.normalWorld.copy(r.normal);Q.multiplyVector3(i.normalWorld);
-i.centroidWorld.copy(r.centroid);P.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);z.multiplyVector3(i.centroidScreen);D=r.vertexNormals;w=0;for(B=D.length;w<B;w++)L=i.vertexNormalsWorld[w],L.copy(D[w]),Q.multiplyVector3(L);w=0;for(B=V.length;w<B;w++)if(R=V[w][q]){D=0;for(L=R.length;D<L;D++)i.uvs[w][D]=R[D]}i.material=T;i.faceMaterial=r.materialIndex!==null?W[r.materialIndex]:null;i.z=i.centroidScreen.z;t.elements.push(i)}}else if(F instanceof THREE.Line){G.multiply(z,P);q=
-F.geometry.vertices;w=b();w.positionScreen.copy(q[0].position);G.multiplyVector4(w.positionScreen);O=1;for(r=q.length;O<r;O++)if(w=b(),w.positionScreen.copy(q[O].position),G.multiplyVector4(w.positionScreen),B=m[l-2],H.copy(w.positionScreen),A.copy(B.positionScreen),d(H,A))H.multiplyScalar(1/H.w),A.multiplyScalar(1/A.w),F=I[u]=I[u]||new THREE.RenderableLine,u++,p=F,p.v1.positionScreen.copy(H),p.v2.positionScreen.copy(A),p.z=Math.max(H.z,A.z),p.material=T,t.elements.push(p)}a=0;for(C=t.sprites.length;a<
-C;a++)if(F=t.sprites[a].object,P=F.matrixWorld,F instanceof THREE.Particle&&(y.set(P.n14,P.n24,P.n34,1),z.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))g=s[E]=s[E]||new THREE.RenderableParticle,E++,v=g,v.x=y.x/y.w,v.y=y.y/y.w,v.z=y.z,v.rotation=F.rotation.z,v.scale.x=F.scale.x*Math.abs(v.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),v.scale.y=F.scale.y*Math.abs(v.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),v.material=F.material,t.elements.push(v);f&&t.elements.sort(c);
-return t}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+i,j,n=[],k,o=[],p,u,I=[],v,E,s=[],t={objects:[],sprites:[],lights:[],elements:[]},C=new THREE.Vector3,x=new THREE.Vector4,y=new THREE.Matrix4,G=new THREE.Matrix4,B=new THREE.Frustum,H=new THREE.Vector4,z=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);y.multiply(b.projectionMatrix,b.matrixWorldInverse);y.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);y.multiply(b.matrixWorld,
+b.projectionMatrixInverse);y.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){e=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||B.contains(b))?(y.multiplyVector3(C.copy(b.position)),f=a(),f.object=
+b,f.z=C.z,t.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(y.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.z,t.sprites.push(f)):b instanceof THREE.Light&&t.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,C=e.far,T,O,r,q,w,A,D,K,F,P,Q,U,X,V,W,R;E=u=k=j=0;t.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);y.multiply(e.projectionMatrix,e.matrixWorldInverse);B.setFromMatrix(y);t=this.projectGraph(a,!1);a=0;for(T=t.objects.length;a<T;a++)if(F=t.objects[a].object,P=F.matrixWorld,U=F.material,l=0,F instanceof THREE.Mesh){Q=F.geometry;X=F.geometry.materials;q=Q.vertices;V=Q.faces;W=Q.faceVertexUvs;Q=F.matrixRotationWorld.extractRotation(P);O=0;for(r=q.length;O<r;O++)h=b(),h.positionWorld.copy(q[O].position),P.multiplyVector3(h.positionWorld),
+h.positionScreen.copy(h.positionWorld),y.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<C;q=0;for(O=V.length;q<O;q++){r=V[q];if(r instanceof THREE.Face3)if(w=m[r.a],A=m[r.b],D=m[r.c],w.visible&&A.visible&&D.visible&&(F.doubleSided||F.flipSided!=(D.positionScreen.x-w.positionScreen.x)*(A.positionScreen.y-w.positionScreen.y)-(D.positionScreen.y-w.positionScreen.y)*(A.positionScreen.x-
+w.positionScreen.x)<0))K=n[j]=n[j]||new THREE.RenderableFace3,j++,i=K,i.v1.copy(w),i.v2.copy(A),i.v3.copy(D);else continue;else if(r instanceof THREE.Face4)if(w=m[r.a],A=m[r.b],D=m[r.c],K=m[r.d],w.visible&&A.visible&&D.visible&&K.visible&&(F.doubleSided||F.flipSided!=((K.positionScreen.x-w.positionScreen.x)*(A.positionScreen.y-w.positionScreen.y)-(K.positionScreen.y-w.positionScreen.y)*(A.positionScreen.x-w.positionScreen.x)<0||(A.positionScreen.x-D.positionScreen.x)*(K.positionScreen.y-D.positionScreen.y)-
+(A.positionScreen.y-D.positionScreen.y)*(K.positionScreen.x-D.positionScreen.x)<0)))R=o[k]=o[k]||new THREE.RenderableFace4,k++,i=R,i.v1.copy(w),i.v2.copy(A),i.v3.copy(D),i.v4.copy(K);else continue;i.normalWorld.copy(r.normal);Q.multiplyVector3(i.normalWorld);i.centroidWorld.copy(r.centroid);P.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);y.multiplyVector3(i.centroidScreen);D=r.vertexNormals;w=0;for(A=D.length;w<A;w++)K=i.vertexNormalsWorld[w],K.copy(D[w]),Q.multiplyVector3(K);
+w=0;for(A=W.length;w<A;w++)if(R=W[w][q]){D=0;for(K=R.length;D<K;D++)i.uvs[w][D]=R[D]}i.material=U;i.faceMaterial=r.materialIndex!==null?X[r.materialIndex]:null;i.z=i.centroidScreen.z;t.elements.push(i)}}else if(F instanceof THREE.Line){G.multiply(y,P);q=F.geometry.vertices;w=b();w.positionScreen.copy(q[0].position);G.multiplyVector4(w.positionScreen);O=1;for(r=q.length;O<r;O++)if(w=b(),w.positionScreen.copy(q[O].position),G.multiplyVector4(w.positionScreen),A=m[l-2],H.copy(w.positionScreen),z.copy(A.positionScreen),
+d(H,z))H.multiplyScalar(1/H.w),z.multiplyScalar(1/z.w),F=I[u]=I[u]||new THREE.RenderableLine,u++,p=F,p.v1.positionScreen.copy(H),p.v2.positionScreen.copy(z),p.z=Math.max(H.z,z.z),p.material=U,t.elements.push(p)}a=0;for(T=t.sprites.length;a<T;a++)if(F=t.sprites[a].object,P=F.matrixWorld,F instanceof THREE.Particle&&(x.set(P.n14,P.n24,P.n34,1),y.multiplyVector4(x),x.z/=x.w,x.z>0&&x.z<1))g=s[E]=s[E]||new THREE.RenderableParticle,E++,v=g,v.x=x.x/x.w,v.y=x.y/x.w,v.z=x.z,v.rotation=F.rotation.z,v.scale.x=
+F.scale.x*Math.abs(v.x-(x.x+e.projectionMatrix.n11)/(x.w+e.projectionMatrix.n14)),v.scale.y=F.scale.y*Math.abs(v.y-(x.y+e.projectionMatrix.n22)/(x.w+e.projectionMatrix.n24)),v.material=F.material,t.elements.push(v);f&&t.elements.sort(c);return t}};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),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-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.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=
@@ -82,9 +80,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 b,c,d,f,e,g=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],f=this.vertices[c.b],e=this.vertices[c.c],g.sub(e.position,f.position),h.sub(d.position,f.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},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),
 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,f,B){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;i=g[e];j=g[f];n=g[B];k=l.x-h.x;o=m.x-h.x;p=l.y-h.y;u=m.y-h.y;I=l.z-h.z;v=m.z-h.z;E=j.u-i.u;s=n.u-i.u;t=j.v-i.v;C=n.v-i.v;y=1/(E*C-s*t);H.set((C*k-t*o)*y,(C*p-t*u)*y,(C*I-t*v)*y);A.set((E*o-s*k)*y,(E*u-s*p)*y,(E*v-s*I)*y);G[b].addSelf(H);G[c].addSelf(H);G[d].addSelf(H);x[b].addSelf(A);x[c].addSelf(A);x[d].addSelf(A)}var b,c,d,f,e,g,h,l,m,i,j,n,k,o,p,u,I,v,E,s,t,C,y,z,G=[],x=[],H=new THREE.Vector3,A=new THREE.Vector3,
-K=new THREE.Vector3,J=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,x[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var N=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)M.copy(e.vertexNormals[d]),f=e[N[d]],
-z=G[f],K.copy(z),K.subSelf(M.multiplyScalar(M.dot(z))).normalize(),J.cross(e.vertexNormals[d],z),f=J.dot(x[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.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=
+b,c,d,e,f,A){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;i=g[e];j=g[f];n=g[A];k=l.x-h.x;o=m.x-h.x;p=l.y-h.y;u=m.y-h.y;I=l.z-h.z;v=m.z-h.z;E=j.u-i.u;s=n.u-i.u;t=j.v-i.v;C=n.v-i.v;x=1/(E*C-s*t);H.set((C*k-t*o)*x,(C*p-t*u)*x,(C*I-t*v)*x);z.set((E*o-s*k)*x,(E*u-s*p)*x,(E*v-s*I)*x);G[b].addSelf(H);G[c].addSelf(H);G[d].addSelf(H);B[b].addSelf(z);B[c].addSelf(z);B[d].addSelf(z)}var b,c,d,f,e,g,h,l,m,i,j,n,k,o,p,u,I,v,E,s,t,C,x,y,G=[],B=[],H=new THREE.Vector3,z=new THREE.Vector3,
+L=new THREE.Vector3,J=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,B[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var N=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)M.copy(e.vertexNormals[d]),f=e[N[d]],
+y=G[f],L.copy(y),L.subSelf(M.multiplyScalar(M.dot(y))).normalize(),J.cross(e.vertexNormals[d],y),f=J.dot(B[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.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=
 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),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],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;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};
@@ -122,18 +120,18 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 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.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,i;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),i=c.dot(j),i<=0||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),i=c.dot(G.sub(j,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function b(a){x[a]==null&&(x[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),M==0&&x[a].setAttribute("shape-rendering","crispEdges"));return x[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,e,g,h=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,i,j,n,k,o,p,u,I=new THREE.Rectangle,v=new THREE.Rectangle,E=!1,s=new THREE.Color,t=new THREE.Color,C=new THREE.Color,y=new THREE.Color,z,G=new THREE.Vector3,x=[],H=[],A,K,J,M=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":M=1;break;case "low":M=0}};this.setSize=function(a,b){m=a;i=b;j=m/2;n=i/2;l.setAttribute("viewBox",-j+" "+-n+" "+m+" "+i);l.setAttribute("width",m);l.setAttribute("height",i);I.set(-j,-n,j,n)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(i,m){var x,G,r,q;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(i,m,this.sortElements);e=f.elements;
-g=f.lights;J=K=0;if(E=g.length>0){t.setRGB(0,0,0);C.setRGB(0,0,0);y.setRGB(0,0,0);x=0;for(G=g.length;x<G;x++)q=g[x],r=q.color,q instanceof THREE.AmbientLight?(t.r+=r.r,t.g+=r.g,t.b+=r.b):q instanceof THREE.DirectionalLight?(C.r+=r.r,C.g+=r.g,C.b+=r.b):q instanceof THREE.PointLight&&(y.r+=r.r,y.g+=r.g,y.b+=r.b)}x=0;for(G=e.length;x<G;x++)if(r=e[x],q=r.material,q=q instanceof THREE.MeshFaceMaterial?r.faceMaterial:q,!(q==null||q.opacity==0))if(v.empty(),r instanceof THREE.RenderableParticle)k=r,k.x*=
-j,k.y*=-n;else if(r instanceof THREE.RenderableLine){if(k=r.v1,o=r.v2,k.positionScreen.x*=j,k.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,v.addPoint(k.positionScreen.x,k.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),I.intersects(v)){r=k;var w=o,B=J++;H[B]==null&&(H[B]=document.createElementNS("http://www.w3.org/2000/svg","line"),M==0&&H[B].setAttribute("shape-rendering","crispEdges"));A=H[B];A.setAttribute("x1",r.positionScreen.x);A.setAttribute("y1",r.positionScreen.y);
-A.setAttribute("x2",w.positionScreen.x);A.setAttribute("y2",w.positionScreen.y);q instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+q.color.getContextStyle()+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.linecap+"; stroke-linejoin: "+q.linejoin),l.appendChild(A))}}else if(r instanceof THREE.RenderableFace3){if(k=r.v1,o=r.v2,p=r.v3,k.positionScreen.x*=j,k.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,p.positionScreen.x*=
-j,p.positionScreen.y*=-n,v.addPoint(k.positionScreen.x,k.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),I.intersects(v)){var w=k,B=o,D=p;d.info.render.vertices+=3;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?s.copy(q.color):q instanceof THREE.MeshLambertMaterial?
-E?(s.r=t.r,s.g=t.g,s.b=t.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1))):s.copy(q.color):q instanceof THREE.MeshDepthMaterial?(z=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(z,z,z)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?A.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
-q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):A.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);l.appendChild(A)}}else if(r instanceof THREE.RenderableFace4&&(k=r.v1,o=r.v2,p=r.v3,u=r.v4,k.positionScreen.x*=j,k.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,p.positionScreen.x*=j,p.positionScreen.y*=-n,u.positionScreen.x*=j,u.positionScreen.y*=-n,v.addPoint(k.positionScreen.x,
-k.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),v.addPoint(u.positionScreen.x,u.positionScreen.y),I.intersects(v))){var w=k,B=o,D=p,L=u;d.info.render.vertices+=4;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+" L "+L.positionScreen.x+","+L.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?
-s.copy(q.color):q instanceof THREE.MeshLambertMaterial?E?(s.r=t.r,s.g=t.g,s.b=t.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1))):s.copy(q.color):q instanceof THREE.MeshDepthMaterial?(z=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(z,z,z)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?A.setAttribute("style",
-"fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):A.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);l.appendChild(A)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,i;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),i=c.dot(j),i<=0||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),i=c.dot(G.sub(j,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function b(a){B[a]==null&&(B[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),M==0&&B[a].setAttribute("shape-rendering","crispEdges"));return B[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,e,g,h=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,i,j,n,k,o,p,u,I=new THREE.Rectangle,v=new THREE.Rectangle,E=!1,s=new THREE.Color,t=new THREE.Color,C=new THREE.Color,x=new THREE.Color,y,G=new THREE.Vector3,B=[],H=[],z,L,J,M=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":M=1;break;case "low":M=0}};this.setSize=function(a,b){m=a;i=b;j=m/2;n=i/2;l.setAttribute("viewBox",-j+" "+-n+" "+m+" "+i);l.setAttribute("width",m);l.setAttribute("height",i);I.set(-j,-n,j,n)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(i,m){var B,G,r,q;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(i,m,this.sortElements);e=f.elements;
+g=f.lights;J=L=0;if(E=g.length>0){t.setRGB(0,0,0);C.setRGB(0,0,0);x.setRGB(0,0,0);B=0;for(G=g.length;B<G;B++)q=g[B],r=q.color,q instanceof THREE.AmbientLight?(t.r+=r.r,t.g+=r.g,t.b+=r.b):q instanceof THREE.DirectionalLight?(C.r+=r.r,C.g+=r.g,C.b+=r.b):q instanceof THREE.PointLight&&(x.r+=r.r,x.g+=r.g,x.b+=r.b)}B=0;for(G=e.length;B<G;B++)if(r=e[B],q=r.material,q=q instanceof THREE.MeshFaceMaterial?r.faceMaterial:q,!(q==null||q.opacity==0))if(v.empty(),r instanceof THREE.RenderableParticle)k=r,k.x*=
+j,k.y*=-n;else if(r instanceof THREE.RenderableLine){if(k=r.v1,o=r.v2,k.positionScreen.x*=j,k.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,v.addPoint(k.positionScreen.x,k.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),I.intersects(v)){r=k;var w=o,A=J++;H[A]==null&&(H[A]=document.createElementNS("http://www.w3.org/2000/svg","line"),M==0&&H[A].setAttribute("shape-rendering","crispEdges"));z=H[A];z.setAttribute("x1",r.positionScreen.x);z.setAttribute("y1",r.positionScreen.y);
+z.setAttribute("x2",w.positionScreen.x);z.setAttribute("y2",w.positionScreen.y);q instanceof THREE.LineBasicMaterial&&(z.setAttribute("style","fill: none; stroke: "+q.color.getContextStyle()+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.linecap+"; stroke-linejoin: "+q.linejoin),l.appendChild(z))}}else if(r instanceof THREE.RenderableFace3){if(k=r.v1,o=r.v2,p=r.v3,k.positionScreen.x*=j,k.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,p.positionScreen.x*=
+j,p.positionScreen.y*=-n,v.addPoint(k.positionScreen.x,k.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),I.intersects(v)){var w=k,A=o,D=p;d.info.render.vertices+=3;d.info.render.faces++;z=b(L++);z.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+A.positionScreen.x+" "+A.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?s.copy(q.color):q instanceof THREE.MeshLambertMaterial?
+E?(s.r=t.r,s.g=t.g,s.b=t.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1))):s.copy(q.color):q instanceof THREE.MeshDepthMaterial?(y=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(y,y,y)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?z.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):z.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);l.appendChild(z)}}else if(r instanceof THREE.RenderableFace4&&(k=r.v1,o=r.v2,p=r.v3,u=r.v4,k.positionScreen.x*=j,k.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,p.positionScreen.x*=j,p.positionScreen.y*=-n,u.positionScreen.x*=j,u.positionScreen.y*=-n,v.addPoint(k.positionScreen.x,
+k.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),v.addPoint(u.positionScreen.x,u.positionScreen.y),I.intersects(v))){var w=k,A=o,D=p,K=u;d.info.render.vertices+=4;d.info.render.faces++;z=b(L++);z.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+A.positionScreen.x+" "+A.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?
+s.copy(q.color):q instanceof THREE.MeshLambertMaterial?E?(s.r=t.r,s.g=t.g,s.b=t.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1))):s.copy(q.color):q instanceof THREE.MeshDepthMaterial?(y=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(y,y,y)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?z.setAttribute("style",
+"fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):z.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);l.appendChild(z)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
 THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};

+ 174 - 175
build/custom/ThreeWebGL.js

@@ -1,7 +1,7 @@
 // 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};
-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("+
+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("+
 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},
 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,87 +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-
 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}};
-THREE.Ray=function(a,b){function c(a,b,c){l.sub(c,a);H=l.dot(b);if(H<=0)return null;s=w.add(a,x.copy(b).multiplyScalar(H));return L=c.distanceTo(s)}function d(a,b,c,d){l.sub(d,b);w.sub(c,b);x.sub(a,b);ra=l.dot(l);T=l.dot(w);ma=l.dot(x);ja=w.dot(w);E=w.dot(x);Q=1/(ra*ja-T*T);I=(ja*ma-T*E)*Q;O=(ra*E-T*ma)*Q;return I>=0&&O>=0&&I+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,q=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3;this.intersectObject=function(l){for(var x,H=[],w=0,R=l.children.length;w<R;w++)Array.prototype.push.apply(H,this.intersectObject(l.children[w]));if(l instanceof THREE.Particle){w=
-c(this.origin,this.direction,l.matrixWorld.getPosition());if(w===null||w>l.scale.x)return[];x={distance:w,point:l.position,face:null,object:l};H.push(x)}else if(l instanceof THREE.Mesh){w=c(this.origin,this.direction,l.matrixWorld.getPosition());if(w===null||w>l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)))return H;var s,L=l.geometry,F=L.vertices,e;l.matrixRotationWorld.extractRotation(l.matrixWorld);w=0;for(R=L.faces.length;w<R;w++)if(x=L.faces[w],a.copy(this.origin),
-b.copy(this.direction),e=l.matrixWorld,q=e.multiplyVector3(q.copy(x.centroid)).subSelf(a),s=q.dot(b),!(s<=0)&&(f=e.multiplyVector3(f.copy(F[x.a].position)),g=e.multiplyVector3(g.copy(F[x.b].position)),h=e.multiplyVector3(h.copy(F[x.c].position)),x instanceof THREE.Face4&&(i=e.multiplyVector3(i.copy(F[x.d].position))),p=l.matrixRotationWorld.multiplyVector3(p.copy(x.normal)),s=b.dot(p),l.doubleSided||(l.flipSided?s>0:s<0)))if(s=p.dot(q.sub(f,a))/s,m.add(a,b.multiplyScalar(s)),x instanceof THREE.Face3)d(m,
-f,g,h)&&(x={distance:a.distanceTo(m),point:m.clone(),face:x,object:l},H.push(x));else if(x instanceof THREE.Face4&&(d(m,f,g,i)||d(m,g,h,i)))x={distance:a.distanceTo(m),point:m.clone(),face:x,object:l},H.push(x)}return H};var l=new THREE.Vector3,w=new THREE.Vector3,x=new THREE.Vector3,H,s,L,ra,T,ma,ja,E,Q,I,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,m,l){i=!1;b=g;c=h;d=m;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,m,l,w,x){i?(i=!1,b=g<m?g<w?g:w:m<w?m:w,c=h<l?h<x?h:x:l<x?l:x,d=g>m?g>w?g:w:m>w?m:w,f=h>l?h>x?h:x:l>x?l:x):(b=g<m?g<w?g<b?g:b:w<b?w:b:m<w?m<b?m:b:w<b?w:b,c=h<l?h<x?h<c?h:c:x<c?x:c:l<x?l<c?l:c:x<c?x:c,d=g>m?g>w?g>d?g:d:w>d?w:d:m>w?m>d?m:d:w>d?w:d,f=h>l?h>x?h>f?h:f:x>f?x:f:l>x?l>f?l:f:x>f?x: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.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.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,f,g,h,i,q,p,m,l,w,x,H,s){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,g!==void 0?g:1,h||0,i||0,q||0,p||0,m!==void 0?m:1,l||0,w||0,x||0,H||0,s!==void 0?s: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,q,p,m,l,w,x,H,s){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=q;this.n32=p;this.n33=m;this.n34=l;this.n41=w;this.n42=x;this.n43=H;this.n44=s;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,q=a.n23,p=a.n24,m=a.n31,l=a.n32,w=a.n33,x=a.n34,H=a.n41,s=a.n42,L=a.n43,
-ra=a.n44,T=b.n11,ma=b.n12,ja=b.n13,E=b.n14,Q=b.n21,I=b.n22,O=b.n23,ua=b.n24,N=b.n31,qa=b.n32,va=b.n33,R=b.n34,oa=b.n41,sa=b.n42,F=b.n43,e=b.n44;this.n11=c*T+d*Q+f*N+g*oa;this.n12=c*ma+d*I+f*qa+g*sa;this.n13=c*ja+d*O+f*va+g*F;this.n14=c*E+d*ua+f*R+g*e;this.n21=h*T+i*Q+q*N+p*oa;this.n22=h*ma+i*I+q*qa+p*sa;this.n23=h*ja+i*O+q*va+p*F;this.n24=h*E+i*ua+q*R+p*e;this.n31=m*T+l*Q+w*N+x*oa;this.n32=m*ma+l*I+w*qa+x*sa;this.n33=m*ja+l*O+w*va+x*F;this.n34=m*E+l*ua+w*R+x*e;this.n41=H*T+s*Q+L*N+ra*oa;this.n42=
-H*ma+s*I+L*qa+ra*sa;this.n43=H*ja+s*O+L*va+ra*F;this.n44=H*E+s*ua+L*R+ra*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,q=this.n31,p=this.n32,m=this.n33,l=this.n34,w=this.n41,x=this.n42,H=this.n43,s=this.n44;return d*h*p*w-c*i*p*w-d*g*m*w+b*i*m*w+c*g*l*w-b*h*l*w-d*h*q*x+c*i*q*x+d*f*m*x-a*i*m*x-c*f*l*x+a*h*l*x+d*g*q*H-b*i*q*H-d*f*p*H+a*i*p*H+b*f*l*H-a*g*l*H-c*g*q*s+b*h*q*s+
-c*f*p*s-a*h*p*s-b*f*m*s+a*g*m*s},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
+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.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
 a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=
 this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,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,q=f*g,p=f*h;this.set(q*g+c,q*h-d*i,q*i+d*h,0,q*h+d*i,p*h+c,p*i-d*g,0,q*i-d*h,p*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,q=a.n24,p=a.n31,m=a.n32,l=a.n33,w=a.n34,x=a.n41,H=a.n42,s=a.n43,L=a.n44;this.n11=i*w*H-q*l*H+q*m*s-h*w*s-i*m*L+h*l*L;this.n12=f*l*H-d*w*H-f*m*s+c*w*s+d*m*L-c*l*L;this.n13=d*q*H-f*i*H+f*h*s-c*q*s-d*h*L+c*i*L;this.n14=f*i*m-d*q*m-f*h*l+c*q*l+d*h*w-c*i*w;this.n21=q*l*x-i*w*x-q*p*s+g*w*s+i*p*L-g*l*L;this.n22=d*w*x-f*l*x+
-f*p*s-b*w*s-d*p*L+b*l*L;this.n23=f*i*x-d*q*x-f*g*s+b*q*s+d*g*L-b*i*L;this.n24=d*q*p-f*i*p+f*g*l-b*q*l-d*g*w+b*i*w;this.n31=h*w*x-q*m*x+q*p*H-g*w*H-h*p*L+g*m*L;this.n32=f*m*x-c*w*x-f*p*H+b*w*H+c*p*L-b*m*L;this.n33=d*q*x-f*h*x+f*g*H-b*q*H-c*g*L+b*h*L;this.n34=f*h*p-c*q*p-f*g*m+b*q*m+c*g*w-b*h*w;this.n41=i*m*x-h*l*x-i*p*H+g*l*H+h*p*s-g*m*s;this.n42=c*l*x-d*m*x+d*p*H-b*l*H-c*p*s+b*m*s;this.n43=d*h*x-c*i*x-d*g*H+b*i*H+c*g*s-b*h*s;this.n44=c*i*p-d*h*p+d*g*m-b*i*m-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 q=h*i,p=h*f,m=d*i,l=d*f;this.n11=q+l*c;this.n12=m*c-p;this.n13=g*d;this.n21=g*f;this.n22=g*i;this.n23=-c;this.n31=p*c-m;this.n32=l+q*c;this.n33=g*h;break;case "ZXY":q=h*i;p=h*f;m=d*i;l=d*f;this.n11=q-l*c;this.n12=-g*f;this.n13=m+p*c;this.n21=p+m*c;this.n22=g*i;this.n23=l-q*c;this.n31=-g*d;this.n32=c;this.n33=g*h;break;case "ZYX":q=
-g*i;p=g*f;m=c*i;l=c*f;this.n11=h*i;this.n12=m*d-p;this.n13=q*d+l;this.n21=h*f;this.n22=l*d+q;this.n23=p*d-m;this.n31=-d;this.n32=c*h;this.n33=g*h;break;case "YZX":q=g*h;p=g*d;m=c*h;l=c*d;this.n11=h*i;this.n12=l-q*f;this.n13=m*f+p;this.n21=f;this.n22=g*i;this.n23=-c*i;this.n31=-d*i;this.n32=p*f+m;this.n33=q-l*f;break;case "XZY":q=g*h;p=g*d;m=c*h;l=c*d;this.n11=h*i;this.n12=-f;this.n13=d*i;this.n21=q*f+l;this.n22=g*i;this.n23=p*f-m;this.n31=m*f-p;this.n32=c*i;this.n33=l*f+q;break;default:q=g*i,p=g*
-f,m=c*i,l=c*f,this.n11=h*i,this.n12=-h*f,this.n13=d,this.n21=p+m*d,this.n22=q-l*d,this.n23=-c*h,this.n31=l-q*d,this.n32=m+p*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,q=b*h;b*=i;var p=c*h;c*=i;d*=i;g*=f;h*=f;f*=i;this.n11=1-(p+d);this.n12=q-f;this.n13=b+h;this.n21=q+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+p);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;
+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=d*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,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,q=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*h+a.n31*p;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*q;c[6]=a*p;c[7]=a*m;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,q,p;h=new THREE.Matrix4;i=b-a;q=c-d;p=g-f;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/q;h.n23=0;h.n24=-((c+d)/q);h.n31=0;h.n32=0;h.n33=-2/p;h.n34=-((g+f)/p);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.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.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,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,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&&
+-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&&
 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[g]=h[g]||new THREE.RenderableObject;g++;return a}function b(){var a=p[q]=p[q]||new THREE.RenderableVertex;q++;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 f,g,h=[],i,q,p=[],
-m,l,w=[],x,H=[],s,L,ra=[],T,ma,ja=[],E={objects:[],sprites:[],lights:[],elements:[]},Q=new THREE.Vector3,I=new THREE.Vector4,O=new THREE.Matrix4,ua=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Vector4,va=new THREE.Vector4;this.computeFrustum=function(a){N[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);N[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);N[2].set(a.n41+a.n21,a.n42+a.n22,
-a.n43+a.n23,a.n44+a.n24);N[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);N[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);N[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=N[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);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;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var h=function(b){if(b.visible!==!1){var e;if(e=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(e=b.frustumCulled===!1))a:{for(var c=b.matrixWorld,
-d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),g=0;g<6;g++)if(e=N[g].x*c.n14+N[g].y*c.n24+N[g].z*c.n34+N[g].w,e<=d){e=!1;break a}e=!0}e?(O.multiplyVector3(Q.copy(b.position)),f=a(),f.object=b,f.z=Q.z,E.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(O.multiplyVector3(Q.copy(b.position)),f=a(),f.object=b,f.z=Q.z,E.sprites.push(f)):b instanceof THREE.Light&&E.lights.push(b);e=0;for(c=b.children.length;e<c;e++)h(b.children[e])}};h(b);d&&
-E.objects.sort(c);return E};this.projectScene=function(a,g,f){var h=g.near,e=g.far,Q,N,fa,$,P,wa,ca,ta,K,na,pa,Ba,Ea,Ca,ya,xa;ma=L=x=l=0;E.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);this.computeFrustum(O);E=this.projectGraph(a,!1);a=0;for(Q=E.objects.length;a<Q;a++)if(K=E.objects[a].object,na=K.matrixWorld,
-Ba=K.material,q=0,K instanceof THREE.Mesh){pa=K.geometry;Ea=K.geometry.materials;$=pa.vertices;Ca=pa.faces;ya=pa.faceVertexUvs;pa=K.matrixRotationWorld.extractRotation(na);N=0;for(fa=$.length;N<fa;N++)i=b(),i.positionWorld.copy($[N].position),na.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;$=0;for(N=Ca.length;$<
-N;$++){fa=Ca[$];if(fa instanceof THREE.Face3)if(P=p[fa.a],wa=p[fa.b],ca=p[fa.c],P.visible&&wa.visible&&ca.visible&&(K.doubleSided||K.flipSided!=(ca.positionScreen.x-P.positionScreen.x)*(wa.positionScreen.y-P.positionScreen.y)-(ca.positionScreen.y-P.positionScreen.y)*(wa.positionScreen.x-P.positionScreen.x)<0))ta=w[l]=w[l]||new THREE.RenderableFace3,l++,m=ta,m.v1.copy(P),m.v2.copy(wa),m.v3.copy(ca);else continue;else if(fa instanceof THREE.Face4)if(P=p[fa.a],wa=p[fa.b],ca=p[fa.c],ta=p[fa.d],P.visible&&
-wa.visible&&ca.visible&&ta.visible&&(K.doubleSided||K.flipSided!=((ta.positionScreen.x-P.positionScreen.x)*(wa.positionScreen.y-P.positionScreen.y)-(ta.positionScreen.y-P.positionScreen.y)*(wa.positionScreen.x-P.positionScreen.x)<0||(wa.positionScreen.x-ca.positionScreen.x)*(ta.positionScreen.y-ca.positionScreen.y)-(wa.positionScreen.y-ca.positionScreen.y)*(ta.positionScreen.x-ca.positionScreen.x)<0)))xa=H[x]=H[x]||new THREE.RenderableFace4,x++,m=xa,m.v1.copy(P),m.v2.copy(wa),m.v3.copy(ca),m.v4.copy(ta);
-else continue;m.normalWorld.copy(fa.normal);pa.multiplyVector3(m.normalWorld);m.centroidWorld.copy(fa.centroid);na.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);O.multiplyVector3(m.centroidScreen);ca=fa.vertexNormals;P=0;for(wa=ca.length;P<wa;P++)ta=m.vertexNormalsWorld[P],ta.copy(ca[P]),pa.multiplyVector3(ta);P=0;for(wa=ya.length;P<wa;P++)if(xa=ya[P][$]){ca=0;for(ta=xa.length;ca<ta;ca++)m.uvs[P][ca]=xa[ca]}m.material=Ba;m.faceMaterial=fa.materialIndex!==null?Ea[fa.materialIndex]:
-null;m.z=m.centroidScreen.z;E.elements.push(m)}}else if(K instanceof THREE.Line){ua.multiply(O,na);$=K.geometry.vertices;P=b();P.positionScreen.copy($[0].position);ua.multiplyVector4(P.positionScreen);N=1;for(fa=$.length;N<fa;N++)if(P=b(),P.positionScreen.copy($[N].position),ua.multiplyVector4(P.positionScreen),wa=p[q-2],qa.copy(P.positionScreen),va.copy(wa.positionScreen),d(qa,va))qa.multiplyScalar(1/qa.w),va.multiplyScalar(1/va.w),K=ra[L]=ra[L]||new THREE.RenderableLine,L++,s=K,s.v1.positionScreen.copy(qa),
-s.v2.positionScreen.copy(va),s.z=Math.max(qa.z,va.z),s.material=Ba,E.elements.push(s)}a=0;for(Q=E.sprites.length;a<Q;a++)if(K=E.sprites[a].object,na=K.matrixWorld,K instanceof THREE.Particle&&(I.set(na.n14,na.n24,na.n34,1),O.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))h=ja[ma]=ja[ma]||new THREE.RenderableParticle,ma++,T=h,T.x=I.x/I.w,T.y=I.y/I.w,T.z=I.z,T.rotation=K.rotation.z,T.scale.x=K.scale.x*Math.abs(T.x-(I.x+g.projectionMatrix.n11)/(I.w+g.projectionMatrix.n14)),T.scale.y=K.scale.y*Math.abs(T.y-
-(I.y+g.projectionMatrix.n22)/(I.w+g.projectionMatrix.n24)),T.material=K.material,E.elements.push(T);f&&E.elements.sort(c);return E}};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);
+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);
 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.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,q=this.w,p=q*c+h*f-i*d,m=q*d+i*c-g*f,l=q*f+g*d-h*c,c=-g*
-c-h*d-i*f;b.x=p*q+c*-g+m*-i-l*-h;b.y=m*q+c*-h+l*-g-p*-i;b.z=l*q+c*-i+p*-h-m*-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};
+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};
 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.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<
+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<
 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,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=
+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=
 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,
-b,c,d,g,f,F){i=a.vertices[b].position;q=a.vertices[c].position;p=a.vertices[d].position;m=h[g];l=h[f];w=h[F];x=q.x-i.x;H=p.x-i.x;s=q.y-i.y;L=p.y-i.y;ra=q.z-i.z;T=p.z-i.z;ma=l.u-m.u;ja=w.u-m.u;E=l.v-m.v;Q=w.v-m.v;I=1/(ma*Q-ja*E);qa.set((Q*x-E*H)*I,(Q*s-E*L)*I,(Q*ra-E*T)*I);va.set((ma*H-ja*x)*I,(ma*L-ja*s)*I,(ma*T-ja*ra)*I);ua[b].addSelf(qa);ua[c].addSelf(qa);ua[d].addSelf(qa);N[b].addSelf(va);N[c].addSelf(va);N[d].addSelf(va)}var b,c,d,f,g,h,i,q,p,m,l,w,x,H,s,L,ra,T,ma,ja,E,Q,I,O,ua=[],N=[],qa=new THREE.Vector3,
-va=new THREE.Vector3,R=new THREE.Vector3,oa=new THREE.Vector3,sa=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)ua[b]=new THREE.Vector3,N[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 F=["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++)sa.copy(g.vertexNormals[d]),
-f=g[F[d]],O=ua[f],R.copy(O),R.subSelf(sa.multiplyScalar(sa.dot(O))).normalize(),oa.cross(g.vertexNormals[d],O),f=oa.dot(N[f]),f=f<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.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<
+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<
 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,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=
+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=
 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},f,g,h,i,q,p,m,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;p=this.points[c[0]];m=this.points[c[1]];
-l=this.points[c[2]];w=this.points[c[3]];i=h*h;q=h*i;d.x=b(p.x,m.x,l.x,w.x,h,i,q);d.y=b(p.y,m.y,l.y,w.y,h,i,q);d.z=b(p.z,m.z,l.z,w.z,h,i,q);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=[],l=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),l+=h.distanceTo(f),
-f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=g&&(i[b]=l,g=b);i[i.length]=l;return{chunks:i,total:l}};this.reparametrizeByArcLength=function(a){var b,c,d,g,f,h,i=[],l=new THREE.Vector3,m=this.getLength();i.push(l.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=m.chunks[b]-m.chunks[b-1];h=Math.ceil(a*c/m.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(l.copy(d).clone());i.push(l.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},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=
 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,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.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.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,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.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.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;
 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;
@@ -117,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.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;
-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=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.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.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,q){THREE.Texture.call(this,null,f,g,h,i,q);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,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.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.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;
 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.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=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.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)};
-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.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.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.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:
@@ -156,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",
 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"};
-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.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.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: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}}};
@@ -176,114 +174,115 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function 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 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,k=a.vertices;h=k.length;var D=a.colors,i=D.length,u=a.__vertexArray,l=a.__colorArray,j=a.__sortArray,o=a.__dirtyVertices,m=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){Fa.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)g=k[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=k[j[d][1]].position,f=d*3,u[f]=g.x,u[f+1]=g.y,u[f+2]=g.z;for(d=0;d<i;d++)f=d*3,g=D[j[d][1]],l[f]=g.r,l[f+
-1]=g.g,l[f+2]=g.b;if(q){D=0;for(i=q.length;D<i;D++)if(k=q[D],k.boundTo===void 0||k.boundTo==="vertices")if(f=0,g=k.value.length,k.size===1)for(d=0;d<g;d++)h=j[d][1],k.array[d]=k.value[h];else if(k.size===2)for(d=0;d<g;d++)h=j[d][1],h=k.value[h],k.array[f]=h.x,k.array[f+1]=h.y,f+=2;else if(k.size===3)if(k.type==="c")for(d=0;d<g;d++)h=j[d][1],h=k.value[h],k.array[f]=h.r,k.array[f+1]=h.g,k.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=j[d][1],h=k.value[h],k.array[f]=h.x,k.array[f+1]=h.y,k.array[f+2]=h.z,
-f+=3;else if(k.size===4)for(d=0;d<g;d++)h=j[d][1],h=k.value[h],k.array[f]=h.x,k.array[f+1]=h.y,k.array[f+2]=h.z,k.array[f+3]=h.w,f+=4}}else{if(o)for(d=0;d<h;d++)g=k[d].position,f=d*3,u[f]=g.x,u[f+1]=g.y,u[f+2]=g.z;if(m)for(d=0;d<i;d++)g=D[d],f=d*3,l[f]=g.r,l[f+1]=g.g,l[f+2]=g.b;if(q){D=0;for(i=q.length;D<i;D++)if(k=q[D],k.needsUpdate&&(k.boundTo===void 0||k.boundTo==="vertices"))if(g=k.value.length,f=0,k.size===1)for(d=0;d<g;d++)k.array[d]=k.value[d];else if(k.size===2)for(d=0;d<g;d++)h=k.value[d],
-k.array[f]=h.x,k.array[f+1]=h.y,f+=2;else if(k.size===3)if(k.type==="c")for(d=0;d<g;d++)h=k.value[d],k.array[f]=h.r,k.array[f+1]=h.g,k.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=k.value[d],k.array[f]=h.x,k.array[f+1]=h.y,k.array[f+2]=h.z,f+=3;else if(k.size===4)for(d=0;d<g;d++)h=k.value[d],k.array[f]=h.x,k.array[f+1]=h.y,k.array[f+2]=h.z,k.array[f+3]=h.w,f+=4}}if(o||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,u,b);if(m||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
-a.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,l,b);if(q){D=0;for(i=q.length;D<i;D++)if(k=q[D],k.needsUpdate||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,k.buffer),e.bufferData(e.ARRAY_BUFFER,k.array,b)}}function i(a,b){return b.z-a.z}function q(a,b,e,c,d,f,g,h){var D,i,u,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var j=i;j!==b;j+=l)if(D=a[j],D.render){i=D.object;u=D.buffer;if(h)D=h;else{D=D[e];if(!D)continue;g&&F.setBlending(D.blending);F.setDepthTest(D.depthTest);ra(D.depthWrite);T(D.polygonOffset,
-D.polygonOffsetFactor,D.polygonOffsetUnits)}F.setObjectFaces(i);F.renderBuffer(c,d,f,D,u,i)}}function p(a,b,c,d,f,g,h){for(var k,i,l,u,m=0,j=a.length;m<j;m++)if(k=a[m],i=k.object,i.visible){P=-1;if(h)l=h;else{l=k[b];if(!l)continue;g&&F.setBlending(l.blending);F.setDepthTest(l.depthTest);ra(l.depthWrite);T(l.polygonOffset,l.polygonOffsetFactor,l.polygonOffsetUnits)}F.setObjectFaces(i);u=s(c,d,f,l,i);i.immediateRenderCallback?i.immediateRenderCallback(u,e,Ia):i.render(function(a){F.renderBufferImmediate(a,
-u,l.shading)})}}function m(a,b,e){a.push({buffer:b,object:e,opaque:null,transparent:null})}function l(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 e=a.length-1;e>=0;e--)a[e].object===b&&a.splice(e,1)}function H(a,b){for(var e=a.length-1;e>=0;e--)a[e]===b&&a.splice(e,1)}function s(a,b,c,d,f){d.program||F.initMaterial(d,b,c,f);if(d.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=
-new Float32Array(F.maxMorphTargets);for(var g=0,h=F.maxMorphTargets;g<h;g++)f.__webglMorphTargetInfluences[g]=0}var k=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Aa&&(e.useProgram(g),Aa=g,k=!0);if(d.id!==$)$=d.id,k=!0;if(k){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 l,u,m=0,j=0,o=0,q,p,w,x=Ka,s=x.directional.colors,H=x.directional.positions,t=x.point.colors,I=x.point.positions,L=x.point.distances,v=0,U=0,c=l=w=0,k=b.length;c<k;c++)if(l=b[c],u=l.color,q=l.position,p=l.intensity,w=l.distance,l instanceof THREE.AmbientLight)F.gammaInput?(m+=u.r*u.r,j+=u.g*u.g,o+=u.b*u.b):(m+=u.r,j+=u.g,o+=u.b);else if(l instanceof THREE.DirectionalLight)w=v*3,F.gammaInput?(s[w]=u.r*u.r*p*p,s[w+1]=u.g*u.g*p*p,s[w+2]=u.b*u.b*
-p*p):(s[w]=u.r*p,s[w+1]=u.g*p,s[w+2]=u.b*p),H[w]=q.x,H[w+1]=q.y,H[w+2]=q.z,v+=1;else if(l instanceof THREE.SpotLight)w=v*3,F.gammaInput?(s[w]=u.r*u.r*p*p,s[w+1]=u.g*u.g*p*p,s[w+2]=u.b*u.b*p*p):(s[w]=u.r*p,s[w+1]=u.g*p,s[w+2]=u.b*p),u=1/q.length(),H[w]=q.x*u,H[w+1]=q.y*u,H[w+2]=q.z*u,v+=1;else if(l instanceof THREE.PointLight)l=U*3,F.gammaInput?(t[l]=u.r*u.r*p*p,t[l+1]=u.g*u.g*p*p,t[l+2]=u.b*u.b*p*p):(t[l]=u.r*p,t[l+1]=u.g*p,t[l+2]=u.b*p),I[l]=q.x,I[l+1]=q.y,I[l+2]=q.z,L[U]=w,U+=1;c=v*3;for(k=s.length;c<
-k;c++)s[c]=0;c=U*3;for(k=t.length;c<k;c++)t[c]=0;x.point.length=U;x.directional.length=v;x.ambient[0]=m;x.ambient[1]=j;x.ambient[2]=o;b=Ka;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,F.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=O.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,F.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)F.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<F.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=F.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=
-F.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=F.shadowMapDarkness;i.shadowBias.value=F.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(j=g.uniforms[b[i][1]])if(m=b[i][0],o=m.type,k=m.value,o==="i")e.uniform1i(j,k);else if(o==="f")e.uniform1f(j,k);else if(o==="v2")e.uniform2f(j,k.x,k.y);else if(o==="v3")e.uniform3f(j,k.x,k.y,k.z);else if(o==="v4")e.uniform4f(j,k.x,k.y,k.z,k.w);else if(o==="c")e.uniform3f(j,k.r,k.g,k.b);else if(o==="fv1")e.uniform1fv(j,k);else if(o==="fv")e.uniform3fv(j,
-k);else if(o==="v3v"){if(!m._array)m._array=new Float32Array(3*k.length);o=0;for(q=k.length;o<q;o++)x=o*3,m._array[x]=k[o].x,m._array[x+1]=k[o].y,m._array[x+2]=k[o].z;e.uniform3fv(j,m._array)}else if(o==="m4"){if(!m._array)m._array=new Float32Array(16);k.flattenToArray(m._array);e.uniformMatrix4fv(j,!1,m._array)}else if(o==="m4v"){if(!m._array)m._array=new Float32Array(16*k.length);o=0;for(q=k.length;o<q;o++)k[o].flattenToArrayOffset(m._array,o*16);e.uniformMatrix4fv(j,!1,m._array)}else if(o==="t"){if(e.uniform1i(j,
-k),j=m.texture)if(j.image instanceof Array&&j.image.length===6){if(m=j,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);k=ja(e.TEXTURE_CUBE_MAP,m,m.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,m.image[j]);k&&e.generateMipmap(e.TEXTURE_CUBE_MAP);m.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+
-k),e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else j instanceof THREE.WebGLRenderTargetCube?(m=j,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,m.__webglTexture)):F.setTexture(j,k)}else if(o==="tv"){if(!m._array){m._array=[];o=0;for(q=m.texture.length;o<q;o++)m._array[o]=k+o}e.uniform1iv(j,m._array);o=0;for(q=m.texture.length;o<q;o++)(j=m.texture[o])&&F.setTexture(j,m._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 L(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function ra(a){pa!==a&&(e.depthMask(a),pa=a)}function T(a,b,c){Ba!==a&&(a?e.enable(e.POLYGON_OFFSET_FILL):
-e.disable(e.POLYGON_OFFSET_FILL),Ba=a);if(a&&(Ea!==b||Ca!==c))e.polygonOffset(b,c),Ea=b,Ca=c}function ma(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 ja(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(e.texParameteri(a,e.TEXTURE_WRAP_S,I(b.wrapS)),e.texParameteri(a,
-e.TEXTURE_WRAP_T,I(b.wrapT)),e.texParameteri(a,e.TEXTURE_MAG_FILTER,I(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,I(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,Q(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,Q(b.minFilter)),!1)}function E(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 Q(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}
-function I(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||{},O=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ua=a.precision!==void 0?a.precision:"highp",N=a.antialias!==void 0?a.antialias:!1,qa=a.stencil!==void 0?a.stencil:!0,va=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,R=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),oa=a.clearAlpha!==void 0?a.clearAlpha:0,sa=a.maxLights!==void 0?a.maxLights:4;this.domElement=O;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 F=this,e,za=[],Aa=null,fa=null,$=-1,P=null,wa=0,ca=null,ta=null,K=null,na=null,pa=null,Ba=null,Ea=null,Ca=null,ya=null,xa=0,Ja=0,Ga=0,Ha=0,Ia=new THREE.Frustum,Fa=new THREE.Matrix4,Da=new THREE.Vector4,Ka={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};e=function(){var a;try{if(!(a=O.getContext("experimental-webgl",{antialias:N,stencil:qa,preserveDrawingBuffer:va})))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,oa);this.context=
-e;var La=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return e};this.supportsVertexTextures=function(){return La};this.setSize=function(a,b){O.width=a;O.height=b;this.setViewport(0,0,O.width,O.height)};this.setViewport=function(a,b,c,d){xa=a;Ja=b;Ga=c;Ha=d;e.viewport(xa,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){R.setHex(a);
-oa=b;e.clearColor(R.r,R.g,R.b,oa)};this.setClearColor=function(a,b){R.copy(a);oa=b;e.clearColor(R.r,R.g,R.b,oa)};this.getClearColor=function(){return R};this.getClearAlpha=function(){return oa};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);
-F.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--};this.deallocateTexture=
-function(a){if(a.__webglInit)a.__webglInit=!1,e.deleteTexture(a.__webglTexture),F.info.memory.textures--};this.updateShadowMap=function(a,b){Aa=null;$=P=pa=na=K=-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,k,i,l,m,q,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],i=c[j+4],m=c[j+5],k=c[j+6],l=c[j+7],q=c[j+8],d=(d+h+k)/3,f=(f+i+l)/3,g=(g+m+q)/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,k,c=s(a,b,c,d,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(d.wireframe?1:0);c!==P&&(P=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 i=g.morphTargetForcedOrder;for(k=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<i.length;)e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i[h]]),e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[h]=
-k[i[h]],h++}else{var i=[],l=-1,m=0;k=g.morphTargetInfluences;var q,j=k.length;h=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(q=0;q<j;q++)!i[q]&&k[q]>l&&(m=q,l=k[m]);e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[m]);e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=l;i[m]=1;l=-1;h++}}d.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){h=
-0;for(k=f.__webglCustomAttributesList.length;h<k;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,
+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,e,c,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[e];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(c,d,f,i,r,n)}}function q(a,b,e,c,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(e,c,d,h,i)}}function k(a,b,e){a.push({buffer:b,object:e,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 e=a.length-1;e>=0;e--)a[e].object===b&&a.splice(e,1)}function G(a,b){for(var e=a.length-1;e>=0;e--)a[e]===b&&a.splice(e,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=
+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>=
 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!==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)),F.info.render.calls++,F.info.render.vertices+=f.__webglFaceCount,F.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),F.info.render.calls++):g instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,f.__webglParticleCount),F.info.render.calls++):g instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,f.__webglVertexCount),F.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,h,k,l=a.lights,m=a.fog;$=-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++)Aa=null,$=P=pa=na=K=-1,this.renderPluginsPre[f].render(a,b,Ga,Ha),Aa=null,$=P=pa=na=K=-1}F.info.render.calls=0;F.info.render.vertices=0;F.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);Ia.setFromMatrix(Fa);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],k=h.object,h.render=!1,k.visible&&(!(k instanceof THREE.Mesh)||!k.frustumCulled||Ia.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);L(k,b);var u=h,w=u.object,
-j=u.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?(u.transparent=o,u.opaque=null):(u.opaque=o,u.transparent=null)}else if(o)o.transparent?(u.transparent=o,u.opaque=null):(u.opaque=o,u.transparent=null);h.render=!0;if(this.sortObjects)k.renderDepth?h.z=k.renderDepth:(Da.copy(k.position),Fa.multiplyVector3(Da),h.z=Da.z)}this.sortObjects&&d.sort(i);d=a.__webglObjectsImmediate;f=0;for(g=d.length;f<g;f++)if(h=
-d[f],k=h.object,k.visible)k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),L(k,b),k=h.object.material,k.transparent?(h.transparent=k,h.opaque=null):(h.opaque=k,h.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),ra(a.overrideMaterial.depthWrite),T(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),q(a.__webglObjects,!1,"",b,l,m,!0,a.overrideMaterial),
-p(a.__webglObjectsImmediate,"",b,l,m,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),q(a.__webglObjects,!0,"opaque",b,l,m,!1),p(a.__webglObjectsImmediate,"opaque",b,l,m,!1),q(a.__webglObjects,!1,"transparent",b,l,m,!0),p(a.__webglObjectsImmediate,"transparent",b,l,m,!0));if(this.renderPluginsPost.length){f=0;for(g=this.renderPluginsPost.length;f<g;f++)this.renderPluginsPost[f].render(a,b,Ga,Ha),Aa=null,$=P=pa=na=K=-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.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var i=a.__objectsAdded[0],q=a,p=void 0,s=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){s=i.geometry;if(s.geometryGroups===void 0){var B=s,C=void 0,k=void 0,D=void 0,aa=void 0,u=void 0,Y=void 0,j=void 0,o={},I=B.morphTargets.length;B.geometryGroups={};C=0;for(k=B.faces.length;C<k;C++)D=B.faces[C],aa=
-D.materialIndex,Y=aa!==void 0?aa:-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:aa,vertices:0,numMorphTargets:I}),u=D instanceof THREE.Face3?3:4,B.geometryGroups[j].vertices+u>65535&&(o[Y].counter+=1,j=o[Y].hash+"_"+o[Y].counter,B.geometryGroups[j]===void 0&&(B.geometryGroups[j]={faces3:[],faces4:[],materialIndex:aa,vertices:0,numMorphTargets:I})),D instanceof THREE.Face3?B.geometryGroups[j].faces3.push(C):
-B.geometryGroups[j].faces4.push(C),B.geometryGroups[j].vertices+=u;B.geometryGroupsList=[];C=void 0;for(C in B.geometryGroups)B.geometryGroups[C].id=wa++,B.geometryGroupsList.push(B.geometryGroups[C])}for(p in s.geometryGroups)if(B=s.geometryGroups[p],!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){D=k=void 0;C.__webglMorphTargetsBuffers=[];k=0;for(D=C.numMorphTargets;k<D;k++)C.__webglMorphTargetsBuffers.push(e.createBuffer())}F.info.memory.geometries++;aa=i;u=aa.geometry;k=B.faces3;Y=B.faces4;C=k.length*3+Y.length*4;D=k.length*
-1+Y.length*2;Y=k.length*3+Y.length*4;k=c(aa,B);j=g(k);o=d(k);I=f(k);B.__vertexArray=new Float32Array(C*3);if(o)B.__normalArray=new Float32Array(C*3);if(u.hasTangents)B.__tangentArray=new Float32Array(C*4);if(I)B.__colorArray=new Float32Array(C*3);if(j){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)B.__uvArray=new Float32Array(C*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)B.__uv2Array=new Float32Array(C*2)}if(aa.geometry.skinWeights.length&&aa.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(D*3);B.__lineArray=new Uint16Array(Y*2);if(B.numMorphTargets){B.__morphTargetsArrays=[];aa=0;for(u=B.numMorphTargets;aa<u;aa++)B.__morphTargetsArrays.push(new Float32Array(C*3))}B.__webglFaceCount=D*3;B.__webglLineCount=Y*2;if(k.attributes){if(B.__webglCustomAttributesList===void 0)B.__webglCustomAttributesList=[];D=void 0;
-for(D in k.attributes){var aa=k.attributes[D],u={},la;for(la in aa)u[la]=aa[la];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,Y=1,u.type==="v2"?Y=2:u.type==="v3"?Y=3:u.type==="v4"?Y=4:u.type==="c"&&(Y=3),u.size=Y,u.array=new Float32Array(C*Y),u.buffer=e.createBuffer(),u.buffer.belongsToAttribute=D,aa.needsUpdate=!0,u.__original=aa;B.__webglCustomAttributesList.push(u)}}B.__inittedArrays=!0;s.__dirtyVertices=!0;s.__dirtyMorphTargets=!0;s.__dirtyElements=!0;s.__dirtyUvs=!0;
-s.__dirtyNormals=!0;s.__dirtyTangents=!0;s.__dirtyColors=!0}}else if(i instanceof THREE.Ribbon){if(s=i.geometry,!s.__webglVertexBuffer)B=s,B.__webglVertexBuffer=e.createBuffer(),B.__webglColorBuffer=e.createBuffer(),F.info.memory.geometries++,B=s,C=B.vertices.length,B.__vertexArray=new Float32Array(C*3),B.__colorArray=new Float32Array(C*3),B.__webglVertexCount=C,s.__dirtyVertices=!0,s.__dirtyColors=!0}else if(i instanceof THREE.Line){if(s=i.geometry,!s.__webglVertexBuffer)B=s,B.__webglVertexBuffer=
-e.createBuffer(),B.__webglColorBuffer=e.createBuffer(),F.info.memory.geometries++,B=s,C=i,k=B.vertices.length,B.__vertexArray=new Float32Array(k*3),B.__colorArray=new Float32Array(k*3),B.__webglLineCount=k,b(B,C),s.__dirtyVertices=!0,s.__dirtyColors=!0}else if(i instanceof THREE.ParticleSystem&&(s=i.geometry,!s.__webglVertexBuffer))B=s,B.__webglVertexBuffer=e.createBuffer(),B.__webglColorBuffer=e.createBuffer(),F.info.geometries++,B=s,C=i,k=B.vertices.length,B.__vertexArray=new Float32Array(k*3),
-B.__colorArray=new Float32Array(k*3),B.__sortArray=[],B.__webglParticleCount=k,b(B,C),s.__dirtyVertices=!0,s.__dirtyColors=!0;if(!i.__webglActive){if(i instanceof THREE.Mesh)for(p in s=i.geometry,s.geometryGroups)B=s.geometryGroups[p],m(q.__webglObjects,B,i);else i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem?(s=i.geometry,m(q.__webglObjects,s,i)):THREE.MarchingCubes!==void 0&&i instanceof THREE.MarchingCubes||i.immediateRenderCallback?q.__webglObjectsImmediate.push({object:i,
-opaque:null,transparent:null}):i instanceof THREE.Sprite?q.__webglSprites.push(i):i instanceof THREE.LensFlare&&q.__webglFlares.push(i);i.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)i=a.__objectsRemoved[0],q=a,i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem||i instanceof THREE.Ribbon||i instanceof THREE.Line?x(q.__webglObjects,i):i instanceof THREE.Sprite?H(q.__webglSprites,i):i instanceof THREE.LensFlare?H(q.__webglFlares,i):(i instanceof THREE.MarchingCubes||
-i.immediateRenderCallback)&&x(q.__webglObjectsImmediate,i),i.__webglActive=!1,a.__objectsRemoved.splice(0,1);i=0;for(q=a.__webglObjects.length;i<q;i++)if(la=a.__webglObjects[i].object,p=la.geometry,s=D=k=void 0,la instanceof THREE.Mesh){B=0;for(C=p.geometryGroupsList.length;B<C;B++)if(k=p.geometryGroupsList[B],s=c(la,k),D=s.attributes&&l(s),p.__dirtyVertices||p.__dirtyMorphTargets||p.__dirtyElements||p.__dirtyUvs||p.__dirtyNormals||p.__dirtyColors||p.__dirtyTangents||D){var M=la,D=e.DYNAMIC_DRAW,
-aa=!p.dynamic,j=s;if(k.__inittedArrays){var u=d(j),Y=f(j),L=g(j),P=u===THREE.SmoothShading,E=o=j=void 0,t=void 0,da=void 0,N=void 0,v=void 0,U=void 0,O=void 0,T=E=void 0,y=void 0,z=void 0,A=void 0,ea=t=void 0,ga=void 0,K=void 0,V=t=O=void 0,W=void 0,Q=A=z=y=v=void 0,G=t=A=z=y=Q=A=z=y=Q=A=z=y=void 0,J=void 0,R=N=void 0,ca=void 0,Z=void 0,ma=void 0,ha=void 0,ja=T=Z=J=0,fa=0,$=G=E=0,S=v=ea=0,r=0,ia=void 0,S=k.__vertexArray,ca=k.__uvArray,r=k.__uv2Array,R=k.__normalArray,da=k.__tangentArray,ga=k.__colorArray,
-V=k.__skinVertexAArray,W=k.__skinVertexBArray,U=k.__skinIndexArray,ka=k.__skinWeightArray,Q=k.__morphTargetsArrays,I=k.__webglCustomAttributesList,n=void 0,n=k.__faceArray,ia=k.__lineArray,K=M.geometry,ra=K.__dirtyElements,qa=K.__dirtyUvs,N=K.__dirtyNormals,O=K.__dirtyTangents,va=K.__dirtyColors,ma=K.__dirtyMorphTargets,ha=K.vertices,M=k.faces3,X=k.faces4,ba=K.faces,ta=K.faceVertexUvs[0],ua=K.faceVertexUvs[1],na=K.skinVerticesA,oa=K.skinVerticesB,pa=K.skinIndices,sa=K.skinWeights,xa=K.morphTargets;
-if(K.__dirtyVertices){j=0;for(o=M.length;j<o;j++)t=ba[M[j]],y=ha[t.a].position,z=ha[t.b].position,A=ha[t.c].position,S[Z]=y.x,S[Z+1]=y.y,S[Z+2]=y.z,S[Z+3]=z.x,S[Z+4]=z.y,S[Z+5]=z.z,S[Z+6]=A.x,S[Z+7]=A.y,S[Z+8]=A.z,Z+=9;j=0;for(o=X.length;j<o;j++)t=ba[X[j]],y=ha[t.a].position,z=ha[t.b].position,A=ha[t.c].position,t=ha[t.d].position,S[Z]=y.x,S[Z+1]=y.y,S[Z+2]=y.z,S[Z+3]=z.x,S[Z+4]=z.y,S[Z+5]=z.z,S[Z+6]=A.x,S[Z+7]=A.y,S[Z+8]=A.z,S[Z+9]=t.x,S[Z+10]=t.y,S[Z+11]=t.z,Z+=12;e.bindBuffer(e.ARRAY_BUFFER,k.__webglVertexBuffer);
-e.bufferData(e.ARRAY_BUFFER,S,D)}if(ma){Z=0;for(ma=xa.length;Z<ma;Z++){j=S=0;for(o=M.length;j<o;j++)t=ba[M[j]],y=xa[Z].vertices[t.a].position,z=xa[Z].vertices[t.b].position,A=xa[Z].vertices[t.c].position,ha=Q[Z],ha[S]=y.x,ha[S+1]=y.y,ha[S+2]=y.z,ha[S+3]=z.x,ha[S+4]=z.y,ha[S+5]=z.z,ha[S+6]=A.x,ha[S+7]=A.y,ha[S+8]=A.z,S+=9;j=0;for(o=X.length;j<o;j++)t=ba[X[j]],y=xa[Z].vertices[t.a].position,z=xa[Z].vertices[t.b].position,A=xa[Z].vertices[t.c].position,t=xa[Z].vertices[t.d].position,ha=Q[Z],ha[S]=y.x,
-ha[S+1]=y.y,ha[S+2]=y.z,ha[S+3]=z.x,ha[S+4]=z.y,ha[S+5]=z.z,ha[S+6]=A.x,ha[S+7]=A.y,ha[S+8]=A.z,ha[S+9]=t.x,ha[S+10]=t.y,ha[S+11]=t.z,S+=12;e.bindBuffer(e.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[Z]);e.bufferData(e.ARRAY_BUFFER,Q[Z],D)}}if(sa.length){j=0;for(o=M.length;j<o;j++)t=ba[M[j]],y=sa[t.a],z=sa[t.b],A=sa[t.c],ka[v]=y.x,ka[v+1]=y.y,ka[v+2]=y.z,ka[v+3]=y.w,ka[v+4]=z.x,ka[v+5]=z.y,ka[v+6]=z.z,ka[v+7]=z.w,ka[v+8]=A.x,ka[v+9]=A.y,ka[v+10]=A.z,ka[v+11]=A.w,y=pa[t.a],z=pa[t.b],A=pa[t.c],U[v]=y.x,
-U[v+1]=y.y,U[v+2]=y.z,U[v+3]=y.w,U[v+4]=z.x,U[v+5]=z.y,U[v+6]=z.z,U[v+7]=z.w,U[v+8]=A.x,U[v+9]=A.y,U[v+10]=A.z,U[v+11]=A.w,y=na[t.a],z=na[t.b],A=na[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,y=oa[t.a],z=oa[t.b],A=oa[t.c],W[v]=y.x,W[v+1]=y.y,W[v+2]=y.z,W[v+3]=1,W[v+4]=z.x,W[v+5]=z.y,W[v+6]=z.z,W[v+7]=1,W[v+8]=A.x,W[v+9]=A.y,W[v+10]=A.z,W[v+11]=1,v+=12;j=0;for(o=X.length;j<o;j++)t=ba[X[j]],y=sa[t.a],z=sa[t.b],A=
-sa[t.c],Q=sa[t.d],ka[v]=y.x,ka[v+1]=y.y,ka[v+2]=y.z,ka[v+3]=y.w,ka[v+4]=z.x,ka[v+5]=z.y,ka[v+6]=z.z,ka[v+7]=z.w,ka[v+8]=A.x,ka[v+9]=A.y,ka[v+10]=A.z,ka[v+11]=A.w,ka[v+12]=Q.x,ka[v+13]=Q.y,ka[v+14]=Q.z,ka[v+15]=Q.w,y=pa[t.a],z=pa[t.b],A=pa[t.c],Q=pa[t.d],U[v]=y.x,U[v+1]=y.y,U[v+2]=y.z,U[v+3]=y.w,U[v+4]=z.x,U[v+5]=z.y,U[v+6]=z.z,U[v+7]=z.w,U[v+8]=A.x,U[v+9]=A.y,U[v+10]=A.z,U[v+11]=A.w,U[v+12]=Q.x,U[v+13]=Q.y,U[v+14]=Q.z,U[v+15]=Q.w,y=na[t.a],z=na[t.b],A=na[t.c],Q=na[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]=Q.x,V[v+13]=Q.y,V[v+14]=Q.z,V[v+15]=1,y=oa[t.a],z=oa[t.b],A=oa[t.c],t=oa[t.d],W[v]=y.x,W[v+1]=y.y,W[v+2]=y.z,W[v+3]=1,W[v+4]=z.x,W[v+5]=z.y,W[v+6]=z.z,W[v+7]=1,W[v+8]=A.x,W[v+9]=A.y,W[v+10]=A.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,k.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,V,D),e.bindBuffer(e.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),
-e.bufferData(e.ARRAY_BUFFER,W,D),e.bindBuffer(e.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,U,D),e.bindBuffer(e.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ka,D))}if(va&&Y){j=0;for(o=M.length;j<o;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,ga[ea]=t.r,ga[ea+1]=t.g,ga[ea+2]=t.b,ga[ea+3]=V.r,ga[ea+4]=V.g,ga[ea+5]=V.b,ga[ea+6]=W.r,ga[ea+7]=W.g,ga[ea+8]=W.b,ea+=9;j=0;for(o=X.length;j<o;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,ga[ea]=t.r,ga[ea+1]=t.g,ga[ea+2]=t.b,ga[ea+3]=V.r,ga[ea+4]=V.g,ga[ea+5]=V.b,ga[ea+6]=W.r,ga[ea+7]=W.g,ga[ea+8]=W.b,ga[ea+9]=v.r,ga[ea+10]=v.g,ga[ea+11]=v.b,ea+=12;ea>0&&(e.bindBuffer(e.ARRAY_BUFFER,k.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,ga,D))}if(O&&K.hasTangents){j=0;for(o=M.length;j<o;j++)t=ba[M[j]],O=t.vertexTangents,ea=O[0],ga=O[1],K=O[2],da[G]=ea.x,da[G+1]=ea.y,da[G+2]=
-ea.z,da[G+3]=ea.w,da[G+4]=ga.x,da[G+5]=ga.y,da[G+6]=ga.z,da[G+7]=ga.w,da[G+8]=K.x,da[G+9]=K.y,da[G+10]=K.z,da[G+11]=K.w,G+=12;j=0;for(o=X.length;j<o;j++)t=ba[X[j]],O=t.vertexTangents,ea=O[0],ga=O[1],K=O[2],O=O[3],da[G]=ea.x,da[G+1]=ea.y,da[G+2]=ea.z,da[G+3]=ea.w,da[G+4]=ga.x,da[G+5]=ga.y,da[G+6]=ga.z,da[G+7]=ga.w,da[G+8]=K.x,da[G+9]=K.y,da[G+10]=K.z,da[G+11]=K.w,da[G+12]=O.x,da[G+13]=O.y,da[G+14]=O.z,da[G+15]=O.w,G+=16;e.bindBuffer(e.ARRAY_BUFFER,k.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,
-da,D)}if(N&&u){j=0;for(o=M.length;j<o;j++)if(t=ba[M[j]],da=t.vertexNormals,N=t.normal,da.length===3&&P)for(G=0;G<3;G++)N=da[G],R[E]=N.x,R[E+1]=N.y,R[E+2]=N.z,E+=3;else for(G=0;G<3;G++)R[E]=N.x,R[E+1]=N.y,R[E+2]=N.z,E+=3;j=0;for(o=X.length;j<o;j++)if(t=ba[X[j]],da=t.vertexNormals,N=t.normal,da.length===4&&P)for(G=0;G<4;G++)N=da[G],R[E]=N.x,R[E+1]=N.y,R[E+2]=N.z,E+=3;else for(G=0;G<4;G++)R[E]=N.x,R[E+1]=N.y,R[E+2]=N.z,E+=3;e.bindBuffer(e.ARRAY_BUFFER,k.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,
-R,D)}if(qa&&ta&&L){j=0;for(o=M.length;j<o;j++)if(E=M[j],E=ta[E],E!==void 0)for(G=0;G<3;G++)R=E[G],ca[T]=R.u,ca[T+1]=R.v,T+=2;j=0;for(o=X.length;j<o;j++)if(E=X[j],E=ta[E],E!==void 0)for(G=0;G<4;G++)R=E[G],ca[T]=R.u,ca[T+1]=R.v,T+=2;T>0&&(e.bindBuffer(e.ARRAY_BUFFER,k.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ca,D))}if(qa&&ua&&L){j=0;for(o=M.length;j<o;j++)if(E=M[j],T=ua[E],T!==void 0)for(G=0;G<3;G++)ca=T[G],r[ja]=ca.u,r[ja+1]=ca.v,ja+=2;j=0;for(o=X.length;j<o;j++)if(E=X[j],T=ua[E],T!==void 0)for(G=
-0;G<4;G++)ca=T[G],r[ja]=ca.u,r[ja+1]=ca.v,ja+=2;ja>0&&(e.bindBuffer(e.ARRAY_BUFFER,k.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,r,D))}if(ra){j=0;for(o=M.length;j<o;j++)n[fa]=J,n[fa+1]=J+1,n[fa+2]=J+2,fa+=3,ia[$]=J,ia[$+1]=J+1,ia[$+2]=J,ia[$+3]=J+2,ia[$+4]=J+1,ia[$+5]=J+2,$+=6,J+=3;j=0;for(o=X.length;j<o;j++)n[fa]=J,n[fa+1]=J+1,n[fa+2]=J+3,n[fa+3]=J+1,n[fa+4]=J+2,n[fa+5]=J+3,fa+=6,ia[$]=J,ia[$+1]=J+1,ia[$+2]=J,ia[$+3]=J+3,ia[$+4]=J+1,ia[$+5]=J+2,ia[$+6]=J+2,ia[$+7]=J+3,$+=8,J+=4;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
-k.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,n,D);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,D)}if(I){G=0;for(J=I.length;G<J;G++)if(n=I[G],n.__original.needsUpdate){r=0;if(n.size===1)if(n.boundTo===void 0||n.boundTo==="vertices"){j=0;for(o=M.length;j<o;j++)t=ba[M[j]],n.array[r]=n.value[t.a],n.array[r+1]=n.value[t.b],n.array[r+2]=n.value[t.c],r+=3;j=0;for(o=X.length;j<o;j++)t=ba[X[j]],n.array[r]=n.value[t.a],n.array[r+1]=n.value[t.b],
-n.array[r+2]=n.value[t.c],n.array[r+3]=n.value[t.d],r+=4}else{if(n.boundTo==="faces"){j=0;for(o=M.length;j<o;j++)ia=n.value[M[j]],n.array[r]=ia,n.array[r+1]=ia,n.array[r+2]=ia,r+=3;j=0;for(o=X.length;j<o;j++)ia=n.value[X[j]],n.array[r]=ia,n.array[r+1]=ia,n.array[r+2]=ia,n.array[r+3]=ia,r+=4}}else if(n.size===2)if(n.boundTo===void 0||n.boundTo==="vertices"){j=0;for(o=M.length;j<o;j++)t=ba[M[j]],y=n.value[t.a],z=n.value[t.b],A=n.value[t.c],n.array[r]=y.x,n.array[r+1]=y.y,n.array[r+2]=z.x,n.array[r+
-3]=z.y,n.array[r+4]=A.x,n.array[r+5]=A.y,r+=6;j=0;for(o=X.length;j<o;j++)t=ba[X[j]],y=n.value[t.a],z=n.value[t.b],A=n.value[t.c],t=n.value[t.d],n.array[r]=y.x,n.array[r+1]=y.y,n.array[r+2]=z.x,n.array[r+3]=z.y,n.array[r+4]=A.x,n.array[r+5]=A.y,n.array[r+6]=t.x,n.array[r+7]=t.y,r+=8}else{if(n.boundTo==="faces"){j=0;for(o=M.length;j<o;j++)A=z=y=ia=n.value[M[j]],n.array[r]=y.x,n.array[r+1]=y.y,n.array[r+2]=z.x,n.array[r+3]=z.y,n.array[r+4]=A.x,n.array[r+5]=A.y,r+=6;j=0;for(o=X.length;j<o;j++)t=A=z=y=
-ia=n.value[X[j]],n.array[r]=y.x,n.array[r+1]=y.y,n.array[r+2]=z.x,n.array[r+3]=z.y,n.array[r+4]=A.x,n.array[r+5]=A.y,n.array[r+6]=t.x,n.array[r+7]=t.y,r+=8}}else if(n.size===3)if(u=n.type==="c"?["r","g","b"]:["x","y","z"],n.boundTo===void 0||n.boundTo==="vertices"){j=0;for(o=M.length;j<o;j++)t=ba[M[j]],y=n.value[t.a],z=n.value[t.b],A=n.value[t.c],n.array[r]=y[u[0]],n.array[r+1]=y[u[1]],n.array[r+2]=y[u[2]],n.array[r+3]=z[u[0]],n.array[r+4]=z[u[1]],n.array[r+5]=z[u[2]],n.array[r+6]=A[u[0]],n.array[r+
-7]=A[u[1]],n.array[r+8]=A[u[2]],r+=9;j=0;for(o=X.length;j<o;j++)t=ba[X[j]],y=n.value[t.a],z=n.value[t.b],A=n.value[t.c],t=n.value[t.d],n.array[r]=y[u[0]],n.array[r+1]=y[u[1]],n.array[r+2]=y[u[2]],n.array[r+3]=z[u[0]],n.array[r+4]=z[u[1]],n.array[r+5]=z[u[2]],n.array[r+6]=A[u[0]],n.array[r+7]=A[u[1]],n.array[r+8]=A[u[2]],n.array[r+9]=t[u[0]],n.array[r+10]=t[u[1]],n.array[r+11]=t[u[2]],r+=12}else{if(n.boundTo==="faces"){j=0;for(o=M.length;j<o;j++)A=z=y=ia=n.value[M[j]],n.array[r]=y[u[0]],n.array[r+
-1]=y[u[1]],n.array[r+2]=y[u[2]],n.array[r+3]=z[u[0]],n.array[r+4]=z[u[1]],n.array[r+5]=z[u[2]],n.array[r+6]=A[u[0]],n.array[r+7]=A[u[1]],n.array[r+8]=A[u[2]],r+=9;j=0;for(o=X.length;j<o;j++)t=A=z=y=ia=n.value[X[j]],n.array[r]=y[u[0]],n.array[r+1]=y[u[1]],n.array[r+2]=y[u[2]],n.array[r+3]=z[u[0]],n.array[r+4]=z[u[1]],n.array[r+5]=z[u[2]],n.array[r+6]=A[u[0]],n.array[r+7]=A[u[1]],n.array[r+8]=A[u[2]],n.array[r+9]=t[u[0]],n.array[r+10]=t[u[1]],n.array[r+11]=t[u[2]],r+=12}}else if(n.size===4)if(n.boundTo===
-void 0||n.boundTo==="vertices"){j=0;for(o=M.length;j<o;j++)t=ba[M[j]],y=n.value[t.a],z=n.value[t.b],A=n.value[t.c],n.array[r]=y.x,n.array[r+1]=y.y,n.array[r+2]=y.z,n.array[r+3]=y.w,n.array[r+4]=z.x,n.array[r+5]=z.y,n.array[r+6]=z.z,n.array[r+7]=z.w,n.array[r+8]=A.x,n.array[r+9]=A.y,n.array[r+10]=A.z,n.array[r+11]=A.w,r+=12;j=0;for(o=X.length;j<o;j++)t=ba[X[j]],y=n.value[t.a],z=n.value[t.b],A=n.value[t.c],t=n.value[t.d],n.array[r]=y.x,n.array[r+1]=y.y,n.array[r+2]=y.z,n.array[r+3]=y.w,n.array[r+4]=
-z.x,n.array[r+5]=z.y,n.array[r+6]=z.z,n.array[r+7]=z.w,n.array[r+8]=A.x,n.array[r+9]=A.y,n.array[r+10]=A.z,n.array[r+11]=A.w,n.array[r+12]=t.x,n.array[r+13]=t.y,n.array[r+14]=t.z,n.array[r+15]=t.w,r+=16}else if(n.boundTo==="faces"){j=0;for(o=M.length;j<o;j++)A=z=y=ia=n.value[M[j]],n.array[r]=y.x,n.array[r+1]=y.y,n.array[r+2]=y.z,n.array[r+3]=y.w,n.array[r+4]=z.x,n.array[r+5]=z.y,n.array[r+6]=z.z,n.array[r+7]=z.w,n.array[r+8]=A.x,n.array[r+9]=A.y,n.array[r+10]=A.z,n.array[r+11]=A.w,r+=12;j=0;for(o=
-X.length;j<o;j++)t=A=z=y=ia=n.value[X[j]],n.array[r]=y.x,n.array[r+1]=y.y,n.array[r+2]=y.z,n.array[r+3]=y.w,n.array[r+4]=z.x,n.array[r+5]=z.y,n.array[r+6]=z.z,n.array[r+7]=z.w,n.array[r+8]=A.x,n.array[r+9]=A.y,n.array[r+10]=A.z,n.array[r+11]=A.w,n.array[r+12]=t.x,n.array[r+13]=t.y,n.array[r+14]=t.z,n.array[r+15]=t.w,r+=16}e.bindBuffer(e.ARRAY_BUFFER,n.buffer);e.bufferData(e.ARRAY_BUFFER,n.array,D)}}aa&&(delete k.__inittedArrays,delete k.__colorArray,delete k.__normalArray,delete k.__tangentArray,
-delete k.__uvArray,delete k.__uv2Array,delete k.__faceArray,delete k.__vertexArray,delete k.__lineArray,delete k.__skinVertexAArray,delete k.__skinVertexBArray,delete k.__skinIndexArray,delete k.__skinWeightArray)}}p.__dirtyVertices=!1;p.__dirtyMorphTargets=!1;p.__dirtyElements=!1;p.__dirtyUvs=!1;p.__dirtyNormals=!1;p.__dirtyColors=!1;p.__dirtyTangents=!1;s.attributes&&w(s)}else if(la instanceof THREE.Ribbon){if(p.__dirtyVertices||p.__dirtyColors){s=p;la=e.DYNAMIC_DRAW;u=B=u=aa=aa=void 0;Y=s.vertices;
-C=s.colors;j=Y.length;k=C.length;o=s.__vertexArray;D=s.__colorArray;I=s.__dirtyColors;if(s.__dirtyVertices){for(aa=0;aa<j;aa++)u=Y[aa].position,B=aa*3,o[B]=u.x,o[B+1]=u.y,o[B+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,s.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,o,la)}if(I){for(aa=0;aa<k;aa++)u=C[aa],B=aa*3,D[B]=u.r,D[B+1]=u.g,D[B+2]=u.b;e.bindBuffer(e.ARRAY_BUFFER,s.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,D,la)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(la instanceof THREE.Line){s=c(la,
-k);D=s.attributes&&l(s);if(p.__dirtyVertices||p.__dirtyColors||D){la=p;B=e.DYNAMIC_DRAW;j=C=P=Y=L=void 0;Y=la.vertices;k=la.colors;j=Y.length;D=k.length;o=la.__vertexArray;aa=la.__colorArray;I=la.__dirtyColors;u=la.__webglCustomAttributesList;J=ba=X=M=P=L=void 0;if(la.__dirtyVertices){for(L=0;L<j;L++)P=Y[L].position,C=L*3,o[C]=P.x,o[C+1]=P.y,o[C+2]=P.z;e.bindBuffer(e.ARRAY_BUFFER,la.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,o,B)}if(I){for(Y=0;Y<D;Y++)j=k[Y],C=Y*3,aa[C]=j.r,aa[C+1]=j.g,aa[C+
-2]=j.b;e.bindBuffer(e.ARRAY_BUFFER,la.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,aa,B)}if(u){L=0;for(P=u.length;L<P;L++)if(J=u[L],J.needsUpdate&&(J.boundTo===void 0||J.boundTo==="vertices")){C=0;X=J.value.length;if(J.size===1)for(M=0;M<X;M++)J.array[M]=J.value[M];else if(J.size===2)for(M=0;M<X;M++)ba=J.value[M],J.array[C]=ba.x,J.array[C+1]=ba.y,C+=2;else if(J.size===3)if(J.type==="c")for(M=0;M<X;M++)ba=J.value[M],J.array[C]=ba.r,J.array[C+1]=ba.g,J.array[C+2]=ba.b,C+=3;else for(M=0;M<X;M++)ba=
-J.value[M],J.array[C]=ba.x,J.array[C+1]=ba.y,J.array[C+2]=ba.z,C+=3;else if(J.size===4)for(M=0;M<X;M++)ba=J.value[M],J.array[C]=ba.x,J.array[C+1]=ba.y,J.array[C+2]=ba.z,J.array[C+3]=ba.w,C+=4;e.bindBuffer(e.ARRAY_BUFFER,J.buffer);e.bufferData(e.ARRAY_BUFFER,J.array,B)}}}p.__dirtyVertices=!1;p.__dirtyColors=!1;s.attributes&&w(s)}else if(la instanceof THREE.ParticleSystem)s=c(la,k),D=s.attributes&&l(s),(p.__dirtyVertices||p.__dirtyColors||la.sortParticles||D)&&h(p,e.DYNAMIC_DRAW,la),p.__dirtyVertices=
-!1,p.__dirtyColors=!1,s.attributes&&w(s)};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 l=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(l.uniforms);
-a.vertexShader=l.vertexShader;a.fragmentShader=l.fragmentShader}var m,p,q;m=q=l=0;for(p=b.length;m<p;m++)h=b[m],h instanceof THREE.SpotLight&&q++,h instanceof THREE.DirectionalLight&&q++,h instanceof THREE.PointLight&&l++;l+q<=sa?m=q:(m=Math.ceil(sa*q/(l+q)),l=sa-m);h={directional:m,point:l};l=q=0;for(m=b.length;l<m;l++)p=b[l],p instanceof THREE.SpotLight&&p.castShadow&&q++;var j=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)j=d.bones.length;var o;a:{m=a.fragmentShader;p=a.vertexShader;var l=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},s,d=[];i?d.push(i):(d.push(m),d.push(p));for(s in c)d.push(s),d.push(c[s]);i=d.join();s=0;for(d=za.length;s<d;s++)if(za[s].code===i){o=za[s].program;break a}s=e.createProgram();d=[La?"#define VERTEX_TEXTURES":"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.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:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.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(s,ma("fragment",h+m));e.attachShader(s,
-ma("vertex",d+p));e.linkProgram(s);e.getProgramParameter(s,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(s,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");s.uniforms={};s.attributes={};var w,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in l)d.push(w);w=d;d=0;for(l=w.length;d<l;d++)m=w[d],s.uniforms[m]=e.getUniformLocation(s,
-m);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)d.push("morphTarget"+w);for(o in b)d.push(o);o=d;w=0;for(b=o.length;w<b;w++)c=o[w],s.attributes[c]=e.getAttribLocation(s,c);s.id=za.length;za.push({program:s,code:i});F.info.memory.programs=za.length;o=s}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++)w="morphTarget"+g,o[w]>=0&&(e.enableVertexAttribArray(o[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(ca!==a.doubleSided)a.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),ca=a.doubleSided;if(ta!==a.flipSided)a.flipSided?e.frontFace(e.CW):
-e.frontFace(e.CCW),ta=a.flipSided};this.setDepthTest=function(a){na!==a&&(a?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),na=a)};this.setBlending=function(a){if(a!==K){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)}K=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=e.createTexture(),F.info.memory.textures++;e.activeTexture(e.TEXTURE0+b);e.bindTexture(e.TEXTURE_2D,a.__webglTexture);var c=ja(e.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,I(a.format),a.image.width,a.image.height,0,I(a.format),e.UNSIGNED_BYTE,a.image.data):e.texImage2D(e.TEXTURE_2D,
+(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,
 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);ja(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,I(a.format),a.width,a.height,0,I(a.format),I(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);E(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=
-e.createFramebuffer(),a.__webglRenderbuffer=e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,a.__webglTexture),ja(e.TEXTURE_2D,a,a),e.texImage2D(e.TEXTURE_2D,0,I(a.format),a.width,a.height,0,I(a.format),I(a.type),null),c=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,c,a.__webglTexture,0),E(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=xa,f=Ja);b!==fa&&(e.bindFramebuffer(e.FRAMEBUFFER,b),e.viewport(d,f,c,a),fa=b)};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+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)};
 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.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};

+ 3 - 44
src/core/Projector.js

@@ -20,38 +20,13 @@ THREE.Projector = function() {
 	_projScreenMatrix = new THREE.Matrix4(),
 	_projScreenobjectMatrixWorld = new THREE.Matrix4(),
 
-	_frustum = [
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4(),
-		new THREE.Vector4()
-	 ],
+	_frustum = new THREE.Frustum(),
 
 	_clippedVertex1PositionScreen = new THREE.Vector4(),
 	_clippedVertex2PositionScreen = new THREE.Vector4(),
 
 	_face3VertexNormals;
 
-	this.computeFrustum = function ( m ) {
-
-		_frustum[ 0 ].set( m.n41 - m.n11, m.n42 - m.n12, m.n43 - m.n13, m.n44 - m.n14 );
-		_frustum[ 1 ].set( m.n41 + m.n11, m.n42 + m.n12, m.n43 + m.n13, m.n44 + m.n14 );
-		_frustum[ 2 ].set( m.n41 + m.n21, m.n42 + m.n22, m.n43 + m.n23, m.n44 + m.n24 );
-		_frustum[ 3 ].set( m.n41 - m.n21, m.n42 - m.n22, m.n43 - m.n23, m.n44 - m.n24 );
-		_frustum[ 4 ].set( m.n41 - m.n31, m.n42 - m.n32, m.n43 - m.n33, m.n44 - m.n34 );
-		_frustum[ 5 ].set( m.n41 + m.n31, m.n42 + m.n32, m.n43 + m.n33, m.n44 + m.n34 );
-
-		for ( var i = 0; i < 6; i ++ ) {
-
-			var plane = _frustum[ i ];
-			plane.divideScalar( Math.sqrt( plane.x * plane.x + plane.y * plane.y + plane.z * plane.z ) );
-
-		}
-
-	}
-
 	this.projectVector = function ( vector, camera ) {
 
 		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
@@ -111,7 +86,7 @@ THREE.Projector = function() {
 			if ( object.visible === false ) return;
 
 			if ( ( object instanceof THREE.Mesh || object instanceof THREE.Line ) &&
-			( object.frustumCulled === false || isInFrustum( object ) ) ) {
+			( object.frustumCulled === false || _frustum.contains( object ) ) ) {
 
 				_projScreenMatrix.multiplyVector3( _vector3.copy( object.position ) );
 
@@ -182,7 +157,7 @@ THREE.Projector = function() {
 
 		_projScreenMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );
 
-		this.computeFrustum( _projScreenMatrix );
+		_frustum.setFromMatrix( _projScreenMatrix );
 
 		_renderData = this.projectGraph( scene, false );
 
@@ -474,22 +449,6 @@ THREE.Projector = function() {
 
 	}
 
-	function isInFrustum( object ) {
-
-		var distance, matrix = object.matrixWorld,
-		radius = - object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) );
-
-		for ( var i = 0; i < 6; i ++ ) {
-
-			distance = _frustum[ i ].x * matrix.n14 + _frustum[ i ].y * matrix.n24 + _frustum[ i ].z * matrix.n34 + _frustum[ i ].w;
-			if ( distance <= radius ) return false;
-
-		}
-
-		return true;
-
-	};
-
 	function clipLine( s1, s2 ) {
 
 		var alpha1 = 0, alpha2 = 1,

+ 1 - 15
src/extras/plugins/ShadowMapPlugin.js

@@ -203,8 +203,6 @@ THREE.ShadowMapPlugin = function ( ) {
 
 					if ( object.visible && object.castShadow ) {
 
-						_currentGeometryGroupHash = -1;
-
 						if( object.matrixAutoUpdate ) {
 
 							object.matrixWorld.flattenToArray( object._objectMatrixArray );
@@ -213,19 +211,7 @@ THREE.ShadowMapPlugin = function ( ) {
 
 						object._modelViewMatrix.multiplyToArray( _cameraLight.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
 
-						_renderer.setObjectFaces( object );
-
-						program = _renderer.setProgram( _cameraLight, lights, fog, _depthMaterial, object );
-
-						if ( object.immediateRenderCallback ) {
-
-							object.immediateRenderCallback( program, _gl, _frustum );
-
-						} else {
-
-							object.render( function( object ) { _renderer.renderBufferImmediate( object, program, _depthMaterial.shading ); } );
-
-						}
+						_renderer.renderImmediateObject( _cameraLight, lights, fog, _depthMaterial, object );
 
 					}
 

+ 0 - 1
src/extras/plugins/SpritePlugin.js

@@ -92,7 +92,6 @@ THREE.SpritePlugin = function ( ) {
 		// setup gl
 
 		_gl.useProgram( _sprite.program );
-		_currentProgram = _sprite.program;
 
 		if ( ! _sprite.attributesEnabled ) {
 

+ 16 - 10
src/renderers/WebGLRenderer.js

@@ -3277,8 +3277,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			if ( object.visible ) {
 
-				_currentGeometryGroupHash = -1;
-
 				if ( overrideMaterial ) {
 
 					material = overrideMaterial;
@@ -3297,21 +3295,29 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				}
 
-				_this.setObjectFaces( object );
+				_this.renderImmediateObject( camera, lights, fog, material, object );
 
-				program = setProgram( camera, lights, fog, material, object );
+			}
 
-				if ( object.immediateRenderCallback ) {
+		}
 
-					object.immediateRenderCallback( program, _gl, _frustum );
+	};
 
-				} else {
+	this.renderImmediateObject = function ( camera, lights, fog, material, object ) {
 
-					object.render( function( object ) { _this.renderBufferImmediate( object, program, material.shading ); } );
+		var program = setProgram( camera, lights, fog, material, object );
 
-				}
+		_currentGeometryGroupHash = -1;
 
-			}
+		_this.setObjectFaces( object );
+
+		if ( object.immediateRenderCallback ) {
+
+			object.immediateRenderCallback( program, _gl, _frustum );
+
+		} else {
+
+			object.render( function( object ) { _this.renderBufferImmediate( object, program, material.shading ); } );
 
 		}