Browse Source

Updated builds and tweaked examples
Removed LOD text example. I think LOD example is good enough.
Ubiquity test working again.
Tweaked README to show the new pattern (Scene first thing created).

Mr.doob 13 years ago
parent
commit
d902ca3bf0

+ 3 - 2
README.md

@@ -99,10 +99,11 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a &
 
 	function init() {
 
+		scene = new THREE.Scene();
+
 		camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
 		camera.position.z = 1000;
-
-		scene = new THREE.Scene();
+		scene.add( camera );
 
 		geometry = new THREE.CubeGeometry( 200, 200, 200 );
 		material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );

File diff suppressed because it is too large
+ 457 - 456
build/Three.js


+ 76 - 70
build/custom/ThreeCanvas.js

@@ -16,61 +16,63 @@ b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},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},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}for(var d,f=[],e=0,g=a.children.length;e<g;e++)Array.prototype.push.apply(f,this.intersectObject(a.children[e]));if(a instanceof THREE.Particle){e=b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.scale.x)return[];d={distance:e,point:a.position,face:null,object:a};f.push(d)}else if(a instanceof THREE.Mesh){e=
-b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;var h,l,m,j,i,o,n,p,k=a.geometry,u=k.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);e=0;for(g=k.faces.length;e<g;e++)if(d=k.faces[e],n=this.origin.clone(),p=this.direction.clone(),j=a.matrixWorld,h=j.multiplyVector3(d.centroid.clone()).subSelf(n),o=h.dot(p),!(o<=0)&&(h=j.multiplyVector3(u[d.a].position.clone()),l=j.multiplyVector3(u[d.b].position.clone()),
-m=j.multiplyVector3(u[d.c].position.clone()),j=d instanceof THREE.Face4?j.multiplyVector3(u[d.d].position.clone()):null,i=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),o=p.dot(i),a.doubleSided||(a.flipSided?o>0:o<0)))if(o=i.dot((new THREE.Vector3).sub(h,n))/o,n=n.addSelf(p.multiplyScalar(o)),d instanceof THREE.Face3)c(n,h,l,m)&&(d={distance:this.origin.distanceTo(n),point:n,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(n,h,l,j)||c(n,l,m,j)))d={distance:this.origin.distanceTo(n),
-point:n,face:d,object:a},f.push(d)}return f}};
-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,o,n){h?(h=!1,b=e<j?e<o?e:o:j<o?j:o,c=g<i?g<n?g:n:i<n?i:n,d=e>j?e>o?e:o:j>o?j:o,f=g>i?g>n?g:n:i>n?i:n):(b=e<j?e<o?e<b?e:b:o<b?o:b:j<o?j<b?j:b:o<b?o: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=e>j?e>o?e>d?e:d:o>d?o:d:j>o?j>d?j:d:o>d?o:d,f=g>i?g>n?g>f?g:f:n>f?n:f:i>n?i>f?i:f:n>f?n: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.Matrix3=function(){this.m=[]};
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;var h,l,o,i,n,m,j,q,k=a.geometry,s=k.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);e=0;for(g=k.faces.length;e<g;e++)if(d=k.faces[e],j=this.origin.clone(),q=this.direction.clone(),i=a.matrixWorld,h=i.multiplyVector3(d.centroid.clone()).subSelf(j),m=h.dot(q),!(m<=0)&&(h=i.multiplyVector3(s[d.a].position.clone()),l=i.multiplyVector3(s[d.b].position.clone()),
+o=i.multiplyVector3(s[d.c].position.clone()),i=d instanceof THREE.Face4?i.multiplyVector3(s[d.d].position.clone()):null,n=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),m=q.dot(n),a.doubleSided||(a.flipSided?m>0:m<0)))if(m=n.dot((new THREE.Vector3).sub(h,j))/m,j=j.addSelf(q.multiplyScalar(m)),d instanceof THREE.Face3)c(j,h,l,o)&&(d={distance:this.origin.distanceTo(j),point:j,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(j,h,l,i)||c(j,l,o,i)))d={distance:this.origin.distanceTo(j),
+point:j,face:d,object:a},f.push(d)}return f}};
+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,n){h=!1;b=e;c=g;d=i;f=n;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,n,m,j){h?(h=!1,b=e<i?e<m?e:m:i<m?i:m,c=g<n?g<j?g:j:n<j?n:j,d=e>i?e>m?e:m:i>m?i:m,f=g>n?g>j?g:j:n>j?n:j):(b=e<i?e<m?e<b?e:b:m<b?m:b:i<m?i<b?i:b:m<b?m:b,c=g<n?g<j?g<c?g:c:j<c?j:c:n<j?n<c?n:c:j<c?j:c,d=e>i?e>m?e>d?e:d:m>d?m:d:i>m?i>d?i:d:m>d?m:d,f=g>n?g>j?g>f?g:f:j>f?j:f:n>j?n>f?n:f:j>f?j: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,l,m,j,i,o,n,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,l||0,m||0,j!==void 0?j:1,i||0,o||0,n||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,l,m,j,i,o,n,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=l;this.n32=m;this.n33=j;this.n34=i;this.n41=o;this.n42=n;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,l=a.n23,m=a.n24,j=a.n31,i=a.n32,o=a.n33,n=a.n34,p=a.n41,k=a.n42,u=a.n43,
-x=a.n44,E=b.n11,G=b.n12,M=b.n13,I=b.n14,N=b.n21,L=b.n22,K=b.n23,s=b.n24,y=b.n31,J=b.n32,S=b.n33,T=b.n34,P=b.n41,t=b.n42,z=b.n43,r=b.n44;this.n11=c*E+d*N+f*y+e*P;this.n12=c*G+d*L+f*J+e*t;this.n13=c*M+d*K+f*S+e*z;this.n14=c*I+d*s+f*T+e*r;this.n21=g*E+h*N+l*y+m*P;this.n22=g*G+h*L+l*J+m*t;this.n23=g*M+h*K+l*S+m*z;this.n24=g*I+h*s+l*T+m*r;this.n31=j*E+i*N+o*y+n*P;this.n32=j*G+i*L+o*J+n*t;this.n33=j*M+i*K+o*S+n*z;this.n34=j*I+i*s+o*T+n*r;this.n41=p*E+k*N+u*y+x*P;this.n42=p*G+k*L+u*J+x*t;this.n43=p*M+k*
-K+u*S+x*z;this.n44=p*I+k*s+u*T+x*r;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,f,e,g,h,l,o,i,n,m,j,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,l||0,o||0,i!==void 0?i:1,n||0,m||0,j||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,l,o,i,n,m,j,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=l;this.n32=o;this.n33=i;this.n34=n;this.n41=m;this.n42=j;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,l=a.n23,o=a.n24,i=a.n31,n=a.n32,m=a.n33,j=a.n34,q=a.n41,k=a.n42,s=a.n43,
+N=a.n44,F=b.n11,S=b.n12,P=b.n13,z=b.n14,A=b.n21,C=b.n22,E=b.n23,u=b.n24,r=b.n31,D=b.n32,J=b.n33,$=b.n34,da=b.n41,L=b.n42,O=b.n43,T=b.n44;this.n11=c*F+d*A+f*r+e*da;this.n12=c*S+d*C+f*D+e*L;this.n13=c*P+d*E+f*J+e*O;this.n14=c*z+d*u+f*$+e*T;this.n21=g*F+h*A+l*r+o*da;this.n22=g*S+h*C+l*D+o*L;this.n23=g*P+h*E+l*J+o*O;this.n24=g*z+h*u+l*$+o*T;this.n31=i*F+n*A+m*r+j*da;this.n32=i*S+n*C+m*D+j*L;this.n33=i*P+n*E+m*J+j*O;this.n34=i*z+n*u+m*$+j*T;this.n41=q*F+k*A+s*r+N*da;this.n42=q*S+k*C+s*D+N*L;this.n43=q*
+P+k*E+s*J+N*O;this.n44=q*z+k*u+s*$+N*T;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,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,j=this.n33,i=this.n34,o=this.n41,n=this.n42,p=this.n43,k=this.n44;return d*g*m*o-c*h*m*o-d*e*j*o+b*h*j*o+c*e*i*o-b*g*i*o-d*g*l*n+c*h*l*n+d*f*j*n-a*h*j*n-c*f*i*n+a*g*i*n+d*e*l*p-b*h*l*p-d*f*m*p+a*h*m*p+b*f*i*p-a*e*i*p-c*e*l*k+b*g*l*k+c*f*m*k-a*g*m*k-b*f*j*k+a*e*j*k},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,f=this.n21,e=this.n22,g=this.n23,h=this.n24,l=this.n31,o=this.n32,i=this.n33,n=this.n34,m=this.n41,j=this.n42,q=this.n43,k=this.n44;return d*g*o*m-c*h*o*m-d*e*i*m+b*h*i*m+c*e*n*m-b*g*n*m-d*g*l*j+c*h*l*j+d*f*i*j-a*h*i*j-c*f*n*j+a*g*n*j+d*e*l*q-b*h*l*q-d*f*o*q+a*h*o*q+b*f*n*q-a*e*n*q-c*e*l*k+b*g*l*k+c*f*o*k-a*g*o*k-b*f*i*k+a*e*i*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,l=f*e,m=f*g;this.set(l*e+c,l*g-d*h,l*h+d*g,0,l*g+d*h,m*g+c,m*h-d*e,0,l*h-d*g,m*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,l=a.n24,m=a.n31,j=a.n32,i=a.n33,o=a.n34,n=a.n41,p=a.n42,k=a.n43,u=a.n44;this.n11=h*o*p-l*i*p+l*j*k-g*o*k-h*j*u+g*i*u;this.n12=f*i*p-d*o*p-f*j*k+c*o*k+d*j*u-c*i*u;this.n13=d*l*p-f*h*p+f*g*k-c*l*k-d*g*u+c*h*u;this.n14=f*h*j-d*l*j-f*g*i+c*l*i+d*g*o-c*h*o;this.n21=l*i*n-h*o*n-l*m*k+e*o*k+h*m*u-e*i*u;this.n22=d*o*n-f*i*n+
-f*m*k-b*o*k-d*m*u+b*i*u;this.n23=f*h*n-d*l*n-f*e*k+b*l*k+d*e*u-b*h*u;this.n24=d*l*m-f*h*m+f*e*i-b*l*i-d*e*o+b*h*o;this.n31=g*o*n-l*j*n+l*m*p-e*o*p-g*m*u+e*j*u;this.n32=f*j*n-c*o*n-f*m*p+b*o*p+c*m*u-b*j*u;this.n33=d*l*n-f*g*n+f*e*p-b*l*p-c*e*u+b*g*u;this.n34=f*g*m-c*l*m-f*e*j+b*l*j+c*e*o-b*g*o;this.n41=h*j*n-g*i*n-h*m*p+e*i*p+g*m*k-e*j*k;this.n42=c*i*n-d*j*n+d*m*p-b*i*p-c*m*k+b*j*k;this.n43=d*g*n-c*h*n-d*e*p+b*h*p+c*e*k-b*g*k;this.n44=c*h*m-d*g*m+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 l=g*h,m=g*f,j=d*h,i=d*f;this.n11=l+i*c;this.n12=j*c-m;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=m*c-j;this.n32=i+l*c;this.n33=e*g;break;case "ZXY":l=g*h;m=g*f;j=d*h;i=d*f;this.n11=l-i*c;this.n12=-e*f;this.n13=j+m*c;this.n21=m+j*c;this.n22=e*h;this.n23=i-l*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":l=
-e*h;m=e*f;j=c*h;i=c*f;this.n11=g*h;this.n12=j*d-m;this.n13=l*d+i;this.n21=g*f;this.n22=i*d+l;this.n23=m*d-j;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":l=e*g;m=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=i-l*f;this.n13=j*f+m;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=m*f+j;this.n33=l-i*f;break;case "XZY":l=e*g;m=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=l*f+i;this.n22=e*h;this.n23=m*f-j;this.n31=j*f-m;this.n32=c*h;this.n33=i*f+l;break;default:l=e*h,m=e*
-f,j=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=m+j*d,this.n22=l-i*d,this.n23=-c*g,this.n31=i-l*d,this.n32=j+m*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,l=b*g;b*=h;var m=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(m+d);this.n12=l-f;this.n13=b+g;this.n21=l+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+m);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,h=a.z,l=f*e,o=f*g;this.set(l*e+c,l*g-d*h,l*h+d*g,0,l*g+d*h,o*g+c,o*h-d*e,0,l*h-d*g,o*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,l=a.n24,o=a.n31,i=a.n32,n=a.n33,m=a.n34,j=a.n41,q=a.n42,k=a.n43,s=a.n44;this.n11=h*m*q-l*n*q+l*i*k-g*m*k-h*i*s+g*n*s;this.n12=f*n*q-d*m*q-f*i*k+c*m*k+d*i*s-c*n*s;this.n13=d*l*q-f*h*q+f*g*k-c*l*k-d*g*s+c*h*s;this.n14=f*h*i-d*l*i-f*g*n+c*l*n+d*g*m-c*h*m;this.n21=l*n*j-h*m*j-l*o*k+e*m*k+h*o*s-e*n*s;this.n22=d*m*j-f*n*j+
+f*o*k-b*m*k-d*o*s+b*n*s;this.n23=f*h*j-d*l*j-f*e*k+b*l*k+d*e*s-b*h*s;this.n24=d*l*o-f*h*o+f*e*n-b*l*n-d*e*m+b*h*m;this.n31=g*m*j-l*i*j+l*o*q-e*m*q-g*o*s+e*i*s;this.n32=f*i*j-c*m*j-f*o*q+b*m*q+c*o*s-b*i*s;this.n33=d*l*j-f*g*j+f*e*q-b*l*q-c*e*s+b*g*s;this.n34=f*g*o-c*l*o-f*e*i+b*l*i+c*e*m-b*g*m;this.n41=h*i*j-g*n*j-h*o*q+e*n*q+g*o*k-e*i*k;this.n42=c*n*j-d*i*j+d*o*q-b*n*q-c*o*k+b*i*k;this.n43=d*g*j-c*h*j-d*e*q+b*h*q+c*e*k-b*g*k;this.n44=c*h*o-d*g*o+d*e*i-b*h*i-c*e*n+b*g*n;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 l=g*h,o=g*f,i=d*h,n=d*f;this.n11=l+n*c;this.n12=i*c-o;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=o*c-i;this.n32=n+l*c;this.n33=e*g;break;case "ZXY":l=g*h;o=g*f;i=d*h;n=d*f;this.n11=l-n*c;this.n12=-e*f;this.n13=i+o*c;this.n21=o+i*c;this.n22=e*h;this.n23=n-l*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":l=
+e*h;o=e*f;i=c*h;n=c*f;this.n11=g*h;this.n12=i*d-o;this.n13=l*d+n;this.n21=g*f;this.n22=n*d+l;this.n23=o*d-i;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":l=e*g;o=e*d;i=c*g;n=c*d;this.n11=g*h;this.n12=n-l*f;this.n13=i*f+o;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=o*f+i;this.n33=l-n*f;break;case "XZY":l=e*g;o=e*d;i=c*g;n=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=l*f+n;this.n22=e*h;this.n23=o*f-i;this.n31=i*f-o;this.n32=c*h;this.n33=n*f+l;break;default:l=e*h,o=e*
+f,i=c*h,n=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=o+i*d,this.n22=l-n*d,this.n23=-c*g,this.n31=n-l*d,this.n32=i+o*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,l=b*g;b*=h;var o=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(o+d);this.n12=l-f;this.n13=b+g;this.n21=l+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+o);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,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);e.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=e.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,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-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,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*m;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*m;c[7]=a*j;c[8]=a*i;return b};
+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,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*o;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*o;c[7]=a*i;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};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,e){var g,h,l,m;g=new THREE.Matrix4;h=b-a;l=c-d;m=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/l;g.n23=0;g.n24=-((c+d)/l);g.n31=0;g.n32=0;g.n33=-2/m;g.n34=-((e+f)/m);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,l,o;g=new THREE.Matrix4;h=b-a;l=c-d;o=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/l;g.n23=0;g.n24=-((c+d)/l);g.n31=0;g.n32=0;g.n33=-2/o;g.n34=-((e+f)/o);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;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&&
 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=e[f]=e[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(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 d,f,e=[],g,h,l=[],m,j=[],i,o,n=[],p,k,u=[],x={objects:[],sprites:[],lights:[],elements:[]};
-new THREE.Vector3;var E=new THREE.Vector4,G=new THREE.Matrix4,M=new THREE.Matrix4,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,L=new THREE.Vector4;this.computeFrustum=function(a){I[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);I[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);I[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);I[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);I[4].set(a.n41-
-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);I[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=I[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);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);G.multiply(b.matrixWorld,b.projectionMatrixInverse);G.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(a){x.objects.length=0;x.sprites.length=0;x.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,e=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),f=0;f<6;f++)if(c=
-I[f].x*d.n14+I[f].y*d.n24+I[f].z*d.n34+I[f].w,c<=e){c=!1;break a}c=!0}c?x.objects.push(a):a instanceof THREE.Line?x.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?x.sprites.push(a):a instanceof THREE.Light&&x.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return x};this.projectScene=function(K,s,y){var J=s.near,I=s.far,T,P,t,z,r,D,w,H,F,U,Z,ca,ga,da,v,A;k=o=m=h=0;x.elements.length=0;s.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
-K.add(s));K.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);G.multiply(s.projectionMatrix,s.matrixWorldInverse);this.computeFrustum(G);x=this.projectGraph(K);K=0;for(T=x.objects.length;K<T;K++)if(F=x.objects[K],U=F.matrixWorld,ca=F.material,f=0,F instanceof THREE.Mesh){Z=F.geometry;ga=F.geometry.materials;z=Z.vertices;da=Z.faces;v=Z.faceVertexUvs;Z=F.matrixRotationWorld.extractRotation(U);P=0;for(t=z.length;P<t;P++)d=a(),d.positionWorld.copy(z[P].position),U.multiplyVector3(d.positionWorld),
-d.positionScreen.copy(d.positionWorld),G.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>J&&d.positionScreen.z<I;z=0;for(P=da.length;z<P;z++){t=da[z];if(t instanceof THREE.Face3)if(r=e[t.a],D=e[t.b],w=e[t.c],r.visible&&D.visible&&w.visible&&(F.doubleSided||F.flipSided!=(w.positionScreen.x-r.positionScreen.x)*(D.positionScreen.y-r.positionScreen.y)-(w.positionScreen.y-r.positionScreen.y)*(D.positionScreen.x-
-r.positionScreen.x)<0))H=l[h]=l[h]||new THREE.RenderableFace3,h++,g=H,g.v1.copy(r),g.v2.copy(D),g.v3.copy(w);else continue;else if(t instanceof THREE.Face4)if(r=e[t.a],D=e[t.b],w=e[t.c],H=e[t.d],r.visible&&D.visible&&w.visible&&H.visible&&(F.doubleSided||F.flipSided!=((H.positionScreen.x-r.positionScreen.x)*(D.positionScreen.y-r.positionScreen.y)-(H.positionScreen.y-r.positionScreen.y)*(D.positionScreen.x-r.positionScreen.x)<0||(D.positionScreen.x-w.positionScreen.x)*(H.positionScreen.y-w.positionScreen.y)-
-(D.positionScreen.y-w.positionScreen.y)*(H.positionScreen.x-w.positionScreen.x)<0)))A=j[m]=j[m]||new THREE.RenderableFace4,m++,g=A,g.v1.copy(r),g.v2.copy(D),g.v3.copy(w),g.v4.copy(H);else continue;g.normalWorld.copy(t.normal);Z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(t.centroid);U.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);G.multiplyVector3(g.centroidScreen);w=t.vertexNormals;r=0;for(D=w.length;r<D;r++)H=g.vertexNormalsWorld[r],H.copy(w[r]),Z.multiplyVector3(H);
-r=0;for(D=v.length;r<D;r++)if(A=v[r][z]){w=0;for(H=A.length;w<H;w++)g.uvs[r][w]=A[w]}g.material=ca;g.faceMaterial=t.materialIndex!==null?ga[t.materialIndex]:null;g.z=g.centroidScreen.z;x.elements.push(g)}}else if(F instanceof THREE.Line){M.multiply(G,U);z=F.geometry.vertices;r=a();r.positionScreen.copy(z[0].position);M.multiplyVector4(r.positionScreen);P=1;for(t=z.length;P<t;P++)if(r=a(),r.positionScreen.copy(z[P].position),M.multiplyVector4(r.positionScreen),D=e[f-2],N.copy(r.positionScreen),L.copy(D.positionScreen),
-c(N,L))N.multiplyScalar(1/N.w),L.multiplyScalar(1/L.w),F=n[o]=n[o]||new THREE.RenderableLine,o++,i=F,i.v1.positionScreen.copy(N),i.v2.positionScreen.copy(L),i.z=Math.max(N.z,L.z),i.material=ca,x.elements.push(i)}K=0;for(T=x.sprites.length;K<T;K++)if(F=x.sprites[K],U=F.matrixWorld,F instanceof THREE.Particle&&(E.set(U.n14,U.n24,U.n34,1),G.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))J=u[k]=u[k]||new THREE.RenderableParticle,k++,p=J,p.x=E.x/E.w,p.y=E.y/E.w,p.z=E.z,p.rotation=F.rotation.z,p.scale.x=F.scale.x*
-Math.abs(p.x-(E.x+s.projectionMatrix.n11)/(E.w+s.projectionMatrix.n14)),p.scale.y=F.scale.y*Math.abs(p.y-(E.y+s.projectionMatrix.n22)/(E.w+s.projectionMatrix.n24)),p.material=F.material,x.elements.push(p);y&&x.elements.sort(b);return x}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=o[l]=o[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,o=[],
+i,n,m=[],j,q=[],k,s,N=[],F,S,P=[],z={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,C=new THREE.Vector4,E=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],D=new THREE.Vector4,J=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);E.multiply(b.projectionMatrix,b.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+E.multiply(b.matrixWorld,b.projectionMatrixInverse);E.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;z.objects.length=0;z.sprites.length=0;z.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?(E.multiplyVector3(A.copy(b.position)),f=a(),f.object=b,f.z=A.z,z.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.multiplyVector3(A.copy(b.position)),f=a(),f.object=b,f.z=A.z,z.sprites.push(f)):b instanceof THREE.Light&&z.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
+z.objects.sort(c);return z};this.projectScene=function(a,e,f){var g=e.near,r=e.far,U,H,B,Q,v,M,K,A,G,t,y,w,x,I,ja,Z;S=s=j=n=0;z.elements.length=0;e.parent==null&&(console.warn("DEPRECATED: Camera hasn't been added to the Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);E.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(E);z=this.projectGraph(a,!1);a=0;for(U=z.objects.length;a<U;a++)if(G=z.objects[a].object,t=G.matrixWorld,w=
+G.material,l=0,G instanceof THREE.Mesh){y=G.geometry;x=G.geometry.materials;Q=y.vertices;I=y.faces;ja=y.faceVertexUvs;y=G.matrixRotationWorld.extractRotation(t);H=0;for(B=Q.length;H<B;H++)h=b(),h.positionWorld.copy(Q[H].position),t.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),E.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<r;Q=0;for(H=I.length;Q<H;Q++){B=
+I[Q];if(B instanceof THREE.Face3)if(v=o[B.a],M=o[B.b],K=o[B.c],v.visible&&M.visible&&K.visible&&(G.doubleSided||G.flipSided!=(K.positionScreen.x-v.positionScreen.x)*(M.positionScreen.y-v.positionScreen.y)-(K.positionScreen.y-v.positionScreen.y)*(M.positionScreen.x-v.positionScreen.x)<0))A=m[n]=m[n]||new THREE.RenderableFace3,n++,i=A,i.v1.copy(v),i.v2.copy(M),i.v3.copy(K);else continue;else if(B instanceof THREE.Face4)if(v=o[B.a],M=o[B.b],K=o[B.c],A=o[B.d],v.visible&&M.visible&&K.visible&&A.visible&&
+(G.doubleSided||G.flipSided!=((A.positionScreen.x-v.positionScreen.x)*(M.positionScreen.y-v.positionScreen.y)-(A.positionScreen.y-v.positionScreen.y)*(M.positionScreen.x-v.positionScreen.x)<0||(M.positionScreen.x-K.positionScreen.x)*(A.positionScreen.y-K.positionScreen.y)-(M.positionScreen.y-K.positionScreen.y)*(A.positionScreen.x-K.positionScreen.x)<0)))Z=q[j]=q[j]||new THREE.RenderableFace4,j++,i=Z,i.v1.copy(v),i.v2.copy(M),i.v3.copy(K),i.v4.copy(A);else continue;i.normalWorld.copy(B.normal);y.multiplyVector3(i.normalWorld);
+i.centroidWorld.copy(B.centroid);t.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);E.multiplyVector3(i.centroidScreen);K=B.vertexNormals;v=0;for(M=K.length;v<M;v++)A=i.vertexNormalsWorld[v],A.copy(K[v]),y.multiplyVector3(A);v=0;for(M=ja.length;v<M;v++)if(Z=ja[v][Q]){K=0;for(A=Z.length;K<A;K++)i.uvs[v][K]=Z[K]}i.material=w;i.faceMaterial=B.materialIndex!==null?x[B.materialIndex]:null;i.z=i.centroidScreen.z;z.elements.push(i)}}else if(G instanceof THREE.Line){u.multiply(E,t);
+Q=G.geometry.vertices;v=b();v.positionScreen.copy(Q[0].position);u.multiplyVector4(v.positionScreen);H=1;for(B=Q.length;H<B;H++)if(v=b(),v.positionScreen.copy(Q[H].position),u.multiplyVector4(v.positionScreen),M=o[l-2],D.copy(v.positionScreen),J.copy(M.positionScreen),d(D,J))D.multiplyScalar(1/D.w),J.multiplyScalar(1/J.w),G=N[s]=N[s]||new THREE.RenderableLine,s++,k=G,k.v1.positionScreen.copy(D),k.v2.positionScreen.copy(J),k.z=Math.max(D.z,J.z),k.material=w,z.elements.push(k)}a=0;for(U=z.sprites.length;a<
+U;a++)if(G=z.sprites[a].object,t=G.matrixWorld,G instanceof THREE.Particle&&(C.set(t.n14,t.n24,t.n34,1),E.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))g=P[S]=P[S]||new THREE.RenderableParticle,S++,F=g,F.x=C.x/C.w,F.y=C.y/C.w,F.z=C.z,F.rotation=G.rotation.z,F.scale.x=G.scale.x*Math.abs(F.x-(C.x+e.projectionMatrix.n11)/(C.w+e.projectionMatrix.n14)),F.scale.y=G.scale.y*Math.abs(F.y-(C.y+e.projectionMatrix.n22)/(C.w+e.projectionMatrix.n24)),F.material=G.material,z.elements.push(F);f&&z.elements.sort(c);
+return z}};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=
-this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-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,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,m=l*c+g*f-h*d,j=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e*
-c-g*d-h*f;b.x=m*l+c*-e+j*-h-i*-g;b.y=j*l+c*-g+i*-e-m*-h;b.z=i*l+c*-h+m*-g-j*-e;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 e=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)*e)/f;d=Math.sin(d*e)/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};
+this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-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,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,o=l*c+g*f-h*d,i=l*d+h*c-e*f,n=l*f+e*d-g*c,c=-e*
+c-g*d-h*f;b.x=o*l+c*-e+i*-h-n*-g;b.y=i*l+c*-g+n*-e-o*-h;b.z=n*l+c*-h+o*-g-i*-e;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 e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)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)*e)/f;d=Math.sin(d*e)/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,e){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=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){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=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.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)}};
@@ -80,9 +82,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 c,d,f,e,g,h=new THREE.Vector3,l=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),l.sub(b.position,c.position),h.crossSelf(l);h.isZero()||h.normalize();e.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,e,f,t){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;j=g[e];i=g[f];o=g[t];n=l.x-h.x;p=m.x-h.x;k=l.y-h.y;u=m.y-h.y;x=l.z-h.z;E=m.z-h.z;G=i.u-j.u;M=o.u-j.u;I=i.v-j.v;N=o.v-j.v;L=1/(G*N-M*I);J.set((N*n-I*p)*L,(N*k-I*u)*L,(N*x-I*E)*L);S.set((G*p-M*n)*L,(G*u-M*k)*L,(G*E-M*x)*L);s[b].addSelf(J);s[c].addSelf(J);s[d].addSelf(J);y[b].addSelf(S);
-y[c].addSelf(S);y[d].addSelf(S)}var b,c,d,f,e,g,h,l,m,j,i,o,n,p,k,u,x,E,G,M,I,N,L,K,s=[],y=[],J=new THREE.Vector3,S=new THREE.Vector3,T=new THREE.Vector3,P=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)s[b]=new THREE.Vector3,y[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 z=["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++)t.copy(e.vertexNormals[d]),f=e[z[d]],K=s[f],T.copy(K),T.subSelf(t.multiplyScalar(t.dot(K))).normalize(),P.cross(e.vertexNormals[d],K),f=P.dot(y[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.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,
+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,E){h=a.vertices[b].position;l=a.vertices[c].position;o=a.vertices[d].position;i=g[e];n=g[f];m=g[E];j=l.x-h.x;q=o.x-h.x;k=l.y-h.y;s=o.y-h.y;N=l.z-h.z;F=o.z-h.z;S=n.u-i.u;P=m.u-i.u;z=n.v-i.v;A=m.v-i.v;C=1/(S*A-P*z);D.set((A*j-z*q)*C,(A*k-z*s)*C,(A*N-z*F)*C);J.set((S*q-P*j)*C,(S*s-P*k)*C,(S*F-P*N)*C);u[b].addSelf(D);u[c].addSelf(D);u[d].addSelf(D);r[b].addSelf(J);
+r[c].addSelf(J);r[d].addSelf(J)}var b,c,d,f,e,g,h,l,o,i,n,m,j,q,k,s,N,F,S,P,z,A,C,E,u=[],r=[],D=new THREE.Vector3,J=new THREE.Vector3,$=new THREE.Vector3,da=new THREE.Vector3,L=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 O=["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++)L.copy(e.vertexNormals[d]),f=e[O[d]],E=u[f],$.copy(E),$.subSelf(L.multiplyScalar(L.dot(E))).normalize(),da.cross(e.vertexNormals[d],E),f=da.dot(r[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.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;
@@ -113,42 +115,46 @@ THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};thi
 THREE.Texture=function(a,b,c,d,f,e){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=e!==void 0?e:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var 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.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip};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("DEPRECATE: Material array is no longer supported. Using material 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.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;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.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:
+!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
+THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
+THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
 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(E!=a)k.globalAlpha=E=a}function c(a){if(G!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}G=a}}function d(a){if(M!=a)k.strokeStyle=M=a}function f(a){if(I!=a)k.fillStyle=I=a}var e=this,g,h,l,m=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-i,o,n,p,k=j.getContext("2d"),u=new THREE.Color(0),x=0,E=1,G=0,M=null,I=null,N=null,L=null,K=null,s,y,J,S,T=new THREE.RenderableVertex,P=new THREE.RenderableVertex,t,z,r,D,w,H,F,U,Z,ca,ga,da,v=new THREE.Color,A=new THREE.Color,B=new THREE.Color,C=new THREE.Color,O=new THREE.Color,wa=[],ea,fa,ba,Y,Aa,Ba,Ca,Da,Ea,Fa,ka=new THREE.Rectangle,W=new THREE.Rectangle,V=new THREE.Rectangle,xa=!1,X=new THREE.Color,ra=new THREE.Color,sa=new THREE.Color,Q=new THREE.Vector3,oa,pa,ya,$,qa,ta,a=16;oa=document.createElement("canvas");
-oa.width=oa.height=2;pa=oa.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);ya=pa.getImageData(0,0,2,2);$=ya.data;qa=document.createElement("canvas");qa.width=qa.height=a;ta=qa.getContext("2d");ta.translate(-a/2,-a/2);ta.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;o=b;n=Math.floor(i/2);p=Math.floor(o/2);j.width=i;j.height=o;ka.set(-n,-p,n,p);W.set(-n,-p,n,p);E=1;G=0;K=
-L=N=I=M=null};this.setClearColor=function(a,b){u.copy(a);x=b;W.set(-n,-p,n,p)};this.setClearColorHex=function(a,b){u.setHex(a);x=b;W.set(-n,-p,n,p)};this.clear=function(){k.setTransform(1,0,0,-1,n,p);W.isEmpty()||(W.minSelf(ka),W.inflate(2),x<1&&k.clearRect(Math.floor(W.getX()),Math.floor(W.getY()),Math.floor(W.getWidth()),Math.floor(W.getHeight())),x>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+x+")"),k.fillRect(Math.floor(W.getX()),
-Math.floor(W.getY()),Math.floor(W.getWidth()),Math.floor(W.getHeight()))),W.empty())};this.render=function(a,j){function i(a){var b,c,d,e;X.setRGB(0,0,0);ra.setRGB(0,0,0);sa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(X.r+=e.r,X.g+=e.g,X.b+=e.b):d instanceof THREE.DirectionalLight?(ra.r+=e.r,ra.g+=e.g,ra.b+=e.b):d instanceof THREE.PointLight&&(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b)}function o(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(Q.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 u(a,e,g){b(g.opacity);c(g.blending);var h,j,l,i,q,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=g.map.image,q=i.width>>1,o=i.height>>
-1,g=e.scale.x*n,l=e.scale.y*p,h=g*q,j=l*o,V.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(V)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-l),k.translate(-q,-o),k.drawImage(i,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*n,j=e.scale.y*p,V.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(V)&&(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 x(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(N!=a)k.lineWidth=N=a;a=g.linecap;if(L!=a)k.lineCap=L=a;a=g.linejoin;if(K!=a)k.lineJoin=K=a;d(g.color.getContextStyle());k.stroke();V.inflate(g.linewidth*2)}}function E(a,d,f,g,h,k,i,q){e.info.render.vertices+=3;e.info.render.faces++;b(q.opacity);c(q.blending);t=a.positionScreen.x;z=a.positionScreen.y;
-r=d.positionScreen.x;D=d.positionScreen.y;w=f.positionScreen.x;H=f.positionScreen.y;G(t,z,r,D,w,H);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(Y=i.uvs[0],za(t,z,r,D,w,H,Y[g].u,Y[g].v,Y[h].u,Y[h].v,Y[k].u,Y[k].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,Q.copy(i.vertexNormalsWorld[g]),Aa=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ba=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(i.vertexNormalsWorld[h]),
-Ca=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Da=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(i.vertexNormalsWorld[k]),Ea=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Fa=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,za(t,z,r,D,w,H,Aa,Ba,Ca,Da,Ea,Fa,q.envMap)}else q.wireframe?ha(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&&(Y=i.uvs[0],za(t,z,r,D,w,H,Y[g].u,Y[g].v,
-Y[h].u,Y[h].v,Y[k].u,Y[k].v,q.map)),c(THREE.SubtractiveBlending)),xa?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(A.r=B.r=C.r=X.r,A.g=B.g=C.g=X.g,A.b=B.b=C.b=X.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],A),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],B),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],C),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)),B.r=Math.max(0,Math.min(q.color.r*
-B.r,1)),B.g=Math.max(0,Math.min(q.color.g*B.g,1)),B.b=Math.max(0,Math.min(q.color.b*B.b,1)),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),O.r=(B.r+C.r)*0.5,O.g=(B.g+C.g)*0.5,O.b=(B.b+C.b)*0.5,ba=ua(A,B,C,O),ma(t,z,r,D,w,H,0,0,1,0,0,1,ba)):(v.r=X.r,v.g=X.g,v.b=X.b,o(l,i.centroidWorld,i.normalWorld,v),v.r=Math.max(0,Math.min(q.color.r*v.r,1)),v.g=Math.max(0,Math.min(q.color.g*v.g,1)),v.b=Math.max(0,Math.min(q.color.b*v.b,
-1)),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v)):q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)ea=j.near,fa=j.far,A.r=A.g=A.b=1-la(a.positionScreen.z,ea,fa),B.r=B.g=B.b=1-la(d.positionScreen.z,ea,fa),C.r=C.g=C.b=1-la(f.positionScreen.z,ea,fa),O.r=(B.r+C.r)*0.5,O.g=(B.g+C.g)*0.5,O.b=(B.b+C.b)*0.5,ba=ua(A,B,C,O),ma(t,z,r,D,w,H,0,0,1,0,0,1,ba);else if(q instanceof THREE.MeshNormalMaterial)v.r=
-na(i.normalWorld.x),v.g=na(i.normalWorld.y),v.b=na(i.normalWorld.z),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v)}function I(a,d,f,g,h,k,i,q,n){e.info.render.vertices+=4;e.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)E(a,d,g,0,1,3,i,q,n),E(h,f,k,1,2,3,i,q,n);else if(t=a.positionScreen.x,z=a.positionScreen.y,r=d.positionScreen.x,D=d.positionScreen.y,w=f.positionScreen.x,H=f.positionScreen.y,F=g.positionScreen.x,U=g.positionScreen.y,Z=h.positionScreen.x,
-ca=h.positionScreen.y,ga=k.positionScreen.x,da=k.positionScreen.y,q instanceof THREE.MeshBasicMaterial)M(t,z,r,D,w,H,F,U),q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)xa?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(A.r=B.r=C.r=O.r=X.r,A.g=B.g=C.g=O.g=X.g,A.b=B.b=C.b=O.b=X.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],A),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],
-B),o(l,i.v4.positionWorld,i.vertexNormalsWorld[3],C),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],O),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)),B.r=Math.max(0,Math.min(q.color.r*B.r,1)),B.g=Math.max(0,Math.min(q.color.g*B.g,1)),B.b=Math.max(0,Math.min(q.color.b*B.b,1)),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),O.r=Math.max(0,Math.min(q.color.r*
-O.r,1)),O.g=Math.max(0,Math.min(q.color.g*O.g,1)),O.b=Math.max(0,Math.min(q.color.b*O.b,1)),ba=ua(A,B,C,O),G(t,z,r,D,F,U),ma(t,z,r,D,F,U,0,0,1,0,0,1,ba),G(Z,ca,w,H,ga,da),ma(Z,ca,w,H,ga,da,1,0,1,1,0,1,ba)):(v.r=X.r,v.g=X.g,v.b=X.b,o(l,i.centroidWorld,i.normalWorld,v),v.r=Math.max(0,Math.min(q.color.r*v.r,1)),v.g=Math.max(0,Math.min(q.color.g*v.g,1)),v.b=Math.max(0,Math.min(q.color.b*v.b,1)),M(t,z,r,D,w,H,F,U),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v)):(M(t,
-z,r,D,w,H,F,U),q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)v.r=na(i.normalWorld.x),v.g=na(i.normalWorld.y),v.b=na(i.normalWorld.z),M(t,z,r,D,w,H,F,U),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v);else if(q instanceof THREE.MeshDepthMaterial)ea=j.near,fa=j.far,A.r=A.g=A.b=1-la(a.positionScreen.z,ea,fa),B.r=B.g=B.b=1-la(d.positionScreen.z,ea,fa),C.r=C.g=C.b=1-la(g.positionScreen.z,
-ea,fa),O.r=O.g=O.b=1-la(f.positionScreen.z,ea,fa),ba=ua(A,B,C,O),G(t,z,r,D,F,U),ma(t,z,r,D,F,U,0,0,1,0,0,1,ba),G(Z,ca,w,H,ga,da),ma(Z,ca,w,H,ga,da,1,0,1,1,0,1,ba)}function G(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 M(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 ha(a,b,c,e){if(N!=b)k.lineWidth=N=b;if(L!=c)k.lineCap=L=c;if(K!=e)k.lineJoin=K=e;d(a.getContextStyle());
-k.stroke();V.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function za(a,b,c,d,e,g,h,i,j,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||wa[m.id]==void 0){var p=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;wa[m.id]=k.createPattern(m.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}f(wa[m.id]);var p=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+p)*s,i=(i+r)*m,j=
-(j+p)*s,l=(l+r)*m,n=(n+p)*s,o=(o+r)*m;c-=a;d-=b;e-=a;g-=b;j-=h;l-=i;n-=h;o-=i;p=1/(j*o-n*l);m=(o*c-l*e)*p;l=(o*d-l*g)*p;c=(j*e-n*c)*p;d=(j*g-n*d)*p;a=a-m*h-c*i;b=b-l*h-d*i;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function ma(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,p;o=n.width-1;p=n.height-1;g*=o;h*=p;i*=o;j*=p;l*=o;m*=p;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;p=1/(i*m-l*j);o=(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-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();
-k.drawImage(n,0,0);k.restore()}function ua(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);$[0]=e<0?0:e>255?255:e;$[1]=f<0?0:f>255?255:f;$[2]=a<0?0:a>255?255:a;$[4]=g<0?0:g>255?255:g;$[5]=h<0?0:h>255?255:h;$[6]=b<0?0:b>255?255:b;$[8]=i<0?0:i>255?255:i;$[9]=j<0?0:j>255?255:j;$[10]=c<0?0:c>255?255:c;$[12]=k<0?0:k>255?255:k;$[13]=l<0?0:l>255?255:l;$[14]=d<0?0:d>255?255:
-d;pa.putImageData(ya,0,0);ta.drawImage(oa,0,0);return qa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ja(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 va,Ga,R,aa;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,p);e.info.render.vertices=0;e.info.render.faces=0;g=m.projectScene(a,j,this.sortElements);h=g.elements;l=g.lights;(xa=l.length>0)&&i(l);va=0;for(Ga=h.length;va<Ga;va++)if(R=
-h[va],aa=R.material,aa=aa instanceof THREE.MeshFaceMaterial?R.faceMaterial:aa,!(aa==null||aa.opacity==0)){V.empty();if(R instanceof THREE.RenderableParticle)s=R,s.x*=n,s.y*=p,u(s,R,aa,a);else if(R instanceof THREE.RenderableLine)s=R.v1,y=R.v2,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,V.addPoint(s.positionScreen.x,s.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),ka.intersects(V)&&x(s,y,R,aa,a);else if(R instanceof THREE.RenderableFace3)s=
-R.v1,y=R.v2,J=R.v3,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,J.positionScreen.x*=n,J.positionScreen.y*=p,aa.overdraw&&(ja(s.positionScreen,y.positionScreen),ja(y.positionScreen,J.positionScreen),ja(J.positionScreen,s.positionScreen)),V.add3Points(s.positionScreen.x,s.positionScreen.y,y.positionScreen.x,y.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ka.intersects(V)&&E(s,y,J,0,1,2,R,aa,a);else if(R instanceof THREE.RenderableFace4)s=R.v1,y=R.v2,
-J=R.v3,S=R.v4,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,J.positionScreen.x*=n,J.positionScreen.y*=p,S.positionScreen.x*=n,S.positionScreen.y*=p,T.positionScreen.copy(y.positionScreen),P.positionScreen.copy(S.positionScreen),aa.overdraw&&(ja(s.positionScreen,y.positionScreen),ja(y.positionScreen,S.positionScreen),ja(S.positionScreen,s.positionScreen),ja(J.positionScreen,T.positionScreen),ja(J.positionScreen,P.positionScreen)),V.addPoint(s.positionScreen.x,
-s.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),V.addPoint(J.positionScreen.x,J.positionScreen.y),V.addPoint(S.positionScreen.x,S.positionScreen.y),ka.intersects(V)&&aa.opacity!=0&&I(s,y,J,S,T,P,R,aa,a);W.addRectangle(V)}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.CanvasRenderer=function(a){function b(a){if(F!=a)k.globalAlpha=F=a}function c(a){if(S!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}S=a}}function d(a){if(P!=a)k.strokeStyle=P=a}function f(a){if(z!=a)k.fillStyle=z=a}var e=this,g,h,l,o=new THREE.Projector,a=a||{},i=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+n,m,j,q,k=i.getContext("2d"),s=new THREE.Color(0),N=0,F=1,S=0,P=null,z=null,A=null,C=null,E=null,u,r,D,J,$=new THREE.RenderableVertex,da=new THREE.RenderableVertex,L,O,T,U,H,B,Q,v,M,K,oa,G,t=new THREE.Color,y=new THREE.Color,w=new THREE.Color,x=new THREE.Color,I=new THREE.Color,ja=[],Z,fa,ea,aa,Aa,Ba,Ca,Da,Ea,Fa,ka=new THREE.Rectangle,X=new THREE.Rectangle,W=new THREE.Rectangle,xa=!1,Y=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,R=new THREE.Vector3,pa,qa,ya,ba,ra,ua,a=16;pa=document.createElement("canvas");
+pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);ya=qa.getImageData(0,0,2,2);ba=ya.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;m=b;j=Math.floor(n/2);q=Math.floor(m/2);i.width=n;i.height=m;ka.set(-j,-q,j,q);X.set(-j,-q,j,q);F=1;S=0;
+E=C=A=z=P=null};this.setClearColor=function(a,b){s.copy(a);N=b;X.set(-j,-q,j,q)};this.setClearColorHex=function(a,b){s.setHex(a);N=b;X.set(-j,-q,j,q)};this.clear=function(){k.setTransform(1,0,0,-1,j,q);X.isEmpty()||(X.minSelf(ka),X.inflate(2),N<1&&k.clearRect(Math.floor(X.getX()),Math.floor(X.getY()),Math.floor(X.getWidth()),Math.floor(X.getHeight())),N>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+N+")"),k.fillRect(Math.floor(X.getX()),
+Math.floor(X.getY()),Math.floor(X.getWidth()),Math.floor(X.getHeight()))),X.empty())};this.render=function(a,i){function n(a){var b,c,d,e;Y.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(Y.r+=e.r,Y.g+=e.g,Y.b+=e.b):d instanceof THREE.DirectionalLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.PointLight&&(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b)}function m(a,b,c,d){var e,f,g,h,i,k;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
+g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),k<=0||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(R.sub(i,b).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),k!=0&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function s(a,e,g){b(g.opacity);c(g.blending);var h,i,l,n,p,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)n=g.map.image,p=n.width>>1,o=n.height>>
+1,g=e.scale.x*j,l=e.scale.y*q,h=g*p,i=l*o,W.set(a.x-h,a.y-i,a.x+h,a.y+i),ka.intersects(W)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-l),k.translate(-p,-o),k.drawImage(n,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*j,i=e.scale.y*q,W.set(a.x-h,a.y-i,a.x+h,a.y+i),ka.intersects(W)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,i),g.program(k),k.restore()))}function z(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(A!=a)k.lineWidth=A=a;a=g.linecap;if(C!=a)k.lineCap=C=a;a=g.linejoin;if(E!=a)k.lineJoin=E=a;d(g.color.getContextStyle());k.stroke();W.inflate(g.linewidth*2)}}function F(a,d,f,g,h,k,j,p){e.info.render.vertices+=3;e.info.render.faces++;b(p.opacity);c(p.blending);L=a.positionScreen.x;O=a.positionScreen.y;
+T=d.positionScreen.x;U=d.positionScreen.y;H=f.positionScreen.x;B=f.positionScreen.y;N(L,O,T,U,H,B);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(aa=j.uvs[0],za(L,O,T,U,H,B,aa[g].u,aa[g].v,aa[h].u,aa[h].v,aa[k].u,aa[k].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=i.matrixWorldInverse,R.copy(j.vertexNormalsWorld[g]),Aa=(R.x*a.n11+R.y*a.n12+R.z*a.n13)*0.5+0.5,Ba=-(R.x*a.n21+R.y*a.n22+R.z*a.n23)*0.5+0.5,R.copy(j.vertexNormalsWorld[h]),
+Ca=(R.x*a.n11+R.y*a.n12+R.z*a.n13)*0.5+0.5,Da=-(R.x*a.n21+R.y*a.n22+R.z*a.n23)*0.5+0.5,R.copy(j.vertexNormalsWorld[k]),Ea=(R.x*a.n11+R.y*a.n12+R.z*a.n13)*0.5+0.5,Fa=-(R.x*a.n21+R.y*a.n22+R.z*a.n23)*0.5+0.5,za(L,O,T,U,H,B,Aa,Ba,Ca,Da,Ea,Fa,p.envMap)}else p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(aa=j.uvs[0],za(L,O,T,U,H,B,aa[g].u,aa[g].v,
+aa[h].u,aa[h].v,aa[k].u,aa[k].v,p.map)),c(THREE.SubtractiveBlending)),xa?!p.wireframe&&p.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3?(y.r=w.r=x.r=Y.r,y.g=w.g=x.g=Y.g,y.b=w.b=x.b=Y.b,m(l,j.v1.positionWorld,j.vertexNormalsWorld[0],y),m(l,j.v2.positionWorld,j.vertexNormalsWorld[1],w),m(l,j.v3.positionWorld,j.vertexNormalsWorld[2],x),y.r=Math.max(0,Math.min(p.color.r*y.r,1)),y.g=Math.max(0,Math.min(p.color.g*y.g,1)),y.b=Math.max(0,Math.min(p.color.b*y.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)),I.r=(w.r+x.r)*0.5,I.g=(w.g+x.g)*0.5,I.b=(w.b+x.b)*0.5,ea=va(y,w,x,I),ma(L,O,T,U,H,B,0,0,1,0,0,1,ea)):(t.r=Y.r,t.g=Y.g,t.b=Y.b,m(l,j.centroidWorld,j.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,
+1)),p.wireframe?ga(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(t)):p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshDepthMaterial)Z=i.near,fa=i.far,y.r=y.g=y.b=1-la(a.positionScreen.z,Z,fa),w.r=w.g=w.b=1-la(d.positionScreen.z,Z,fa),x.r=x.g=x.b=1-la(f.positionScreen.z,Z,fa),I.r=(w.r+x.r)*0.5,I.g=(w.g+x.g)*0.5,I.b=(w.b+x.b)*0.5,ea=va(y,w,x,I),ma(L,O,T,U,H,B,0,0,1,0,0,1,ea);else if(p instanceof THREE.MeshNormalMaterial)t.r=
+na(j.normalWorld.x),t.g=na(j.normalWorld.y),t.b=na(j.normalWorld.z),p.wireframe?ga(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(t)}function S(a,d,f,g,h,k,j,p,n){e.info.render.vertices+=4;e.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)F(a,d,g,0,1,3,j,p,n),F(h,f,k,1,2,3,j,p,n);else if(L=a.positionScreen.x,O=a.positionScreen.y,T=d.positionScreen.x,U=d.positionScreen.y,H=f.positionScreen.x,B=f.positionScreen.y,Q=g.positionScreen.x,v=g.positionScreen.y,M=h.positionScreen.x,
+K=h.positionScreen.y,oa=k.positionScreen.x,G=k.positionScreen.y,p instanceof THREE.MeshBasicMaterial)P(L,O,T,U,H,B,Q,v),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)xa?!p.wireframe&&p.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4?(y.r=w.r=x.r=I.r=Y.r,y.g=w.g=x.g=I.g=Y.g,y.b=w.b=x.b=I.b=Y.b,m(l,j.v1.positionWorld,j.vertexNormalsWorld[0],y),m(l,j.v2.positionWorld,j.vertexNormalsWorld[1],
+w),m(l,j.v4.positionWorld,j.vertexNormalsWorld[3],x),m(l,j.v3.positionWorld,j.vertexNormalsWorld[2],I),y.r=Math.max(0,Math.min(p.color.r*y.r,1)),y.g=Math.max(0,Math.min(p.color.g*y.g,1)),y.b=Math.max(0,Math.min(p.color.b*y.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)),I.r=Math.max(0,Math.min(p.color.r*
+I.r,1)),I.g=Math.max(0,Math.min(p.color.g*I.g,1)),I.b=Math.max(0,Math.min(p.color.b*I.b,1)),ea=va(y,w,x,I),N(L,O,T,U,Q,v),ma(L,O,T,U,Q,v,0,0,1,0,0,1,ea),N(M,K,H,B,oa,G),ma(M,K,H,B,oa,G,1,0,1,1,0,1,ea)):(t.r=Y.r,t.g=Y.g,t.b=Y.b,m(l,j.centroidWorld,j.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1)),P(L,O,T,U,H,B,Q,v),p.wireframe?ga(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(t)):(P(L,O,
+T,U,H,B,Q,v),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color));else if(p instanceof THREE.MeshNormalMaterial)t.r=na(j.normalWorld.x),t.g=na(j.normalWorld.y),t.b=na(j.normalWorld.z),P(L,O,T,U,H,B,Q,v),p.wireframe?ga(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(t);else if(p instanceof THREE.MeshDepthMaterial)Z=i.near,fa=i.far,y.r=y.g=y.b=1-la(a.positionScreen.z,Z,fa),w.r=w.g=w.b=1-la(d.positionScreen.z,Z,fa),x.r=x.g=x.b=1-la(g.positionScreen.z,
+Z,fa),I.r=I.g=I.b=1-la(f.positionScreen.z,Z,fa),ea=va(y,w,x,I),N(L,O,T,U,Q,v),ma(L,O,T,U,Q,v,0,0,1,0,0,1,ea),N(M,K,H,B,oa,G),ma(M,K,H,B,oa,G,1,0,1,1,0,1,ea)}function N(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 P(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 ga(a,b,c,e){if(A!=b)k.lineWidth=A=b;if(C!=c)k.lineCap=C=c;if(E!=e)k.lineJoin=E=e;d(a.getContextStyle());
+k.stroke();W.inflate(b*2)}function ha(a){f(a.getContextStyle());k.fill()}function za(a,b,c,d,e,g,h,i,j,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||ja[m.id]==void 0){var q=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;ja[m.id]=k.createPattern(m.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}f(ja[m.id]);var q=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+q)*s,i=(i+r)*m,j=
+(j+q)*s,l=(l+r)*m,n=(n+q)*s,o=(o+r)*m;c-=a;d-=b;e-=a;g-=b;j-=h;l-=i;n-=h;o-=i;q=1/(j*o-n*l);m=(o*c-l*e)*q;l=(o*d-l*g)*q;c=(j*e-n*c)*q;d=(j*g-n*d)*q;a=a-m*h-c*i;b=b-l*h-d*i;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function ma(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,q;o=n.width-1;q=n.height-1;g*=o;h*=q;i*=o;j*=q;l*=o;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;q=1/(i*m-l*j);o=(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-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();
+k.drawImage(n,0,0);k.restore()}function va(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;qa.putImageData(ya,0,0);ua.drawImage(pa,0,0);return ra}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(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 wa,Ga,V,ca;this.autoClear?this.clear():k.setTransform(1,0,0,-1,j,q);e.info.render.vertices=0;e.info.render.faces=0;g=o.projectScene(a,i,this.sortElements);h=g.elements;l=g.lights;(xa=l.length>0)&&n(l);wa=0;for(Ga=h.length;wa<
+Ga;wa++)if(V=h[wa],ca=V.material,ca=ca instanceof THREE.MeshFaceMaterial?V.faceMaterial:ca,!(ca==null||ca.opacity==0)){W.empty();if(V instanceof THREE.RenderableParticle)u=V,u.x*=j,u.y*=q,s(u,V,ca,a);else if(V instanceof THREE.RenderableLine)u=V.v1,r=V.v2,u.positionScreen.x*=j,u.positionScreen.y*=q,r.positionScreen.x*=j,r.positionScreen.y*=q,W.addPoint(u.positionScreen.x,u.positionScreen.y),W.addPoint(r.positionScreen.x,r.positionScreen.y),ka.intersects(W)&&z(u,r,V,ca,a);else if(V instanceof THREE.RenderableFace3)u=
+V.v1,r=V.v2,D=V.v3,u.positionScreen.x*=j,u.positionScreen.y*=q,r.positionScreen.x*=j,r.positionScreen.y*=q,D.positionScreen.x*=j,D.positionScreen.y*=q,ca.overdraw&&(ia(u.positionScreen,r.positionScreen),ia(r.positionScreen,D.positionScreen),ia(D.positionScreen,u.positionScreen)),W.add3Points(u.positionScreen.x,u.positionScreen.y,r.positionScreen.x,r.positionScreen.y,D.positionScreen.x,D.positionScreen.y),ka.intersects(W)&&F(u,r,D,0,1,2,V,ca,a);else if(V instanceof THREE.RenderableFace4)u=V.v1,r=V.v2,
+D=V.v3,J=V.v4,u.positionScreen.x*=j,u.positionScreen.y*=q,r.positionScreen.x*=j,r.positionScreen.y*=q,D.positionScreen.x*=j,D.positionScreen.y*=q,J.positionScreen.x*=j,J.positionScreen.y*=q,$.positionScreen.copy(r.positionScreen),da.positionScreen.copy(J.positionScreen),ca.overdraw&&(ia(u.positionScreen,r.positionScreen),ia(r.positionScreen,J.positionScreen),ia(J.positionScreen,u.positionScreen),ia(D.positionScreen,$.positionScreen),ia(D.positionScreen,da.positionScreen)),W.addPoint(u.positionScreen.x,
+u.positionScreen.y),W.addPoint(r.positionScreen.x,r.positionScreen.y),W.addPoint(D.positionScreen.x,D.positionScreen.y),W.addPoint(J.positionScreen.x,J.positionScreen.y),ka.intersects(W)&&S(u,r,D,J,$,da,V,ca,a);X.addRectangle(W)}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.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};

+ 52 - 46
build/custom/ThreeDOM.js

@@ -1,7 +1,7 @@
 // ThreeDOM.js r46dev - 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,e,g;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),g=c*(1-
-b*e),b=c*(1-b*(1-e)),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,e,f;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),f=c*(1-
+b*e),b=c*(1-b*(1-e)),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)},
@@ -15,74 +15,80 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
 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){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},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},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
-c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a*c-b*d)*e;return f>0&&a>0&&f+a<1}for(var d,e=[],g=0,f=a.children.length;g<f;g++)Array.prototype.push.apply(e,this.intersectObject(a.children[g]));if(a instanceof THREE.Particle){g=b(this.origin,this.direction,a.matrixWorld.getPosition());if(g===null||g>a.scale.x)return[];d={distance:g,point:a.position,face:null,object:a};e.push(d)}else if(a instanceof THREE.Mesh){g=
-b(this.origin,this.direction,a.matrixWorld.getPosition());if(g===null||g>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return e;var h,k,l,i,j,n,m,o,p=a.geometry,r=p.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);g=0;for(f=p.faces.length;g<f;g++)if(d=p.faces[g],m=this.origin.clone(),o=this.direction.clone(),i=a.matrixWorld,h=i.multiplyVector3(d.centroid.clone()).subSelf(m),n=h.dot(o),!(n<=0)&&(h=i.multiplyVector3(r[d.a].position.clone()),k=i.multiplyVector3(r[d.b].position.clone()),
-l=i.multiplyVector3(r[d.c].position.clone()),i=d instanceof THREE.Face4?i.multiplyVector3(r[d.d].position.clone()):null,j=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=o.dot(j),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=j.dot((new THREE.Vector3).sub(h,m))/n,m=m.addSelf(o.multiplyScalar(n)),d instanceof THREE.Face3)c(m,h,k,l)&&(d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d));else if(d instanceof THREE.Face4&&(c(m,h,k,i)||c(m,k,l,i)))d={distance:this.origin.distanceTo(m),
+c=c.clone().subSelf(b),e=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(e),f=c.dot(c),c=c.dot(e),e=1/(a*f-b*b),f=(f*d-b*c)*e,a=(a*c-b*d)*e;return f>0&&a>0&&f+a<1}for(var d,e=[],f=0,g=a.children.length;f<g;f++)Array.prototype.push.apply(e,this.intersectObject(a.children[f]));if(a instanceof THREE.Particle){f=b(this.origin,this.direction,a.matrixWorld.getPosition());if(f===null||f>a.scale.x)return[];d={distance:f,point:a.position,face:null,object:a};e.push(d)}else if(a instanceof THREE.Mesh){f=
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(f===null||f>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return e;var h,j,k,i,l,n,m,p,o=a.geometry,q=o.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);f=0;for(g=o.faces.length;f<g;f++)if(d=o.faces[f],m=this.origin.clone(),p=this.direction.clone(),i=a.matrixWorld,h=i.multiplyVector3(d.centroid.clone()).subSelf(m),n=h.dot(p),!(n<=0)&&(h=i.multiplyVector3(q[d.a].position.clone()),j=i.multiplyVector3(q[d.b].position.clone()),
+k=i.multiplyVector3(q[d.c].position.clone()),i=d instanceof THREE.Face4?i.multiplyVector3(q[d.d].position.clone()):null,l=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),n=p.dot(l),a.doubleSided||(a.flipSided?n>0:n<0)))if(n=l.dot((new THREE.Vector3).sub(h,m))/n,m=m.addSelf(p.multiplyScalar(n)),d instanceof THREE.Face3)c(m,h,j,k)&&(d={distance:this.origin.distanceTo(m),point:m,face:d,object:a},e.push(d));else if(d instanceof THREE.Face4&&(c(m,h,j,i)||c(m,j,k,i)))d={distance:this.origin.distanceTo(m),
 point:m,face:d,object:a},e.push(d)}return e}};
-THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,i,j){h=!1;b=f;c=g;d=i;e=j;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,i,j,n,m){h?(h=!1,b=f<i?f<n?f:n:i<n?i:n,c=g<j?g<m?g:m:j<m?j:m,d=f>i?f>n?f:n:i>n?i:n,e=g>j?g>m?g:m:j>m?j:m):(b=f<i?f<n?f<b?f:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b,c=g<j?g<m?g<c?g:c:m<c?m:c:j<m?j<c?j:c:m<c?m:c,d=f>i?f>n?f>d?f:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d,e=g>j?g>m?g>e?g:e:m>e?m:e:j>m?j>e?j:e:m>e?m: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}};THREE.Matrix3=function(){this.m=[]};
+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(f,g,i,l){h=!1;b=f;c=g;d=i;e=l;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,i,l,n,m){h?(h=!1,b=f<i?f<n?f:n:i<n?i:n,c=g<l?g<m?g:m:l<m?l:m,d=f>i?f>n?f:n:i>n?i:n,e=g>l?g>m?g:m:l>m?l:m):(b=f<i?f<n?f<b?f:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b,c=g<l?g<m?g<c?g:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c,d=f>i?f>n?f>d?f:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d,e=g>l?g>m?g>e?g:e:m>e?m:e:l>m?l>e?l:e:m>e?m: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}};
+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,k,l,i,j,n,m,o,p){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,k||0,l||0,i!==void 0?i:1,j||0,n||0,m||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,e,g,f,h,k,l,i,j,n,m,o,p){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=k;this.n32=l;this.n33=i;this.n34=j;this.n41=n;this.n42=m;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,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,k=a.n23,l=a.n24,i=a.n31,j=a.n32,n=a.n33,m=a.n34,o=a.n41,p=a.n42,r=a.n43,
-t=a.n44,w=b.n11,B=b.n12,I=b.n13,s=b.n14,E=b.n21,F=b.n22,O=b.n23,z=b.n24,L=b.n31,J=b.n32,M=b.n33,G=b.n34,C=b.n41,u=b.n42,A=b.n43,q=b.n44;this.n11=c*w+d*E+e*L+g*C;this.n12=c*B+d*F+e*J+g*u;this.n13=c*I+d*O+e*M+g*A;this.n14=c*s+d*z+e*G+g*q;this.n21=f*w+h*E+k*L+l*C;this.n22=f*B+h*F+k*J+l*u;this.n23=f*I+h*O+k*M+l*A;this.n24=f*s+h*z+k*G+l*q;this.n31=i*w+j*E+n*L+m*C;this.n32=i*B+j*F+n*J+m*u;this.n33=i*I+j*O+n*M+m*A;this.n34=i*s+j*z+n*G+m*q;this.n41=o*w+p*E+r*L+t*C;this.n42=o*B+p*F+r*J+t*u;this.n43=o*I+p*
-O+r*M+t*A;this.n44=o*s+p*z+r*G+t*q;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,f,g,h,j,k,i,l,n,m,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,j||0,k||0,i!==void 0?i:1,l||0,n||0,m||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,j,k,i,l,n,m,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=j;this.n32=k;this.n33=i;this.n34=l;this.n41=n;this.n42=m;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,j=a.n23,k=a.n24,i=a.n31,l=a.n32,n=a.n33,m=a.n34,p=a.n41,o=a.n42,q=a.n43,
+K=a.n44,A=b.n11,H=b.n12,L=b.n13,s=b.n14,B=b.n21,u=b.n22,z=b.n23,J=b.n24,x=b.n31,E=b.n32,F=b.n33,O=b.n34,P=b.n41,Q=b.n42,R=b.n43,S=b.n44;this.n11=c*A+d*B+e*x+f*P;this.n12=c*H+d*u+e*E+f*Q;this.n13=c*L+d*z+e*F+f*R;this.n14=c*s+d*J+e*O+f*S;this.n21=g*A+h*B+j*x+k*P;this.n22=g*H+h*u+j*E+k*Q;this.n23=g*L+h*z+j*F+k*R;this.n24=g*s+h*J+j*O+k*S;this.n31=i*A+l*B+n*x+m*P;this.n32=i*H+l*u+n*E+m*Q;this.n33=i*L+l*z+n*F+m*R;this.n34=i*s+l*J+n*O+m*S;this.n41=p*A+o*B+q*x+K*P;this.n42=p*H+o*u+q*E+K*Q;this.n43=p*L+o*
+z+q*F+K*R;this.n44=p*s+o*J+q*O+K*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,g=this.n22,f=this.n23,h=this.n24,k=this.n31,l=this.n32,i=this.n33,j=this.n34,n=this.n41,m=this.n42,o=this.n43,p=this.n44;return d*f*l*n-c*h*l*n-d*g*i*n+b*h*i*n+c*g*j*n-b*f*j*n-d*f*k*m+c*h*k*m+d*e*i*m-a*h*i*m-c*e*j*m+a*f*j*m+d*g*k*o-b*h*k*o-d*e*l*o+a*h*l*o+b*e*j*o-a*g*j*o-c*g*k*p+b*f*k*p+c*e*l*p-a*f*l*p-b*e*i*p+a*g*i*p},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,f=this.n22,g=this.n23,h=this.n24,j=this.n31,k=this.n32,i=this.n33,l=this.n34,n=this.n41,m=this.n42,p=this.n43,o=this.n44;return d*g*k*n-c*h*k*n-d*f*i*n+b*h*i*n+c*f*l*n-b*g*l*n-d*g*j*m+c*h*j*m+d*e*i*m-a*h*i*m-c*e*l*m+a*g*l*m+d*f*j*p-b*h*j*p-d*e*k*p+a*h*k*p+b*e*l*p-a*f*l*p-c*f*j*o+b*g*j*o+c*e*k*o-a*g*k*o-b*e*i*o+a*f*i*o},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,k=e*g,l=e*f;this.set(k*g+c,k*f-d*h,k*h+d*f,0,k*f+d*h,l*f+c,l*h-d*g,0,k*h-d*f,l*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,f=a.n22,h=a.n23,k=a.n24,l=a.n31,i=a.n32,j=a.n33,n=a.n34,m=a.n41,o=a.n42,p=a.n43,r=a.n44;this.n11=h*n*o-k*j*o+k*i*p-f*n*p-h*i*r+f*j*r;this.n12=e*j*o-d*n*o-e*i*p+c*n*p+d*i*r-c*j*r;this.n13=d*k*o-e*h*o+e*f*p-c*k*p-d*f*r+c*h*r;this.n14=e*h*i-d*k*i-e*f*j+c*k*j+d*f*n-c*h*n;this.n21=k*j*m-h*n*m-k*l*p+g*n*p+h*l*r-g*j*r;this.n22=d*n*m-e*j*m+
-e*l*p-b*n*p-d*l*r+b*j*r;this.n23=e*h*m-d*k*m-e*g*p+b*k*p+d*g*r-b*h*r;this.n24=d*k*l-e*h*l+e*g*j-b*k*j-d*g*n+b*h*n;this.n31=f*n*m-k*i*m+k*l*o-g*n*o-f*l*r+g*i*r;this.n32=e*i*m-c*n*m-e*l*o+b*n*o+c*l*r-b*i*r;this.n33=d*k*m-e*f*m+e*g*o-b*k*o-c*g*r+b*f*r;this.n34=e*f*l-c*k*l-e*g*i+b*k*i+c*g*n-b*f*n;this.n41=h*i*m-f*j*m-h*l*o+g*j*o+f*l*p-g*i*p;this.n42=c*j*m-d*i*m+d*l*o-b*j*o-c*l*p+b*i*p;this.n43=d*f*m-c*h*m-d*g*o+b*h*o+c*g*p-b*f*p;this.n44=c*h*l-d*f*l+d*g*i-b*h*i-c*g*j+b*f*j;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 k=f*h,l=f*e,i=d*h,j=d*e;this.n11=k+j*c;this.n12=i*c-l;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=l*c-i;this.n32=j+k*c;this.n33=g*f;break;case "ZXY":k=f*h;l=f*e;i=d*h;j=d*e;this.n11=k-j*c;this.n12=-g*e;this.n13=i+l*c;this.n21=l+i*c;this.n22=g*h;this.n23=j-k*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":k=
-g*h;l=g*e;i=c*h;j=c*e;this.n11=f*h;this.n12=i*d-l;this.n13=k*d+j;this.n21=f*e;this.n22=j*d+k;this.n23=l*d-i;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":k=g*f;l=g*d;i=c*f;j=c*d;this.n11=f*h;this.n12=j-k*e;this.n13=i*e+l;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+i;this.n33=k-j*e;break;case "XZY":k=g*f;l=g*d;i=c*f;j=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=k*e+j;this.n22=g*h;this.n23=l*e-i;this.n31=i*e-l;this.n32=c*h;this.n33=j*e+k;break;default:k=g*h,l=g*
-e,i=c*h,j=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=l+i*d,this.n22=k-j*d,this.n23=-c*f,this.n31=j-k*d,this.n32=i+l*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,k=b*f;b*=h;var l=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(l+d);this.n12=k-e;this.n13=b+f;this.n21=k+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
-a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,
-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;
+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,j=e*f,k=e*g;this.set(j*f+c,j*g-d*h,j*h+d*g,0,j*g+d*h,k*g+c,k*h-d*f,0,j*h-d*g,k*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,j=a.n24,k=a.n31,i=a.n32,l=a.n33,n=a.n34,m=a.n41,p=a.n42,o=a.n43,q=a.n44;this.n11=h*n*p-j*l*p+j*i*o-g*n*o-h*i*q+g*l*q;this.n12=e*l*p-d*n*p-e*i*o+c*n*o+d*i*q-c*l*q;this.n13=d*j*p-e*h*p+e*g*o-c*j*o-d*g*q+c*h*q;this.n14=e*h*i-d*j*i-e*g*l+c*j*l+d*g*n-c*h*n;this.n21=j*l*m-h*n*m-j*k*o+f*n*o+h*k*q-f*l*q;this.n22=d*n*m-e*l*m+
+e*k*o-b*n*o-d*k*q+b*l*q;this.n23=e*h*m-d*j*m-e*f*o+b*j*o+d*f*q-b*h*q;this.n24=d*j*k-e*h*k+e*f*l-b*j*l-d*f*n+b*h*n;this.n31=g*n*m-j*i*m+j*k*p-f*n*p-g*k*q+f*i*q;this.n32=e*i*m-c*n*m-e*k*p+b*n*p+c*k*q-b*i*q;this.n33=d*j*m-e*g*m+e*f*p-b*j*p-c*f*q+b*g*q;this.n34=e*g*k-c*j*k-e*f*i+b*j*i+c*f*n-b*g*n;this.n41=h*i*m-g*l*m-h*k*p+f*l*p+g*k*o-f*i*o;this.n42=c*l*m-d*i*m+d*k*p-b*l*p-c*k*o+b*i*o;this.n43=d*g*m-c*h*m-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*k-d*g*k+d*f*i-b*h*i-c*f*l+b*g*l;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 j=g*h,k=g*e,i=d*h,l=d*e;this.n11=j+l*c;this.n12=i*c-k;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=k*c-i;this.n32=l+j*c;this.n33=f*g;break;case "ZXY":j=g*h;k=g*e;i=d*h;l=d*e;this.n11=j-l*c;this.n12=-f*e;this.n13=i+k*c;this.n21=k+i*c;this.n22=f*h;this.n23=l-j*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":j=
+f*h;k=f*e;i=c*h;l=c*e;this.n11=g*h;this.n12=i*d-k;this.n13=j*d+l;this.n21=g*e;this.n22=l*d+j;this.n23=k*d-i;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":j=f*g;k=f*d;i=c*g;l=c*d;this.n11=g*h;this.n12=l-j*e;this.n13=i*e+k;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=k*e+i;this.n33=j-l*e;break;case "XZY":j=f*g;k=f*d;i=c*g;l=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=j*e+l;this.n22=f*h;this.n23=k*e-i;this.n31=i*e-k;this.n32=c*h;this.n33=l*e+j;break;default:j=f*h,k=f*
+e,i=c*h,l=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=k+i*d,this.n22=j-l*d,this.n23=-c*g,this.n31=l-j*d,this.n32=i+k*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,j=b*g;b*=h;var k=c*g;c*=h;d*=h;f*=e;g*=e;e*=h;this.n11=1-(k+d);this.n12=j-e;this.n13=b+g;this.n21=j+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+k);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,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.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=e.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,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,k=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*l;c[7]=a*i;c[8]=a*j;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,k,l;f=new THREE.Matrix4;h=b-a;k=c-d;l=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((g+e)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.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,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*j;c[6]=a*k;c[7]=a*i;c[8]=a*l;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};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,f){var g,h,j,k;g=new THREE.Matrix4;h=b-a;j=c-d;k=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/j;g.n23=0;g.n24=-((c+d)/j);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((f+e)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;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,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;
 if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 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.RenderableVertex;e++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),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 d,e,g=[],f,h,k=[],l,i=[],j,n,m=[],o,p,r=[],t={objects:[],sprites:[],lights:[],elements:[]};
-new THREE.Vector3;var w=new THREE.Vector4,B=new THREE.Matrix4,I=new THREE.Matrix4,s=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,F=new THREE.Vector4;this.computeFrustum=function(a){s[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);s[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);s[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);s[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);s[4].set(a.n41-
-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);s[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=s[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);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.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(a){t.objects.length=0;t.sprites.length=0;t.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(c=
-s[e].x*d.n14+s[e].y*d.n24+s[e].z*d.n34+s[e].w,c<=f){c=!1;break a}c=!0}c?t.objects.push(a):a instanceof THREE.Line?t.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?t.sprites.push(a):a instanceof THREE.Light&&t.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return t};this.projectScene=function(s,z,L){var J=z.near,M=z.far,G,C,u,A,q,y,x,D,v,H,K,P,S,Q,R,N;p=n=l=h=0;t.elements.length=0;z.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
-s.add(z));s.updateMatrixWorld();z.matrixWorldInverse.getInverse(z.matrixWorld);B.multiply(z.projectionMatrix,z.matrixWorldInverse);this.computeFrustum(B);t=this.projectGraph(s);s=0;for(G=t.objects.length;s<G;s++)if(v=t.objects[s],H=v.matrixWorld,P=v.material,e=0,v instanceof THREE.Mesh){K=v.geometry;S=v.geometry.materials;A=K.vertices;Q=K.faces;R=K.faceVertexUvs;K=v.matrixRotationWorld.extractRotation(H);C=0;for(u=A.length;C<u;C++)d=a(),d.positionWorld.copy(A[C].position),H.multiplyVector3(d.positionWorld),
-d.positionScreen.copy(d.positionWorld),B.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>J&&d.positionScreen.z<M;A=0;for(C=Q.length;A<C;A++){u=Q[A];if(u instanceof THREE.Face3)if(q=g[u.a],y=g[u.b],x=g[u.c],q.visible&&y.visible&&x.visible&&(v.doubleSided||v.flipSided!=(x.positionScreen.x-q.positionScreen.x)*(y.positionScreen.y-q.positionScreen.y)-(x.positionScreen.y-q.positionScreen.y)*(y.positionScreen.x-
-q.positionScreen.x)<0))D=k[h]=k[h]||new THREE.RenderableFace3,h++,f=D,f.v1.copy(q),f.v2.copy(y),f.v3.copy(x);else continue;else if(u instanceof THREE.Face4)if(q=g[u.a],y=g[u.b],x=g[u.c],D=g[u.d],q.visible&&y.visible&&x.visible&&D.visible&&(v.doubleSided||v.flipSided!=((D.positionScreen.x-q.positionScreen.x)*(y.positionScreen.y-q.positionScreen.y)-(D.positionScreen.y-q.positionScreen.y)*(y.positionScreen.x-q.positionScreen.x)<0||(y.positionScreen.x-x.positionScreen.x)*(D.positionScreen.y-x.positionScreen.y)-
-(y.positionScreen.y-x.positionScreen.y)*(D.positionScreen.x-x.positionScreen.x)<0)))N=i[l]=i[l]||new THREE.RenderableFace4,l++,f=N,f.v1.copy(q),f.v2.copy(y),f.v3.copy(x),f.v4.copy(D);else continue;f.normalWorld.copy(u.normal);K.multiplyVector3(f.normalWorld);f.centroidWorld.copy(u.centroid);H.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);B.multiplyVector3(f.centroidScreen);x=u.vertexNormals;q=0;for(y=x.length;q<y;q++)D=f.vertexNormalsWorld[q],D.copy(x[q]),K.multiplyVector3(D);
-q=0;for(y=R.length;q<y;q++)if(N=R[q][A]){x=0;for(D=N.length;x<D;x++)f.uvs[q][x]=N[x]}f.material=P;f.faceMaterial=u.materialIndex!==null?S[u.materialIndex]:null;f.z=f.centroidScreen.z;t.elements.push(f)}}else if(v instanceof THREE.Line){I.multiply(B,H);A=v.geometry.vertices;q=a();q.positionScreen.copy(A[0].position);I.multiplyVector4(q.positionScreen);C=1;for(u=A.length;C<u;C++)if(q=a(),q.positionScreen.copy(A[C].position),I.multiplyVector4(q.positionScreen),y=g[e-2],E.copy(q.positionScreen),F.copy(y.positionScreen),
-c(E,F))E.multiplyScalar(1/E.w),F.multiplyScalar(1/F.w),v=m[n]=m[n]||new THREE.RenderableLine,n++,j=v,j.v1.positionScreen.copy(E),j.v2.positionScreen.copy(F),j.z=Math.max(E.z,F.z),j.material=P,t.elements.push(j)}s=0;for(G=t.sprites.length;s<G;s++)if(v=t.sprites[s],H=v.matrixWorld,v instanceof THREE.Particle&&(w.set(H.n14,H.n24,H.n34,1),B.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1))J=r[p]=r[p]||new THREE.RenderableParticle,p++,o=J,o.x=w.x/w.w,o.y=w.y/w.w,o.z=w.z,o.rotation=v.rotation.z,o.scale.x=v.scale.x*
-Math.abs(o.x-(w.x+z.projectionMatrix.n11)/(w.w+z.projectionMatrix.n14)),o.scale.y=v.scale.y*Math.abs(o.y-(w.y+z.projectionMatrix.n22)/(w.w+z.projectionMatrix.n24)),o.material=v.material,t.elements.push(o);L&&t.elements.sort(b);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,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=k[j]=k[j]||new THREE.RenderableVertex;j++;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,j,k=[],
+i,l,n=[],m,p=[],o,q,K=[],A,H,L=[],s={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,u=new THREE.Vector4,z=new THREE.Matrix4,J=new THREE.Matrix4,x=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,F=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){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=x[h].x*d.n14+x[h].y*d.n24+x[h].z*d.n34+x[h].w,c<=f){c=!1;break a}c=!0}c?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,s.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.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,x=e.far,B,G,w,D,r,y,v,C,t,I,M,T,W,U,V,N;H=q=m=l=0;s.elements.length=0;e.parent==null&&(console.warn("DEPRECATED: Camera hasn't been added to the Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);z.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(z);s=this.projectGraph(a,!1);a=0;for(B=s.objects.length;a<B;a++)if(t=s.objects[a].object,I=t.matrixWorld,T=t.material,
+j=0,t instanceof THREE.Mesh){M=t.geometry;W=t.geometry.materials;D=M.vertices;U=M.faces;V=M.faceVertexUvs;M=t.matrixRotationWorld.extractRotation(I);G=0;for(w=D.length;G<w;G++)h=b(),h.positionWorld.copy(D[G].position),I.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;D=0;for(G=U.length;D<G;D++){w=U[D];if(w instanceof
+THREE.Face3)if(r=k[w.a],y=k[w.b],v=k[w.c],r.visible&&y.visible&&v.visible&&(t.doubleSided||t.flipSided!=(v.positionScreen.x-r.positionScreen.x)*(y.positionScreen.y-r.positionScreen.y)-(v.positionScreen.y-r.positionScreen.y)*(y.positionScreen.x-r.positionScreen.x)<0))C=n[l]=n[l]||new THREE.RenderableFace3,l++,i=C,i.v1.copy(r),i.v2.copy(y),i.v3.copy(v);else continue;else if(w instanceof THREE.Face4)if(r=k[w.a],y=k[w.b],v=k[w.c],C=k[w.d],r.visible&&y.visible&&v.visible&&C.visible&&(t.doubleSided||t.flipSided!=
+((C.positionScreen.x-r.positionScreen.x)*(y.positionScreen.y-r.positionScreen.y)-(C.positionScreen.y-r.positionScreen.y)*(y.positionScreen.x-r.positionScreen.x)<0||(y.positionScreen.x-v.positionScreen.x)*(C.positionScreen.y-v.positionScreen.y)-(y.positionScreen.y-v.positionScreen.y)*(C.positionScreen.x-v.positionScreen.x)<0)))N=p[m]=p[m]||new THREE.RenderableFace4,m++,i=N,i.v1.copy(r),i.v2.copy(y),i.v3.copy(v),i.v4.copy(C);else continue;i.normalWorld.copy(w.normal);M.multiplyVector3(i.normalWorld);
+i.centroidWorld.copy(w.centroid);I.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);z.multiplyVector3(i.centroidScreen);v=w.vertexNormals;r=0;for(y=v.length;r<y;r++)C=i.vertexNormalsWorld[r],C.copy(v[r]),M.multiplyVector3(C);r=0;for(y=V.length;r<y;r++)if(N=V[r][D]){v=0;for(C=N.length;v<C;v++)i.uvs[r][v]=N[v]}i.material=T;i.faceMaterial=w.materialIndex!==null?W[w.materialIndex]:null;i.z=i.centroidScreen.z;s.elements.push(i)}}else if(t instanceof THREE.Line){J.multiply(z,I);D=
+t.geometry.vertices;r=b();r.positionScreen.copy(D[0].position);J.multiplyVector4(r.positionScreen);G=1;for(w=D.length;G<w;G++)if(r=b(),r.positionScreen.copy(D[G].position),J.multiplyVector4(r.positionScreen),y=k[j-2],E.copy(r.positionScreen),F.copy(y.positionScreen),d(E,F))E.multiplyScalar(1/E.w),F.multiplyScalar(1/F.w),t=K[q]=K[q]||new THREE.RenderableLine,q++,o=t,o.v1.positionScreen.copy(E),o.v2.positionScreen.copy(F),o.z=Math.max(E.z,F.z),o.material=T,s.elements.push(o)}a=0;for(B=s.sprites.length;a<
+B;a++)if(t=s.sprites[a].object,I=t.matrixWorld,t instanceof THREE.Particle&&(u.set(I.n14,I.n24,I.n34,1),z.multiplyVector4(u),u.z/=u.w,u.z>0&&u.z<1))g=L[H]=L[H]||new THREE.RenderableParticle,H++,A=g,A.x=u.x/u.w,A.y=u.y/u.w,A.z=u.z,A.rotation=t.rotation.z,A.scale.x=t.scale.x*Math.abs(A.x-(u.x+e.projectionMatrix.n11)/(u.w+e.projectionMatrix.n14)),A.scale.y=t.scale.y*Math.abs(A.y-(u.y+e.projectionMatrix.n22)/(u.w+e.projectionMatrix.n24)),A.material=t.material,s.elements.push(A);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=
-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,k=this.w,l=k*c+f*e-h*d,i=k*d+h*c-g*e,j=k*e+g*d-f*c,c=-g*
-c-f*d-h*e;b.x=l*k+c*-g+i*-h-j*-f;b.y=i*k+c*-f+j*-g-l*-h;b.z=j*k+c*-h+l*-f-i*-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};
+this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-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,f=this.x,g=this.y,h=this.z,j=this.w,k=j*c+g*e-h*d,i=j*d+h*c-f*e,l=j*e+f*d-g*c,c=-f*
+c-g*d-h*e;b.x=k*j+c*-f+i*-h-l*-g;b.y=i*j+c*-g+l*-f-k*-h;b.z=l*j+c*-h+k*-g-i*-f;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 f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)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)/e;d=Math.sin(d*f)/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,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=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,d,e,f,g){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=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.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.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.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,f){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=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,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
+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,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;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.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=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.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.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:
+!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
+THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
+THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
 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.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 k,l,i,j,n,m,o,p;a=b.projectScene(c,d);k=0;for(l=a.length;k<l;k++)if(n=a[k],n instanceof THREE.RenderableParticle){o=n.x*e+e;p=n.y*g+g;i=0;for(j=n.material.length;i<j;i++)if(m=n.material[i],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=o+"px",m.style.top=p+"px"}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var j,k,i,l,n,m,p,o;a=b.projectScene(c,d);j=0;for(k=a.length;j<k;j++)if(n=a[j],n instanceof THREE.RenderableParticle){p=n.x*e+e;o=n.y*f+f;i=0;for(l=n.material.length;i<l;i++)if(m=n.material[i],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=p+"px",m.style.top=o+"px"}}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};

+ 4 - 4
build/custom/ThreeExtras.js

@@ -93,7 +93,7 @@ this.cameraNY,e);e.activeCubeFace=4;a.render(b,this.cameraPZ,e);e.activeCubeFace
 THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,e,g,h,f){THREE.Camera.call(this);this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,h,f);this.cameraP=new THREE.PerspectiveCamera(b,a/c,e,g);this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
 THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.projectionMatrix=this.cameraP.projectionMatrix};THREE.CombinedCamera.prototype.toOrthographic=function(){this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix};THREE.CombinedCamera.prototype.setFov=function(a){this.cameraP.fov=a;this.cameraP.updateProjectionMatrix();this.toPerspective()};
 THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};
-THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.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));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
@@ -103,14 +103,14 @@ this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b)
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,e,c){var f={name:e,fps:0.6,length:c,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),p=g.length,y=0;h=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[h]={time:c,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)y=c*k.chunks[h]/k.total,b.keys[h]={time:y,pos:g[h]};f.hierarchy[0]=
 b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var e,c,f=new THREE.Geometry;for(e=0;e<a.points.length*b;e++)c=e/(a.points.length*b),c=a.getPoint(c),f.vertices[e]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;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,k=Math.PI/180;this.update=function(a){var e;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)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;e=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;e=THREE.Math.mapLinear(this.phi,e[0],e[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((e-a[0])/c)*c+a[0];e=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;e=THREE.Math.mapLinear(this.theta,e[0],e[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((e-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(f,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
 e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -154,7 +154,7 @@ THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THRE
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
 -a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
 l,a);b(h.faces[k].c,n,m,a);b(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.001;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
 for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,k/a.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
 f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,g(a,b),g(a,c),k),e(g(a,b),b,g(b,c),k),e(g(a,c),g(b,c),c,k),e(g(a,b),g(b,c),g(a,c),k))}function g(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===

+ 60 - 54
build/custom/ThreeSVG.js

@@ -16,73 +16,75 @@ b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},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},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),
 c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}for(var d,f=[],e=0,g=a.children.length;e<g;e++)Array.prototype.push.apply(f,this.intersectObject(a.children[e]));if(a instanceof THREE.Particle){e=b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.scale.x)return[];d={distance:e,point:a.position,face:null,object:a};f.push(d)}else if(a instanceof THREE.Mesh){e=
-b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;var h,i,n,k,j,o,l,q,r=a.geometry,v=r.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);e=0;for(g=r.faces.length;e<g;e++)if(d=r.faces[e],l=this.origin.clone(),q=this.direction.clone(),k=a.matrixWorld,h=k.multiplyVector3(d.centroid.clone()).subSelf(l),o=h.dot(q),!(o<=0)&&(h=k.multiplyVector3(v[d.a].position.clone()),i=k.multiplyVector3(v[d.b].position.clone()),
-n=k.multiplyVector3(v[d.c].position.clone()),k=d instanceof THREE.Face4?k.multiplyVector3(v[d.d].position.clone()):null,j=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),o=q.dot(j),a.doubleSided||(a.flipSided?o>0:o<0)))if(o=j.dot((new THREE.Vector3).sub(h,l))/o,l=l.addSelf(q.multiplyScalar(o)),d instanceof THREE.Face3)c(l,h,i,n)&&(d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(l,h,i,k)||c(l,i,n,k)))d={distance:this.origin.distanceTo(l),
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(e===null||e>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;var h,j,n,i,k,o,l,q,r=a.geometry,u=r.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);e=0;for(g=r.faces.length;e<g;e++)if(d=r.faces[e],l=this.origin.clone(),q=this.direction.clone(),i=a.matrixWorld,h=i.multiplyVector3(d.centroid.clone()).subSelf(l),o=h.dot(q),!(o<=0)&&(h=i.multiplyVector3(u[d.a].position.clone()),j=i.multiplyVector3(u[d.b].position.clone()),
+n=i.multiplyVector3(u[d.c].position.clone()),i=d instanceof THREE.Face4?i.multiplyVector3(u[d.d].position.clone()):null,k=a.matrixRotationWorld.multiplyVector3(d.normal.clone()),o=q.dot(k),a.doubleSided||(a.flipSided?o>0:o<0)))if(o=k.dot((new THREE.Vector3).sub(h,l))/o,l=l.addSelf(q.multiplyScalar(o)),d instanceof THREE.Face3)c(l,h,j,n)&&(d={distance:this.origin.distanceTo(l),point:l,face:d,object:a},f.push(d));else if(d instanceof THREE.Face4&&(c(l,h,j,i)||c(l,j,n,i)))d={distance:this.origin.distanceTo(l),
 point:l,face:d,object:a},f.push(d)}return f}};
-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,k,j){h=!1;b=e;c=g;d=k;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,k,j,o,l){h?(h=!1,b=e<k?e<o?e:o:k<o?k:o,c=g<j?g<l?g:l:j<l?j:l,d=e>k?e>o?e:o:k>o?k:o,f=g>j?g>l?g:l:j>l?j:l):(b=e<k?e<o?e<b?e:b:o<b?o:b:k<o?k<b?k:b:o<b?o:b,c=g<j?g<l?g<c?g:c:l<c?l:c:j<l?j<c?j:c:l<c?l:c,d=e>k?e>o?e>d?e:d:o>d?o:d:k>o?k>d?k:d:o>d?o:d,f=g>j?g>l?g>f?g:f:l>f?l:f:j>l?j>f?j:f:l>f?l: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.Matrix3=function(){this.m=[]};
+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,k){h=!1;b=e;c=g;d=i;f=k;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,k,o,l){h?(h=!1,b=e<i?e<o?e:o:i<o?i:o,c=g<k?g<l?g:l:k<l?k:l,d=e>i?e>o?e:o:i>o?i:o,f=g>k?g>l?g:l:k>l?k:l):(b=e<i?e<o?e<b?e:b:o<b?o:b:i<o?i<b?i:b:o<b?o:b,c=g<k?g<l?g<c?g:c:l<c?l:c:k<l?k<c?k:c:l<c?l:c,d=e>i?e>o?e>d?e:d:o>d?o:d:i>o?i>d?i:d:o>d?o:d,f=g>k?g>l?g>f?g:f:l>f?l:f:k>l?k>f?k:f:l>f?l: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,i,n,k,j,o,l,q,r){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,i||0,n||0,k!==void 0?k:1,j||0,o||0,l||0,q||0,r!==void 0?r: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,i,n,k,j,o,l,q,r){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=i;this.n32=n;this.n33=k;this.n34=j;this.n41=o;this.n42=l;this.n43=q;this.n44=r;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,i=a.n23,n=a.n24,k=a.n31,j=a.n32,o=a.n33,l=a.n34,q=a.n41,r=a.n42,v=a.n43,
-y=a.n44,w=b.n11,D=b.n12,t=b.n13,u=b.n14,G=b.n21,E=b.n22,L=b.n23,A=b.n24,F=b.n31,M=b.n32,B=b.n33,K=b.n34,H=b.n41,z=b.n42,I=b.n43,x=b.n44;this.n11=c*w+d*G+f*F+e*H;this.n12=c*D+d*E+f*M+e*z;this.n13=c*t+d*L+f*B+e*I;this.n14=c*u+d*A+f*K+e*x;this.n21=g*w+h*G+i*F+n*H;this.n22=g*D+h*E+i*M+n*z;this.n23=g*t+h*L+i*B+n*I;this.n24=g*u+h*A+i*K+n*x;this.n31=k*w+j*G+o*F+l*H;this.n32=k*D+j*E+o*M+l*z;this.n33=k*t+j*L+o*B+l*I;this.n34=k*u+j*A+o*K+l*x;this.n41=q*w+r*G+v*F+y*H;this.n42=q*D+r*E+v*M+y*z;this.n43=q*t+r*
-L+v*B+y*I;this.n44=q*u+r*A+v*K+y*x;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,f,e,g,h,j,n,i,k,o,l,q,r){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,j||0,n||0,i!==void 0?i:1,k||0,o||0,l||0,q||0,r!==void 0?r: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,j,n,i,k,o,l,q,r){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=j;this.n32=n;this.n33=i;this.n34=k;this.n41=o;this.n42=l;this.n43=q;this.n44=r;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,j=a.n23,n=a.n24,i=a.n31,k=a.n32,o=a.n33,l=a.n34,q=a.n41,r=a.n42,u=a.n43,
+K=a.n44,y=b.n11,I=b.n12,t=b.n13,v=b.n14,E=b.n21,A=b.n22,B=b.n23,G=b.n24,x=b.n31,H=b.n32,z=b.n33,L=b.n34,N=b.n41,M=b.n42,R=b.n43,T=b.n44;this.n11=c*y+d*E+f*x+e*N;this.n12=c*I+d*A+f*H+e*M;this.n13=c*t+d*B+f*z+e*R;this.n14=c*v+d*G+f*L+e*T;this.n21=g*y+h*E+j*x+n*N;this.n22=g*I+h*A+j*H+n*M;this.n23=g*t+h*B+j*z+n*R;this.n24=g*v+h*G+j*L+n*T;this.n31=i*y+k*E+o*x+l*N;this.n32=i*I+k*A+o*H+l*M;this.n33=i*t+k*B+o*z+l*R;this.n34=i*v+k*G+o*L+l*T;this.n41=q*y+r*E+u*x+K*N;this.n42=q*I+r*A+u*H+K*M;this.n43=q*t+r*
+B+u*z+K*R;this.n44=q*v+r*G+u*L+K*T;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,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,i=this.n31,n=this.n32,k=this.n33,j=this.n34,o=this.n41,l=this.n42,q=this.n43,r=this.n44;return d*g*n*o-c*h*n*o-d*e*k*o+b*h*k*o+c*e*j*o-b*g*j*o-d*g*i*l+c*h*i*l+d*f*k*l-a*h*k*l-c*f*j*l+a*g*j*l+d*e*i*q-b*h*i*q-d*f*n*q+a*h*n*q+b*f*j*q-a*e*j*q-c*e*i*r+b*g*i*r+c*f*n*r-a*g*n*r-b*f*k*r+a*e*k*r},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,f=this.n21,e=this.n22,g=this.n23,h=this.n24,j=this.n31,n=this.n32,i=this.n33,k=this.n34,o=this.n41,l=this.n42,q=this.n43,r=this.n44;return d*g*n*o-c*h*n*o-d*e*i*o+b*h*i*o+c*e*k*o-b*g*k*o-d*g*j*l+c*h*j*l+d*f*i*l-a*h*i*l-c*f*k*l+a*g*k*l+d*e*j*q-b*h*j*q-d*f*n*q+a*h*n*q+b*f*k*q-a*e*k*q-c*e*j*r+b*g*j*r+c*f*n*r-a*g*n*r-b*f*i*r+a*e*i*r},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,i=f*e,n=f*g;this.set(i*e+c,i*g-d*h,i*h+d*g,0,i*g+d*h,n*g+c,n*h-d*e,0,i*h-d*g,n*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,i=a.n24,n=a.n31,k=a.n32,j=a.n33,o=a.n34,l=a.n41,q=a.n42,r=a.n43,v=a.n44;this.n11=h*o*q-i*j*q+i*k*r-g*o*r-h*k*v+g*j*v;this.n12=f*j*q-d*o*q-f*k*r+c*o*r+d*k*v-c*j*v;this.n13=d*i*q-f*h*q+f*g*r-c*i*r-d*g*v+c*h*v;this.n14=f*h*k-d*i*k-f*g*j+c*i*j+d*g*o-c*h*o;this.n21=i*j*l-h*o*l-i*n*r+e*o*r+h*n*v-e*j*v;this.n22=d*o*l-f*j*l+
-f*n*r-b*o*r-d*n*v+b*j*v;this.n23=f*h*l-d*i*l-f*e*r+b*i*r+d*e*v-b*h*v;this.n24=d*i*n-f*h*n+f*e*j-b*i*j-d*e*o+b*h*o;this.n31=g*o*l-i*k*l+i*n*q-e*o*q-g*n*v+e*k*v;this.n32=f*k*l-c*o*l-f*n*q+b*o*q+c*n*v-b*k*v;this.n33=d*i*l-f*g*l+f*e*q-b*i*q-c*e*v+b*g*v;this.n34=f*g*n-c*i*n-f*e*k+b*i*k+c*e*o-b*g*o;this.n41=h*k*l-g*j*l-h*n*q+e*j*q+g*n*r-e*k*r;this.n42=c*j*l-d*k*l+d*n*q-b*j*q-c*n*r+b*k*r;this.n43=d*g*l-c*h*l-d*e*q+b*h*q+c*e*r-b*g*r;this.n44=c*h*n-d*g*n+d*e*k-b*h*k-c*e*j+b*g*j;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 i=g*h,n=g*f,k=d*h,j=d*f;this.n11=i+j*c;this.n12=k*c-n;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=n*c-k;this.n32=j+i*c;this.n33=e*g;break;case "ZXY":i=g*h;n=g*f;k=d*h;j=d*f;this.n11=i-j*c;this.n12=-e*f;this.n13=k+n*c;this.n21=n+k*c;this.n22=e*h;this.n23=j-i*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":i=
-e*h;n=e*f;k=c*h;j=c*f;this.n11=g*h;this.n12=k*d-n;this.n13=i*d+j;this.n21=g*f;this.n22=j*d+i;this.n23=n*d-k;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":i=e*g;n=e*d;k=c*g;j=c*d;this.n11=g*h;this.n12=j-i*f;this.n13=k*f+n;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=n*f+k;this.n33=i-j*f;break;case "XZY":i=e*g;n=e*d;k=c*g;j=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=i*f+j;this.n22=e*h;this.n23=n*f-k;this.n31=k*f-n;this.n32=c*h;this.n33=j*f+i;break;default:i=e*h,n=e*
-f,k=c*h,j=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=n+k*d,this.n22=i-j*d,this.n23=-c*g,this.n31=j-i*d,this.n32=k+n*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,i=b*g;b*=h;var n=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(n+d);this.n12=i-f;this.n13=b+g;this.n21=i+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+n);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+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,j=f*e,n=f*g;this.set(j*e+c,j*g-d*h,j*h+d*g,0,j*g+d*h,n*g+c,n*h-d*e,0,j*h-d*g,n*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,j=a.n24,n=a.n31,i=a.n32,k=a.n33,o=a.n34,l=a.n41,q=a.n42,r=a.n43,u=a.n44;this.n11=h*o*q-j*k*q+j*i*r-g*o*r-h*i*u+g*k*u;this.n12=f*k*q-d*o*q-f*i*r+c*o*r+d*i*u-c*k*u;this.n13=d*j*q-f*h*q+f*g*r-c*j*r-d*g*u+c*h*u;this.n14=f*h*i-d*j*i-f*g*k+c*j*k+d*g*o-c*h*o;this.n21=j*k*l-h*o*l-j*n*r+e*o*r+h*n*u-e*k*u;this.n22=d*o*l-f*k*l+
+f*n*r-b*o*r-d*n*u+b*k*u;this.n23=f*h*l-d*j*l-f*e*r+b*j*r+d*e*u-b*h*u;this.n24=d*j*n-f*h*n+f*e*k-b*j*k-d*e*o+b*h*o;this.n31=g*o*l-j*i*l+j*n*q-e*o*q-g*n*u+e*i*u;this.n32=f*i*l-c*o*l-f*n*q+b*o*q+c*n*u-b*i*u;this.n33=d*j*l-f*g*l+f*e*q-b*j*q-c*e*u+b*g*u;this.n34=f*g*n-c*j*n-f*e*i+b*j*i+c*e*o-b*g*o;this.n41=h*i*l-g*k*l-h*n*q+e*k*q+g*n*r-e*i*r;this.n42=c*k*l-d*i*l+d*n*q-b*k*q-c*n*r+b*i*r;this.n43=d*g*l-c*h*l-d*e*q+b*h*q+c*e*r-b*g*r;this.n44=c*h*n-d*g*n+d*e*i-b*h*i-c*e*k+b*g*k;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 j=g*h,n=g*f,i=d*h,k=d*f;this.n11=j+k*c;this.n12=i*c-n;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=n*c-i;this.n32=k+j*c;this.n33=e*g;break;case "ZXY":j=g*h;n=g*f;i=d*h;k=d*f;this.n11=j-k*c;this.n12=-e*f;this.n13=i+n*c;this.n21=n+i*c;this.n22=e*h;this.n23=k-j*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":j=
+e*h;n=e*f;i=c*h;k=c*f;this.n11=g*h;this.n12=i*d-n;this.n13=j*d+k;this.n21=g*f;this.n22=k*d+j;this.n23=n*d-i;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":j=e*g;n=e*d;i=c*g;k=c*d;this.n11=g*h;this.n12=k-j*f;this.n13=i*f+n;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=n*f+i;this.n33=j-k*f;break;case "XZY":j=e*g;n=e*d;i=c*g;k=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=j*f+k;this.n22=e*h;this.n23=n*f-i;this.n31=i*f-n;this.n32=c*h;this.n33=k*f+j;break;default:j=e*h,n=e*
+f,i=c*h,k=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=n+i*d,this.n22=j-k*d,this.n23=-c*g,this.n31=k-j*d,this.n32=i+n*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,j=b*g;b*=h;var n=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(n+d);this.n12=j-f;this.n13=b+g;this.n21=j+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+n);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);e.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=e.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,e=a.n32*a.n21-a.n31*a.n22,g=-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,n=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*n;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*i;c[6]=a*n;c[7]=a*k;c[8]=a*j;return b};
+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,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*n;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*j;c[6]=a*n;c[7]=a*i;c[8]=a*k;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};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,e){var g,h,i,n;g=new THREE.Matrix4;h=b-a;i=c-d;n=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/i;g.n23=0;g.n24=-((c+d)/i);g.n31=0;g.n32=0;g.n33=-2/n;g.n34=-((e+f)/n);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,j,n;g=new THREE.Matrix4;h=b-a;j=c-d;n=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/j;g.n23=0;g.n24=-((c+d)/j);g.n31=0;g.n32=0;g.n33=-2/n;g.n34=-((e+f)/n);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;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&&
 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=e[f]=e[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(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 d,f,e=[],g,h,i=[],n,k=[],j,o,l=[],q,r,v=[],y={objects:[],sprites:[],lights:[],elements:[]};
-new THREE.Vector3;var w=new THREE.Vector4,D=new THREE.Matrix4,t=new THREE.Matrix4,u=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,E=new THREE.Vector4;this.computeFrustum=function(a){u[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);u[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);u[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);u[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);u[4].set(a.n41-
-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);u[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=u[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(a){y.objects.length=0;y.sprites.length=0;y.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,e=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),f=0;f<6;f++)if(c=
-u[f].x*d.n14+u[f].y*d.n24+u[f].z*d.n34+u[f].w,c<=e){c=!1;break a}c=!0}c?y.objects.push(a):a instanceof THREE.Line?y.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?y.sprites.push(a):a instanceof THREE.Light&&y.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return y};this.projectScene=function(u,A,F){var M=A.near,B=A.far,K,H,z,I,x,C,J,s,p,N,O,R,P,S,T,Q;r=o=n=h=0;y.elements.length=0;A.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
-u.add(A));u.updateMatrixWorld();A.matrixWorldInverse.getInverse(A.matrixWorld);D.multiply(A.projectionMatrix,A.matrixWorldInverse);this.computeFrustum(D);y=this.projectGraph(u);u=0;for(K=y.objects.length;u<K;u++)if(p=y.objects[u],N=p.matrixWorld,R=p.material,f=0,p instanceof THREE.Mesh){O=p.geometry;P=p.geometry.materials;I=O.vertices;S=O.faces;T=O.faceVertexUvs;O=p.matrixRotationWorld.extractRotation(N);H=0;for(z=I.length;H<z;H++)d=a(),d.positionWorld.copy(I[H].position),N.multiplyVector3(d.positionWorld),
-d.positionScreen.copy(d.positionWorld),D.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>M&&d.positionScreen.z<B;I=0;for(H=S.length;I<H;I++){z=S[I];if(z instanceof THREE.Face3)if(x=e[z.a],C=e[z.b],J=e[z.c],x.visible&&C.visible&&J.visible&&(p.doubleSided||p.flipSided!=(J.positionScreen.x-x.positionScreen.x)*(C.positionScreen.y-x.positionScreen.y)-(J.positionScreen.y-x.positionScreen.y)*(C.positionScreen.x-
-x.positionScreen.x)<0))s=i[h]=i[h]||new THREE.RenderableFace3,h++,g=s,g.v1.copy(x),g.v2.copy(C),g.v3.copy(J);else continue;else if(z instanceof THREE.Face4)if(x=e[z.a],C=e[z.b],J=e[z.c],s=e[z.d],x.visible&&C.visible&&J.visible&&s.visible&&(p.doubleSided||p.flipSided!=((s.positionScreen.x-x.positionScreen.x)*(C.positionScreen.y-x.positionScreen.y)-(s.positionScreen.y-x.positionScreen.y)*(C.positionScreen.x-x.positionScreen.x)<0||(C.positionScreen.x-J.positionScreen.x)*(s.positionScreen.y-J.positionScreen.y)-
-(C.positionScreen.y-J.positionScreen.y)*(s.positionScreen.x-J.positionScreen.x)<0)))Q=k[n]=k[n]||new THREE.RenderableFace4,n++,g=Q,g.v1.copy(x),g.v2.copy(C),g.v3.copy(J),g.v4.copy(s);else continue;g.normalWorld.copy(z.normal);O.multiplyVector3(g.normalWorld);g.centroidWorld.copy(z.centroid);N.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);D.multiplyVector3(g.centroidScreen);J=z.vertexNormals;x=0;for(C=J.length;x<C;x++)s=g.vertexNormalsWorld[x],s.copy(J[x]),O.multiplyVector3(s);
-x=0;for(C=T.length;x<C;x++)if(Q=T[x][I]){J=0;for(s=Q.length;J<s;J++)g.uvs[x][J]=Q[J]}g.material=R;g.faceMaterial=z.materialIndex!==null?P[z.materialIndex]:null;g.z=g.centroidScreen.z;y.elements.push(g)}}else if(p instanceof THREE.Line){t.multiply(D,N);I=p.geometry.vertices;x=a();x.positionScreen.copy(I[0].position);t.multiplyVector4(x.positionScreen);H=1;for(z=I.length;H<z;H++)if(x=a(),x.positionScreen.copy(I[H].position),t.multiplyVector4(x.positionScreen),C=e[f-2],G.copy(x.positionScreen),E.copy(C.positionScreen),
-c(G,E))G.multiplyScalar(1/G.w),E.multiplyScalar(1/E.w),p=l[o]=l[o]||new THREE.RenderableLine,o++,j=p,j.v1.positionScreen.copy(G),j.v2.positionScreen.copy(E),j.z=Math.max(G.z,E.z),j.material=R,y.elements.push(j)}u=0;for(K=y.sprites.length;u<K;u++)if(p=y.sprites[u],N=p.matrixWorld,p instanceof THREE.Particle&&(w.set(N.n14,N.n24,N.n34,1),D.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1))M=v[r]=v[r]||new THREE.RenderableParticle,r++,q=M,q.x=w.x/w.w,q.y=w.y/w.w,q.z=w.z,q.rotation=p.rotation.z,q.scale.x=p.scale.x*
-Math.abs(q.x-(w.x+A.projectionMatrix.n11)/(w.w+A.projectionMatrix.n14)),q.scale.y=p.scale.y*Math.abs(q.y-(w.y+A.projectionMatrix.n22)/(w.w+A.projectionMatrix.n24)),q.material=p.material,y.elements.push(q);F&&y.elements.sort(b);return y}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=n[j]=n[j]||new THREE.RenderableVertex;j++;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,j,n=[],
+i,k,o=[],l,q=[],r,u,K=[],y,I,t=[],v={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,A=new THREE.Vector4,B=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,z=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);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.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){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?(B.multiplyVector3(E.copy(b.position)),f=a(),f.object=b,f.z=E.z,v.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(B.multiplyVector3(E.copy(b.position)),f=a(),f.object=b,f.z=E.z,v.sprites.push(f)):b instanceof THREE.Light&&v.lights.push(b);c=0;for(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,x=e.far,E,O,s,p,w,C,D,J,F,P,Q,U,X,V,W,S;I=u=l=k=0;v.elements.length=0;e.parent==null&&(console.warn("DEPRECATED: Camera hasn't been added to the Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(B);v=this.projectGraph(a,!1);a=0;for(E=v.objects.length;a<E;a++)if(F=v.objects[a].object,P=F.matrixWorld,U=F.material,
+j=0,F instanceof THREE.Mesh){Q=F.geometry;X=F.geometry.materials;p=Q.vertices;V=Q.faces;W=Q.faceVertexUvs;Q=F.matrixRotationWorld.extractRotation(P);O=0;for(s=p.length;O<s;O++)h=b(),h.positionWorld.copy(p[O].position),P.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),B.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;p=0;for(O=V.length;p<O;p++){s=V[p];if(s instanceof
+THREE.Face3)if(w=n[s.a],C=n[s.b],D=n[s.c],w.visible&&C.visible&&D.visible&&(F.doubleSided||F.flipSided!=(D.positionScreen.x-w.positionScreen.x)*(C.positionScreen.y-w.positionScreen.y)-(D.positionScreen.y-w.positionScreen.y)*(C.positionScreen.x-w.positionScreen.x)<0))J=o[k]=o[k]||new THREE.RenderableFace3,k++,i=J,i.v1.copy(w),i.v2.copy(C),i.v3.copy(D);else continue;else if(s instanceof THREE.Face4)if(w=n[s.a],C=n[s.b],D=n[s.c],J=n[s.d],w.visible&&C.visible&&D.visible&&J.visible&&(F.doubleSided||F.flipSided!=
+((J.positionScreen.x-w.positionScreen.x)*(C.positionScreen.y-w.positionScreen.y)-(J.positionScreen.y-w.positionScreen.y)*(C.positionScreen.x-w.positionScreen.x)<0||(C.positionScreen.x-D.positionScreen.x)*(J.positionScreen.y-D.positionScreen.y)-(C.positionScreen.y-D.positionScreen.y)*(J.positionScreen.x-D.positionScreen.x)<0)))S=q[l]=q[l]||new THREE.RenderableFace4,l++,i=S,i.v1.copy(w),i.v2.copy(C),i.v3.copy(D),i.v4.copy(J);else continue;i.normalWorld.copy(s.normal);Q.multiplyVector3(i.normalWorld);
+i.centroidWorld.copy(s.centroid);P.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);B.multiplyVector3(i.centroidScreen);D=s.vertexNormals;w=0;for(C=D.length;w<C;w++)J=i.vertexNormalsWorld[w],J.copy(D[w]),Q.multiplyVector3(J);w=0;for(C=W.length;w<C;w++)if(S=W[w][p]){D=0;for(J=S.length;D<J;D++)i.uvs[w][D]=S[D]}i.material=U;i.faceMaterial=s.materialIndex!==null?X[s.materialIndex]:null;i.z=i.centroidScreen.z;v.elements.push(i)}}else if(F instanceof THREE.Line){G.multiply(B,P);p=
+F.geometry.vertices;w=b();w.positionScreen.copy(p[0].position);G.multiplyVector4(w.positionScreen);O=1;for(s=p.length;O<s;O++)if(w=b(),w.positionScreen.copy(p[O].position),G.multiplyVector4(w.positionScreen),C=n[j-2],H.copy(w.positionScreen),z.copy(C.positionScreen),d(H,z))H.multiplyScalar(1/H.w),z.multiplyScalar(1/z.w),F=K[u]=K[u]||new THREE.RenderableLine,u++,r=F,r.v1.positionScreen.copy(H),r.v2.positionScreen.copy(z),r.z=Math.max(H.z,z.z),r.material=U,v.elements.push(r)}a=0;for(E=v.sprites.length;a<
+E;a++)if(F=v.sprites[a].object,P=F.matrixWorld,F instanceof THREE.Particle&&(A.set(P.n14,P.n24,P.n34,1),B.multiplyVector4(A),A.z/=A.w,A.z>0&&A.z<1))g=t[I]=t[I]||new THREE.RenderableParticle,I++,y=g,y.x=A.x/A.w,y.y=A.y/A.w,y.z=A.z,y.rotation=F.rotation.z,y.scale.x=F.scale.x*Math.abs(y.x-(A.x+e.projectionMatrix.n11)/(A.w+e.projectionMatrix.n14)),y.scale.y=F.scale.y*Math.abs(y.y-(A.y+e.projectionMatrix.n22)/(A.w+e.projectionMatrix.n24)),y.material=F.material,v.elements.push(y);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=
-this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-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,f=a.z,e=this.x,g=this.y,h=this.z,i=this.w,n=i*c+g*f-h*d,k=i*d+h*c-e*f,j=i*f+e*d-g*c,c=-e*
-c-g*d-h*f;b.x=n*i+c*-e+k*-h-j*-g;b.y=k*i+c*-g+j*-e-n*-h;b.z=j*i+c*-h+n*-g-k*-e;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 e=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)*e)/f;d=Math.sin(d*e)/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};
+this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-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,f=a.z,e=this.x,g=this.y,h=this.z,j=this.w,n=j*c+g*f-h*d,i=j*d+h*c-e*f,k=j*f+e*d-g*c,c=-e*
+c-g*d-h*f;b.x=n*j+c*-e+i*-h-k*-g;b.y=i*j+c*-g+k*-e-n*-h;b.z=k*j+c*-h+n*-g-i*-e;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 e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)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)*e)/f;d=Math.sin(d*e)/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,e){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=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){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=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.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 e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,d,f,e,g,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),i.sub(b.position,c.position),h.crossSelf(i);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
+c,d,f,e,g,h=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),j.sub(b.position,c.position),h.crossSelf(j);h.isZero()||h.normalize();e.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,e,f,I){h=a.vertices[b].position;i=a.vertices[c].position;n=a.vertices[d].position;k=g[e];j=g[f];o=g[I];l=i.x-h.x;q=n.x-h.x;r=i.y-h.y;v=n.y-h.y;y=i.z-h.z;w=n.z-h.z;D=j.u-k.u;t=o.u-k.u;u=j.v-k.v;G=o.v-k.v;E=1/(D*G-t*u);M.set((G*l-u*q)*E,(G*r-u*v)*E,(G*y-u*w)*E);B.set((D*q-t*l)*E,(D*v-t*r)*E,(D*w-t*y)*E);A[b].addSelf(M);A[c].addSelf(M);A[d].addSelf(M);F[b].addSelf(B);
-F[c].addSelf(B);F[d].addSelf(B)}var b,c,d,f,e,g,h,i,n,k,j,o,l,q,r,v,y,w,D,t,u,G,E,L,A=[],F=[],M=new THREE.Vector3,B=new THREE.Vector3,K=new THREE.Vector3,H=new THREE.Vector3,z=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)A[b]=new THREE.Vector3,F[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++)z.copy(e.vertexNormals[d]),f=e[I[d]],L=A[f],K.copy(L),K.subSelf(z.multiplyScalar(z.dot(L))).normalize(),H.cross(e.vertexNormals[d],L),f=H.dot(F[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,
+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,C){h=a.vertices[b].position;j=a.vertices[c].position;n=a.vertices[d].position;i=g[e];k=g[f];o=g[C];l=j.x-h.x;q=n.x-h.x;r=j.y-h.y;u=n.y-h.y;K=j.z-h.z;y=n.z-h.z;I=k.u-i.u;t=o.u-i.u;v=k.v-i.v;E=o.v-i.v;A=1/(I*E-t*v);H.set((E*l-v*q)*A,(E*r-v*u)*A,(E*K-v*y)*A);z.set((I*q-t*l)*A,(I*u-t*r)*A,(I*y-t*K)*A);G[b].addSelf(H);G[c].addSelf(H);G[d].addSelf(H);x[b].addSelf(z);
+x[c].addSelf(z);x[d].addSelf(z)}var b,c,d,f,e,g,h,j,n,i,k,o,l,q,r,u,K,y,I,t,v,E,A,B,G=[],x=[],H=new THREE.Vector3,z=new THREE.Vector3,L=new THREE.Vector3,N=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 R=["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[R[d]],B=G[f],L.copy(B),L.subSelf(M.multiplyScalar(M.dot(B))).normalize(),N.cross(e.vertexNormals[d],B),f=N.dot(x[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;
@@ -109,27 +111,31 @@ a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.
 THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};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};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
 THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
 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.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip};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("DEPRECATE: Material array is no longer supported. Using material 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.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;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.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:
+!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
+THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
+THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
 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(A.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){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),z==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[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,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,k,j,o,l,q,r,v,y=new THREE.Rectangle,w=new THREE.Rectangle,D=!1,t=new THREE.Color,u=new THREE.Color,G=new THREE.Color,E=new THREE.Color,L,A=new THREE.Vector3,F=[],M=[],B,K,H,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){n=a;k=b;j=n/2;o=k/2;i.setAttribute("viewBox",-j+" "+-o+" "+n+" "+k);i.setAttribute("width",n);i.setAttribute("height",k);y.set(-j,-o,j,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,n){var C,A,s,p;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(k,n,this.sortElements);e=f.elements;
-g=f.lights;H=K=0;if(D=g.length>0){u.setRGB(0,0,0);G.setRGB(0,0,0);E.setRGB(0,0,0);C=0;for(A=g.length;C<A;C++)p=g[C],s=p.color,p instanceof THREE.AmbientLight?(u.r+=s.r,u.g+=s.g,u.b+=s.b):p instanceof THREE.DirectionalLight?(G.r+=s.r,G.g+=s.g,G.b+=s.b):p instanceof THREE.PointLight&&(E.r+=s.r,E.g+=s.g,E.b+=s.b)}C=0;for(A=e.length;C<A;C++)if(s=e[C],p=s.material,p=p instanceof THREE.MeshFaceMaterial?s.faceMaterial:p,!(p==null||p.opacity==0))if(w.empty(),s instanceof THREE.RenderableParticle)l=s,l.x*=
-j,l.y*=-o,m=0,ml=s.materials.length;else if(s instanceof THREE.RenderableLine){if(l=s.v1,q=s.v2,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=j,q.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),y.intersects(w)){s=l;var N=q,O=H++;M[O]==null&&(M[O]=document.createElementNS("http://www.w3.org/2000/svg","line"),z==0&&M[O].setAttribute("shape-rendering","crispEdges"));B=M[O];B.setAttribute("x1",s.positionScreen.x);
-B.setAttribute("y1",s.positionScreen.y);B.setAttribute("x2",N.positionScreen.x);B.setAttribute("y2",N.positionScreen.y);p instanceof THREE.LineBasicMaterial&&(B.setAttribute("style","fill: none; stroke: "+p.color.getContextStyle()+"; stroke-width: "+p.linewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.linecap+"; stroke-linejoin: "+p.linejoin),i.appendChild(B))}}else if(s instanceof THREE.RenderableFace3){if(l=s.v1,q=s.v2,r=s.v3,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=
-j,q.positionScreen.y*=-o,r.positionScreen.x*=j,r.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),w.addPoint(r.positionScreen.x,r.positionScreen.y),y.intersects(w)){var N=l,O=q,F=r;d.info.render.vertices+=3;d.info.render.faces++;B=b(K++);B.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+O.positionScreen.x+" "+O.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?
-t.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(t.r=u.r,t.g=u.g,t.b=u.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1))):t.copy(p.color):p instanceof THREE.MeshDepthMaterial?(L=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear),t.setRGB(L,L,L)):p instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),c(s.normalWorld.y),c(s.normalWorld.z));p.wireframe?B.setAttribute("style",
-"fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):B.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+p.opacity);i.appendChild(B)}}else if(s instanceof THREE.RenderableFace4&&(l=s.v1,q=s.v2,r=s.v3,v=s.v4,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=j,q.positionScreen.y*=-o,r.positionScreen.x*=j,r.positionScreen.y*=
--o,v.positionScreen.x*=j,v.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),w.addPoint(r.positionScreen.x,r.positionScreen.y),w.addPoint(v.positionScreen.x,v.positionScreen.y),y.intersects(w))){var N=l,O=q,F=r,P=v;d.info.render.vertices+=4;d.info.render.faces++;B=b(K++);B.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+O.positionScreen.x+" "+O.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+
-" L "+P.positionScreen.x+","+P.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?t.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(t.r=u.r,t.g=u.g,t.b=u.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1))):t.copy(p.color):p instanceof THREE.MeshDepthMaterial?(L=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear),t.setRGB(L,L,L)):p instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),
-c(s.normalWorld.y),c(s.normalWorld.z));p.wireframe?B.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):B.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+p.opacity);i.appendChild(B)}}};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,i,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(G.sub(i,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}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,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,i,k,o,l,q,r,u,K=new THREE.Rectangle,y=new THREE.Rectangle,I=!1,t=new THREE.Color,v=new THREE.Color,E=new THREE.Color,A=new THREE.Color,B,G=new THREE.Vector3,x=[],H=[],z,L,N,M=1;this.domElement=j;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){n=a;i=b;k=n/2;o=i/2;j.setAttribute("viewBox",-k+" "+-o+" "+n+" "+i);j.setAttribute("width",n);j.setAttribute("height",i);K.set(-k,-o,k,o)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(i,n){var x,G,s,p;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(i,n,this.sortElements);e=f.elements;
+g=f.lights;N=L=0;if(I=g.length>0){v.setRGB(0,0,0);E.setRGB(0,0,0);A.setRGB(0,0,0);x=0;for(G=g.length;x<G;x++)p=g[x],s=p.color,p instanceof THREE.AmbientLight?(v.r+=s.r,v.g+=s.g,v.b+=s.b):p instanceof THREE.DirectionalLight?(E.r+=s.r,E.g+=s.g,E.b+=s.b):p instanceof THREE.PointLight&&(A.r+=s.r,A.g+=s.g,A.b+=s.b)}x=0;for(G=e.length;x<G;x++)if(s=e[x],p=s.material,p=p instanceof THREE.MeshFaceMaterial?s.faceMaterial:p,!(p==null||p.opacity==0))if(y.empty(),s instanceof THREE.RenderableParticle)l=s,l.x*=
+k,l.y*=-o,m=0,ml=s.materials.length;else if(s instanceof THREE.RenderableLine){if(l=s.v1,q=s.v2,l.positionScreen.x*=k,l.positionScreen.y*=-o,q.positionScreen.x*=k,q.positionScreen.y*=-o,y.addPoint(l.positionScreen.x,l.positionScreen.y),y.addPoint(q.positionScreen.x,q.positionScreen.y),K.intersects(y)){s=l;var w=q,C=N++;H[C]==null&&(H[C]=document.createElementNS("http://www.w3.org/2000/svg","line"),M==0&&H[C].setAttribute("shape-rendering","crispEdges"));z=H[C];z.setAttribute("x1",s.positionScreen.x);
+z.setAttribute("y1",s.positionScreen.y);z.setAttribute("x2",w.positionScreen.x);z.setAttribute("y2",w.positionScreen.y);p instanceof THREE.LineBasicMaterial&&(z.setAttribute("style","fill: none; stroke: "+p.color.getContextStyle()+"; stroke-width: "+p.linewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.linecap+"; stroke-linejoin: "+p.linejoin),j.appendChild(z))}}else if(s instanceof THREE.RenderableFace3){if(l=s.v1,q=s.v2,r=s.v3,l.positionScreen.x*=k,l.positionScreen.y*=-o,q.positionScreen.x*=
+k,q.positionScreen.y*=-o,r.positionScreen.x*=k,r.positionScreen.y*=-o,y.addPoint(l.positionScreen.x,l.positionScreen.y),y.addPoint(q.positionScreen.x,q.positionScreen.y),y.addPoint(r.positionScreen.x,r.positionScreen.y),K.intersects(y)){var w=l,C=q,D=r;d.info.render.vertices+=3;d.info.render.faces++;z=b(L++);z.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?
+t.copy(p.color):p instanceof THREE.MeshLambertMaterial?I?(t.r=v.r,t.g=v.g,t.b=v.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1))):t.copy(p.color):p instanceof THREE.MeshDepthMaterial?(B=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear),t.setRGB(B,B,B)):p instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),c(s.normalWorld.y),c(s.normalWorld.z));p.wireframe?z.setAttribute("style",
+"fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):z.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+p.opacity);j.appendChild(z)}}else if(s instanceof THREE.RenderableFace4&&(l=s.v1,q=s.v2,r=s.v3,u=s.v4,l.positionScreen.x*=k,l.positionScreen.y*=-o,q.positionScreen.x*=k,q.positionScreen.y*=-o,r.positionScreen.x*=k,r.positionScreen.y*=
+-o,u.positionScreen.x*=k,u.positionScreen.y*=-o,y.addPoint(l.positionScreen.x,l.positionScreen.y),y.addPoint(q.positionScreen.x,q.positionScreen.y),y.addPoint(r.positionScreen.x,r.positionScreen.y),y.addPoint(u.positionScreen.x,u.positionScreen.y),K.intersects(y))){var w=l,C=q,D=r,J=u;d.info.render.vertices+=4;d.info.render.faces++;z=b(L++);z.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+
+" L "+J.positionScreen.x+","+J.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?t.copy(p.color):p instanceof THREE.MeshLambertMaterial?I?(t.r=v.r,t.g=v.g,t.b=v.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1))):t.copy(p.color):p instanceof THREE.MeshDepthMaterial?(B=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear),t.setRGB(B,B,B)):p instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),
+c(s.normalWorld.y),c(s.normalWorld.z));p.wireframe?z.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):z.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+p.opacity);j.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.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};

+ 161 - 159
build/custom/ThreeWebGL.js

@@ -16,80 +16,82 @@ b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function c(a,b,c,e){var e=e.clone().subSelf(b),
 c=c.clone().subSelf(b),f=a.clone().subSelf(b),a=e.dot(e),b=e.dot(c),e=e.dot(f),h=c.dot(c),c=c.dot(f),f=1/(a*h-b*b),h=(h*e-b*c)*f,a=(a*c-b*e)*f;return h>0&&a>0&&h+a<1}for(var e,f=[],h=0,i=a.children.length;h<i;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=
-b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;var j,n,l,o,k,r,v,z,B=a.geometry,F=B.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);h=0;for(i=B.faces.length;h<i;h++)if(e=B.faces[h],v=this.origin.clone(),z=this.direction.clone(),o=a.matrixWorld,j=o.multiplyVector3(e.centroid.clone()).subSelf(v),r=j.dot(z),!(r<=0)&&(j=o.multiplyVector3(F[e.a].position.clone()),n=o.multiplyVector3(F[e.b].position.clone()),
-l=o.multiplyVector3(F[e.c].position.clone()),o=e instanceof THREE.Face4?o.multiplyVector3(F[e.d].position.clone()):null,k=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),r=z.dot(k),a.doubleSided||(a.flipSided?r>0:r<0)))if(r=k.dot((new THREE.Vector3).sub(j,v))/r,v=v.addSelf(z.multiplyScalar(r)),e instanceof THREE.Face3)c(v,j,n,l)&&(e={distance:this.origin.distanceTo(v),point:v,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(v,j,n,o)||c(v,n,l,o)))e={distance:this.origin.distanceTo(v),
-point:v,face:e,object:a},f.push(e)}return f}};
-THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,i,o,k){j=!1;b=h;c=i;e=o;f=k;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=b<h?b:h,c=c<i?c:i,e=e>h?e:h,f=f>i?f:i);a()};this.add3Points=
-function(h,i,o,k,r,v){j?(j=!1,b=h<o?h<r?h:r:o<r?o:r,c=i<k?i<v?i:v:k<v?k:v,e=h>o?h>r?h:r:o>r?o:r,f=i>k?i>v?i:v:k>v?k:v):(b=h<o?h<r?h<b?h:b:r<b?r:b:o<r?o<b?o:b:r<b?r:b,c=i<k?i<v?i<c?i:c:v<c?v:c:k<v?k<c?k:c:v<c?v:c,e=h>o?h>r?h>e?h:e:r>e?r:e:o>r?o>e?o:e:r>e?r:e,f=i>k?i>v?i>f?i:f:v>f?v:f:k>v?k>f?k:f:v>f?v:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=b<h.getLeft()?b:h.getLeft(),c=c<h.getTop()?c:h.getTop(),e=e>h.getRight()?e:h.getRight(),f=f>
-h.getBottom()?f:h.getBottom());a()};this.inflate=function(h){b-=h;c-=h;e+=h;f+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();f=f<h.getBottom()?f:h.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){j=!0;f=e=c=b=0;a()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;var j,l,m,k,o,v,q,B,A=a.geometry,G=A.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);h=0;for(i=A.faces.length;h<i;h++)if(e=A.faces[h],q=this.origin.clone(),B=this.direction.clone(),k=a.matrixWorld,j=k.multiplyVector3(e.centroid.clone()).subSelf(q),v=j.dot(B),!(v<=0)&&(j=k.multiplyVector3(G[e.a].position.clone()),l=k.multiplyVector3(G[e.b].position.clone()),
+m=k.multiplyVector3(G[e.c].position.clone()),k=e instanceof THREE.Face4?k.multiplyVector3(G[e.d].position.clone()):null,o=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),v=B.dot(o),a.doubleSided||(a.flipSided?v>0:v<0)))if(v=o.dot((new THREE.Vector3).sub(j,q))/v,q=q.addSelf(B.multiplyScalar(v)),e instanceof THREE.Face3)c(q,j,l,m)&&(e={distance:this.origin.distanceTo(q),point:q,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(q,j,l,k)||c(q,l,m,k)))e={distance:this.origin.distanceTo(q),
+point:q,face:e,object:a},f.push(e)}return f}};
+THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,i,k,o){j=!1;b=h;c=i;e=k;f=o;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=b<h?b:h,c=c<i?c:i,e=e>h?e:h,f=f>i?f:i);a()};this.add3Points=
+function(h,i,k,o,v,q){j?(j=!1,b=h<k?h<v?h:v:k<v?k:v,c=i<o?i<q?i:q:o<q?o:q,e=h>k?h>v?h:v:k>v?k:v,f=i>o?i>q?i:q:o>q?o:q):(b=h<k?h<v?h<b?h:b:v<b?v:b:k<v?k<b?k:b:v<b?v:b,c=i<o?i<q?i<c?i:c:q<c?q:c:o<q?o<c?o:c:q<c?q:c,e=h>k?h>v?h>e?h:e:v>e?v:e:k>v?k>e?k:e:v>e?v:e,f=i>o?i>q?i>f?i:f:q>f?q:f:o>q?o>f?o:f:q>f?q:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=b<h.getLeft()?b:h.getLeft(),c=c<h.getTop()?c:h.getTop(),e=e>h.getRight()?e:h.getRight(),f=f>
+h.getBottom()?f:h.getBottom());a()};this.inflate=function(h){b-=h;c-=h;e+=h;f+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();f=f<h.getBottom()?f:h.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){j=!0;f=e=c=b=0;a()};this.isEmpty=function(){return j}};
+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,e,f){return e+(a-b)*(f-e)/(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,e,f,h,i,j,n,l,o,k,r,v,z,B){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,i||0,j||0,n||0,l||0,o!==void 0?o:1,k||0,r||0,v||0,z||0,B!==void 0?B:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,i,j,n,l,o,k,r,v,z,B){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=j;this.n31=n;this.n32=l;this.n33=o;this.n34=k;this.n41=r;this.n42=v;this.n43=z;this.n44=B;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 e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,n=a.n23,l=a.n24,o=a.n31,k=a.n32,r=a.n33,v=a.n34,z=a.n41,B=a.n42,F=a.n43,
-E=a.n44,fa=b.n11,ia=b.n12,ra=b.n13,O=b.n14,I=b.n21,T=b.n22,ta=b.n23,U=b.n24,ma=b.n31,pa=b.n32,X=b.n33,R=b.n34,K=b.n41,A=b.n42,d=b.n43,C=b.n44;this.n11=c*fa+e*I+f*ma+h*K;this.n12=c*ia+e*T+f*pa+h*A;this.n13=c*ra+e*ta+f*X+h*d;this.n14=c*O+e*U+f*R+h*C;this.n21=i*fa+j*I+n*ma+l*K;this.n22=i*ia+j*T+n*pa+l*A;this.n23=i*ra+j*ta+n*X+l*d;this.n24=i*O+j*U+n*R+l*C;this.n31=o*fa+k*I+r*ma+v*K;this.n32=o*ia+k*T+r*pa+v*A;this.n33=o*ra+k*ta+r*X+v*d;this.n34=o*O+k*U+r*R+v*C;this.n41=z*fa+B*I+F*ma+E*K;this.n42=z*ia+
-B*T+F*pa+E*A;this.n43=z*ra+B*ta+F*X+E*d;this.n44=z*O+B*U+F*R+E*C;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,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*
+THREE.Matrix4=function(a,b,c,e,f,h,i,j,l,m,k,o,v,q,B,A){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,i||0,j||0,l||0,m||0,k!==void 0?k:1,o||0,v||0,q||0,B||0,A!==void 0?A:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,i,j,l,m,k,o,v,q,B,A){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=j;this.n31=l;this.n32=m;this.n33=k;this.n34=o;this.n41=v;this.n42=q;this.n43=B;this.n44=A;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 e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,l=a.n23,m=a.n24,k=a.n31,o=a.n32,v=a.n33,q=a.n34,B=a.n41,A=a.n42,G=a.n43,
+Z=a.n44,ma=b.n11,sa=b.n12,va=b.n13,R=b.n14,N=b.n21,E=b.n22,O=b.n23,qa=b.n24,C=b.n31,ja=b.n32,aa=b.n33,wa=b.n34,P=b.n41,F=b.n42,d=b.n43,xa=b.n44;this.n11=c*ma+e*N+f*C+h*P;this.n12=c*sa+e*E+f*ja+h*F;this.n13=c*va+e*O+f*aa+h*d;this.n14=c*R+e*qa+f*wa+h*xa;this.n21=i*ma+j*N+l*C+m*P;this.n22=i*sa+j*E+l*ja+m*F;this.n23=i*va+j*O+l*aa+m*d;this.n24=i*R+j*qa+l*wa+m*xa;this.n31=k*ma+o*N+v*C+q*P;this.n32=k*sa+o*E+v*ja+q*F;this.n33=k*va+o*O+v*aa+q*d;this.n34=k*R+o*qa+v*wa+q*xa;this.n41=B*ma+A*N+G*C+Z*P;this.n42=
+B*sa+A*E+G*ja+Z*F;this.n43=B*va+A*O+G*aa+Z*d;this.n44=B*R+A*qa+G*wa+Z*xa;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,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*
 e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*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,e=this.n14,f=this.n21,h=this.n22,i=this.n23,j=this.n24,n=this.n31,l=this.n32,o=this.n33,k=this.n34,r=this.n41,v=this.n42,z=this.n43,B=this.n44;return e*i*l*r-c*j*l*r-e*h*o*r+b*j*o*r+c*h*k*r-b*i*k*r-e*i*n*v+c*j*n*v+e*f*o*v-a*j*o*v-c*f*k*v+a*i*k*v+e*h*n*z-b*j*n*z-e*f*l*z+a*j*l*z+b*f*k*z-a*h*k*z-c*h*n*B+b*i*n*B+
-c*f*l*B-a*i*l*B-b*f*o*B+a*h*o*B},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.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,e=this.n14,f=this.n21,h=this.n22,i=this.n23,j=this.n24,l=this.n31,m=this.n32,k=this.n33,o=this.n34,v=this.n41,q=this.n42,B=this.n43,A=this.n44;return e*i*m*v-c*j*m*v-e*h*k*v+b*j*k*v+c*h*o*v-b*i*o*v-e*i*l*q+c*j*l*q+e*f*k*q-a*j*k*q-c*f*o*q+a*i*o*q+e*h*l*B-b*j*l*B-e*f*m*B+a*j*m*B+b*f*o*B-a*h*o*B-c*h*l*A+b*i*l*A+
+c*f*m*A-a*i*m*A-b*f*k*A+a*h*k*A},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),e=Math.sin(b),f=1-c,h=a.x,i=a.y,j=a.z,n=f*h,l=f*i;this.set(n*h+c,n*i-e*j,n*j+e*i,0,n*i+e*j,l*i+c,l*j-e*h,0,n*j-e*i,l*j+e*h,f*j*j+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,e=a.n13,f=a.n14,h=a.n21,i=a.n22,j=a.n23,n=a.n24,l=a.n31,o=a.n32,k=a.n33,r=a.n34,v=a.n41,z=a.n42,B=a.n43,F=a.n44;this.n11=j*r*z-n*k*z+n*o*B-i*r*B-j*o*F+i*k*F;this.n12=f*k*z-e*r*z-f*o*B+c*r*B+e*o*F-c*k*F;this.n13=e*n*z-f*j*z+f*i*B-c*n*B-e*i*F+c*j*F;this.n14=f*j*o-e*n*o-f*i*k+c*n*k+e*i*r-c*j*r;this.n21=n*k*v-j*r*v-n*l*B+h*r*B+j*l*F-h*k*F;this.n22=e*r*v-f*k*v+
-f*l*B-b*r*B-e*l*F+b*k*F;this.n23=f*j*v-e*n*v-f*h*B+b*n*B+e*h*F-b*j*F;this.n24=e*n*l-f*j*l+f*h*k-b*n*k-e*h*r+b*j*r;this.n31=i*r*v-n*o*v+n*l*z-h*r*z-i*l*F+h*o*F;this.n32=f*o*v-c*r*v-f*l*z+b*r*z+c*l*F-b*o*F;this.n33=e*n*v-f*i*v+f*h*z-b*n*z-c*h*F+b*i*F;this.n34=f*i*l-c*n*l-f*h*o+b*n*o+c*h*r-b*i*r;this.n41=j*o*v-i*k*v-j*l*z+h*k*z+i*l*B-h*o*B;this.n42=c*k*v-e*o*v+e*l*z-b*k*z-c*l*B+b*o*B;this.n43=e*i*v-c*j*v-e*h*z+b*j*z+c*h*B-b*i*B;this.n44=c*j*l-e*i*l+e*h*o-b*j*o-c*h*k+b*i*k;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var n=i*j,l=i*f,o=e*j,k=e*f;this.n11=n+k*c;this.n12=o*c-l;this.n13=h*e;this.n21=h*f;this.n22=h*j;this.n23=-c;this.n31=l*c-o;this.n32=k+n*c;this.n33=h*i;break;case "ZXY":n=i*j;l=i*f;o=e*j;k=e*f;this.n11=n-k*c;this.n12=-h*f;this.n13=o+l*c;this.n21=l+o*c;this.n22=h*j;this.n23=k-n*c;this.n31=-h*e;this.n32=c;this.n33=h*i;break;case "ZYX":n=
-h*j;l=h*f;o=c*j;k=c*f;this.n11=i*j;this.n12=o*e-l;this.n13=n*e+k;this.n21=i*f;this.n22=k*e+n;this.n23=l*e-o;this.n31=-e;this.n32=c*i;this.n33=h*i;break;case "YZX":n=h*i;l=h*e;o=c*i;k=c*e;this.n11=i*j;this.n12=k-n*f;this.n13=o*f+l;this.n21=f;this.n22=h*j;this.n23=-c*j;this.n31=-e*j;this.n32=l*f+o;this.n33=n-k*f;break;case "XZY":n=h*i;l=h*e;o=c*i;k=c*e;this.n11=i*j;this.n12=-f;this.n13=e*j;this.n21=n*f+k;this.n22=h*j;this.n23=l*f-o;this.n31=o*f-l;this.n32=c*j;this.n33=k*f+n;break;default:n=h*j,l=h*
-f,o=c*j,k=c*f,this.n11=i*j,this.n12=-i*f,this.n13=e,this.n21=l+o*e,this.n22=n-k*e,this.n23=-c*i,this.n31=k-n*e,this.n32=o+l*e,this.n33=h*i}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,h=b+b,i=c+c,j=e+e,a=b*h,n=b*i;b*=j;var l=c*i;c*=j;e*=j;h*=f;i*=f;f*=j;this.n11=1-(l+e);this.n12=n-f;this.n13=b+i;this.n21=n+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-i;this.n32=c+h;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*=
+0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,h=a.x,i=a.y,j=a.z,l=f*h,m=f*i;this.set(l*h+c,l*i-e*j,l*j+e*i,0,l*i+e*j,m*i+c,m*j-e*h,0,l*j-e*i,m*j+e*h,f*j*j+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,e=a.n13,f=a.n14,h=a.n21,i=a.n22,j=a.n23,l=a.n24,m=a.n31,k=a.n32,o=a.n33,v=a.n34,q=a.n41,B=a.n42,A=a.n43,G=a.n44;this.n11=j*v*B-l*o*B+l*k*A-i*v*A-j*k*G+i*o*G;this.n12=f*o*B-e*v*B-f*k*A+c*v*A+e*k*G-c*o*G;this.n13=e*l*B-f*j*B+f*i*A-c*l*A-e*i*G+c*j*G;this.n14=f*j*k-e*l*k-f*i*o+c*l*o+e*i*v-c*j*v;this.n21=l*o*q-j*v*q-l*m*A+h*v*A+j*m*G-h*o*G;this.n22=e*v*q-f*o*q+
+f*m*A-b*v*A-e*m*G+b*o*G;this.n23=f*j*q-e*l*q-f*h*A+b*l*A+e*h*G-b*j*G;this.n24=e*l*m-f*j*m+f*h*o-b*l*o-e*h*v+b*j*v;this.n31=i*v*q-l*k*q+l*m*B-h*v*B-i*m*G+h*k*G;this.n32=f*k*q-c*v*q-f*m*B+b*v*B+c*m*G-b*k*G;this.n33=e*l*q-f*i*q+f*h*B-b*l*B-c*h*G+b*i*G;this.n34=f*i*m-c*l*m-f*h*k+b*l*k+c*h*v-b*i*v;this.n41=j*k*q-i*o*q-j*m*B+h*o*B+i*m*A-h*k*A;this.n42=c*o*q-e*k*q+e*m*B-b*o*B-c*m*A+b*k*A;this.n43=e*i*q-c*j*q-e*h*B+b*j*B+c*h*A-b*i*A;this.n44=c*j*m-e*i*m+e*h*k-b*j*k-c*h*o+b*i*o;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=i*j,m=i*f,k=e*j,o=e*f;this.n11=l+o*c;this.n12=k*c-m;this.n13=h*e;this.n21=h*f;this.n22=h*j;this.n23=-c;this.n31=m*c-k;this.n32=o+l*c;this.n33=h*i;break;case "ZXY":l=i*j;m=i*f;k=e*j;o=e*f;this.n11=l-o*c;this.n12=-h*f;this.n13=k+m*c;this.n21=m+k*c;this.n22=h*j;this.n23=o-l*c;this.n31=-h*e;this.n32=c;this.n33=h*i;break;case "ZYX":l=
+h*j;m=h*f;k=c*j;o=c*f;this.n11=i*j;this.n12=k*e-m;this.n13=l*e+o;this.n21=i*f;this.n22=o*e+l;this.n23=m*e-k;this.n31=-e;this.n32=c*i;this.n33=h*i;break;case "YZX":l=h*i;m=h*e;k=c*i;o=c*e;this.n11=i*j;this.n12=o-l*f;this.n13=k*f+m;this.n21=f;this.n22=h*j;this.n23=-c*j;this.n31=-e*j;this.n32=m*f+k;this.n33=l-o*f;break;case "XZY":l=h*i;m=h*e;k=c*i;o=c*e;this.n11=i*j;this.n12=-f;this.n13=e*j;this.n21=l*f+o;this.n22=h*j;this.n23=m*f-k;this.n31=k*f-m;this.n32=c*j;this.n33=o*f+l;break;default:l=h*j,m=h*
+f,k=c*j,o=c*f,this.n11=i*j,this.n12=-i*f,this.n13=e,this.n21=m+k*e,this.n22=l-o*e,this.n23=-c*i,this.n31=o-l*e,this.n32=k+m*e,this.n33=h*i}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,h=b+b,i=c+c,j=e+e,a=b*h,l=b*i;b*=j;var m=c*i;c*=j;e*=j;h*=f;i*=f;f*=j;this.n11=1-(m+e);this.n12=l-f;this.n13=b+i;this.n21=l+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-i;this.n32=c+h;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 e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);h.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=e.length();c.y=f.length();c.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);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(),e=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*e;this.n22=a.n22*e;this.n32=a.n32*e;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,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*n;c[6]=a*l;c[7]=a*o;c[8]=a*k;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,l=-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*e+a.n21*i+a.n31*m;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*l;c[6]=a*m;c[7]=a*k;c[8]=a*o;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-c);i.n23=(e+c)/(e-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
-THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,n,l;i=new THREE.Matrix4;j=b-a;n=c-e;l=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/n;i.n23=0;i.n24=-((c+e)/n);i.n31=0;i.n32=0;i.n33=-2/l;i.n34=-((h+f)/l);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,l,m;i=new THREE.Matrix4;j=b-a;l=c-e;m=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/l;i.n23=0;i.n24=-((c+e)/l);i.n31=0;i.n32=0;i.n33=-2/m;i.n34=-((h+f)/m);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};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,e,f;c=0;for(e=this.children.length;c<e;c++){f=this.children[c];if(f.name===a)return f;
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,e=1,h=a.z+a.w,f=b.z+b.w,i=-a.z+a.w,j=-b.z+b.w;return h>=0&&f>=0&&i>=0&&j>=0?!0:h<0&&f<0||i<0&&j<0?!1:(h<0?c=Math.max(c,h/(h-f)):f<0&&(e=Math.min(e,h/(h-f))),i<0?c=Math.max(c,i/(i-j)):j<0&&(e=Math.min(e,i/(i-j))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var e,f,h=[],i,j,n=[],l,o=[],k,r,v=[],z,B,F=[],E={objects:[],sprites:[],lights:[],elements:[]};
-new THREE.Vector3;var fa=new THREE.Vector4,ia=new THREE.Matrix4,ra=new THREE.Matrix4,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,T=new THREE.Vector4;this.computeFrustum=function(a){O[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);O[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);O[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);O[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);
-O[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);O[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=O[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);ia.multiply(b.projectionMatrix,b.matrixWorldInverse);ia.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);ia.multiply(b.matrixWorld,b.projectionMatrixInverse);
-ia.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(a){E.objects.length=0;E.sprites.length=0;E.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var e=a.matrixWorld,h=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),
-f=0;f<6;f++)if(c=O[f].x*e.n14+O[f].y*e.n24+O[f].z*e.n34+O[f].w,c<=h){c=!1;break a}c=!0}c?E.objects.push(a):a instanceof THREE.Line?E.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?E.sprites.push(a):a instanceof THREE.Light&&E.lights.push(a);c=0;for(e=a.children.length;c<e;c++)b(a.children[c])}};b(a);return E};this.projectScene=function(O,U,ma){var pa=U.near,X=U.far,R,K,A,d,C,S,W,Q,N,Aa,va,Ga,Ka,wa,Ba,ya;B=r=l=j=0;E.elements.length=0;U.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
-O.add(U));O.updateMatrixWorld();U.matrixWorldInverse.getInverse(U.matrixWorld);ia.multiply(U.projectionMatrix,U.matrixWorldInverse);this.computeFrustum(ia);E=this.projectGraph(O);O=0;for(R=E.objects.length;O<R;O++)if(N=E.objects[O],Aa=N.matrixWorld,Ga=N.material,f=0,N instanceof THREE.Mesh){va=N.geometry;Ka=N.geometry.materials;d=va.vertices;wa=va.faces;Ba=va.faceVertexUvs;va=N.matrixRotationWorld.extractRotation(Aa);K=0;for(A=d.length;K<A;K++)e=a(),e.positionWorld.copy(d[K].position),Aa.multiplyVector3(e.positionWorld),
-e.positionScreen.copy(e.positionWorld),ia.multiplyVector4(e.positionScreen),e.positionScreen.x/=e.positionScreen.w,e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>pa&&e.positionScreen.z<X;d=0;for(K=wa.length;d<K;d++){A=wa[d];if(A instanceof THREE.Face3)if(C=h[A.a],S=h[A.b],W=h[A.c],C.visible&&S.visible&&W.visible&&(N.doubleSided||N.flipSided!=(W.positionScreen.x-C.positionScreen.x)*(S.positionScreen.y-C.positionScreen.y)-(W.positionScreen.y-C.positionScreen.y)*(S.positionScreen.x-
-C.positionScreen.x)<0))Q=n[j]=n[j]||new THREE.RenderableFace3,j++,i=Q,i.v1.copy(C),i.v2.copy(S),i.v3.copy(W);else continue;else if(A instanceof THREE.Face4)if(C=h[A.a],S=h[A.b],W=h[A.c],Q=h[A.d],C.visible&&S.visible&&W.visible&&Q.visible&&(N.doubleSided||N.flipSided!=((Q.positionScreen.x-C.positionScreen.x)*(S.positionScreen.y-C.positionScreen.y)-(Q.positionScreen.y-C.positionScreen.y)*(S.positionScreen.x-C.positionScreen.x)<0||(S.positionScreen.x-W.positionScreen.x)*(Q.positionScreen.y-W.positionScreen.y)-
-(S.positionScreen.y-W.positionScreen.y)*(Q.positionScreen.x-W.positionScreen.x)<0)))ya=o[l]=o[l]||new THREE.RenderableFace4,l++,i=ya,i.v1.copy(C),i.v2.copy(S),i.v3.copy(W),i.v4.copy(Q);else continue;i.normalWorld.copy(A.normal);va.multiplyVector3(i.normalWorld);i.centroidWorld.copy(A.centroid);Aa.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);ia.multiplyVector3(i.centroidScreen);W=A.vertexNormals;C=0;for(S=W.length;C<S;C++)Q=i.vertexNormalsWorld[C],Q.copy(W[C]),va.multiplyVector3(Q);
-C=0;for(S=Ba.length;C<S;C++)if(ya=Ba[C][d]){W=0;for(Q=ya.length;W<Q;W++)i.uvs[C][W]=ya[W]}i.material=Ga;i.faceMaterial=A.materialIndex!==null?Ka[A.materialIndex]:null;i.z=i.centroidScreen.z;E.elements.push(i)}}else if(N instanceof THREE.Line){ra.multiply(ia,Aa);d=N.geometry.vertices;C=a();C.positionScreen.copy(d[0].position);ra.multiplyVector4(C.positionScreen);K=1;for(A=d.length;K<A;K++)if(C=a(),C.positionScreen.copy(d[K].position),ra.multiplyVector4(C.positionScreen),S=h[f-2],I.copy(C.positionScreen),
-T.copy(S.positionScreen),c(I,T))I.multiplyScalar(1/I.w),T.multiplyScalar(1/T.w),N=v[r]=v[r]||new THREE.RenderableLine,r++,k=N,k.v1.positionScreen.copy(I),k.v2.positionScreen.copy(T),k.z=Math.max(I.z,T.z),k.material=Ga,E.elements.push(k)}O=0;for(R=E.sprites.length;O<R;O++)if(N=E.sprites[O],Aa=N.matrixWorld,N instanceof THREE.Particle&&(fa.set(Aa.n14,Aa.n24,Aa.n34,1),ia.multiplyVector4(fa),fa.z/=fa.w,fa.z>0&&fa.z<1))pa=F[B]=F[B]||new THREE.RenderableParticle,B++,z=pa,z.x=fa.x/fa.w,z.y=fa.y/fa.w,z.z=
-fa.z,z.rotation=N.rotation.z,z.scale.x=N.scale.x*Math.abs(z.x-(fa.x+U.projectionMatrix.n11)/(fa.w+U.projectionMatrix.n14)),z.scale.y=N.scale.y*Math.abs(z.y-(fa.y+U.projectionMatrix.n22)/(fa.w+U.projectionMatrix.n24)),z.material=N.material,E.elements.push(z);ma&&E.elements.sort(b);return E}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
+THREE.Projector=function(){function a(){var a=i[h]=i[h]||new THREE.RenderableObject;h++;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 e(a,b){var c=0,d=1,e=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,i=-b.z+b.w;return e>=0&&h>=0&&f>=0&&i>=0?!0:e<0&&h<0||f<0&&i<0?!1:(e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h))),f<0?c=Math.max(c,f/(f-i)):i<0&&(d=Math.min(d,f/(f-i))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,h,i=[],j,l,m=[],
+k,o,v=[],q,B=[],A,G,Z=[],ma,sa,va=[],R={objects:[],sprites:[],lights:[],elements:[]},N=new THREE.Vector3,E=new THREE.Vector4,O=new THREE.Matrix4,qa=new THREE.Matrix4,C=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Vector4,aa=new THREE.Vector4;this.computeFrustum=function(a){C[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);C[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);C[2].set(a.n41+a.n21,a.n42+a.n22,
+a.n43+a.n23,a.n44+a.n24);C[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);C[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);C[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=C[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,e){h=0;R.objects.length=0;R.sprites.length=0;R.lights.length=0;var i=function(d){if(d.visible!==!1){var b;if(b=d instanceof THREE.Mesh||d instanceof THREE.Line)if(!(b=d.frustumCulled===!1))a:{for(var c=d.matrixWorld,
+e=-d.geometry.boundingSphere.radius*Math.max(d.scale.x,Math.max(d.scale.y,d.scale.z)),h=0;h<6;h++)if(b=C[h].x*c.n14+C[h].y*c.n24+C[h].z*c.n34+C[h].w,b<=e){b=!1;break a}b=!0}b?(O.multiplyVector3(N.copy(d.position)),f=a(),f.object=d,f.z=N.z,R.objects.push(f)):d instanceof THREE.Sprite||d instanceof THREE.Particle?(O.multiplyVector3(N.copy(d.position)),f=a(),f.object=d,f.z=N.z,R.sprites.push(f)):d instanceof THREE.Light&&R.lights.push(d);b=0;for(c=d.children.length;b<c;b++)i(d.children[b])}};i(b);e&&
+R.objects.sort(c);return R};this.projectScene=function(a,h,f){var d=h.near,i=h.far,N,C,J,Q,S,T,X,ka,U,ua,za,Ka,Qa,Ba,Ca,ta;sa=G=q=o=0;R.elements.length=0;h.parent==null&&(console.warn("DEPRECATED: Camera hasn't been added to the Scene. Adding it..."),a.add(h));a.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);O.multiply(h.projectionMatrix,h.matrixWorldInverse);this.computeFrustum(O);R=this.projectGraph(a,!1);a=0;for(N=R.objects.length;a<N;a++)if(U=R.objects[a].object,ua=U.matrixWorld,
+Ka=U.material,l=0,U instanceof THREE.Mesh){za=U.geometry;Qa=U.geometry.materials;Q=za.vertices;Ba=za.faces;Ca=za.faceVertexUvs;za=U.matrixRotationWorld.extractRotation(ua);C=0;for(J=Q.length;C<J;C++)j=b(),j.positionWorld.copy(Q[C].position),ua.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),O.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>d&&j.positionScreen.z<i;Q=0;for(C=Ba.length;Q<
+C;Q++){J=Ba[Q];if(J instanceof THREE.Face3)if(S=m[J.a],T=m[J.b],X=m[J.c],S.visible&&T.visible&&X.visible&&(U.doubleSided||U.flipSided!=(X.positionScreen.x-S.positionScreen.x)*(T.positionScreen.y-S.positionScreen.y)-(X.positionScreen.y-S.positionScreen.y)*(T.positionScreen.x-S.positionScreen.x)<0))ka=v[o]=v[o]||new THREE.RenderableFace3,o++,k=ka,k.v1.copy(S),k.v2.copy(T),k.v3.copy(X);else continue;else if(J instanceof THREE.Face4)if(S=m[J.a],T=m[J.b],X=m[J.c],ka=m[J.d],S.visible&&T.visible&&X.visible&&
+ka.visible&&(U.doubleSided||U.flipSided!=((ka.positionScreen.x-S.positionScreen.x)*(T.positionScreen.y-S.positionScreen.y)-(ka.positionScreen.y-S.positionScreen.y)*(T.positionScreen.x-S.positionScreen.x)<0||(T.positionScreen.x-X.positionScreen.x)*(ka.positionScreen.y-X.positionScreen.y)-(T.positionScreen.y-X.positionScreen.y)*(ka.positionScreen.x-X.positionScreen.x)<0)))ta=B[q]=B[q]||new THREE.RenderableFace4,q++,k=ta,k.v1.copy(S),k.v2.copy(T),k.v3.copy(X),k.v4.copy(ka);else continue;k.normalWorld.copy(J.normal);
+za.multiplyVector3(k.normalWorld);k.centroidWorld.copy(J.centroid);ua.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);O.multiplyVector3(k.centroidScreen);X=J.vertexNormals;S=0;for(T=X.length;S<T;S++)ka=k.vertexNormalsWorld[S],ka.copy(X[S]),za.multiplyVector3(ka);S=0;for(T=Ca.length;S<T;S++)if(ta=Ca[S][Q]){X=0;for(ka=ta.length;X<ka;X++)k.uvs[S][X]=ta[X]}k.material=Ka;k.faceMaterial=J.materialIndex!==null?Qa[J.materialIndex]:null;k.z=k.centroidScreen.z;R.elements.push(k)}}else if(U instanceof
+THREE.Line){qa.multiply(O,ua);Q=U.geometry.vertices;S=b();S.positionScreen.copy(Q[0].position);qa.multiplyVector4(S.positionScreen);C=1;for(J=Q.length;C<J;C++)if(S=b(),S.positionScreen.copy(Q[C].position),qa.multiplyVector4(S.positionScreen),T=m[l-2],ja.copy(S.positionScreen),aa.copy(T.positionScreen),e(ja,aa))ja.multiplyScalar(1/ja.w),aa.multiplyScalar(1/aa.w),U=Z[G]=Z[G]||new THREE.RenderableLine,G++,A=U,A.v1.positionScreen.copy(ja),A.v2.positionScreen.copy(aa),A.z=Math.max(ja.z,aa.z),A.material=
+Ka,R.elements.push(A)}a=0;for(N=R.sprites.length;a<N;a++)if(U=R.sprites[a].object,ua=U.matrixWorld,U instanceof THREE.Particle&&(E.set(ua.n14,ua.n24,ua.n34,1),O.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))d=va[sa]=va[sa]||new THREE.RenderableParticle,sa++,ma=d,ma.x=E.x/E.w,ma.y=E.y/E.w,ma.z=E.z,ma.rotation=U.rotation.z,ma.scale.x=U.scale.x*Math.abs(ma.x-(E.x+h.projectionMatrix.n11)/(E.w+h.projectionMatrix.n14)),ma.scale.y=U.scale.y*Math.abs(ma.y-(E.y+h.projectionMatrix.n22)/(E.w+h.projectionMatrix.n24)),
+ma.material=U.material,R.elements.push(ma);f&&R.elements.sort(c);return R}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;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,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),i=a*b,j=e*f;this.w=i*h-j*c;this.x=i*c+j*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;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,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;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,e=a.y,f=a.z,h=this.x,i=this.y,j=this.z,n=this.w,l=n*c+i*f-j*e,o=n*e+j*c-h*f,k=n*f+h*e-i*c,c=-h*
-c-i*e-j*f;b.x=l*n+c*-h+o*-j-k*-i;b.y=o*n+c*-i+k*-h-l*-j;b.z=k*n+c*-j+l*-i-o*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){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 h=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-e)*h)/f;e=Math.sin(e*h)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+this.x,c=this.y,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;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,e=a.y,f=a.z,h=this.x,i=this.y,j=this.z,l=this.w,m=l*c+i*f-j*e,k=l*e+j*c-h*f,o=l*f+h*e-i*c,c=-h*
+c-i*e-j*f;b.x=m*l+c*-h+k*-j-o*-i;b.y=k*l+c*-i+o*-h-m*-j;b.z=o*l+c*-j+m*-i-k*-h;return b}};
+THREE.Quaternion.slerp=function(a,b,c,e){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 h=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)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-e)*h)/f;e=Math.sin(e*h)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];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.Face4=function(a,b,c,e,f,h,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=i;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,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,i=f.vertexNormals.length;h<i;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,e,f,h,i,j=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){j.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)j.addSelf(h.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],i=this.vertices[h.c],j.sub(i.position,c.position),n.sub(b.position,c.position),j.crossSelf(n);j.isZero()||j.normalize();h.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
+c,e,f,h,i,j=new THREE.Vector3,l=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){j.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)j.addSelf(h.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],i=this.vertices[h.c],j.sub(i.position,c.position),l.sub(b.position,c.position),j.crossSelf(l);j.isZero()||j.normalize();h.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[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{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
-c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,d,b,c,e,h,f){j=a.vertices[d].position;n=a.vertices[b].position;l=a.vertices[c].position;o=i[e];k=i[h];r=i[f];v=n.x-j.x;z=l.x-j.x;B=n.y-j.y;F=l.y-j.y;E=n.z-j.z;fa=l.z-j.z;ia=k.u-o.u;ra=r.u-o.u;O=k.v-o.v;I=r.v-o.v;T=1/(ia*I-ra*O);pa.set((I*v-O*z)*T,(I*B-O*F)*T,(I*E-O*fa)*T);X.set((ia*z-ra*v)*T,(ia*F-ra*B)*T,(ia*fa-ra*E)*T);U[d].addSelf(pa);U[b].addSelf(pa);U[c].addSelf(pa);
-ma[d].addSelf(X);ma[b].addSelf(X);ma[c].addSelf(X)}var b,c,e,f,h,i,j,n,l,o,k,r,v,z,B,F,E,fa,ia,ra,O,I,T,ta,U=[],ma=[],pa=new THREE.Vector3,X=new THREE.Vector3,R=new THREE.Vector3,K=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)U[b]=new THREE.Vector3,ma[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],i=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,
-h.d,0,1,3));var d=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)A.copy(h.vertexNormals[e]),f=h[d[e]],ta=U[f],R.copy(ta),R.subSelf(A.multiplyScalar(A.dot(ta))).normalize(),K.cross(h.vertexNormals[e],ta),f=K.dot(ma[f]),f=f<0?-1:1,h.vertexTangents[e]=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],
+c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,d,b,c,e,h,f){j=a.vertices[d].position;l=a.vertices[b].position;m=a.vertices[c].position;k=i[e];o=i[h];v=i[f];q=l.x-j.x;B=m.x-j.x;A=l.y-j.y;G=m.y-j.y;Z=l.z-j.z;ma=m.z-j.z;sa=o.u-k.u;va=v.u-k.u;R=o.v-k.v;N=v.v-k.v;E=1/(sa*N-va*R);ja.set((N*q-R*B)*E,(N*A-R*G)*E,(N*Z-R*ma)*E);aa.set((sa*B-va*q)*E,(sa*G-va*A)*E,(sa*ma-va*Z)*E);qa[d].addSelf(ja);qa[b].addSelf(ja);qa[c].addSelf(ja);
+C[d].addSelf(aa);C[b].addSelf(aa);C[c].addSelf(aa)}var b,c,e,f,h,i,j,l,m,k,o,v,q,B,A,G,Z,ma,sa,va,R,N,E,O,qa=[],C=[],ja=new THREE.Vector3,aa=new THREE.Vector3,wa=new THREE.Vector3,P=new THREE.Vector3,F=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)qa[b]=new THREE.Vector3,C[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],i=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,
+h.d,0,1,3));var d=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)F.copy(h.vertexNormals[e]),f=h[d[e]],O=qa[f],wa.copy(O),wa.subSelf(F.multiplyScalar(F.dot(O))).normalize(),P.cross(h.vertexNormals[e],O),f=P.dot(C[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(wa.x,wa.y,wa.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=[],e,f=Math.pow(10,4),h,i;h=0;for(i=this.vertices.length;h<i;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),
 a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),c[h]=b.length-1):c[h]=c[a[e]];h=0;for(i=this.faces.length;h<i;h++)if(a=this.faces[h],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,e,h,f,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*f+a*h+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,i,j,n,l,o,k,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){f=(this.points.length-1)*a;h=Math.floor(f);i=f-h;c[0]=h===0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;l=this.points[c[0]];o=this.points[c[1]];
-k=this.points[c[2]];r=this.points[c[3]];j=i*i;n=i*j;e.x=b(l.x,o.x,k.x,r.x,i,j,n);e.y=b(l.y,o.y,k.y,r.y,i,j,n);e.z=b(l.z,o.z,k.z,r.z,i,j,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,f=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),f.copy(position),
-j+=f.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,h,f,i,j=[],o=new THREE.Vector3,n=this.getLength();j.push(o.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=n.chunks[b]-n.chunks[b-1];i=Math.ceil(a*c/n.total);h=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=h+c*(1/i)*(f-h),position=this.getPoint(e),j.push(o.copy(position).clone());
-j.push(o.copy(this.points[b]).clone())}this.points=j}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};
+THREE.Spline=function(a){function b(a,b,c,e,h,f,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*f+a*h+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,i,j,l,m,k,o,v;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;h=Math.floor(f);i=f-h;c[0]=h===0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;m=this.points[c[0]];k=this.points[c[1]];
+o=this.points[c[2]];v=this.points[c[3]];j=i*i;l=i*j;e.x=b(m.x,k.x,o.x,v.x,i,j,l);e.y=b(m.y,k.y,o.y,v.y,i,j,l);e.z=b(m.z,k.z,o.z,v.z,i,j,l);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,f=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),f.copy(position),
+j+=f.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,h,f,i,j=[],k=new THREE.Vector3,l=this.getLength();j.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];i=Math.ceil(a*c/l.total);h=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=h+c*(1/i)*(f-h),position=this.getPoint(e),j.push(k.copy(position).clone());
+j.push(k.copy(this.points[b]).clone())}this.points=j}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];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,e,f,h){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=e;this.near=f!==void 0?f:0.1;this.far=h!==void 0?h: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,e){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=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
@@ -119,11 +121,11 @@ void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.ve
 THREE.Texture=function(a,b,c,e,f,h){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=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var 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,e,f,h,i,j,n){THREE.Texture.call(this,null,f,h,i,j,n);this.image={data:a,width:b,height:c};this.format=e!==void 0?e: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,e,f,h,i,j,l){THREE.Texture.call(this,null,f,h,i,j,l);this.image={data:a,width:b,height:c};this.format=e!==void 0?e: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};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("DEPRECATE: Material array is no longer supported. Using material 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.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,e=this.children.length;for(c=0;c<e;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,e,f,h,i,j;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],h=f.pos,i=f.rotq,j=f.scl,e=this.addBone(),e.name=f.name,e.position.set(h[0],h[1],h[2]),e.quaternion.set(i[0],i[1],i[2],i[3]),e.useQuaternion=!0,j!==void 0?e.scale.set(j[0],j[1],j[2]):e.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
@@ -135,7 +137,7 @@ new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVec
 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:
-!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
+!this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
 THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
 THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
 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;
@@ -175,122 +177,122 @@ 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){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function c(a,b,c){var e,h,f,i=a.vertices,u=i.length,p=a.colors,q=p.length,j=a.__vertexArray,xa=a.__colorArray,za=a.__sortArray,P=a.__dirtyVertices,o=a.__dirtyColors,n=a.__webglCustomAttributesList,k;if(n){f=0;for(e=n.length;f<e;f++)n[f].offset=0}if(c.sortParticles){Ca.multiplySelf(c.matrixWorld);for(e=
-0;e<u;e++)h=i[e].position,Ha.copy(h),Ca.multiplyVector3(Ha),za[e]=[Ha.z,e];za.sort(function(a,b){return b[0]-a[0]});for(e=0;e<u;e++)h=i[za[e][1]].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;for(e=0;e<q;e++)f=e*3,color=p[za[e][1]],xa[f]=color.r,xa[f+1]=color.g,xa[f+2]=color.b;if(n){f=0;for(e=n.length;f<e;f++){u=n[f];q=u.value.length;for(p=0;p<q;p++){index=za[p][1];i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[index]}else{if(u.boundTo===void 0||u.boundTo===
-"vertices")k=u.value[index];u.size===2?(u.array[i]=k.x,u.array[i+1]=k.y):u.size===3?u.type==="c"?(u.array[i]=k.r,u.array[i+1]=k.g,u.array[i+2]=k.b):(u.array[i]=k.x,u.array[i+1]=k.y,u.array[i+2]=k.z):(u.array[i]=k.x,u.array[i+1]=k.y,u.array[i+2]=k.z,u.array[i+3]=k.w)}u.offset+=u.size}}}}else{if(P)for(e=0;e<u;e++)h=i[e].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;if(o)for(e=0;e<q;e++)color=p[e],f=e*3,xa[f]=color.r,xa[f+1]=color.g,xa[f+2]=color.b;if(n){f=0;for(e=n.length;f<e;f++)if(u=n[f],u.__original.needsUpdate){q=
-u.value.length;for(p=0;p<q;p++){i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[p]}else{if(u.boundTo===void 0||u.boundTo==="vertices")k=u.value[p];u.size===2?(u.array[i]=k.x,u.array[i+1]=k.y):u.size===3?u.type==="c"?(u.array[i]=k.r,u.array[i+1]=k.g,u.array[i+2]=k.b):(u.array[i]=k.x,u.array[i+1]=k.y,u.array[i+2]=k.z):(u.array[i]=k.x,u.array[i+1]=k.y,u.array[i+2]=k.z,u.array[i+3]=k.w)}u.offset+=u.size}}}}if(P||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),
-d.bufferData(d.ARRAY_BUFFER,j,b);if(o||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,xa,b);if(n){f=0;for(e=n.length;f<e;f++)if(u=n[f],u.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,u.buffer),d.bufferData(d.ARRAY_BUFFER,u.array,b)}}function e(a,b,c,e,h){e.program||A.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(A.maxMorphTargets);for(var f=0,i=A.maxMorphTargets;f<
-i;f++)h.__webglMorphTargetInfluences[f]=0}var u=!1,f=e.program,i=f.uniforms,p=e.uniforms;f!==S&&(d.useProgram(f),S=f,u=!0);if(e.id!==Q)Q=e.id,u=!0;if(u){d.uniformMatrix4fv(i.projectionMatrix,!1,Ta);if(c&&e.fog)if(p.fogColor.value=c.color,c instanceof THREE.Fog)p.fogNear.value=c.near,p.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)p.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var q,j,k=0,n=0,P=0,o,l,r,v=Za,y=v.directional.colors,
-t=v.directional.positions,z=v.point.colors,B=v.point.positions,C=v.point.distances,O=0,G=0,c=q=r=0,u=b.length;c<u;c++)if(q=b[c],j=q.color,o=q.position,l=q.intensity,r=q.distance,q instanceof THREE.AmbientLight)A.gammaInput?(k+=j.r*j.r,n+=j.g*j.g,P+=j.b*j.b):(k+=j.r,n+=j.g,P+=j.b);else if(q instanceof THREE.DirectionalLight)r=O*3,A.gammaInput?(y[r]=j.r*j.r*l*l,y[r+1]=j.g*j.g*l*l,y[r+2]=j.b*j.b*l*l):(y[r]=j.r*l,y[r+1]=j.g*l,y[r+2]=j.b*l),t[r]=o.x,t[r+1]=o.y,t[r+2]=o.z,O+=1;else if(q instanceof THREE.SpotLight)r=
-O*3,A.gammaInput?(y[r]=j.r*j.r*l*l,y[r+1]=j.g*j.g*l*l,y[r+2]=j.b*j.b*l*l):(y[r]=j.r*l,y[r+1]=j.g*l,y[r+2]=j.b*l),j=1/o.length(),t[r]=o.x*j,t[r+1]=o.y*j,t[r+2]=o.z*j,O+=1;else if(q instanceof THREE.PointLight)q=G*3,A.gammaInput?(z[q]=j.r*j.r*l*l,z[q+1]=j.g*j.g*l*l,z[q+2]=j.b*j.b*l*l):(z[q]=j.r*l,z[q+1]=j.g*l,z[q+2]=j.b*l),B[q]=o.x,B[q+1]=o.y,B[q+2]=o.z,C[G]=r,G+=1;c=O*3;for(u=y.length;c<u;c++)y[c]=0;c=G*3;for(u=z.length;c<u;c++)z[c]=0;v.point.length=G;v.directional.length=O;v.ambient[0]=k;v.ambient[1]=
-n;v.ambient[2]=P;b=Za;p.enableLighting.value=b.directional.length+b.point.length;p.ambientLightColor.value=b.ambient;p.directionalLightColor.value=b.directional.colors;p.directionalLightDirection.value=b.directional.positions;p.pointLightColor.value=b.point.colors;p.pointLightPosition.value=b.point.positions;p.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)p.opacity.value=e.opacity,A.gammaInput?
-p.diffuse.value.copyGammaToLinear(e.color):p.diffuse.value=e.color,(p.map.texture=e.map)&&p.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),p.lightMap.texture=e.lightMap,p.envMap.texture=e.envMap,p.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,p.reflectivity.value=e.reflectivity,p.refractionRatio.value=e.refractionRatio,p.combine.value=e.combine,p.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof
-THREE.LineBasicMaterial)p.diffuse.value=e.color,p.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)p.psColor.value=e.color,p.opacity.value=e.opacity,p.size.value=e.size,p.scale.value=Da.height/2,p.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)p.shininess.value=e.shininess,A.gammaInput?(p.ambient.value.copyGammaToLinear(e.ambient),p.specular.value.copyGammaToLinear(e.specular)):(p.ambient.value=e.ambient,p.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)A.gammaInput?
-p.ambient.value.copyGammaToLinear(e.ambient):p.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)p.mNear.value=a.near,p.mFar.value=a.far,p.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)p.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&p.shadowMatrix){for(b=0;b<Ra.length;b++)p.shadowMatrix.value[b]=Ra[b],p.shadowMap.texture[b]=A.shadowMap[b];p.shadowDarkness.value=A.shadowMapDarkness;p.shadowBias.value=A.shadowMapBias}b=e.uniformsList;p=0;for(c=
-b.length;p<c;p++)if(n=f.uniforms[b[p][1]])if(k=b[p][0],P=k.type,u=k.value,P==="i")d.uniform1i(n,u);else if(P==="f")d.uniform1f(n,u);else if(P==="v2")d.uniform2f(n,u.x,u.y);else if(P==="v3")d.uniform3f(n,u.x,u.y,u.z);else if(P==="v4")d.uniform4f(n,u.x,u.y,u.z,u.w);else if(P==="c")d.uniform3f(n,u.r,u.g,u.b);else if(P==="fv1")d.uniform1fv(n,u);else if(P==="fv")d.uniform3fv(n,u);else if(P==="v3v"){if(!k._array)k._array=new Float32Array(3*u.length);P=0;for(o=u.length;P<o;P++)v=P*3,k._array[v]=u[P].x,k._array[v+
-1]=u[P].y,k._array[v+2]=u[P].z;d.uniform3fv(n,k._array)}else if(P==="m4"){if(!k._array)k._array=new Float32Array(16);u.flattenToArray(k._array);d.uniformMatrix4fv(n,!1,k._array)}else if(P==="m4v"){if(!k._array)k._array=new Float32Array(16*u.length);P=0;for(o=u.length;P<o;P++)u[P].flattenToArrayOffset(k._array,P*16);d.uniformMatrix4fv(n,!1,k._array)}else if(P==="t"){if(d.uniform1i(n,u),n=k.texture)if(n.image instanceof Array&&n.image.length===6){if(k=n,k.image.length===6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
-d.createTexture();d.activeTexture(d.TEXTURE0+u);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(u=0;u<6;u++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[u]);T(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(k=n,d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):ta(n,u)}else if(P===
-"tv"){if(!k._array){k._array=[];P=0;for(o=k.texture.length;P<o;P++)k._array[P]=u+P}d.uniform1iv(n,k._array);P=0;for(o=k.texture.length;P<o;P++)(n=k.texture[P])&&ta(n,k._array[P])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&
+THREE.WebGLRenderer=function(a){function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function c(a,b,c){var e,h,f,i=a.vertices,u=i.length,t=a.colors,p=t.length,j=a.__vertexArray,k=a.__colorArray,Aa=a.__sortArray,y=a.__dirtyVertices,l=a.__dirtyColors,m=a.__webglCustomAttributesList,o;if(m){f=0;for(e=m.length;f<e;f++)m[f].offset=0}if(c.sortParticles){Da.multiplySelf(c.matrixWorld);for(e=
+0;e<u;e++)h=i[e].position,Ha.copy(h),Da.multiplyVector3(Ha),Aa[e]=[Ha.z,e];Aa.sort(function(a,b){return b[0]-a[0]});for(e=0;e<u;e++)h=i[Aa[e][1]].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;for(e=0;e<p;e++)f=e*3,color=t[Aa[e][1]],k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(m){f=0;for(e=m.length;f<e;f++){u=m[f];p=u.value.length;for(t=0;t<p;t++){index=Aa[t][1];i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[index]}else{if(u.boundTo===void 0||u.boundTo===
+"vertices")o=u.value[index];u.size===2?(u.array[i]=o.x,u.array[i+1]=o.y):u.size===3?u.type==="c"?(u.array[i]=o.r,u.array[i+1]=o.g,u.array[i+2]=o.b):(u.array[i]=o.x,u.array[i+1]=o.y,u.array[i+2]=o.z):(u.array[i]=o.x,u.array[i+1]=o.y,u.array[i+2]=o.z,u.array[i+3]=o.w)}u.offset+=u.size}}}}else{if(y)for(e=0;e<u;e++)h=i[e].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;if(l)for(e=0;e<p;e++)color=t[e],f=e*3,k[f]=color.r,k[f+1]=color.g,k[f+2]=color.b;if(m){f=0;for(e=m.length;f<e;f++)if(u=m[f],u.__original.needsUpdate){p=
+u.value.length;for(t=0;t<p;t++){i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[t]}else{if(u.boundTo===void 0||u.boundTo==="vertices")o=u.value[t];u.size===2?(u.array[i]=o.x,u.array[i+1]=o.y):u.size===3?u.type==="c"?(u.array[i]=o.r,u.array[i+1]=o.g,u.array[i+2]=o.b):(u.array[i]=o.x,u.array[i+1]=o.y,u.array[i+2]=o.z):(u.array[i]=o.x,u.array[i+1]=o.y,u.array[i+2]=o.z,u.array[i+3]=o.w)}u.offset+=u.size}}}}if(y||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),
+d.bufferData(d.ARRAY_BUFFER,j,b);if(l||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(m){f=0;for(e=m.length;f<e;f++)if(u=m[f],u.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,u.buffer),d.bufferData(d.ARRAY_BUFFER,u.array,b)}}function e(a,b,c,e,h){e.program||F.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var f=0,i=F.maxMorphTargets;f<
+i;f++)h.__webglMorphTargetInfluences[f]=0}var u=!1,f=e.program,i=f.uniforms,t=e.uniforms;f!==Wa&&(d.useProgram(f),Wa=f,u=!0);if(e.id!==J)J=e.id,u=!0;if(u){d.uniformMatrix4fv(i.projectionMatrix,!1,Ta);if(c&&e.fog)if(t.fogColor.value=c.color,c instanceof THREE.Fog)t.fogNear.value=c.near,t.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)t.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var p,j,k=0,o=0,y=0,m,l,q,v=Za,z=v.directional.colors,
+s=v.directional.positions,A=v.point.colors,B=v.point.positions,G=v.point.distances,C=0,H=0,c=p=q=0,u=b.length;c<u;c++)if(p=b[c],j=p.color,m=p.position,l=p.intensity,q=p.distance,p instanceof THREE.AmbientLight)F.gammaInput?(k+=j.r*j.r,o+=j.g*j.g,y+=j.b*j.b):(k+=j.r,o+=j.g,y+=j.b);else if(p instanceof THREE.DirectionalLight)q=C*3,F.gammaInput?(z[q]=j.r*j.r*l*l,z[q+1]=j.g*j.g*l*l,z[q+2]=j.b*j.b*l*l):(z[q]=j.r*l,z[q+1]=j.g*l,z[q+2]=j.b*l),s[q]=m.x,s[q+1]=m.y,s[q+2]=m.z,C+=1;else if(p instanceof THREE.SpotLight)q=
+C*3,F.gammaInput?(z[q]=j.r*j.r*l*l,z[q+1]=j.g*j.g*l*l,z[q+2]=j.b*j.b*l*l):(z[q]=j.r*l,z[q+1]=j.g*l,z[q+2]=j.b*l),j=1/m.length(),s[q]=m.x*j,s[q+1]=m.y*j,s[q+2]=m.z*j,C+=1;else if(p instanceof THREE.PointLight)p=H*3,F.gammaInput?(A[p]=j.r*j.r*l*l,A[p+1]=j.g*j.g*l*l,A[p+2]=j.b*j.b*l*l):(A[p]=j.r*l,A[p+1]=j.g*l,A[p+2]=j.b*l),B[p]=m.x,B[p+1]=m.y,B[p+2]=m.z,G[H]=q,H+=1;c=C*3;for(u=z.length;c<u;c++)z[c]=0;c=H*3;for(u=A.length;c<u;c++)A[c]=0;v.point.length=H;v.directional.length=C;v.ambient[0]=k;v.ambient[1]=
+o;v.ambient[2]=y;b=Za;t.enableLighting.value=b.directional.length+b.point.length;t.ambientLightColor.value=b.ambient;t.directionalLightColor.value=b.directional.colors;t.directionalLightDirection.value=b.directional.positions;t.pointLightColor.value=b.point.colors;t.pointLightPosition.value=b.point.positions;t.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)t.opacity.value=e.opacity,F.gammaInput?
+t.diffuse.value.copyGammaToLinear(e.color):t.diffuse.value=e.color,(t.map.texture=e.map)&&t.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),t.lightMap.texture=e.lightMap,t.envMap.texture=e.envMap,t.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.combine.value=e.combine,t.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof
+THREE.LineBasicMaterial)t.diffuse.value=e.color,t.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)t.psColor.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size,t.scale.value=ya.height/2,t.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)t.shininess.value=e.shininess,F.gammaInput?(t.ambient.value.copyGammaToLinear(e.ambient),t.specular.value.copyGammaToLinear(e.specular)):(t.ambient.value=e.ambient,t.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)F.gammaInput?
+t.ambient.value.copyGammaToLinear(e.ambient):t.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)t.mNear.value=a.near,t.mFar.value=a.far,t.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)t.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&t.shadowMatrix){for(b=0;b<Sa.length;b++)t.shadowMatrix.value[b]=Sa[b],t.shadowMap.texture[b]=F.shadowMap[b];t.shadowDarkness.value=F.shadowMapDarkness;t.shadowBias.value=F.shadowMapBias}b=e.uniformsList;t=0;for(c=
+b.length;t<c;t++)if(o=f.uniforms[b[t][1]])if(k=b[t][0],y=k.type,u=k.value,y==="i")d.uniform1i(o,u);else if(y==="f")d.uniform1f(o,u);else if(y==="v2")d.uniform2f(o,u.x,u.y);else if(y==="v3")d.uniform3f(o,u.x,u.y,u.z);else if(y==="v4")d.uniform4f(o,u.x,u.y,u.z,u.w);else if(y==="c")d.uniform3f(o,u.r,u.g,u.b);else if(y==="fv1")d.uniform1fv(o,u);else if(y==="fv")d.uniform3fv(o,u);else if(y==="v3v"){if(!k._array)k._array=new Float32Array(3*u.length);y=0;for(m=u.length;y<m;y++)v=y*3,k._array[v]=u[y].x,k._array[v+
+1]=u[y].y,k._array[v+2]=u[y].z;d.uniform3fv(o,k._array)}else if(y==="m4"){if(!k._array)k._array=new Float32Array(16);u.flattenToArray(k._array);d.uniformMatrix4fv(o,!1,k._array)}else if(y==="m4v"){if(!k._array)k._array=new Float32Array(16*u.length);y=0;for(m=u.length;y<m;y++)u[y].flattenToArrayOffset(k._array,y*16);d.uniformMatrix4fv(o,!1,k._array)}else if(y==="t"){if(d.uniform1i(o,u),o=k.texture)if(o.image instanceof Array&&o.image.length===6){if(k=o,k.image.length===6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
+d.createTexture();d.activeTexture(d.TEXTURE0+u);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(u=0;u<6;u++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[u]);E(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else o instanceof THREE.WebGLRenderTargetCube?(k=o,d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):O(o,u)}else if(y===
+"tv"){if(!k._array){k._array=[];y=0;for(m=k.texture.length;y<m;y++)k._array[y]=u+y}d.uniform1iv(o,k._array);y=0;for(m=k.texture.length;y<m;y++)(o=k.texture[y])&&O(o,k._array[y])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&
 d.uniformMatrix4fv(i.viewMatrix,!1,Ua);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ua),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);return f}function f(a,b,c,h,f,i){if(h.opacity!==
-0){var j,u,c=e(a,b,c,h,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(h.wireframe?1:0);c!==N&&(N=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),
-d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var p=i.morphTargetForcedOrder;for(u=i.morphTargetInfluences;j<h.numSupportedMorphTargets&&j<p.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=u[p[j]],j++}else{var p=[],q=-1,k=0;u=i.morphTargetInfluences;var n,o=u.length;j=0;for(i.morphTargetBase!==-1&&(p[i.morphTargetBase]=!0);j<h.numSupportedMorphTargets;){for(n=
-0;n<o;n++)!p[n]&&u[n]>q&&(k=n,q=u[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=q;p[k]=1;q=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(u=f.__webglCustomAttributesList.length;j<u;j++)c=f.__webglCustomAttributesList[j],a[c.buffer.belongsToAttribute]>=
+0){var j,u,c=e(a,b,c,h,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(h.wireframe?1:0);c!==Q&&(Q=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),
+d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var t=i.morphTargetForcedOrder;for(u=i.morphTargetInfluences;j<h.numSupportedMorphTargets&&j<t.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[t[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=u[t[j]],j++}else{var t=[],p=-1,k=0;u=i.morphTargetInfluences;var o,l=u.length;j=0;for(i.morphTargetBase!==-1&&(t[i.morphTargetBase]=!0);j<h.numSupportedMorphTargets;){for(o=
+0;o<l;o++)!t[o]&&u[o]>p&&(k=o,p=u[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=p;t[k]=1;p=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(u=f.__webglCustomAttributesList.length;j<u;j++)c=f.__webglCustomAttributesList[j],a[c.buffer.belongsToAttribute]>=
 0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}a.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(a.color,3,d.FLOAT,!1,0,0));a.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(a.normal,3,d.FLOAT,!1,0,0));a.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(a.tangent,4,d.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,
 f.__webglUVBuffer),d.vertexAttribPointer(a.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv)):d.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),d.vertexAttribPointer(a.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv2)):d.disableVertexAttribArray(a.uv2));h.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(a.skinVertexA,4,
 d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(a.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(a.skinIndex,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(a.skinWeight,4,d.FLOAT,!1,0,0))}i instanceof THREE.Mesh?(h.wireframe?(d.lineWidth(h.wireframeLinewidth),b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,
-d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),A.info.render.calls++,A.info.render.vertices+=f.__webglFaceCount,A.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),A.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),A.info.render.calls++):
-i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),A.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,
-a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,i,j,p,q,k,n,o,l=a.count*3;for(o=0;o<l;o+=9)c=a.normalArray,e=c[o],f=c[o+1],h=c[o+2],i=c[o+3],p=c[o+4],k=c[o+5],j=c[o+6],q=c[o+7],n=c[o+8],e=(e+i+j)/3,f=(f+p+q)/3,h=(h+k+n)/3,c[o]=e,c[o+1]=f,c[o+2]=h,c[o+3]=e,c[o+4]=f,c[o+5]=h,c[o+6]=e,c[o+7]=f,c[o+8]=h}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,
-0,a.count);a.count=0}function i(a){if(va!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),va=a.doubleSided;if(Ga!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),Ga=a.flipSided}function j(a){wa!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),wa=a)}function n(a){Ba!==a&&(d.depthMask(a),Ba=a)}function l(a,b,c){ya!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),ya=a);if(a&&($a!==b||ab!==c))d.polygonOffset(b,c),$a=b,ab=c}function o(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(var b,a=0;a<6;a++)b=Z[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function k(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
-Math.max(a.scale.y,a.scale.z)),c=0;c<6;c++)if(a=Z[c].x*b.n14+Z[c].y*b.n24+Z[c].z*b.n34+Z[c].w,a<=d)return!1;return!0}function r(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function v(a){var b=a.object,d=a.buffer,c;c=b.material;if(c instanceof THREE.MeshFaceMaterial){if(d=d.materialIndex,d>=0)b=b.geometry.materials[d],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=c)b.transparent?(a.transparent=b,
-a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a,b){return b.z-a.z}function B(a){var b,c,n,sa=0,J,l,u,p,q=a.lights;ja||(ja=new THREE.PerspectiveCamera(A.shadowCameraFov,A.shadowMapWidth/A.shadowMapHeight,A.shadowCameraNear,A.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(n=q[b],n instanceof THREE.SpotLight&&n.castShadow){Q=-1;A.shadowMap[sa]||(A.shadowMap[sa]=new THREE.WebGLRenderTarget(A.shadowMapWidth,A.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
-Ra[sa]||(Ra[sa]=new THREE.Matrix4);J=A.shadowMap[sa];l=Ra[sa];ja.position.copy(n.position);ja.lookAt(n.target.position);ja.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ja));this.autoUpdateScene&&a.updateMatrixWorld();ja.matrixWorldInverse.getInverse(ja.matrixWorld);l.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);l.multiplySelf(ja.projectionMatrix);l.multiplySelf(ja.matrixWorldInverse);ja.matrixWorldInverse.flattenToArray(Ua);ja.projectionMatrix.flattenToArray(Ta);
-Ca.multiply(ja.projectionMatrix,ja.matrixWorldInverse);o(Ca);ma(J);d.clearColor(1,1,1,1);A.clear();d.clearColor(ga.r,ga.g,ga.b,Ea);l=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(J=0;J<l;J++)u=a.__webglObjects[J],p=u.object,p.visible&&p.castShadow?!(p instanceof THREE.Mesh)||!p.frustumCulled||k(p)?(p.matrixWorld.flattenToArray(p._objectMatrixArray),E(p,ja,!1),u.render=!0):u.render=!1:u.render=!1;j(!0);I(THREE.NormalBlending);for(J=0;J<l;J++)if(u=a.__webglObjects[J],u.render)p=u.object,
-buffer=u.buffer,i(p),u=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?bb:Va,f(ja,q,null,u,buffer,p);for(J=0;J<n;J++)u=a.__webglObjectsImmediate[J],p=u.object,p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),N=-1,E(p,ja,!1),i(p),program=e(ja,q,null,Va,p),p.immediateRenderCallback?p.immediateRenderCallback(program,d,Z):p.render(function(a){h(a,program,Va.shading)}));sa++}}function F(a,b){var c,e,f;c=t.attributes;var h=t.uniforms,
-i=Ia/Sa,j,p=[],q=Sa*0.5,k=Ia*0.5,n=!0;d.useProgram(t.program);S=t.program;N=wa=Ka=-1;cb||(d.enableVertexAttribArray(t.attributes.position),d.enableVertexAttribArray(t.attributes.uv),cb=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,t.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,t.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Ta);d.activeTexture(d.TEXTURE0);
-d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(z);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,
-(f.position.x-q)/q,(k-f.position.y)/k,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?Ia:1),p[0]=j*i*f.scale.x,p[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),
-d.uniform3f(h.color,f.color.r,f.color.g,f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,p),f.mergeWith3D&&!n?(d.enable(d.DEPTH_TEST),n=!0):!f.mergeWith3D&&n&&(d.disable(d.DEPTH_TEST),n=!1),I(f.blending),ta(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Ba)}function E(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
-function fa(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function ia(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function ra(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function O(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function I(a){if(a!==Ka){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);
-d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}Ka=a}}function T(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,K(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,K(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,K(b.magFilter)),
-d.texParameteri(a,d.TEXTURE_MIN_FILTER,K(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,R(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,R(b.minFilter)))}function ta(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),A.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof
-THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,K(a.format),a.image.width,a.image.height,0,K(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);T(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function U(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,
-d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function ma(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=d.createTexture();
-if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);T(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,K(a.format),a.width,a.height,0,K(a.format),K(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,
-f,e.__webglTexture,0);U(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),T(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,K(a.format),a.width,a.height,0,K(a.format),K(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),
-U(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Sa,a=Ia,e=Wa,f=Xa);b!==W&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),W=b)}function pa(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),
-d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function X(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function R(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;
-default:return d.LINEAR}}function K(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;
+d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),F.info.render.calls++,F.info.render.vertices+=f.__webglFaceCount,F.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),F.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),F.info.render.calls++):
+i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),F.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,
+a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,i,j,t,k,o,l,m,y=a.count*3;for(m=0;m<y;m+=9)c=a.normalArray,e=c[m],f=c[m+1],h=c[m+2],i=c[m+3],t=c[m+4],o=c[m+5],j=c[m+6],k=c[m+7],l=c[m+8],e=(e+i+j)/3,f=(f+t+k)/3,h=(h+o+l)/3,c[m]=e,c[m+1]=f,c[m+2]=h,c[m+3]=e,c[m+4]=f,c[m+5]=h,c[m+6]=e,c[m+7]=f,c[m+8]=h}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,
+0,a.count);a.count=0}function i(a){if(T!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),T=a.doubleSided;if(X!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),X=a.flipSided}function j(a){U!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),U=a)}function l(a){ua!==a&&(d.depthMask(a),ua=a)}function m(a,b,c){za!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),za=a);if(a&&(Ka!==b||Qa!==c))d.polygonOffset(b,c),Ka=b,Qa=c}function k(a){ha[0].set(a.n41-
+a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ha[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ha[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ha[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ha[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ha[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ha[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function o(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
+Math.max(a.scale.y,a.scale.z)),c=0;c<6;c++)if(a=ha[c].x*b.n14+ha[c].y*b.n24+ha[c].z*b.n34+ha[c].w,a<=d)return!1;return!0}function v(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function q(a){var b=a.object,d=a.buffer,c;c=b.material;if(c instanceof THREE.MeshFaceMaterial){if(d=d.materialIndex,d>=0)b=b.geometry.materials[d],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=c)b.transparent?(a.transparent=
+b,a.opaque=null):(a.opaque=b,a.transparent=null)}function B(a,b){return b.z-a.z}function A(a){var b,c,m,l=0,K,q,u,t,p=a.lights;V||(V=new THREE.PerspectiveCamera(F.shadowCameraFov,F.shadowMapWidth/F.shadowMapHeight,F.shadowCameraNear,F.shadowCameraFar));b=0;for(c=p.length;b<c;b++)if(m=p[b],m instanceof THREE.SpotLight&&m.castShadow){J=-1;F.shadowMap[l]||(F.shadowMap[l]=new THREE.WebGLRenderTarget(F.shadowMapWidth,F.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
+Sa[l]||(Sa[l]=new THREE.Matrix4);K=F.shadowMap[l];q=Sa[l];V.position.copy(m.position);V.lookAt(m.target.position);V.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(V));this.autoUpdateScene&&a.updateMatrixWorld();V.matrixWorldInverse.getInverse(V.matrixWorld);q.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);q.multiplySelf(V.projectionMatrix);q.multiplySelf(V.matrixWorldInverse);V.matrixWorldInverse.flattenToArray(Ua);V.projectionMatrix.flattenToArray(Ta);Da.multiply(V.projectionMatrix,
+V.matrixWorldInverse);k(Da);C(K);d.clearColor(1,1,1,1);F.clear();d.clearColor(Y.r,Y.g,Y.b,Ea);q=a.__webglObjects.length;m=a.__webglObjectsImmediate.length;for(K=0;K<q;K++)u=a.__webglObjects[K],t=u.object,t.visible&&t.castShadow?!(t instanceof THREE.Mesh)||!t.frustumCulled||o(t)?(t.matrixWorld.flattenToArray(t._objectMatrixArray),Z(t,V,!1),u.render=!0):u.render=!1:u.render=!1;j(!0);N(THREE.NormalBlending);for(K=0;K<q;K++)if(u=a.__webglObjects[K],u.render)t=u.object,buffer=u.buffer,i(t),u=t.customDepthMaterial?
+t.customDepthMaterial:t.geometry.morphTargets.length?$a:Va,f(V,p,null,u,buffer,t);for(K=0;K<m;K++)u=a.__webglObjectsImmediate[K],t=u.object,t.visible&&t.castShadow&&(t.matrixAutoUpdate&&t.matrixWorld.flattenToArray(t._objectMatrixArray),Q=-1,Z(t,V,!1),i(t),program=e(V,p,null,Va,t),t.immediateRenderCallback?t.immediateRenderCallback(program,d,ha):t.render(function(a){h(a,program,Va.shading)}));l++}}function G(a,b){var c,e,f;c=s.attributes;var h=s.uniforms,i=Ia/ta,j,t=[],k=ta*0.5,m=Ia*0.5,o=!0;d.useProgram(s.program);
+Wa=s.program;Q=U=ka=-1;ab||(d.enableVertexAttribArray(s.attributes.position),d.enableVertexAttribArray(s.attributes.uv),ab=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,s.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Ta);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<
+e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(B);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-k)/k,(m-f.position.y)/
+m,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?Ia:1),t[0]=j*i*f.scale.x,t[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),d.uniform3f(h.color,f.color.r,f.color.g,
+f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,t),f.mergeWith3D&&!o?(d.enable(d.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(d.disable(d.DEPTH_TEST),o=!1),N(f.blending),O(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(ua)}function Z(a,b,d){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
+function ma(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function sa(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function va(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function R(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function N(a){if(a!==ka){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);
+d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}ka=a}}function E(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,P(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,P(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,P(b.magFilter)),
+d.texParameteri(a,d.TEXTURE_MIN_FILTER,P(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,wa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,wa(b.minFilter)))}function O(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),F.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof
+THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,P(a.format),a.image.width,a.image.height,0,P(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);E(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function qa(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,
+d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function C(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=d.createTexture();
+if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);E(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,P(a.format),a.width,a.height,0,P(a.format),P(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,
+f,e.__webglTexture,0);qa(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),E(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,P(a.format),a.width,a.height,0,P(a.format),P(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),
+qa(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=ta,a=Ia,e=Ba,f=Ca);b!==Ya&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),Ya=b)}function ja(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),
+d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function aa(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function wa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;
+default:return d.LINEAR}}function P(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;
 case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}
-var A=this,d,C=[],S=null,W=null,Q=-1,N=null,Aa=0,va=null,Ga=null,Ka=null,wa=null,Ba=null,ya=null,$a=null,ab=null,Wa=0,Xa=0,Sa=0,Ia=0,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ta=new Float32Array(16),Ua=new Float32Array(16),Ha=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Da=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-H=a.stencil!==void 0?a.stencil:!0,fb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,gb=a.antialias!==void 0?a.antialias:!1,ga=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Ea=a.clearAlpha!==void 0?a.clearAlpha:0,Ya=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Da;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
-this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var ja,Ra=[],a=THREE.ShaderLib.depthRGBA,db=THREE.UniformsUtils.clone(a.uniforms),Va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
-vertexShader:a.vertexShader,uniforms:db}),bb=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:db,morphTargets:!0});Va._shadowPass=!0;bb._shadowPass=!0;try{if(!(d=Da.getContext("experimental-webgl",{antialias:gb,stencil:H,preserveDrawingBuffer:fb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(hb){console.error(hb)}d.clearColor(0,
-0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(ga.r,ga.g,ga.b,Ea);this.context=d;var eb=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);H=0;t.vertices[H++]=-1;t.vertices[H++]=-1;t.vertices[H++]=0;t.vertices[H++]=1;t.vertices[H++]=
-1;t.vertices[H++]=-1;t.vertices[H++]=1;t.vertices[H++]=1;t.vertices[H++]=1;t.vertices[H++]=1;t.vertices[H++]=1;t.vertices[H++]=0;t.vertices[H++]=-1;t.vertices[H++]=1;t.vertices[H++]=0;H=t.vertices[H++]=0;t.faces[H++]=0;t.faces[H++]=1;t.faces[H++]=2;t.faces[H++]=0;t.faces[H++]=2;t.faces[H++]=3;t.vertexBuffer=d.createBuffer();t.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,t.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,t.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,t.elementBuffer);
-d.bufferData(d.ELEMENT_ARRAY_BUFFER,t.faces,d.STATIC_DRAW);t.program=d.createProgram();d.attachShader(t.program,X("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(t.program,X("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.position=d.getAttribLocation(t.program,"position");t.attributes.uv=d.getAttribLocation(t.program,"uv");t.uniforms.uvOffset=d.getUniformLocation(t.program,"uvOffset");t.uniforms.uvScale=d.getUniformLocation(t.program,
-"uvScale");t.uniforms.rotation=d.getUniformLocation(t.program,"rotation");t.uniforms.scale=d.getUniformLocation(t.program,"scale");t.uniforms.alignment=d.getUniformLocation(t.program,"alignment");t.uniforms.color=d.getUniformLocation(t.program,"color");t.uniforms.map=d.getUniformLocation(t.program,"map");t.uniforms.opacity=d.getUniformLocation(t.program,"opacity");t.uniforms.useScreenCoordinates=d.getUniformLocation(t.program,"useScreenCoordinates");t.uniforms.affectedByDistance=d.getUniformLocation(t.program,
-"affectedByDistance");t.uniforms.screenPosition=d.getUniformLocation(t.program,"screenPosition");t.uniforms.modelViewMatrix=d.getUniformLocation(t.program,"modelViewMatrix");t.uniforms.projectionMatrix=d.getUniformLocation(t.program,"projectionMatrix");var cb=!1;this.setSize=function(a,b){Da.width=a;Da.height=b;this.setViewport(0,0,Da.width,Da.height)};this.setViewport=function(a,b,c,e){Wa=a;Xa=b;Sa=c;Ia=e;d.viewport(Wa,Xa,Sa,Ia)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
-function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ga.setHex(a);Ea=b;d.clearColor(ga.r,ga.g,ga.b,Ea)};this.setClearColor=function(a,b){ga.copy(a);Ea=b;d.clearColor(ga.r,ga.g,ga.b,Ea)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return Ea};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d};
+var F=this,d,xa=[],Wa=null,Ya=null,J=-1,Q=null,S=0,T=null,X=null,ka=null,U=null,ua=null,za=null,Ka=null,Qa=null,Ba=0,Ca=0,ta=0,Ia=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Ta=new Float32Array(16),Ua=new Float32Array(16),Ha=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},ya=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+I=a.stencil!==void 0?a.stencil:!0,db=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,eb=a.antialias!==void 0?a.antialias:!1,Y=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Ea=a.clearAlpha!==void 0?a.clearAlpha:0,Xa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=ya;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
+this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var V,Sa=[],a=THREE.ShaderLib.depthRGBA,bb=THREE.UniformsUtils.clone(a.uniforms),Va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:bb}),$a=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:bb,morphTargets:!0});Va._shadowPass=!0;$a._shadowPass=!0;try{if(!(d=ya.getContext("experimental-webgl",{antialias:eb,stencil:I,preserveDrawingBuffer:db})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(fb){console.error(fb)}d.clearColor(0,
+0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(Y.r,Y.g,Y.b,Ea);this.context=d;var cb=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,s={};s.vertices=new Float32Array(16);s.faces=new Uint16Array(6);I=0;s.vertices[I++]=-1;s.vertices[I++]=-1;s.vertices[I++]=0;s.vertices[I++]=1;s.vertices[I++]=1;
+s.vertices[I++]=-1;s.vertices[I++]=1;s.vertices[I++]=1;s.vertices[I++]=1;s.vertices[I++]=1;s.vertices[I++]=1;s.vertices[I++]=0;s.vertices[I++]=-1;s.vertices[I++]=1;s.vertices[I++]=0;I=s.vertices[I++]=0;s.faces[I++]=0;s.faces[I++]=1;s.faces[I++]=2;s.faces[I++]=0;s.faces[I++]=2;s.faces[I++]=3;s.vertexBuffer=d.createBuffer();s.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,s.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,s.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s.elementBuffer);
+d.bufferData(d.ELEMENT_ARRAY_BUFFER,s.faces,d.STATIC_DRAW);s.program=d.createProgram();d.attachShader(s.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(s.program,aa("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(s.program);s.attributes={};s.uniforms={};s.attributes.position=d.getAttribLocation(s.program,"position");s.attributes.uv=d.getAttribLocation(s.program,"uv");s.uniforms.uvOffset=d.getUniformLocation(s.program,"uvOffset");s.uniforms.uvScale=d.getUniformLocation(s.program,
+"uvScale");s.uniforms.rotation=d.getUniformLocation(s.program,"rotation");s.uniforms.scale=d.getUniformLocation(s.program,"scale");s.uniforms.alignment=d.getUniformLocation(s.program,"alignment");s.uniforms.color=d.getUniformLocation(s.program,"color");s.uniforms.map=d.getUniformLocation(s.program,"map");s.uniforms.opacity=d.getUniformLocation(s.program,"opacity");s.uniforms.useScreenCoordinates=d.getUniformLocation(s.program,"useScreenCoordinates");s.uniforms.affectedByDistance=d.getUniformLocation(s.program,
+"affectedByDistance");s.uniforms.screenPosition=d.getUniformLocation(s.program,"screenPosition");s.uniforms.modelViewMatrix=d.getUniformLocation(s.program,"modelViewMatrix");s.uniforms.projectionMatrix=d.getUniformLocation(s.program,"projectionMatrix");var ab=!1;this.setSize=function(a,b){ya.width=a;ya.height=b;this.setViewport(0,0,ya.width,ya.height)};this.setViewport=function(a,b,c,e){Ba=a;Ca=b;ta=c;Ia=e;d.viewport(Ba,Ca,ta,Ia)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
+function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Y.setHex(a);Ea=b;d.clearColor(Y.r,Y.g,Y.b,Ea)};this.setClearColor=function(a,b){Y.copy(a);Ea=b;d.clearColor(Y.r,Y.g,Y.b,Ea)};this.getClearColor=function(){return Y};this.getClearAlpha=function(){return Ea};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d};
 this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];d.deleteBuffer(b.__webglVertexBuffer);d.deleteBuffer(b.__webglNormalBuffer);d.deleteBuffer(b.__webglTangentBuffer);d.deleteBuffer(b.__webglColorBuffer);d.deleteBuffer(b.__webglUVBuffer);d.deleteBuffer(b.__webglUV2Buffer);d.deleteBuffer(b.__webglSkinVertexABuffer);
-d.deleteBuffer(b.__webglSkinVertexBBuffer);d.deleteBuffer(b.__webglSkinIndicesBuffer);d.deleteBuffer(b.__webglSkinWeightsBuffer);d.deleteBuffer(b.__webglFaceBuffer);d.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)d.deleteBuffer(b.__webglMorphTargetsBuffers[c]);A.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--;else if(a instanceof
-THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),A.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":
-a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var p=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q,k,n;q=n=p=0;for(k=b.length;q<k;q++)i=b[q],i instanceof
-THREE.SpotLight&&n++,i instanceof THREE.DirectionalLight&&n++,i instanceof THREE.PointLight&&p++;p+n<=Ya?q=n:(q=Math.ceil(Ya*n/(p+n)),p=Ya-q);i={directional:q,point:p};p=n=0;for(q=b.length;p<q;p++)k=b[p],k instanceof THREE.SpotLight&&k.castShadow&&n++;var o=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)o=e.bones.length;var l;a:{q=a.fragmentShader;k=a.vertexShader;var p=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:i.directional,maxPointLights:i.point,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},r,e=[];j?e.push(j):(e.push(q),e.push(k));for(r in c)e.push(r),e.push(c[r]);j=e.join();r=0;
-for(e=C.length;r<e;r++)if(C[r].code===j){l=C[r].program;break a}r=d.createProgram();e=[eb?"#define VERTEX_TEXTURES":"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.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":
+d.deleteBuffer(b.__webglSkinVertexBBuffer);d.deleteBuffer(b.__webglSkinIndicesBuffer);d.deleteBuffer(b.__webglSkinWeightsBuffer);d.deleteBuffer(b.__webglFaceBuffer);d.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)d.deleteBuffer(b.__webglMorphTargetsBuffers[c]);F.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof
+THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),F.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":
+a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var p,m,o;p=o=k=0;for(m=b.length;p<m;p++)i=b[p],i instanceof
+THREE.SpotLight&&o++,i instanceof THREE.DirectionalLight&&o++,i instanceof THREE.PointLight&&k++;k+o<=Xa?p=o:(p=Math.ceil(Xa*o/(k+o)),k=Xa-p);i={directional:p,point:k};k=o=0;for(p=b.length;k<p;k++)m=b[k],m instanceof THREE.SpotLight&&m.castShadow&&o++;var l=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)l=e.bones.length;var y;a:{p=a.fragmentShader;m=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:i.directional,maxPointLights:i.point,maxBones:l,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},q,e=[];j?e.push(j):(e.push(p),e.push(m));for(q in c)e.push(q),e.push(c[q]);j=e.join();q=0;
+for(e=xa.length;q<e;q++)if(xa[q].code===j){y=xa[q].program;break a}q=d.createProgram();e=[cb?"#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.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");
-i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.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");d.attachShader(r,X("fragment",i+q));d.attachShader(r,
-X("vertex",e+k));d.linkProgram(r);d.getProgramParameter(r,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(r,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");r.uniforms={};r.attributes={};var v,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in p)e.push(v);v=e;e=0;for(p=v.length;e<p;e++)q=v[e],r.uniforms[q]=d.getUniformLocation(r,
-q);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)e.push("morphTarget"+v);for(l in b)e.push(l);l=e;v=0;for(b=l.length;v<b;v++)c=l[v],r.attributes[c]=d.getAttribLocation(r,c);r.id=C.length;C.push({program:r,code:j});A.info.memory.programs=C.length;l=r}a.program=l;l=a.program.attributes;l.position>=0&&d.enableVertexAttribArray(l.position);l.color>=0&&d.enableVertexAttribArray(l.color);l.normal>=0&&d.enableVertexAttribArray(l.normal);
-l.tangent>=0&&d.enableVertexAttribArray(l.tangent);a.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0&&(d.enableVertexAttribArray(l.skinVertexA),d.enableVertexAttribArray(l.skinVertexB),d.enableVertexAttribArray(l.skinIndex),d.enableVertexAttribArray(l.skinWeight));if(a.attributes)for(h in a.attributes)l[h]!==void 0&&l[h]>=0&&d.enableVertexAttribArray(l[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)v="morphTarget"+h,l[v]>=0&&(d.enableVertexAttribArray(l[v]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){ma(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){B(a,b)};this.render=function(a,b,c,t){var sa,J,Qa,u,p,q,Pa,xa=a.lights,za=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&B(a,b);A.info.render.calls=0;A.info.render.vertices=0;A.info.render.faces=0;b.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ua);b.projectionMatrix.flattenToArray(Ta);Ca.multiply(b.projectionMatrix,b.matrixWorldInverse);o(Ca);ma(c);(this.autoClear||t)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Qa=a.__webglObjects.length;for(t=0;t<Qa;t++)if(p=a.__webglObjects[t],q=p.object,q.visible)if(!(q instanceof THREE.Mesh)||!q.frustumCulled||k(q)){if(q.matrixWorld.flattenToArray(q._objectMatrixArray),
-E(q,b,!0),v(p),p.render=!0,this.sortObjects)q.renderDepth?p.z=q.renderDepth:(Ha.copy(q.position),Ca.multiplyVector3(Ha),p.z=Ha.z)}else p.render=!1;else p.render=!1;this.sortObjects&&a.__webglObjects.sort(z);u=a.__webglObjectsImmediate.length;for(t=0;t<u;t++)p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),E(q,b,!0),r(p));if(a.overrideMaterial){j(a.overrideMaterial.depthTest);I(a.overrideMaterial.blending);for(t=0;t<Qa;t++)if(p=
-a.__webglObjects[t],p.render)q=p.object,Pa=p.buffer,i(q),f(b,xa,za,a.overrideMaterial,Pa,q);for(t=0;t<u;t++)p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(N=-1,i(q),sa=e(b,xa,za,a.overrideMaterial,q),q.immediateRenderCallback?q.immediateRenderCallback(sa,d,Z):q.render(function(b){h(b,sa,a.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(t=Qa-1;t>=0;t--)if(p=a.__webglObjects[t],p.render&&(q=p.object,Pa=p.buffer,J=p.opaque))i(q),j(J.depthTest),n(J.depthWrite),l(J.polygonOffset,J.polygonOffsetFactor,
-J.polygonOffsetUnits),f(b,xa,za,J,Pa,q);for(t=0;t<u;t++)if(p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(N=-1,J=p.opaque))i(q),j(J.depthTest),n(J.depthWrite),l(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),sa=e(b,xa,za,J,q),q.immediateRenderCallback?q.immediateRenderCallback(sa,d,Z):q.render(function(a){h(a,sa,J.shading)});for(t=0;t<Qa;t++)if(p=a.__webglObjects[t],p.render&&(q=p.object,Pa=p.buffer,J=p.transparent))i(q),I(J.blending),j(J.depthTest),n(J.depthWrite),l(J.polygonOffset,
-J.polygonOffsetFactor,J.polygonOffsetUnits),f(b,xa,za,J,Pa,q);for(t=0;t<u;t++)if(p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(N=-1,J=p.transparent))i(q),I(J.blending),j(J.depthTest),n(J.depthWrite),l(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),sa=e(b,xa,za,J,q),q.immediateRenderCallback?q.immediateRenderCallback(sa,d,Z):q.render(function(a){h(a,sa,J.shading)})}a.__webglSprites.length&&F(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&pa(c)};this.initWebGLObjects=
-function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,i=void 0,j=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){i=e.geometry;if(i.geometryGroups===
-void 0){var j=i,k=void 0,n=void 0,p=void 0,q=void 0,l=p=void 0,o=void 0,r={},t=j.morphTargets.length;j.geometryGroups={};k=0;for(n=j.faces.length;k<n;k++)p=j.faces[k],q=p.materialIndex,l=q!==void 0?q:-1,r[l]===void 0&&(r[l]={hash:l,counter:0}),o=r[l].hash+"_"+r[l].counter,j.geometryGroups[o]===void 0&&(j.geometryGroups[o]={faces:[],materialIndex:q,vertices:0,numMorphTargets:t}),p=p instanceof THREE.Face3?3:4,j.geometryGroups[o].vertices+p>65535&&(r[l].counter+=1,o=r[l].hash+"_"+r[l].counter,j.geometryGroups[o]===
-void 0&&(j.geometryGroups[o]={faces:[],materialIndex:q,vertices:0,numMorphTargets:t})),j.geometryGroups[o].faces.push(k),j.geometryGroups[o].vertices+=p;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=Aa++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=
-d.createBuffer();k.__webglUVBuffer=d.createBuffer();k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){q=n=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(q=k.numMorphTargets;n<q;n++)k.__webglMorphTargetsBuffers.push(d.createBuffer())}A.info.memory.geometries++;
-for(var q=e,v=p=r=void 0,l=v=t=v=void 0,o=l=k=0,z=p=void 0,B=void 0,p=n=t=r=void 0,t=q.geometry,z=t.faces,B=j.faces,r=0,p=B.length;r<p;r++)v=B[r],v=z[v],v instanceof THREE.Face3?(k+=3,l+=1,o+=3):v instanceof THREE.Face4&&(k+=4,l+=2,o+=4);r=b(q,j);p=r.map||r.lightMap||r instanceof THREE.ShaderMaterial?!0:!1;B=r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial?!1:r&&r.shading!==void 0&&r.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;z=r.vertexColors?
-r.vertexColors:!1;j.__vertexArray=new Float32Array(k*3);if(B)j.__normalArray=new Float32Array(k*3);if(t.hasTangents)j.__tangentArray=new Float32Array(k*4);if(z)j.__colorArray=new Float32Array(k*3);if(p){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(q.geometry.skinWeights.length&&q.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*
-4),j.__skinIndexArray=new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(l*3);j.__lineArray=new Uint16Array(o*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(v=j.numMorphTargets;t<v;t++)j.__morphTargetsArrays.push(new Float32Array(k*3))}j.__needsSmoothNormals=B===THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=z;j.__normalType=B;j.__webglFaceCount=l*3;j.__webglLineCount=o*2;if(r.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=
-[];q=void 0;for(q in r.attributes){p=r.attributes[q];t={};for(n in p)t[n]=p[n];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,l=1,t.type==="v2"?l=2:t.type==="v3"?l=3:t.type==="v4"?l=4:t.type==="c"&&(l=3),t.size=l,t.array=new Float32Array(k*l),t.buffer=d.createBuffer(),t.buffer.belongsToAttribute=q,p.needsUpdate=!0,t.__original=p;j.__webglCustomAttributesList.push(t)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=
-!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),A.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.Line){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),
-j.__webglColorBuffer=d.createBuffer(),A.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(i=e.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=d.createBuffer();j.__webglColorBuffer=d.createBuffer();A.info.geometries++;j=i;n=e;k=j.vertices.length;j.__vertexArray=new Float32Array(k*3);j.__colorArray=new Float32Array(k*
-3);j.__sortArray=[];j.__webglParticleCount=k;n=n.material;if(n.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];q=void 0;for(q in n.attributes){originalAttribute=n.attributes[q];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:
-attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=q,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in i=e.geometry,i.geometryGroups)j=i.geometryGroups[h],O(f.__webglObjects,j,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
-e instanceof THREE.ParticleSystem?(i=e.geometry,O(f.__webglObjects,i,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)ra(f.__webglObjects,
-e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;for(i=f.length-1;i>=0;i--)f[i]===h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&ra(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(i=a.__webglObjects[e].object,h=i.geometry,j=l=q=void 0,i instanceof THREE.Mesh){k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(q=h.geometryGroupsList[k],j=b(i,q),l=j.attributes&&fa(j),h.__dirtyVertices||
-h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||l)if(l=d.DYNAMIC_DRAW,o=!h.dynamic,q.__inittedArrays){var C=t=r=void 0,y=void 0,F=C=void 0,E=void 0,K=void 0,N=void 0,U=v=B=z=p=void 0,G=void 0,L=void 0,M=void 0,H=void 0,w=y=N=y=K=E=void 0,D=void 0,s=D=w=E=void 0,m=void 0,s=D=w=C=C=F=D=w=y=s=D=w=m=s=D=w=m=s=D=w=void 0,ha=0,I=0,T=0,W=0,S=0,Q=0,Y=0,R=0,ka=0,x=0,la=0,V=s=0,V=void 0,na=q.__vertexArray,ja=q.__uvArray,ma=q.__uv2Array,X=q.__normalArray,
-$=q.__tangentArray,oa=q.__colorArray,aa=q.__skinVertexAArray,ca=q.__skinVertexBArray,da=q.__skinIndexArray,ea=q.__skinWeightArray,pa=q.__morphTargetsArrays,Z=q.__webglCustomAttributesList,m=void 0,ga=q.__faceArray,ua=q.__lineArray,ta=q.__needsSmoothNormals,z=q.__vertexColorType,p=q.__uvType,B=q.__normalType,qa=i.geometry,va=qa.__dirtyVertices,ya=qa.__dirtyElements,wa=qa.__dirtyUvs,Ba=qa.__dirtyNormals,Ca=qa.__dirtyTangents,Da=qa.__dirtyColors,Ea=qa.__dirtyMorphTargets,La=qa.vertices,Ga=q.faces,Ka=
-qa.faces,Ha=qa.faceVertexUvs[0],Ia=qa.faceVertexUvs[1],Ma=qa.skinVerticesA,Na=qa.skinVerticesB,Oa=qa.skinIndices,Ja=qa.skinWeights,Fa=qa.morphTargets;if(Z){w=0;for(D=Z.length;w<D;w++)Z[w].offset=0,Z[w].offsetSrc=0}r=0;for(t=Ga.length;r<t;r++)if(C=Ga[r],y=Ka[C],Ha&&(v=Ha[C]),Ia&&(U=Ia[C]),C=y.vertexNormals,F=y.normal,E=y.vertexColors,K=y.color,N=y.vertexTangents,y instanceof THREE.Face3){if(va)G=La[y.a].position,L=La[y.b].position,M=La[y.c].position,na[I]=G.x,na[I+1]=G.y,na[I+2]=G.z,na[I+3]=L.x,na[I+
-4]=L.y,na[I+5]=L.z,na[I+6]=M.x,na[I+7]=M.y,na[I+8]=M.z,I+=9;if(Z){w=0;for(D=Z.length;w<D;w++)if(m=Z[w],m.__original.needsUpdate)s=m.offset,V=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[y.a],m.array[s+1]=m.value[y.b],m.array[s+2]=m.value[y.c]):m.boundTo==="faces"?(V=m.value[V],m.array[s]=V,m.array[s+1]=V,m.array[s+2]=V,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[V],m.array[s+1]=m.value[V+1],m.array[s+2]=m.value[V+2],m.offsetSrc+=3),m.offset+=
-3):(m.boundTo===void 0||m.boundTo==="vertices"?(G=m.value[y.a],L=m.value[y.b],M=m.value[y.c]):m.boundTo==="faces"?(M=L=G=V=m.value[V],m.offsetSrc++):m.boundTo==="faceVertices"&&(G=m.value[V],L=m.value[V+1],M=m.value[V+2],m.offsetSrc+=3),m.size===2?(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=L.x,m.array[s+3]=L.y,m.array[s+4]=M.x,m.array[s+5]=M.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s]=G.r,m.array[s+1]=G.g,m.array[s+2]=G.b,m.array[s+3]=L.r,m.array[s+4]=L.g,m.array[s+5]=L.b,m.array[s+6]=
-M.r,m.array[s+7]=M.g,m.array[s+8]=M.b):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=L.x,m.array[s+4]=L.y,m.array[s+5]=L.z,m.array[s+6]=M.x,m.array[s+7]=M.y,m.array[s+8]=M.z),m.offset+=9):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=G.w,m.array[s+4]=L.x,m.array[s+5]=L.y,m.array[s+6]=L.z,m.array[s+7]=L.w,m.array[s+8]=M.x,m.array[s+9]=M.y,m.array[s+10]=M.z,m.array[s+11]=M.w,m.offset+=12))}if(Ea){w=0;for(D=Fa.length;w<D;w++)G=Fa[w].vertices[y.a].position,L=Fa[w].vertices[y.b].position,
-M=Fa[w].vertices[y.c].position,s=pa[w],s[la]=G.x,s[la+1]=G.y,s[la+2]=G.z,s[la+3]=L.x,s[la+4]=L.y,s[la+5]=L.z,s[la+6]=M.x,s[la+7]=M.y,s[la+8]=M.z;la+=9}if(Ja.length)w=Ja[y.a],D=Ja[y.b],s=Ja[y.c],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=w.w,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=D.w,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=s.w,w=Oa[y.a],D=Oa[y.b],s=Oa[y.c],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=w.w,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=D.w,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+
-11]=s.w,w=Ma[y.a],D=Ma[y.b],s=Ma[y.c],aa[x]=w.x,aa[x+1]=w.y,aa[x+2]=w.z,aa[x+3]=1,aa[x+4]=D.x,aa[x+5]=D.y,aa[x+6]=D.z,aa[x+7]=1,aa[x+8]=s.x,aa[x+9]=s.y,aa[x+10]=s.z,aa[x+11]=1,w=Na[y.a],D=Na[y.b],s=Na[y.c],ca[x]=w.x,ca[x+1]=w.y,ca[x+2]=w.z,ca[x+3]=1,ca[x+4]=D.x,ca[x+5]=D.y,ca[x+6]=D.z,ca[x+7]=1,ca[x+8]=s.x,ca[x+9]=s.y,ca[x+10]=s.z,ca[x+11]=1,x+=12;if(Da&&z)E.length===3&&z===THREE.VertexColors?(y=E[0],w=E[1],D=E[2]):D=w=y=K,oa[ka]=y.r,oa[ka+1]=y.g,oa[ka+2]=y.b,oa[ka+3]=w.r,oa[ka+4]=w.g,oa[ka+5]=w.b,
-oa[ka+6]=D.r,oa[ka+7]=D.g,oa[ka+8]=D.b,ka+=9;if(Ca&&qa.hasTangents)E=N[0],K=N[1],y=N[2],$[Y]=E.x,$[Y+1]=E.y,$[Y+2]=E.z,$[Y+3]=E.w,$[Y+4]=K.x,$[Y+5]=K.y,$[Y+6]=K.z,$[Y+7]=K.w,$[Y+8]=y.x,$[Y+9]=y.y,$[Y+10]=y.z,$[Y+11]=y.w,Y+=12;if(Ba&&B)if(C.length===3&&ta)for(w=0;w<3;w++)F=C[w],X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;else for(w=0;w<3;w++)X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;if(wa&&v!==void 0&&p)for(w=0;w<3;w++)C=v[w],ja[T]=C.u,ja[T+1]=C.v,T+=2;if(wa&&U!==void 0&&p)for(w=0;w<3;w++)C=U[w],ma[W]=C.u,ma[W+
-1]=C.v,W+=2;ya&&(ga[S]=ha,ga[S+1]=ha+1,ga[S+2]=ha+2,S+=3,ua[R]=ha,ua[R+1]=ha+1,ua[R+2]=ha,ua[R+3]=ha+2,ua[R+4]=ha+1,ua[R+5]=ha+2,R+=6,ha+=3)}else if(y instanceof THREE.Face4){if(va)G=La[y.a].position,L=La[y.b].position,M=La[y.c].position,H=La[y.d].position,na[I]=G.x,na[I+1]=G.y,na[I+2]=G.z,na[I+3]=L.x,na[I+4]=L.y,na[I+5]=L.z,na[I+6]=M.x,na[I+7]=M.y,na[I+8]=M.z,na[I+9]=H.x,na[I+10]=H.y,na[I+11]=H.z,I+=12;if(Z){w=0;for(D=Z.length;w<D;w++)if(m=Z[w],m.__original.needsUpdate)s=m.offset,V=m.offsetSrc,m.size===
-1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[y.a],m.array[s+1]=m.value[y.b],m.array[s+2]=m.value[y.c],m.array[s+3]=m.value[y.d]):m.boundTo==="faces"?(V=m.value[V],m.array[s]=V,m.array[s+1]=V,m.array[s+2]=V,m.array[s+3]=V,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[V],m.array[s+1]=m.value[V+1],m.array[s+2]=m.value[V+2],m.array[s+3]=m.value[V+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(G=m.value[y.a],L=m.value[y.b],M=m.value[y.c],
-H=m.value[y.d]):m.boundTo==="faces"?(H=M=L=G=V=m.value[V],m.offsetSrc++):m.boundTo==="faceVertices"&&(G=m.value[V],L=m.value[V+1],M=m.value[V+2],H=m.value[V+3],m.offsetSrc+=4),m.size===2?(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=L.x,m.array[s+3]=L.y,m.array[s+4]=M.x,m.array[s+5]=M.y,m.array[s+6]=H.x,m.array[s+7]=H.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s]=G.r,m.array[s+1]=G.g,m.array[s+2]=G.b,m.array[s+3]=L.r,m.array[s+4]=L.g,m.array[s+5]=L.b,m.array[s+6]=M.r,m.array[s+7]=M.g,m.array[s+
-8]=M.b,m.array[s+9]=H.r,m.array[s+10]=H.g,m.array[s+11]=H.b):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=L.x,m.array[s+4]=L.y,m.array[s+5]=L.z,m.array[s+6]=M.x,m.array[s+7]=M.y,m.array[s+8]=M.z,m.array[s+9]=H.x,m.array[s+10]=H.y,m.array[s+11]=H.z),m.offset+=12):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=G.w,m.array[s+4]=L.x,m.array[s+5]=L.y,m.array[s+6]=L.z,m.array[s+7]=L.w,m.array[s+8]=M.x,m.array[s+9]=M.y,m.array[s+10]=M.z,m.array[s+11]=M.w,m.array[s+12]=H.x,
-m.array[s+13]=H.y,m.array[s+14]=H.z,m.array[s+15]=H.w,m.offset+=16))}if(Ea){w=0;for(D=Fa.length;w<D;w++)G=Fa[w].vertices[y.a].position,L=Fa[w].vertices[y.b].position,M=Fa[w].vertices[y.c].position,H=Fa[w].vertices[y.d].position,s=pa[w],s[la]=G.x,s[la+1]=G.y,s[la+2]=G.z,s[la+3]=L.x,s[la+4]=L.y,s[la+5]=L.z,s[la+6]=M.x,s[la+7]=M.y,s[la+8]=M.z,s[la+9]=H.x,s[la+10]=H.y,s[la+11]=H.z;la+=12}if(Ja.length)w=Ja[y.a],D=Ja[y.b],s=Ja[y.c],m=Ja[y.d],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=w.w,ea[x+4]=D.x,ea[x+
-5]=D.y,ea[x+6]=D.z,ea[x+7]=D.w,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=s.w,ea[x+12]=m.x,ea[x+13]=m.y,ea[x+14]=m.z,ea[x+15]=m.w,w=Oa[y.a],D=Oa[y.b],s=Oa[y.c],m=Oa[y.d],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=w.w,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=D.w,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+11]=s.w,da[x+12]=m.x,da[x+13]=m.y,da[x+14]=m.z,da[x+15]=m.w,w=Ma[y.a],D=Ma[y.b],s=Ma[y.c],m=Ma[y.d],aa[x]=w.x,aa[x+1]=w.y,aa[x+2]=w.z,aa[x+3]=1,aa[x+4]=D.x,aa[x+5]=D.y,aa[x+6]=D.z,aa[x+7]=1,aa[x+
-8]=s.x,aa[x+9]=s.y,aa[x+10]=s.z,aa[x+11]=1,aa[x+12]=m.x,aa[x+13]=m.y,aa[x+14]=m.z,aa[x+15]=1,w=Na[y.a],D=Na[y.b],s=Na[y.c],y=Na[y.d],ca[x]=w.x,ca[x+1]=w.y,ca[x+2]=w.z,ca[x+3]=1,ca[x+4]=D.x,ca[x+5]=D.y,ca[x+6]=D.z,ca[x+7]=1,ca[x+8]=s.x,ca[x+9]=s.y,ca[x+10]=s.z,ca[x+11]=1,ca[x+12]=y.x,ca[x+13]=y.y,ca[x+14]=y.z,ca[x+15]=1,x+=16;if(Da&&z)E.length===4&&z===THREE.VertexColors?(y=E[0],w=E[1],D=E[2],E=E[3]):E=D=w=y=K,oa[ka]=y.r,oa[ka+1]=y.g,oa[ka+2]=y.b,oa[ka+3]=w.r,oa[ka+4]=w.g,oa[ka+5]=w.b,oa[ka+6]=D.r,
-oa[ka+7]=D.g,oa[ka+8]=D.b,oa[ka+9]=E.r,oa[ka+10]=E.g,oa[ka+11]=E.b,ka+=12;if(Ca&&qa.hasTangents)E=N[0],K=N[1],y=N[2],N=N[3],$[Y]=E.x,$[Y+1]=E.y,$[Y+2]=E.z,$[Y+3]=E.w,$[Y+4]=K.x,$[Y+5]=K.y,$[Y+6]=K.z,$[Y+7]=K.w,$[Y+8]=y.x,$[Y+9]=y.y,$[Y+10]=y.z,$[Y+11]=y.w,$[Y+12]=N.x,$[Y+13]=N.y,$[Y+14]=N.z,$[Y+15]=N.w,Y+=16;if(Ba&&B)if(C.length===4&&ta)for(w=0;w<4;w++)F=C[w],X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;else for(w=0;w<4;w++)X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;if(wa&&v!==void 0&&p)for(w=0;w<4;w++)C=v[w],ja[T]=
-C.u,ja[T+1]=C.v,T+=2;if(wa&&U!==void 0&&p)for(w=0;w<4;w++)C=U[w],ma[W]=C.u,ma[W+1]=C.v,W+=2;ya&&(ga[S]=ha,ga[S+1]=ha+1,ga[S+2]=ha+3,ga[S+3]=ha+1,ga[S+4]=ha+2,ga[S+5]=ha+3,S+=6,ua[R]=ha,ua[R+1]=ha+1,ua[R+2]=ha,ua[R+3]=ha+3,ua[R+4]=ha+1,ua[R+5]=ha+2,ua[R+6]=ha+2,ua[R+7]=ha+3,R+=8,ha+=4)}va&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,na,l));if(Z){w=0;for(D=Z.length;w<D;w++)m=Z[w],m.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,m.buffer),d.bufferData(d.ARRAY_BUFFER,
-m.array,l))}if(Ea){w=0;for(D=Fa.length;w<D;w++)d.bindBuffer(d.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[w]),d.bufferData(d.ARRAY_BUFFER,pa[w],l)}Da&&ka>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,oa,l));Ba&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,X,l));Ca&&qa.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,$,l));wa&&T>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,
-ja,l));wa&&W>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ma,l));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ga,l),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ua,l));x>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,aa,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,ca,l),d.bindBuffer(d.ARRAY_BUFFER,
-q.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,da,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ea,l));o&&(delete q.__inittedArrays,delete q.__colorArray,delete q.__normalArray,delete q.__tangentArray,delete q.__uvArray,delete q.__uv2Array,delete q.__faceArray,delete q.__vertexArray,delete q.__lineArray,delete q.__skinVertexAArray,delete q.__skinVertexBArray,delete q.__skinIndexArray,delete q.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=
-!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyColors=!1;h.__dirtyTangents=!1;j.attributes&&ia(j)}else if(i instanceof THREE.Ribbon){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=r=o=o=void 0;t=i.vertices;n=i.colors;p=t.length;q=n.length;z=i.__vertexArray;l=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(o=0;o<p;o++)r=t[o].position,k=o*3,z[k]=r.x,z[k+1]=r.y,z[k+2]=r.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,z,
-j)}if(B){for(o=0;o<q;o++)color=n[o],k=o*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=r=o=o=void 0;t=i.vertices;n=i.colors;p=t.length;q=n.length;z=i.__vertexArray;l=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(o=0;o<p;o++)r=t[o].position,k=o*3,z[k]=r.x,z[k+1]=r.y,z[k+2]=
-r.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,z,j)}if(B){for(o=0;o<q;o++)color=n[o],k=o*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)j=b(i,q),l=j.attributes&&fa(j),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||l)&&c(h,d.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,j.attributes&&
-ia(j)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return eb}};
+i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",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");d.attachShader(q,aa("fragment",i+p));d.attachShader(q,
+aa("vertex",e+m));d.linkProgram(q);d.getProgramParameter(q,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(q,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");q.uniforms={};q.attributes={};var v,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in k)e.push(v);v=e;e=0;for(k=v.length;e<k;e++)p=v[e],q.uniforms[p]=d.getUniformLocation(q,
+p);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)e.push("morphTarget"+v);for(y in b)e.push(y);y=e;v=0;for(b=y.length;v<b;v++)c=y[v],q.attributes[c]=d.getAttribLocation(q,c);q.id=xa.length;xa.push({program:q,code:j});F.info.memory.programs=xa.length;y=q}a.program=y;y=a.program.attributes;y.position>=0&&d.enableVertexAttribArray(y.position);y.color>=0&&d.enableVertexAttribArray(y.color);y.normal>=0&&d.enableVertexAttribArray(y.normal);
+y.tangent>=0&&d.enableVertexAttribArray(y.tangent);a.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0&&(d.enableVertexAttribArray(y.skinVertexA),d.enableVertexAttribArray(y.skinVertexB),d.enableVertexAttribArray(y.skinIndex),d.enableVertexAttribArray(y.skinWeight));if(a.attributes)for(h in a.attributes)y[h]!==void 0&&y[h]>=0&&d.enableVertexAttribArray(y[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)v="morphTarget"+h,y[v]>=0&&(d.enableVertexAttribArray(y[v]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){C(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){A(a,b)};this.render=function(a,b,c,s){var Ga,K,Ra,u,t,p,Oa,Pa=a.lights,Aa=a.fog;J=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&A(a,b);F.info.render.calls=0;F.info.render.vertices=0;F.info.render.faces=0;b.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ua);b.projectionMatrix.flattenToArray(Ta);Da.multiply(b.projectionMatrix,b.matrixWorldInverse);k(Da);C(c);(this.autoClear||s)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Ra=a.__webglObjects.length;for(s=0;s<Ra;s++)if(t=a.__webglObjects[s],p=t.object,p.visible)if(!(p instanceof THREE.Mesh)||!p.frustumCulled||o(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),
+Z(p,b,!0),q(t),t.render=!0,this.sortObjects)p.renderDepth?t.z=p.renderDepth:(Ha.copy(p.position),Da.multiplyVector3(Ha),t.z=Ha.z)}else t.render=!1;else t.render=!1;this.sortObjects&&a.__webglObjects.sort(B);u=a.__webglObjectsImmediate.length;for(s=0;s<u;s++)t=a.__webglObjectsImmediate[s],p=t.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),Z(p,b,!0),v(t));if(a.overrideMaterial){j(a.overrideMaterial.depthTest);N(a.overrideMaterial.blending);for(s=0;s<Ra;s++)if(t=
+a.__webglObjects[s],t.render)p=t.object,Oa=t.buffer,i(p),f(b,Pa,Aa,a.overrideMaterial,Oa,p);for(s=0;s<u;s++)t=a.__webglObjectsImmediate[s],p=t.object,p.visible&&(Q=-1,i(p),Ga=e(b,Pa,Aa,a.overrideMaterial,p),p.immediateRenderCallback?p.immediateRenderCallback(Ga,d,ha):p.render(function(b){h(b,Ga,a.overrideMaterial.shading)}))}else{N(THREE.NormalBlending);for(s=Ra-1;s>=0;s--)if(t=a.__webglObjects[s],t.render&&(p=t.object,Oa=t.buffer,K=t.opaque))i(p),j(K.depthTest),l(K.depthWrite),m(K.polygonOffset,
+K.polygonOffsetFactor,K.polygonOffsetUnits),f(b,Pa,Aa,K,Oa,p);for(s=0;s<u;s++)if(t=a.__webglObjectsImmediate[s],p=t.object,p.visible&&(Q=-1,K=t.opaque))i(p),j(K.depthTest),l(K.depthWrite),m(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),Ga=e(b,Pa,Aa,K,p),p.immediateRenderCallback?p.immediateRenderCallback(Ga,d,ha):p.render(function(a){h(a,Ga,K.shading)});for(s=0;s<Ra;s++)if(t=a.__webglObjects[s],t.render&&(p=t.object,Oa=t.buffer,K=t.transparent))i(p),N(K.blending),j(K.depthTest),l(K.depthWrite),
+m(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),f(b,Pa,Aa,K,Oa,p);for(s=0;s<u;s++)if(t=a.__webglObjectsImmediate[s],p=t.object,p.visible&&(Q=-1,K=t.transparent))i(p),N(K.blending),j(K.depthTest),l(K.depthWrite),m(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),Ga=e(b,Pa,Aa,K,p),p.immediateRenderCallback?p.immediateRenderCallback(Ga,d,ha):p.render(function(a){h(a,Ga,K.shading)})}a.__webglSprites.length&&G(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
+ja(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,i=void 0,j=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){i=e.geometry;
+if(i.geometryGroups===void 0){var j=i,k=void 0,o=void 0,m=void 0,p=void 0,l=m=void 0,q=void 0,s={},y=j.morphTargets.length;j.geometryGroups={};k=0;for(o=j.faces.length;k<o;k++)m=j.faces[k],p=m.materialIndex,l=p!==void 0?p:-1,s[l]===void 0&&(s[l]={hash:l,counter:0}),q=s[l].hash+"_"+s[l].counter,j.geometryGroups[q]===void 0&&(j.geometryGroups[q]={faces:[],materialIndex:p,vertices:0,numMorphTargets:y}),m=m instanceof THREE.Face3?3:4,j.geometryGroups[q].vertices+m>65535&&(s[l].counter+=1,q=s[l].hash+
+"_"+s[l].counter,j.geometryGroups[q]===void 0&&(j.geometryGroups[q]={faces:[],materialIndex:p,vertices:0,numMorphTargets:y})),j.geometryGroups[q].faces.push(k),j.geometryGroups[q].vertices+=m;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=S++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=d.createBuffer();k.__webglTangentBuffer=
+d.createBuffer();k.__webglColorBuffer=d.createBuffer();k.__webglUVBuffer=d.createBuffer();k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){p=o=void 0;k.__webglMorphTargetsBuffers=[];o=0;for(p=k.numMorphTargets;o<p;o++)k.__webglMorphTargetsBuffers.push(d.createBuffer())}F.info.memory.geometries++;
+for(var p=e,v=m=s=void 0,l=v=y=v=void 0,q=l=k=0,A=m=void 0,B=void 0,m=o=y=s=void 0,y=p.geometry,A=y.faces,B=j.faces,s=0,m=B.length;s<m;s++)v=B[s],v=A[v],v instanceof THREE.Face3?(k+=3,l+=1,q+=3):v instanceof THREE.Face4&&(k+=4,l+=2,q+=4);s=b(p,j);m=s.map||s.lightMap||s instanceof THREE.ShaderMaterial?!0:!1;B=s instanceof THREE.MeshBasicMaterial&&!s.envMap||s instanceof THREE.MeshDepthMaterial?!1:s&&s.shading!==void 0&&s.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;A=s.vertexColors?
+s.vertexColors:!1;j.__vertexArray=new Float32Array(k*3);if(B)j.__normalArray=new Float32Array(k*3);if(y.hasTangents)j.__tangentArray=new Float32Array(k*4);if(A)j.__colorArray=new Float32Array(k*3);if(m){if(y.faceUvs.length>0||y.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(y.faceUvs.length>1||y.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*
+4),j.__skinIndexArray=new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(l*3);j.__lineArray=new Uint16Array(q*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];y=0;for(v=j.numMorphTargets;y<v;y++)j.__morphTargetsArrays.push(new Float32Array(k*3))}j.__needsSmoothNormals=B===THREE.SmoothShading;j.__uvType=m;j.__vertexColorType=A;j.__normalType=B;j.__webglFaceCount=l*3;j.__webglLineCount=q*2;if(s.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=
+[];p=void 0;for(p in s.attributes){m=s.attributes[p];y={};for(o in m)y[o]=m[o];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,l=1,y.type==="v2"?l=2:y.type==="v3"?l=3:y.type==="v4"?l=4:y.type==="c"&&(l=3),y.size=l,y.array=new Float32Array(k*l),y.buffer=d.createBuffer(),y.buffer.belongsToAttribute=p,m.needsUpdate=!0,y.__original=m;j.__webglCustomAttributesList.push(y)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=
+!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.Line){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),
+j.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(i=e.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=d.createBuffer();j.__webglColorBuffer=d.createBuffer();F.info.geometries++;j=i;o=e;k=j.vertices.length;j.__vertexArray=new Float32Array(k*3);j.__colorArray=new Float32Array(k*
+3);j.__sortArray=[];j.__webglParticleCount=k;o=o.material;if(o.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];p=void 0;for(p in o.attributes){originalAttribute=o.attributes[p];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:
+attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=p,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in i=e.geometry,i.geometryGroups)j=i.geometryGroups[h],R(f.__webglObjects,j,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
+e instanceof THREE.ParticleSystem?(i=e.geometry,R(f.__webglObjects,i,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)va(f.__webglObjects,
+e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;for(i=f.length-1;i>=0;i--)f[i]===h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&va(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(i=a.__webglObjects[e].object,h=i.geometry,j=l=p=void 0,i instanceof THREE.Mesh){k=0;for(o=h.geometryGroupsList.length;k<o;k++)if(p=h.geometryGroupsList[k],j=b(i,p),l=j.attributes&&ma(j),h.__dirtyVertices||
+h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||l)if(l=d.DYNAMIC_DRAW,q=!h.dynamic,p.__inittedArrays){var C=y=s=void 0,z=void 0,G=C=void 0,E=void 0,N=void 0,O=void 0,U=v=B=A=m=void 0,H=void 0,L=void 0,M=void 0,I=void 0,w=z=O=z=N=E=void 0,D=void 0,r=D=w=E=void 0,n=void 0,r=D=w=C=C=G=D=w=z=r=D=w=n=r=D=w=n=r=D=w=void 0,ia=0,J=0,X=0,aa=0,T=0,P=0,$=0,Q=0,la=0,x=0,na=0,W=r=0,W=void 0,oa=p.__vertexArray,ja=p.__uvArray,ka=p.__uv2Array,V=p.__normalArray,
+ca=p.__tangentArray,pa=p.__colorArray,da=p.__skinVertexAArray,ea=p.__skinVertexBArray,fa=p.__skinIndexArray,ga=p.__skinWeightArray,qa=p.__morphTargetsArrays,Z=p.__webglCustomAttributesList,n=void 0,ha=p.__faceArray,Y=p.__lineArray,wa=p.__needsSmoothNormals,A=p.__vertexColorType,m=p.__uvType,B=p.__normalType,ra=i.geometry,ua=ra.__dirtyVertices,xa=ra.__dirtyElements,ta=ra.__dirtyUvs,za=ra.__dirtyNormals,Ba=ra.__dirtyTangents,Ca=ra.__dirtyColors,Da=ra.__dirtyMorphTargets,ya=ra.vertices,Ea=p.faces,Ka=
+ra.faces,Ha=ra.faceVertexUvs[0],Ia=ra.faceVertexUvs[1],La=ra.skinVerticesA,Ma=ra.skinVerticesB,Na=ra.skinIndices,Ja=ra.skinWeights,Fa=ra.morphTargets;if(Z){w=0;for(D=Z.length;w<D;w++)Z[w].offset=0,Z[w].offsetSrc=0}s=0;for(y=Ea.length;s<y;s++)if(C=Ea[s],z=Ka[C],Ha&&(v=Ha[C]),Ia&&(U=Ia[C]),C=z.vertexNormals,G=z.normal,E=z.vertexColors,N=z.color,O=z.vertexTangents,z instanceof THREE.Face3){if(ua)H=ya[z.a].position,L=ya[z.b].position,M=ya[z.c].position,oa[J]=H.x,oa[J+1]=H.y,oa[J+2]=H.z,oa[J+3]=L.x,oa[J+
+4]=L.y,oa[J+5]=L.z,oa[J+6]=M.x,oa[J+7]=M.y,oa[J+8]=M.z,J+=9;if(Z){w=0;for(D=Z.length;w<D;w++)if(n=Z[w],n.__original.needsUpdate)r=n.offset,W=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[r]=n.value[z.a],n.array[r+1]=n.value[z.b],n.array[r+2]=n.value[z.c]):n.boundTo==="faces"?(W=n.value[W],n.array[r]=W,n.array[r+1]=W,n.array[r+2]=W,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[r]=n.value[W],n.array[r+1]=n.value[W+1],n.array[r+2]=n.value[W+2],n.offsetSrc+=3),n.offset+=
+3):(n.boundTo===void 0||n.boundTo==="vertices"?(H=n.value[z.a],L=n.value[z.b],M=n.value[z.c]):n.boundTo==="faces"?(M=L=H=W=n.value[W],n.offsetSrc++):n.boundTo==="faceVertices"&&(H=n.value[W],L=n.value[W+1],M=n.value[W+2],n.offsetSrc+=3),n.size===2?(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=L.x,n.array[r+3]=L.y,n.array[r+4]=M.x,n.array[r+5]=M.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[r]=H.r,n.array[r+1]=H.g,n.array[r+2]=H.b,n.array[r+3]=L.r,n.array[r+4]=L.g,n.array[r+5]=L.b,n.array[r+6]=
+M.r,n.array[r+7]=M.g,n.array[r+8]=M.b):(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=H.z,n.array[r+3]=L.x,n.array[r+4]=L.y,n.array[r+5]=L.z,n.array[r+6]=M.x,n.array[r+7]=M.y,n.array[r+8]=M.z),n.offset+=9):(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=H.z,n.array[r+3]=H.w,n.array[r+4]=L.x,n.array[r+5]=L.y,n.array[r+6]=L.z,n.array[r+7]=L.w,n.array[r+8]=M.x,n.array[r+9]=M.y,n.array[r+10]=M.z,n.array[r+11]=M.w,n.offset+=12))}if(Da){w=0;for(D=Fa.length;w<D;w++)H=Fa[w].vertices[z.a].position,L=Fa[w].vertices[z.b].position,
+M=Fa[w].vertices[z.c].position,r=qa[w],r[na]=H.x,r[na+1]=H.y,r[na+2]=H.z,r[na+3]=L.x,r[na+4]=L.y,r[na+5]=L.z,r[na+6]=M.x,r[na+7]=M.y,r[na+8]=M.z;na+=9}if(Ja.length)w=Ja[z.a],D=Ja[z.b],r=Ja[z.c],ga[x]=w.x,ga[x+1]=w.y,ga[x+2]=w.z,ga[x+3]=w.w,ga[x+4]=D.x,ga[x+5]=D.y,ga[x+6]=D.z,ga[x+7]=D.w,ga[x+8]=r.x,ga[x+9]=r.y,ga[x+10]=r.z,ga[x+11]=r.w,w=Na[z.a],D=Na[z.b],r=Na[z.c],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=w.w,fa[x+4]=D.x,fa[x+5]=D.y,fa[x+6]=D.z,fa[x+7]=D.w,fa[x+8]=r.x,fa[x+9]=r.y,fa[x+10]=r.z,fa[x+
+11]=r.w,w=La[z.a],D=La[z.b],r=La[z.c],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=1,da[x+8]=r.x,da[x+9]=r.y,da[x+10]=r.z,da[x+11]=1,w=Ma[z.a],D=Ma[z.b],r=Ma[z.c],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=1,ea[x+8]=r.x,ea[x+9]=r.y,ea[x+10]=r.z,ea[x+11]=1,x+=12;if(Ca&&A)E.length===3&&A===THREE.VertexColors?(z=E[0],w=E[1],D=E[2]):D=w=z=N,pa[la]=z.r,pa[la+1]=z.g,pa[la+2]=z.b,pa[la+3]=w.r,pa[la+4]=w.g,pa[la+5]=w.b,
+pa[la+6]=D.r,pa[la+7]=D.g,pa[la+8]=D.b,la+=9;if(Ba&&ra.hasTangents)E=O[0],N=O[1],z=O[2],ca[$]=E.x,ca[$+1]=E.y,ca[$+2]=E.z,ca[$+3]=E.w,ca[$+4]=N.x,ca[$+5]=N.y,ca[$+6]=N.z,ca[$+7]=N.w,ca[$+8]=z.x,ca[$+9]=z.y,ca[$+10]=z.z,ca[$+11]=z.w,$+=12;if(za&&B)if(C.length===3&&wa)for(w=0;w<3;w++)G=C[w],V[P]=G.x,V[P+1]=G.y,V[P+2]=G.z,P+=3;else for(w=0;w<3;w++)V[P]=G.x,V[P+1]=G.y,V[P+2]=G.z,P+=3;if(ta&&v!==void 0&&m)for(w=0;w<3;w++)C=v[w],ja[X]=C.u,ja[X+1]=C.v,X+=2;if(ta&&U!==void 0&&m)for(w=0;w<3;w++)C=U[w],ka[aa]=
+C.u,ka[aa+1]=C.v,aa+=2;xa&&(ha[T]=ia,ha[T+1]=ia+1,ha[T+2]=ia+2,T+=3,Y[Q]=ia,Y[Q+1]=ia+1,Y[Q+2]=ia,Y[Q+3]=ia+2,Y[Q+4]=ia+1,Y[Q+5]=ia+2,Q+=6,ia+=3)}else if(z instanceof THREE.Face4){if(ua)H=ya[z.a].position,L=ya[z.b].position,M=ya[z.c].position,I=ya[z.d].position,oa[J]=H.x,oa[J+1]=H.y,oa[J+2]=H.z,oa[J+3]=L.x,oa[J+4]=L.y,oa[J+5]=L.z,oa[J+6]=M.x,oa[J+7]=M.y,oa[J+8]=M.z,oa[J+9]=I.x,oa[J+10]=I.y,oa[J+11]=I.z,J+=12;if(Z){w=0;for(D=Z.length;w<D;w++)if(n=Z[w],n.__original.needsUpdate)r=n.offset,W=n.offsetSrc,
+n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[r]=n.value[z.a],n.array[r+1]=n.value[z.b],n.array[r+2]=n.value[z.c],n.array[r+3]=n.value[z.d]):n.boundTo==="faces"?(W=n.value[W],n.array[r]=W,n.array[r+1]=W,n.array[r+2]=W,n.array[r+3]=W,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[r]=n.value[W],n.array[r+1]=n.value[W+1],n.array[r+2]=n.value[W+2],n.array[r+3]=n.value[W+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(H=n.value[z.a],L=n.value[z.b],M=
+n.value[z.c],I=n.value[z.d]):n.boundTo==="faces"?(I=M=L=H=W=n.value[W],n.offsetSrc++):n.boundTo==="faceVertices"&&(H=n.value[W],L=n.value[W+1],M=n.value[W+2],I=n.value[W+3],n.offsetSrc+=4),n.size===2?(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=L.x,n.array[r+3]=L.y,n.array[r+4]=M.x,n.array[r+5]=M.y,n.array[r+6]=I.x,n.array[r+7]=I.y,n.offset+=8):n.size===3?(n.type==="c"?(n.array[r]=H.r,n.array[r+1]=H.g,n.array[r+2]=H.b,n.array[r+3]=L.r,n.array[r+4]=L.g,n.array[r+5]=L.b,n.array[r+6]=M.r,n.array[r+
+7]=M.g,n.array[r+8]=M.b,n.array[r+9]=I.r,n.array[r+10]=I.g,n.array[r+11]=I.b):(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=H.z,n.array[r+3]=L.x,n.array[r+4]=L.y,n.array[r+5]=L.z,n.array[r+6]=M.x,n.array[r+7]=M.y,n.array[r+8]=M.z,n.array[r+9]=I.x,n.array[r+10]=I.y,n.array[r+11]=I.z),n.offset+=12):(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=H.z,n.array[r+3]=H.w,n.array[r+4]=L.x,n.array[r+5]=L.y,n.array[r+6]=L.z,n.array[r+7]=L.w,n.array[r+8]=M.x,n.array[r+9]=M.y,n.array[r+10]=M.z,n.array[r+11]=M.w,
+n.array[r+12]=I.x,n.array[r+13]=I.y,n.array[r+14]=I.z,n.array[r+15]=I.w,n.offset+=16))}if(Da){w=0;for(D=Fa.length;w<D;w++)H=Fa[w].vertices[z.a].position,L=Fa[w].vertices[z.b].position,M=Fa[w].vertices[z.c].position,I=Fa[w].vertices[z.d].position,r=qa[w],r[na]=H.x,r[na+1]=H.y,r[na+2]=H.z,r[na+3]=L.x,r[na+4]=L.y,r[na+5]=L.z,r[na+6]=M.x,r[na+7]=M.y,r[na+8]=M.z,r[na+9]=I.x,r[na+10]=I.y,r[na+11]=I.z;na+=12}if(Ja.length)w=Ja[z.a],D=Ja[z.b],r=Ja[z.c],n=Ja[z.d],ga[x]=w.x,ga[x+1]=w.y,ga[x+2]=w.z,ga[x+3]=w.w,
+ga[x+4]=D.x,ga[x+5]=D.y,ga[x+6]=D.z,ga[x+7]=D.w,ga[x+8]=r.x,ga[x+9]=r.y,ga[x+10]=r.z,ga[x+11]=r.w,ga[x+12]=n.x,ga[x+13]=n.y,ga[x+14]=n.z,ga[x+15]=n.w,w=Na[z.a],D=Na[z.b],r=Na[z.c],n=Na[z.d],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=w.w,fa[x+4]=D.x,fa[x+5]=D.y,fa[x+6]=D.z,fa[x+7]=D.w,fa[x+8]=r.x,fa[x+9]=r.y,fa[x+10]=r.z,fa[x+11]=r.w,fa[x+12]=n.x,fa[x+13]=n.y,fa[x+14]=n.z,fa[x+15]=n.w,w=La[z.a],D=La[z.b],r=La[z.c],n=La[z.d],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=1,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=
+D.z,da[x+7]=1,da[x+8]=r.x,da[x+9]=r.y,da[x+10]=r.z,da[x+11]=1,da[x+12]=n.x,da[x+13]=n.y,da[x+14]=n.z,da[x+15]=1,w=Ma[z.a],D=Ma[z.b],r=Ma[z.c],z=Ma[z.d],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=1,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=1,ea[x+8]=r.x,ea[x+9]=r.y,ea[x+10]=r.z,ea[x+11]=1,ea[x+12]=z.x,ea[x+13]=z.y,ea[x+14]=z.z,ea[x+15]=1,x+=16;if(Ca&&A)E.length===4&&A===THREE.VertexColors?(z=E[0],w=E[1],D=E[2],E=E[3]):E=D=w=z=N,pa[la]=z.r,pa[la+1]=z.g,pa[la+2]=z.b,pa[la+3]=w.r,pa[la+4]=w.g,pa[la+
+5]=w.b,pa[la+6]=D.r,pa[la+7]=D.g,pa[la+8]=D.b,pa[la+9]=E.r,pa[la+10]=E.g,pa[la+11]=E.b,la+=12;if(Ba&&ra.hasTangents)E=O[0],N=O[1],z=O[2],O=O[3],ca[$]=E.x,ca[$+1]=E.y,ca[$+2]=E.z,ca[$+3]=E.w,ca[$+4]=N.x,ca[$+5]=N.y,ca[$+6]=N.z,ca[$+7]=N.w,ca[$+8]=z.x,ca[$+9]=z.y,ca[$+10]=z.z,ca[$+11]=z.w,ca[$+12]=O.x,ca[$+13]=O.y,ca[$+14]=O.z,ca[$+15]=O.w,$+=16;if(za&&B)if(C.length===4&&wa)for(w=0;w<4;w++)G=C[w],V[P]=G.x,V[P+1]=G.y,V[P+2]=G.z,P+=3;else for(w=0;w<4;w++)V[P]=G.x,V[P+1]=G.y,V[P+2]=G.z,P+=3;if(ta&&v!==
+void 0&&m)for(w=0;w<4;w++)C=v[w],ja[X]=C.u,ja[X+1]=C.v,X+=2;if(ta&&U!==void 0&&m)for(w=0;w<4;w++)C=U[w],ka[aa]=C.u,ka[aa+1]=C.v,aa+=2;xa&&(ha[T]=ia,ha[T+1]=ia+1,ha[T+2]=ia+3,ha[T+3]=ia+1,ha[T+4]=ia+2,ha[T+5]=ia+3,T+=6,Y[Q]=ia,Y[Q+1]=ia+1,Y[Q+2]=ia,Y[Q+3]=ia+3,Y[Q+4]=ia+1,Y[Q+5]=ia+2,Y[Q+6]=ia+2,Y[Q+7]=ia+3,Q+=8,ia+=4)}ua&&(d.bindBuffer(d.ARRAY_BUFFER,p.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,oa,l));if(Z){w=0;for(D=Z.length;w<D;w++)n=Z[w],n.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,
+n.buffer),d.bufferData(d.ARRAY_BUFFER,n.array,l))}if(Da){w=0;for(D=Fa.length;w<D;w++)d.bindBuffer(d.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[w]),d.bufferData(d.ARRAY_BUFFER,qa[w],l)}Ca&&la>0&&(d.bindBuffer(d.ARRAY_BUFFER,p.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,pa,l));za&&(d.bindBuffer(d.ARRAY_BUFFER,p.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,V,l));Ba&&ra.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,p.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,ca,l));ta&&X>0&&(d.bindBuffer(d.ARRAY_BUFFER,
+p.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ja,l));ta&&aa>0&&(d.bindBuffer(d.ARRAY_BUFFER,p.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ka,l));xa&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ha,l),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,Y,l));x>0&&(d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,da,l),d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),
+d.bufferData(d.ARRAY_BUFFER,ea,l),d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,fa,l),d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,l));q&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=
+!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyColors=!1;h.__dirtyTangents=!1;j.attributes&&sa(j)}else if(i instanceof THREE.Ribbon){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=s=q=q=void 0;y=i.vertices;o=i.colors;m=y.length;p=o.length;A=i.__vertexArray;l=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(q=0;q<m;q++)s=y[q].position,k=q*3,A[k]=s.x,A[k+1]=s.y,A[k+2]=s.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
+A,j)}if(B){for(q=0;q<p;q++)color=o[q],k=q*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=s=q=q=void 0;y=i.vertices;o=i.colors;m=y.length;p=o.length;A=i.__vertexArray;l=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(q=0;q<m;q++)s=y[q].position,k=q*3,A[k]=s.x,A[k+1]=s.y,A[k+
+2]=s.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,A,j)}if(B){for(q=0;q<p;q++)color=o[q],k=q*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)j=b(i,p),l=j.attributes&&ma(j),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||l)&&c(h,d.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,j.attributes&&
+sa(j)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return cb}};
 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};

+ 1 - 1
examples/misc_ubiquity_test.html

@@ -198,7 +198,7 @@
 
 				canvasRenderer.render( scene, camera );
 				svgRenderer.render( scene, camera );
-				// webglRenderer.render( scene, camera );
+				webglRenderer.render( scene, camera );
 
 			}
 

+ 0 - 196
examples/webgl_lod_text.html

@@ -1,196 +0,0 @@
-<!doctype html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - level-of-details</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<style>
-			body {
-				background:#000;
-				color:#fff;
-				padding:0;
-				margin:0;
-				font-weight: bold;
-				overflow:hidden;
-			}
-
-			#info {
-				position: absolute;
-				top: 0px; width: 100%;
-				color: #ffffff;
-				padding: 5px;
-				font-family: Monospace;
-				font-size: 13px;
-				text-align: center;
-				z-index:100;
-			}
-
-			a { color:red }
-
-		</style>
-	</head>
-
-	<body>
-		<div id="info">
-			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - level-of-details WebGL example
-		</div>
-
-
-		<script src="../build/Three.js"></script>
-
-		<script src="js/Detector.js"></script>
-		<script src="js/RequestAnimationFrame.js"></script>
-		<script src="js/Stats.js"></script>
-
-		<!-- load the font file from canvas-text -->
-
-		<script src="fonts/helvetiker_regular.typeface.js"></script>
-
-		<script>
-
-			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
-
-			var container, stats;
-
-			var camera, scene, renderer;
-
-			var geometry, objects;
-
-			var mouseX = 0, mouseY = 0;
-
-			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
-
-			document.addEventListener( 'mousemove', onDocumentMouseMove, false );
-
-			init();
-			animate();
-
-			function init() {
-
-				container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 15000 );
-				camera.position.z = 1000;
-
-				scene = new THREE.Scene();
-				scene.fog = new THREE.Fog( 0x000000, 1, 15000 );
-
-				var light = new THREE.PointLight( 0xff2200 );
-				light.position.set( 0, 0, 0 );
-				scene.add( light );
-
-				var light = new THREE.DirectionalLight( 0xffffff );
-				light.position.set( 0, 0, 1 ).normalize();
-				scene.add( light );
-
-				var wireMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, opacity: 0.5, wireframe: true, transparent: true } );
-
-				function getOptionsWithSegments( x, b, bevel ) {
-
-					return {
-
-						size: 80,
-						height: 20,
-						curveSegments: x,
-						font: "helvetiker",
-						bevelSegments: b,
-						bevelEnabled: bevel,
-						bevelThickness:8,
-						bevelSize: 3,
-						steps: 1,
-						amount: 20,
-
-					};
-
-				};
-
-				var theText = "&"; // Try $ :)
-
-				// we could use TextPath and ExtrudeGeometry if we wish to optimize stuff futher
-
-				var geometry = [
-
-					[ new THREE.TextGeometry( theText, getOptionsWithSegments(8, 6, true)),
-						300, [ new THREE.MeshPhongMaterial( { color: 0xffee00 } ), wireMaterial ] ],
-					[ new THREE.TextGeometry( theText, getOptionsWithSegments(5,2, true)),
-						800, [ new THREE.MeshLambertMaterial( { color: 0xffaa00 } ), wireMaterial ]],
-					[ new THREE.TextGeometry( theText, getOptionsWithSegments(2,1, true)),
-						1000, [ new THREE.MeshLambertMaterial( { color: 0x005500 } ), wireMaterial ] ],
-					[ new THREE.TextGeometry( theText, getOptionsWithSegments(2,1,false)),
-						2000, [ new THREE.MeshLambertMaterial( { color: 0x0055ff } ), wireMaterial ]],
-					[ new THREE.TextGeometry( theText, getOptionsWithSegments(1,1, false)),
-						10000, [ new THREE.MeshLambertMaterial( { color: 0xff1100 } ), wireMaterial ]]
-
-				];
-
-				var i, j, mesh, lod;
-
-				for ( j = 0; j < 1000; j ++ ) {
-
-					lod = new THREE.LOD();
-
-					for ( i = 0; i < geometry.length; i ++ ) {
-
-						mesh = new THREE.Mesh( geometry[ i ][ 0 ], geometry[ i ][ 2 ][ 1 ] );
-						mesh.scale.set( 1.5, 1.5, 1.5 );
-						mesh.updateMatrix();
-						mesh.matrixAutoUpdate = false;
-						lod.addLevel( mesh, geometry[ i ][ 1 ] );
-
-					}
-
-					lod.position.x = 10000 * ( 0.5 - Math.random() );
-					lod.position.y =  7500 * ( 0.5 - Math.random() );
-					lod.position.z = 10000 * ( 0.5 - Math.random() );
-					lod.updateMatrix();
-					lod.matrixAutoUpdate = false;
-
-					scene.add( lod );
-
-				}
-
-
-				renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } );
-				renderer.setSize( window.innerWidth, window.innerHeight );
-
-				renderer.sortObjects = false;
-				renderer.autoUpdateScene = false;
-
-				container.appendChild( renderer.domElement );
-
-			}
-
-			function onDocumentMouseMove(event) {
-
-				mouseX = ( event.clientX - windowHalfX ) * 10;
-				mouseY = ( event.clientY - windowHalfY ) * 10;
-
-			}
-
-			function animate() {
-
-				requestAnimationFrame( animate );
-				render();
-
-			}
-
-			function render() {
-
-				camera.position.x += ( mouseX - camera.position.x ) * .005;
-				camera.position.y += ( - mouseY - camera.position.y ) * .01;
-
-				camera.lookAt( scene.position );
-
-				scene.updateMatrixWorld();
-				THREE.SceneUtils.traverseHierarchy( scene, function ( node ) { if ( node instanceof THREE.LOD ) node.update( camera ) } );
-
-				renderer.render( scene, camera );
-
-			}
-
-		</script>
-
-	</body>
-</html>

Some files were not shown because too many files changed in this diff