Ver Fonte

Quick and dirty hack to get WebGLRenderer working with new scene graph.

This is not supposed to be "proper" solution (for example this doesn't solve removing of objects), but at least some WebGL examples are working now.
alteredq há 13 anos atrás
pai
commit
a8869f9e5b
3 ficheiros alterados com 556 adições e 545 exclusões
  1. 372 372
      build/Three.js
  2. 149 151
      build/custom/ThreeWebGL.js
  3. 35 22
      src/renderers/WebGLRenderer.js

+ 372 - 372
build/Three.js

@@ -16,60 +16,60 @@ e.z;this.w=b.w-e.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,e){this.x+=(b.x-this.x)*e;this.y+=(b.y-this.y)*e;this.z+=(b.z-this.z)*e;this.w+=(b.w-this.w)*e;return this}};THREE.Ray=function(b,e){this.origin=b||new THREE.Vector3;this.direction=e||new THREE.Vector3};
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,e){this.x+=(b.x-this.x)*e;this.y+=(b.y-this.y)*e;this.z+=(b.z-this.z)*e;this.w+=(b.w-this.w)*e;return this}};THREE.Ray=function(b,e){this.origin=b||new THREE.Vector3;this.direction=e||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.children)},intersectObjects:function(b){var e,c,f=[];e=0;for(c=b.length;e<c;e++)Array.prototype.push.apply(f,this.intersectObject(b[e]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function e(b,c,e){var f;f=e.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return e.distanceTo(b)}function c(b,c,e,f){var f=f.clone().subSelf(c),
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.children)},intersectObjects:function(b){var e,c,f=[];e=0;for(c=b.length;e<c;e++)Array.prototype.push.apply(f,this.intersectObject(b[e]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function e(b,c,e){var f;f=e.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return e.distanceTo(b)}function c(b,c,e,f){var f=f.clone().subSelf(c),
 e=e.clone().subSelf(c),m=b.clone().subSelf(c),b=f.dot(f),c=f.dot(e),f=f.dot(m),h=e.dot(e),e=e.dot(m),m=1/(b*h-c*c),h=(h*f-c*e)*m,b=(b*e-c*f)*m;return h>0&&b>0&&h+b<1}for(var f,m=[],h=0,k=b.children.length;h<k;h++)Array.prototype.push.apply(m,this.intersectObject(b.children[h]));if(b instanceof THREE.Particle){h=e(this.origin,this.direction,b.matrixWorld.getPosition());if(h==null||h>b.scale.x)return[];f={distance:h,point:b.position,face:null,object:b};m.push(f)}else if(b instanceof THREE.Mesh){h=e(this.origin,
 e=e.clone().subSelf(c),m=b.clone().subSelf(c),b=f.dot(f),c=f.dot(e),f=f.dot(m),h=e.dot(e),e=e.dot(m),m=1/(b*h-c*c),h=(h*f-c*e)*m,b=(b*e-c*f)*m;return h>0&&b>0&&h+b<1}for(var f,m=[],h=0,k=b.children.length;h<k;h++)Array.prototype.push.apply(m,this.intersectObject(b.children[h]));if(b instanceof THREE.Particle){h=e(this.origin,this.direction,b.matrixWorld.getPosition());if(h==null||h>b.scale.x)return[];f={distance:h,point:b.position,face:null,object:b};m.push(f)}else if(b instanceof THREE.Mesh){h=e(this.origin,
-this.direction,b.matrixWorld.getPosition());if(h==null||h>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return m;var n,p,t,u,v,x,w,A,y=b.geometry,z=y.vertices;b.matrixRotationWorld.extractRotation(b.matrixWorld);h=0;for(k=y.faces.length;h<k;h++)if(f=y.faces[h],w=this.origin.clone(),A=this.direction.clone(),u=b.matrixWorld,n=u.multiplyVector3(f.centroid.clone()).subSelf(w),x=n.dot(A),!(x<=0)&&(n=u.multiplyVector3(z[f.a].position.clone()),p=u.multiplyVector3(z[f.b].position.clone()),
-t=u.multiplyVector3(z[f.c].position.clone()),u=f instanceof THREE.Face4?u.multiplyVector3(z[f.d].position.clone()):null,v=b.matrixRotationWorld.multiplyVector3(f.normal.clone()),x=A.dot(v),b.doubleSided||(b.flipSided?x>0:x<0)))if(x=v.dot((new THREE.Vector3).sub(n,w))/x,w=w.addSelf(A.multiplyScalar(x)),f instanceof THREE.Face3)c(w,n,p,t)&&(f={distance:this.origin.distanceTo(w),point:w,face:f,object:b},m.push(f));else if(f instanceof THREE.Face4&&(c(w,n,p,u)||c(w,p,t,u)))f={distance:this.origin.distanceTo(w),
+this.direction,b.matrixWorld.getPosition());if(h==null||h>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return m;var n,p,v,u,t,x,w,A,y=b.geometry,z=y.vertices;b.matrixRotationWorld.extractRotation(b.matrixWorld);h=0;for(k=y.faces.length;h<k;h++)if(f=y.faces[h],w=this.origin.clone(),A=this.direction.clone(),u=b.matrixWorld,n=u.multiplyVector3(f.centroid.clone()).subSelf(w),x=n.dot(A),!(x<=0)&&(n=u.multiplyVector3(z[f.a].position.clone()),p=u.multiplyVector3(z[f.b].position.clone()),
+v=u.multiplyVector3(z[f.c].position.clone()),u=f instanceof THREE.Face4?u.multiplyVector3(z[f.d].position.clone()):null,t=b.matrixRotationWorld.multiplyVector3(f.normal.clone()),x=A.dot(t),b.doubleSided||(b.flipSided?x>0:x<0)))if(x=t.dot((new THREE.Vector3).sub(n,w))/x,w=w.addSelf(A.multiplyScalar(x)),f instanceof THREE.Face3)c(w,n,p,v)&&(f={distance:this.origin.distanceTo(w),point:w,face:f,object:b},m.push(f));else if(f instanceof THREE.Face4&&(c(w,n,p,u)||c(w,p,v,u)))f={distance:this.origin.distanceTo(w),
 point:w,face:f,object:b},m.push(f)}return m}};
 point:w,face:f,object:b},m.push(f)}return m}};
-THREE.Rectangle=function(){function b(){h=f-e;k=m-c}var e,c,f,m,h,k,n=!0;this.getX=function(){return e};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return e};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return m};this.set=function(h,k,u,v){n=!1;e=h;c=k;f=u;m=v;b()};this.addPoint=function(h,k){n?(n=!1,e=h,c=k,f=h,m=k):(e=e<h?e:h,c=c<k?c:k,f=f>h?f:h,m=m>k?m:k);b()};this.add3Points=
-function(h,k,u,v,x,w){n?(n=!1,e=h<u?h<x?h:x:u<x?u:x,c=k<v?k<w?k:w:v<w?v:w,f=h>u?h>x?h:x:u>x?u:x,m=k>v?k>w?k:w:v>w?v:w):(e=h<u?h<x?h<e?h:e:x<e?x:e:u<x?u<e?u:e:x<e?x:e,c=k<v?k<w?k<c?k:c:w<c?w:c:v<w?v<c?v:c:w<c?w:c,f=h>u?h>x?h>f?h:f:x>f?x:f:u>x?u>f?u:f:x>f?x:f,m=k>v?k>w?k>m?k:m:w>m?w:m:v>w?v>m?v:m:w>m?w:m);b()};this.addRectangle=function(h){n?(n=!1,e=h.getLeft(),c=h.getTop(),f=h.getRight(),m=h.getBottom()):(e=e<h.getLeft()?e:h.getLeft(),c=c<h.getTop()?c:h.getTop(),f=f>h.getRight()?f:h.getRight(),m=m>
+THREE.Rectangle=function(){function b(){h=f-e;k=m-c}var e,c,f,m,h,k,n=!0;this.getX=function(){return e};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return e};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return m};this.set=function(h,k,u,t){n=!1;e=h;c=k;f=u;m=t;b()};this.addPoint=function(h,k){n?(n=!1,e=h,c=k,f=h,m=k):(e=e<h?e:h,c=c<k?c:k,f=f>h?f:h,m=m>k?m:k);b()};this.add3Points=
+function(h,k,u,t,x,w){n?(n=!1,e=h<u?h<x?h:x:u<x?u:x,c=k<t?k<w?k:w:t<w?t:w,f=h>u?h>x?h:x:u>x?u:x,m=k>t?k>w?k:w:t>w?t:w):(e=h<u?h<x?h<e?h:e:x<e?x:e:u<x?u<e?u:e:x<e?x:e,c=k<t?k<w?k<c?k:c:w<c?w:c:t<w?t<c?t:c:w<c?w:c,f=h>u?h>x?h>f?h:f:x>f?x:f:u>x?u>f?u:f:x>f?x:f,m=k>t?k>w?k>m?k:m:w>m?w:m:t>w?t>m?t:m:w>m?w:m);b()};this.addRectangle=function(h){n?(n=!1,e=h.getLeft(),c=h.getTop(),f=h.getRight(),m=h.getBottom()):(e=e<h.getLeft()?e:h.getLeft(),c=c<h.getTop()?c:h.getTop(),f=f>h.getRight()?f:h.getRight(),m=m>
 h.getBottom()?m:h.getBottom());b()};this.inflate=function(h){e-=h;c-=h;f+=h;m+=h;b()};this.minSelf=function(h){e=e>h.getLeft()?e:h.getLeft();c=c>h.getTop()?c:h.getTop();f=f<h.getRight()?f:h.getRight();m=m<h.getBottom()?m:h.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(e,b.getLeft())>=0&&Math.min(m,b.getBottom())-Math.max(c,b.getTop())>=0};this.empty=function(){n=!0;m=f=c=e=0;b()};this.isEmpty=function(){return n}};THREE.Matrix3=function(){this.m=[]};
 h.getBottom()?m:h.getBottom());b()};this.inflate=function(h){e-=h;c-=h;f+=h;m+=h;b()};this.minSelf=function(h){e=e>h.getLeft()?e:h.getLeft();c=c>h.getTop()?c:h.getTop();f=f<h.getRight()?f:h.getRight();m=m<h.getBottom()?m:h.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(e,b.getLeft())>=0&&Math.min(m,b.getBottom())-Math.max(c,b.getTop())>=0};this.empty=function(){n=!0;m=f=c=e=0;b()};this.isEmpty=function(){return n}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,e=this.m;b=e[1];e[1]=e[3];e[3]=b;b=e[2];e[2]=e[6];e[6]=b;b=e[5];e[5]=e[7];e[7]=b;return this},transposeIntoArray:function(b){var e=this.m;b[0]=e[0];b[1]=e[3];b[2]=e[6];b[3]=e[1];b[4]=e[4];b[5]=e[7];b[6]=e[2];b[7]=e[5];b[8]=e[8];return this}};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,e=this.m;b=e[1];e[1]=e[3];e[3]=b;b=e[2];e[2]=e[6];e[6]=b;b=e[5];e[5]=e[7];e[7]=b;return this},transposeIntoArray:function(b){var e=this.m;b[0]=e[0];b[1]=e[3];b[2]=e[6];b[3]=e[1];b[4]=e[4];b[5]=e[7];b[6]=e[2];b[7]=e[5];b[8]=e[8];return this}};
-THREE.Matrix4=function(b,e,c,f,m,h,k,n,p,t,u,v,x,w,A,y){this.set(b!==void 0?b:1,e||0,c||0,f||0,m||0,h!==void 0?h:1,k||0,n||0,p||0,t||0,u!==void 0?u:1,v||0,x||0,w||0,A||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,e,c,f,m,h,k,n,p,t,u,v,x,w,A,y){this.n11=b;this.n12=e;this.n13=c;this.n14=f;this.n21=m;this.n22=h;this.n23=k;this.n24=n;this.n31=p;this.n32=t;this.n33=u;this.n34=v;this.n41=x;this.n42=w;this.n43=A;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
-e,c){var f=THREE.Matrix4.__v1,m=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,e).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(c,h).normalize());m.cross(h,f).normalize();this.n11=f.x;this.n12=m.x;this.n13=h.x;this.n21=f.y;this.n22=m.y;this.n23=h.y;this.n31=f.z;this.n32=m.z;this.n33=h.z;return this},multiply:function(b,e){var c=b.n11,f=b.n12,m=b.n13,h=b.n14,k=b.n21,n=b.n22,p=b.n23,t=b.n24,u=b.n31,v=b.n32,x=b.n33,w=b.n34,A=b.n41,y=b.n42,z=b.n43,
-E=b.n44,C=e.n11,B=e.n12,G=e.n13,N=e.n14,I=e.n21,M=e.n22,Z=e.n23,J=e.n24,O=e.n31,L=e.n32,F=e.n33,aa=e.n34,Y=e.n41,Q=e.n42,P=e.n43,o=e.n44;this.n11=c*C+f*I+m*O+h*Y;this.n12=c*B+f*M+m*L+h*Q;this.n13=c*G+f*Z+m*F+h*P;this.n14=c*N+f*J+m*aa+h*o;this.n21=k*C+n*I+p*O+t*Y;this.n22=k*B+n*M+p*L+t*Q;this.n23=k*G+n*Z+p*F+t*P;this.n24=k*N+n*J+p*aa+t*o;this.n31=u*C+v*I+x*O+w*Y;this.n32=u*B+v*M+x*L+w*Q;this.n33=u*G+v*Z+x*F+w*P;this.n34=u*N+v*J+x*aa+w*o;this.n41=A*C+y*I+z*O+E*Y;this.n42=A*B+y*M+z*L+E*Q;this.n43=A*
-G+y*Z+z*F+E*P;this.n44=A*N+y*J+z*aa+E*o;return this},multiplySelf:function(b){return this.multiply(this,b)},multiplyToArray:function(b,e,c){this.multiply(b,e);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(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;
+THREE.Matrix4=function(b,e,c,f,m,h,k,n,p,v,u,t,x,w,A,y){this.set(b!==void 0?b:1,e||0,c||0,f||0,m||0,h!==void 0?h:1,k||0,n||0,p||0,v||0,u!==void 0?u:1,t||0,x||0,w||0,A||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,e,c,f,m,h,k,n,p,v,u,t,x,w,A,y){this.n11=b;this.n12=e;this.n13=c;this.n14=f;this.n21=m;this.n22=h;this.n23=k;this.n24=n;this.n31=p;this.n32=v;this.n33=u;this.n34=t;this.n41=x;this.n42=w;this.n43=A;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
+e,c){var f=THREE.Matrix4.__v1,m=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,e).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(c,h).normalize());m.cross(h,f).normalize();this.n11=f.x;this.n12=m.x;this.n13=h.x;this.n21=f.y;this.n22=m.y;this.n23=h.y;this.n31=f.z;this.n32=m.z;this.n33=h.z;return this},multiply:function(b,e){var c=b.n11,f=b.n12,m=b.n13,h=b.n14,k=b.n21,n=b.n22,p=b.n23,v=b.n24,u=b.n31,t=b.n32,x=b.n33,w=b.n34,A=b.n41,y=b.n42,z=b.n43,
+F=b.n44,D=e.n11,B=e.n12,G=e.n13,O=e.n14,E=e.n21,P=e.n22,U=e.n23,L=e.n24,R=e.n31,I=e.n32,K=e.n33,aa=e.n34,Z=e.n41,S=e.n42,M=e.n43,o=e.n44;this.n11=c*D+f*E+m*R+h*Z;this.n12=c*B+f*P+m*I+h*S;this.n13=c*G+f*U+m*K+h*M;this.n14=c*O+f*L+m*aa+h*o;this.n21=k*D+n*E+p*R+v*Z;this.n22=k*B+n*P+p*I+v*S;this.n23=k*G+n*U+p*K+v*M;this.n24=k*O+n*L+p*aa+v*o;this.n31=u*D+t*E+x*R+w*Z;this.n32=u*B+t*P+x*I+w*S;this.n33=u*G+t*U+x*K+w*M;this.n34=u*O+t*L+x*aa+w*o;this.n41=A*D+y*E+z*R+F*Z;this.n42=A*B+y*P+z*I+F*S;this.n43=A*
+G+y*U+z*K+F*M;this.n44=A*O+y*L+z*aa+F*o;return this},multiplySelf:function(b){return this.multiply(this,b)},multiplyToArray:function(b,e,c){this.multiply(b,e);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(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;
 this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},multiplyVector3:function(b){var e=b.x,c=b.y,f=b.z,m=1/(this.n41*e+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*e+this.n12*c+this.n13*f+this.n14)*m;b.y=(this.n21*e+this.n22*c+this.n23*f+this.n24)*m;b.z=(this.n31*e+this.n32*c+this.n33*f+this.n34)*m;return b},multiplyVector4:function(b){var e=b.x,c=b.y,f=b.z,m=b.w;b.x=this.n11*e+this.n12*c+this.n13*f+this.n14*m;b.y=this.n21*
 this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},multiplyVector3:function(b){var e=b.x,c=b.y,f=b.z,m=1/(this.n41*e+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*e+this.n12*c+this.n13*f+this.n14)*m;b.y=(this.n21*e+this.n22*c+this.n23*f+this.n24)*m;b.z=(this.n31*e+this.n32*c+this.n33*f+this.n34)*m;return b},multiplyVector4:function(b){var e=b.x,c=b.y,f=b.z,m=b.w;b.x=this.n11*e+this.n12*c+this.n13*f+this.n14*m;b.y=this.n21*
 e+this.n22*c+this.n23*f+this.n24*m;b.z=this.n31*e+this.n32*c+this.n33*f+this.n34*m;b.w=this.n41*e+this.n42*c+this.n43*f+this.n44*m;return b},rotateAxis:function(b){var e=b.x,c=b.y,f=b.z;b.x=e*this.n11+c*this.n12+f*this.n13;b.y=e*this.n21+c*this.n22+f*this.n23;b.z=e*this.n31+c*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var e=new THREE.Vector4;e.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;e.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;e.z=this.n31*b.x+this.n32*
 e+this.n22*c+this.n23*f+this.n24*m;b.z=this.n31*e+this.n32*c+this.n33*f+this.n34*m;b.w=this.n41*e+this.n42*c+this.n43*f+this.n44*m;return b},rotateAxis:function(b){var e=b.x,c=b.y,f=b.z;b.x=e*this.n11+c*this.n12+f*this.n13;b.y=e*this.n21+c*this.n22+f*this.n23;b.z=e*this.n31+c*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var e=new THREE.Vector4;e.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;e.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;e.z=this.n31*b.x+this.n32*
-b.y+this.n33*b.z+this.n34*b.w;e.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return e},determinant:function(){var b=this.n11,e=this.n12,c=this.n13,f=this.n14,m=this.n21,h=this.n22,k=this.n23,n=this.n24,p=this.n31,t=this.n32,u=this.n33,v=this.n34,x=this.n41,w=this.n42,A=this.n43,y=this.n44;return f*k*t*x-c*n*t*x-f*h*u*x+e*n*u*x+c*h*v*x-e*k*v*x-f*k*p*w+c*n*p*w+f*m*u*w-b*n*u*w-c*m*v*w+b*k*v*w+f*h*p*A-e*n*p*A-f*m*t*A+b*n*t*A+e*m*v*A-b*h*v*A-c*h*p*y+e*k*p*y+c*m*t*y-b*k*t*y-e*m*u*y+b*h*u*
+b.y+this.n33*b.z+this.n34*b.w;e.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return e},determinant:function(){var b=this.n11,e=this.n12,c=this.n13,f=this.n14,m=this.n21,h=this.n22,k=this.n23,n=this.n24,p=this.n31,v=this.n32,u=this.n33,t=this.n34,x=this.n41,w=this.n42,A=this.n43,y=this.n44;return f*k*v*x-c*n*v*x-f*h*u*x+e*n*u*x+c*h*t*x-e*k*t*x-f*k*p*w+c*n*p*w+f*m*u*w-b*n*u*w-c*m*t*w+b*k*t*w+f*h*p*A-e*n*p*A-f*m*v*A+b*n*v*A+e*m*t*A-b*h*t*A-c*h*p*y+e*k*p*y+c*m*v*y-b*k*v*y-e*m*u*y+b*h*u*
 y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;
 y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;
 b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;
 b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;
 b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,e){b[e]=this.n11;b[e+1]=this.n21;b[e+2]=this.n31;b[e+3]=this.n41;b[e+4]=this.n12;b[e+5]=this.n22;b[e+6]=this.n32;b[e+7]=this.n42;b[e+8]=this.n13;b[e+9]=this.n23;b[e+10]=this.n33;b[e+11]=this.n43;b[e+12]=this.n14;b[e+13]=this.n24;b[e+14]=this.n34;
 b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,e){b[e]=this.n11;b[e+1]=this.n21;b[e+2]=this.n31;b[e+3]=this.n41;b[e+4]=this.n12;b[e+5]=this.n22;b[e+6]=this.n32;b[e+7]=this.n42;b[e+8]=this.n13;b[e+9]=this.n23;b[e+10]=this.n33;b[e+11]=this.n43;b[e+12]=this.n14;b[e+13]=this.n24;b[e+14]=this.n34;
 b[e+15]=this.n44;return b},setTranslation:function(b,e,c){this.set(1,0,0,b,0,1,0,e,0,0,1,c,0,0,0,1);return this},setScale:function(b,e,c){this.set(b,0,0,0,0,e,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,e,-b,0,0,b,e,0,0,0,0,1);return this},setRotationY:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(e,0,b,0,0,1,0,0,-b,0,e,0,0,0,0,1);return this},setRotationZ:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(e,-b,0,0,b,e,0,0,
 b[e+15]=this.n44;return b},setTranslation:function(b,e,c){this.set(1,0,0,b,0,1,0,e,0,0,1,c,0,0,0,1);return this},setScale:function(b,e,c){this.set(b,0,0,0,0,e,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,e,-b,0,0,b,e,0,0,0,0,1);return this},setRotationY:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(e,0,b,0,0,1,0,0,-b,0,e,0,0,0,0,1);return this},setRotationZ:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(e,-b,0,0,b,e,0,0,
-0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,e){var c=Math.cos(e),f=Math.sin(e),m=1-c,h=b.x,k=b.y,n=b.z,p=m*h,t=m*k;this.set(p*h+c,p*k-f*n,p*n+f*k,0,p*k+f*n,t*k+c,t*n-f*h,0,p*n-f*k,t*n+f*h,m*n*n+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){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(b){var e=b.n11,c=b.n12,f=b.n13,m=b.n14,h=b.n21,k=b.n22,n=b.n23,p=b.n24,t=b.n31,u=b.n32,v=b.n33,x=b.n34,w=b.n41,A=b.n42,y=b.n43,z=b.n44;this.n11=n*x*A-p*v*A+p*u*y-k*x*y-n*u*z+k*v*z;this.n12=m*v*A-f*x*A-m*u*y+c*x*y+f*u*z-c*v*z;this.n13=f*p*A-m*n*A+m*k*y-c*p*y-f*k*z+c*n*z;this.n14=m*n*u-f*p*u-m*k*v+c*p*v+f*k*x-c*n*x;this.n21=p*v*w-n*x*w-p*t*y+h*x*y+n*t*z-h*v*z;this.n22=f*x*w-m*v*w+
-m*t*y-e*x*y-f*t*z+e*v*z;this.n23=m*n*w-f*p*w-m*h*y+e*p*y+f*h*z-e*n*z;this.n24=f*p*t-m*n*t+m*h*v-e*p*v-f*h*x+e*n*x;this.n31=k*x*w-p*u*w+p*t*A-h*x*A-k*t*z+h*u*z;this.n32=m*u*w-c*x*w-m*t*A+e*x*A+c*t*z-e*u*z;this.n33=f*p*w-m*k*w+m*h*A-e*p*A-c*h*z+e*k*z;this.n34=m*k*t-c*p*t-m*h*u+e*p*u+c*h*x-e*k*x;this.n41=n*u*w-k*v*w-n*t*A+h*v*A+k*t*y-h*u*y;this.n42=c*v*w-f*u*w+f*t*A-e*v*A-c*t*y+e*u*y;this.n43=f*k*w-c*n*w-f*h*A+e*n*A+c*h*y-e*k*y;this.n44=c*n*t-f*k*t+f*h*u-e*n*u-c*h*v+e*k*v;this.multiplyScalar(1/b.determinant());
-return this},setRotationFromEuler:function(b,e){var c=b.x,f=b.y,m=b.z,h=Math.cos(c),c=Math.sin(c),k=Math.cos(f),f=Math.sin(f),n=Math.cos(m),m=Math.sin(m);switch(e){case "YXZ":var p=k*n,t=k*m,u=f*n,v=f*m;this.n11=p+v*c;this.n12=u*c-t;this.n13=h*f;this.n21=h*m;this.n22=h*n;this.n23=-c;this.n31=t*c-u;this.n32=v+p*c;this.n33=h*k;break;case "ZXY":p=k*n;t=k*m;u=f*n;v=f*m;this.n11=p-v*c;this.n12=-h*m;this.n13=u+t*c;this.n21=t+u*c;this.n22=h*n;this.n23=v-p*c;this.n31=-h*f;this.n32=c;this.n33=h*k;break;case "ZYX":p=
-h*n;t=h*m;u=c*n;v=c*m;this.n11=k*n;this.n12=u*f-t;this.n13=p*f+v;this.n21=k*m;this.n22=v*f+p;this.n23=t*f-u;this.n31=-f;this.n32=c*k;this.n33=h*k;break;case "YZX":p=h*k;t=h*f;u=c*k;v=c*f;this.n11=k*n;this.n12=v-p*m;this.n13=u*m+t;this.n21=m;this.n22=h*n;this.n23=-c*n;this.n31=-f*n;this.n32=t*m+u;this.n33=p-v*m;break;case "XZY":p=h*k;t=h*f;u=c*k;v=c*f;this.n11=k*n;this.n12=-m;this.n13=f*n;this.n21=p*m+v;this.n22=h*n;this.n23=t*m-u;this.n31=u*m-t;this.n32=c*n;this.n33=v*m+p;break;default:p=h*n,t=h*
-m,u=c*n,v=c*m,this.n11=k*n,this.n12=-k*m,this.n13=f,this.n21=t+u*f,this.n22=p-v*f,this.n23=-c*k,this.n31=v-p*f,this.n32=u+t*f,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var e=b.x,c=b.y,f=b.z,m=b.w,h=e+e,k=c+c,n=f+f,b=e*h,p=e*k;e*=n;var t=c*k;c*=n;f*=n;h*=m;k*=m;m*=n;this.n11=1-(t+f);this.n12=p-m;this.n13=e+k;this.n21=p+m;this.n22=1-(b+f);this.n23=c-h;this.n31=e-k;this.n32=c+h;this.n33=1-(b+t);return this},scale:function(b){var e=b.x,c=b.y,b=b.z;this.n11*=e;this.n12*=c;this.n13*=
+0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,e){var c=Math.cos(e),f=Math.sin(e),m=1-c,h=b.x,k=b.y,n=b.z,p=m*h,v=m*k;this.set(p*h+c,p*k-f*n,p*n+f*k,0,p*k+f*n,v*k+c,v*n-f*h,0,p*n-f*k,v*n+f*h,m*n*n+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){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(b){var e=b.n11,c=b.n12,f=b.n13,m=b.n14,h=b.n21,k=b.n22,n=b.n23,p=b.n24,v=b.n31,u=b.n32,t=b.n33,x=b.n34,w=b.n41,A=b.n42,y=b.n43,z=b.n44;this.n11=n*x*A-p*t*A+p*u*y-k*x*y-n*u*z+k*t*z;this.n12=m*t*A-f*x*A-m*u*y+c*x*y+f*u*z-c*t*z;this.n13=f*p*A-m*n*A+m*k*y-c*p*y-f*k*z+c*n*z;this.n14=m*n*u-f*p*u-m*k*t+c*p*t+f*k*x-c*n*x;this.n21=p*t*w-n*x*w-p*v*y+h*x*y+n*v*z-h*t*z;this.n22=f*x*w-m*t*w+
+m*v*y-e*x*y-f*v*z+e*t*z;this.n23=m*n*w-f*p*w-m*h*y+e*p*y+f*h*z-e*n*z;this.n24=f*p*v-m*n*v+m*h*t-e*p*t-f*h*x+e*n*x;this.n31=k*x*w-p*u*w+p*v*A-h*x*A-k*v*z+h*u*z;this.n32=m*u*w-c*x*w-m*v*A+e*x*A+c*v*z-e*u*z;this.n33=f*p*w-m*k*w+m*h*A-e*p*A-c*h*z+e*k*z;this.n34=m*k*v-c*p*v-m*h*u+e*p*u+c*h*x-e*k*x;this.n41=n*u*w-k*t*w-n*v*A+h*t*A+k*v*y-h*u*y;this.n42=c*t*w-f*u*w+f*v*A-e*t*A-c*v*y+e*u*y;this.n43=f*k*w-c*n*w-f*h*A+e*n*A+c*h*y-e*k*y;this.n44=c*n*v-f*k*v+f*h*u-e*n*u-c*h*t+e*k*t;this.multiplyScalar(1/b.determinant());
+return this},setRotationFromEuler:function(b,e){var c=b.x,f=b.y,m=b.z,h=Math.cos(c),c=Math.sin(c),k=Math.cos(f),f=Math.sin(f),n=Math.cos(m),m=Math.sin(m);switch(e){case "YXZ":var p=k*n,v=k*m,u=f*n,t=f*m;this.n11=p+t*c;this.n12=u*c-v;this.n13=h*f;this.n21=h*m;this.n22=h*n;this.n23=-c;this.n31=v*c-u;this.n32=t+p*c;this.n33=h*k;break;case "ZXY":p=k*n;v=k*m;u=f*n;t=f*m;this.n11=p-t*c;this.n12=-h*m;this.n13=u+v*c;this.n21=v+u*c;this.n22=h*n;this.n23=t-p*c;this.n31=-h*f;this.n32=c;this.n33=h*k;break;case "ZYX":p=
+h*n;v=h*m;u=c*n;t=c*m;this.n11=k*n;this.n12=u*f-v;this.n13=p*f+t;this.n21=k*m;this.n22=t*f+p;this.n23=v*f-u;this.n31=-f;this.n32=c*k;this.n33=h*k;break;case "YZX":p=h*k;v=h*f;u=c*k;t=c*f;this.n11=k*n;this.n12=t-p*m;this.n13=u*m+v;this.n21=m;this.n22=h*n;this.n23=-c*n;this.n31=-f*n;this.n32=v*m+u;this.n33=p-t*m;break;case "XZY":p=h*k;v=h*f;u=c*k;t=c*f;this.n11=k*n;this.n12=-m;this.n13=f*n;this.n21=p*m+t;this.n22=h*n;this.n23=v*m-u;this.n31=u*m-v;this.n32=c*n;this.n33=t*m+p;break;default:p=h*n,v=h*
+m,u=c*n,t=c*m,this.n11=k*n,this.n12=-k*m,this.n13=f,this.n21=v+u*f,this.n22=p-t*f,this.n23=-c*k,this.n31=t-p*f,this.n32=u+v*f,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var e=b.x,c=b.y,f=b.z,m=b.w,h=e+e,k=c+c,n=f+f,b=e*h,p=e*k;e*=n;var v=c*k;c*=n;f*=n;h*=m;k*=m;m*=n;this.n11=1-(v+f);this.n12=p-m;this.n13=e+k;this.n21=p+m;this.n22=1-(b+f);this.n23=c-h;this.n31=e-k;this.n32=c+h;this.n33=1-(b+v);return this},scale:function(b){var e=b.x,c=b.y,b=b.z;this.n11*=e;this.n12*=c;this.n13*=
 b;this.n21*=e;this.n22*=c;this.n23*=b;this.n31*=e;this.n32*=c;this.n33*=b;this.n41*=e;this.n42*=c;this.n43*=b;return this},compose:function(b,e,c){var f=THREE.Matrix4.__m1,m=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(e);m.setScale(c.x,c.y,c.z);this.multiply(f,m);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,e,c){var f=THREE.Matrix4.__v1,m=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);m.set(this.n12,this.n22,this.n32);h.set(this.n13,
 b;this.n21*=e;this.n22*=c;this.n23*=b;this.n31*=e;this.n32*=c;this.n33*=b;this.n41*=e;this.n42*=c;this.n43*=b;return this},compose:function(b,e,c){var f=THREE.Matrix4.__m1,m=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(e);m.setScale(c.x,c.y,c.z);this.multiply(f,m);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,e,c){var f=THREE.Matrix4.__v1,m=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);m.set(this.n12,this.n22,this.n32);h.set(this.n13,
 this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;e=e instanceof THREE.Quaternion?e:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=f.length();c.y=m.length();c.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=c.x;f.n21/=c.x;f.n31/=c.x;f.n12/=c.y;f.n22/=c.y;f.n32/=c.y;f.n13/=c.z;f.n23/=c.z;f.n33/=c.z;e.setFromRotationMatrix(f);return[b,e,c]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34;
 this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;e=e instanceof THREE.Quaternion?e:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=f.length();c.y=m.length();c.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=c.x;f.n21/=c.x;f.n31/=c.x;f.n12/=c.y;f.n22/=c.y;f.n32/=c.y;f.n13/=c.z;f.n23/=c.z;f.n33/=c.z;e.setFromRotationMatrix(f);return[b,e,c]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34;
 return this},extractRotation:function(b){var e=THREE.Matrix4.__v1,c=1/e.set(b.n11,b.n21,b.n31).length(),f=1/e.set(b.n12,b.n22,b.n32).length(),e=1/e.set(b.n13,b.n23,b.n33).length();this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*e;this.n23=b.n23*e;this.n33=b.n33*e;return this}};
 return this},extractRotation:function(b){var e=THREE.Matrix4.__v1,c=1/e.set(b.n11,b.n21,b.n31).length(),f=1/e.set(b.n12,b.n22,b.n32).length(),e=1/e.set(b.n13,b.n23,b.n33).length();this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*e;this.n23=b.n23*e;this.n33=b.n33*e;return this}};
-THREE.Matrix4.makeInvert3x3=function(b){var e=b.m33,c=e.m,f=b.n33*b.n22-b.n32*b.n23,m=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,u=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*t;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;c[0]=b*f;c[1]=b*m;c[2]=b*h;c[3]=b*k;c[4]=b*n;c[5]=b*p;c[6]=b*t;c[7]=b*u;c[8]=b*v;return e};
+THREE.Matrix4.makeInvert3x3=function(b){var e=b.m33,c=e.m,f=b.n33*b.n22-b.n32*b.n23,m=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,v=b.n23*b.n12-b.n22*b.n13,u=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*v;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;c[0]=b*f;c[1]=b*m;c[2]=b*h;c[3]=b*k;c[4]=b*n;c[5]=b*p;c[6]=b*v;c[7]=b*u;c[8]=b*t;return e};
 THREE.Matrix4.makeFrustum=function(b,e,c,f,m,h){var k;k=new THREE.Matrix4;k.n11=2*m/(e-b);k.n12=0;k.n13=(e+b)/(e-b);k.n14=0;k.n21=0;k.n22=2*m/(f-c);k.n23=(f+c)/(f-c);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+m)/(h-m);k.n34=-2*h*m/(h-m);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,e,c,f){var m,b=c*Math.tan(b*Math.PI/360);m=-b;return THREE.Matrix4.makeFrustum(m*e,b*e,m,b,c,f)};
 THREE.Matrix4.makeFrustum=function(b,e,c,f,m,h){var k;k=new THREE.Matrix4;k.n11=2*m/(e-b);k.n12=0;k.n13=(e+b)/(e-b);k.n14=0;k.n21=0;k.n22=2*m/(f-c);k.n23=(f+c)/(f-c);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+m)/(h-m);k.n34=-2*h*m/(h-m);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,e,c,f){var m,b=c*Math.tan(b*Math.PI/360);m=-b;return THREE.Matrix4.makeFrustum(m*e,b*e,m,b,c,f)};
-THREE.Matrix4.makeOrtho=function(b,e,c,f,m,h){var k,n,p,t;k=new THREE.Matrix4;n=e-b;p=c-f;t=h-m;k.n11=2/n;k.n12=0;k.n13=0;k.n14=-((e+b)/n);k.n21=0;k.n22=2/p;k.n23=0;k.n24=-((c+f)/p);k.n31=0;k.n32=0;k.n33=-2/t;k.n34=-((h+m)/t);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};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(b,e,c,f,m,h){var k,n,p,v;k=new THREE.Matrix4;n=e-b;p=c-f;v=h-m;k.n11=2/n;k.n12=0;k.n13=0;k.n14=-((e+b)/n);k.n21=0;k.n22=2/p;k.n23=0;k.n24=-((c+f)/p);k.n31=0;k.n32=0;k.n33=-2/v;k.n34=-((h+m)/v);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,e){this.matrix.rotateAxis(e);this.position.addSelf(e.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,e){this.matrix.rotateAxis(e);this.position.addSelf(e.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
 -1)b.parent!==void 0&&b.parent.remove(b),b.parent=this,this.children.push(b)},remove:function(b){var e=this.children.indexOf(b);if(e!==-1)b.parent=void 0,this.children.splice(e,1)},getChildByName:function(b,e){var c,f,m;c=0;for(f=this.children.length;c<f;c++){m=this.children[c];if(m.name===b)return m;if(e&&(m=m.getChildByName(b,e),m!==void 0))return m}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
 -1)b.parent!==void 0&&b.parent.remove(b),b.parent=this,this.children.push(b)},remove:function(b){var e=this.children.indexOf(b);if(e!==-1)b.parent=void 0,this.children.splice(e,1)},getChildByName:function(b,e){var c,f,m;c=0;for(f=this.children.length;c<f;c++){m=this.children[c];if(m.name===b)return m;if(e&&(m=m.getChildByName(b,e),m!==void 0))return m}},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(b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;for(var e=0,c=this.children.length;e<
 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(b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;for(var e=0,c=this.children.length;e<
 c;e++)this.children[e].updateMatrixWorld(b)}};THREE.Object3DCount=0;
 c;e++)this.children[e].updateMatrixWorld(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=h[m]=h[m]||new THREE.RenderableVertex;m++;return b}function e(b,c){return c.z-b.z}function c(b,c){var e=0,f=1,h=b.z+b.w,m=c.z+c.w,k=-b.z+b.w,n=-c.z+c.w;return h>=0&&m>=0&&k>=0&&n>=0?!0:h<0&&m<0||k<0&&n<0?!1:(h<0?e=Math.max(e,h/(h-m)):m<0&&(f=Math.min(f,h/(h-m))),k<0?e=Math.max(e,k/(k-n)):n<0&&(f=Math.min(f,k/(k-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,m,h=[],k,n,p=[],t,u=[],v,x,w=[],A,y,z=[],E={objects:[],lights:[],elements:[]};new THREE.Vector3;
-var C=new THREE.Vector4,B=new THREE.Matrix4,G=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(b,c){c.matrixWorldInverse.getInverse(c.matrixWorld);B.multiply(c.projectionMatrix,c.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,c){c.projectionMatrixInverse.getInverse(c.projectionMatrix);B.multiply(c.matrixWorld,c.projectionMatrixInverse);
-B.multiplyVector3(b);return b};this.pickingRay=function(b,c){var e;b.z=-1;e=new THREE.Vector3(b.x,b.y,1);this.unprojectVector(b,c);this.unprojectVector(e,c);e.subSelf(b).normalize();return new THREE.Ray(b,e)};this.projectGraph=function(b){E.objects.length=0;E.lights.length=0;var c=function(b){if(b.visible!=!1){var e;if(!(e=b instanceof THREE.Particle))if(!(e=b instanceof THREE.Line))if(e=b instanceof THREE.Mesh)if(!(e=!b.frustumCulled))a:{for(var f=b.matrixWorld,h=-b.geometry.boundingSphere.radius*
-Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),m=0;m<6;m++)if(e=N[m].x*f.n14+N[m].y*f.n24+N[m].z*f.n34+N[m].w,e<=h){e=!1;break a}e=!0}e?E.objects.push(b):b instanceof THREE.Light&&E.lights.push(b);e=0;for(f=b.children.length;e<f;e++)c(b.children[e])}};c(b);return E};this.projectScene=function(Z,J,O){var L=J.near,F=J.far,aa,Y,Q,P,o,T,$,da,ca,ra,qa,sa,va,ka,X,ha;y=x=t=n=0;E.elements.length=0;J.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),Z.add(J));Z.updateMatrixWorld();
-J.matrixWorldInverse.getInverse(J.matrixWorld);B.multiply(J.projectionMatrix,J.matrixWorldInverse);N[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);N[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);N[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);N[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);N[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);N[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(aa=0;aa<6;aa++)ca=N[aa],ca.divideScalar(Math.sqrt(ca.x*
-ca.x+ca.y*ca.y+ca.z*ca.z));E=this.projectGraph(Z);Z=0;for(aa=E.objects.length;Z<aa;Z++)if(ca=E.objects[Z],ra=ca.matrixWorld,sa=ca.materials,va=ca.overdraw,m=0,ca instanceof THREE.Mesh){qa=ca.geometry;P=qa.vertices;ka=qa.faces;X=qa.faceVertexUvs;qa=ca.matrixRotationWorld.extractRotation(ca.matrixWorld);Y=0;for(Q=P.length;Y<Q;Y++)f=b(),f.positionWorld.copy(P[Y].position),ra.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),B.multiplyVector4(f.positionScreen),f.positionScreen.x/=
-f.positionScreen.w,f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>L&&f.positionScreen.z<F;P=0;for(Y=ka.length;P<Y;P++){Q=ka[P];if(Q instanceof THREE.Face3)if(o=h[Q.a],T=h[Q.b],$=h[Q.c],o.visible&&T.visible&&$.visible&&(ca.doubleSided||ca.flipSided!=($.positionScreen.x-o.positionScreen.x)*(T.positionScreen.y-o.positionScreen.y)-($.positionScreen.y-o.positionScreen.y)*(T.positionScreen.x-o.positionScreen.x)<0))da=p[n]=p[n]||new THREE.RenderableFace3,n++,k=da,k.v1.copy(o),k.v2.copy(T),
-k.v3.copy($);else continue;else if(Q instanceof THREE.Face4)if(o=h[Q.a],T=h[Q.b],$=h[Q.c],da=h[Q.d],o.visible&&T.visible&&$.visible&&da.visible&&(ca.doubleSided||ca.flipSided!=((da.positionScreen.x-o.positionScreen.x)*(T.positionScreen.y-o.positionScreen.y)-(da.positionScreen.y-o.positionScreen.y)*(T.positionScreen.x-o.positionScreen.x)<0||(T.positionScreen.x-$.positionScreen.x)*(da.positionScreen.y-$.positionScreen.y)-(T.positionScreen.y-$.positionScreen.y)*(da.positionScreen.x-$.positionScreen.x)<
-0)))ha=u[t]=u[t]||new THREE.RenderableFace4,t++,k=ha,k.v1.copy(o),k.v2.copy(T),k.v3.copy($),k.v4.copy(da);else continue;k.normalWorld.copy(Q.normal);qa.multiplyVector3(k.normalWorld);k.centroidWorld.copy(Q.centroid);ra.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);B.multiplyVector3(k.centroidScreen);$=Q.vertexNormals;o=0;for(T=$.length;o<T;o++)da=k.vertexNormalsWorld[o],da.copy($[o]),qa.multiplyVector3(da);o=0;for(T=X.length;o<T;o++)if(ha=X[o][P]){$=0;for(da=ha.length;$<
-da;$++)k.uvs[o][$]=ha[$]}k.meshMaterials=sa;k.faceMaterials=Q.materials;k.overdraw=va;k.z=k.centroidScreen.z;E.elements.push(k)}}else if(ca instanceof THREE.Line){G.multiply(B,ra);P=ca.geometry.vertices;o=b();o.positionScreen.copy(P[0].position);G.multiplyVector4(o.positionScreen);Y=1;for(Q=P.length;Y<Q;Y++)if(o=b(),o.positionScreen.copy(P[Y].position),G.multiplyVector4(o.positionScreen),T=h[m-2],I.copy(o.positionScreen),M.copy(T.positionScreen),c(I,M))I.multiplyScalar(1/I.w),M.multiplyScalar(1/M.w),
-ra=w[x]=w[x]||new THREE.RenderableLine,x++,v=ra,v.v1.positionScreen.copy(I),v.v2.positionScreen.copy(M),v.z=Math.max(I.z,M.z),v.materials=ca.materials,E.elements.push(v)}else if(ca instanceof THREE.Particle&&(C.set(ca.matrixWorld.n14,ca.matrixWorld.n24,ca.matrixWorld.n34,1),B.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))ra=z[y]=z[y]||new THREE.RenderableParticle,y++,A=ra,A.x=C.x/C.w,A.y=C.y/C.w,A.z=C.z,A.rotation=ca.rotation.z,A.scale.x=ca.scale.x*Math.abs(A.x-(C.x+J.projectionMatrix.n11)/(C.w+J.projectionMatrix.n14)),
-A.scale.y=ca.scale.y*Math.abs(A.y-(C.y+J.projectionMatrix.n22)/(C.w+J.projectionMatrix.n24)),A.materials=ca.materials,E.elements.push(A);O&&E.elements.sort(e);return E}};THREE.Quaternion=function(b,e,c,f){this.set(b||0,e||0,c||0,f!==void 0?f:1)};
+THREE.Projector=function(){function b(){var b=h[m]=h[m]||new THREE.RenderableVertex;m++;return b}function e(b,c){return c.z-b.z}function c(b,c){var e=0,f=1,h=b.z+b.w,m=c.z+c.w,k=-b.z+b.w,n=-c.z+c.w;return h>=0&&m>=0&&k>=0&&n>=0?!0:h<0&&m<0||k<0&&n<0?!1:(h<0?e=Math.max(e,h/(h-m)):m<0&&(f=Math.min(f,h/(h-m))),k<0?e=Math.max(e,k/(k-n)):n<0&&(f=Math.min(f,k/(k-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,m,h=[],k,n,p=[],v,u=[],t,x,w=[],A,y,z=[],F={objects:[],lights:[],elements:[]};new THREE.Vector3;
+var D=new THREE.Vector4,B=new THREE.Matrix4,G=new THREE.Matrix4,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(b,c){c.matrixWorldInverse.getInverse(c.matrixWorld);B.multiply(c.projectionMatrix,c.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,c){c.projectionMatrixInverse.getInverse(c.projectionMatrix);B.multiply(c.matrixWorld,c.projectionMatrixInverse);
+B.multiplyVector3(b);return b};this.pickingRay=function(b,c){var e;b.z=-1;e=new THREE.Vector3(b.x,b.y,1);this.unprojectVector(b,c);this.unprojectVector(e,c);e.subSelf(b).normalize();return new THREE.Ray(b,e)};this.projectGraph=function(b){F.objects.length=0;F.lights.length=0;var c=function(b){if(b.visible!=!1){var e;if(!(e=b instanceof THREE.Particle))if(!(e=b instanceof THREE.Line))if(e=b instanceof THREE.Mesh)if(!(e=!b.frustumCulled))a:{for(var f=b.matrixWorld,h=-b.geometry.boundingSphere.radius*
+Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),m=0;m<6;m++)if(e=O[m].x*f.n14+O[m].y*f.n24+O[m].z*f.n34+O[m].w,e<=h){e=!1;break a}e=!0}e?F.objects.push(b):b instanceof THREE.Light&&F.lights.push(b);e=0;for(f=b.children.length;e<f;e++)c(b.children[e])}};c(b);return F};this.projectScene=function(U,L,R){var I=L.near,K=L.far,aa,Z,S,M,o,N,da,fa,X,ma,pa,ra,ya,la,Y,$;y=x=v=n=0;F.elements.length=0;L.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),U.add(L));U.updateMatrixWorld();
+L.matrixWorldInverse.getInverse(L.matrixWorld);B.multiply(L.projectionMatrix,L.matrixWorldInverse);O[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);O[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);O[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);O[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);O[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);O[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(aa=0;aa<6;aa++)X=O[aa],X.divideScalar(Math.sqrt(X.x*
+X.x+X.y*X.y+X.z*X.z));F=this.projectGraph(U);U=0;for(aa=F.objects.length;U<aa;U++)if(X=F.objects[U],ma=X.matrixWorld,ra=X.materials,ya=X.overdraw,m=0,X instanceof THREE.Mesh){pa=X.geometry;M=pa.vertices;la=pa.faces;Y=pa.faceVertexUvs;pa=X.matrixRotationWorld.extractRotation(X.matrixWorld);Z=0;for(S=M.length;Z<S;Z++)f=b(),f.positionWorld.copy(M[Z].position),ma.multiplyVector3(f.positionWorld),f.positionScreen.copy(f.positionWorld),B.multiplyVector4(f.positionScreen),f.positionScreen.x/=f.positionScreen.w,
+f.positionScreen.y/=f.positionScreen.w,f.visible=f.positionScreen.z>I&&f.positionScreen.z<K;M=0;for(Z=la.length;M<Z;M++){S=la[M];if(S instanceof THREE.Face3)if(o=h[S.a],N=h[S.b],da=h[S.c],o.visible&&N.visible&&da.visible&&(X.doubleSided||X.flipSided!=(da.positionScreen.x-o.positionScreen.x)*(N.positionScreen.y-o.positionScreen.y)-(da.positionScreen.y-o.positionScreen.y)*(N.positionScreen.x-o.positionScreen.x)<0))fa=p[n]=p[n]||new THREE.RenderableFace3,n++,k=fa,k.v1.copy(o),k.v2.copy(N),k.v3.copy(da);
+else continue;else if(S instanceof THREE.Face4)if(o=h[S.a],N=h[S.b],da=h[S.c],fa=h[S.d],o.visible&&N.visible&&da.visible&&fa.visible&&(X.doubleSided||X.flipSided!=((fa.positionScreen.x-o.positionScreen.x)*(N.positionScreen.y-o.positionScreen.y)-(fa.positionScreen.y-o.positionScreen.y)*(N.positionScreen.x-o.positionScreen.x)<0||(N.positionScreen.x-da.positionScreen.x)*(fa.positionScreen.y-da.positionScreen.y)-(N.positionScreen.y-da.positionScreen.y)*(fa.positionScreen.x-da.positionScreen.x)<0)))$=
+u[v]=u[v]||new THREE.RenderableFace4,v++,k=$,k.v1.copy(o),k.v2.copy(N),k.v3.copy(da),k.v4.copy(fa);else continue;k.normalWorld.copy(S.normal);pa.multiplyVector3(k.normalWorld);k.centroidWorld.copy(S.centroid);ma.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);B.multiplyVector3(k.centroidScreen);da=S.vertexNormals;o=0;for(N=da.length;o<N;o++)fa=k.vertexNormalsWorld[o],fa.copy(da[o]),pa.multiplyVector3(fa);o=0;for(N=Y.length;o<N;o++)if($=Y[o][M]){da=0;for(fa=$.length;da<fa;da++)k.uvs[o][da]=
+$[da]}k.meshMaterials=ra;k.faceMaterials=S.materials;k.overdraw=ya;k.z=k.centroidScreen.z;F.elements.push(k)}}else if(X instanceof THREE.Line){G.multiply(B,ma);M=X.geometry.vertices;o=b();o.positionScreen.copy(M[0].position);G.multiplyVector4(o.positionScreen);Z=1;for(S=M.length;Z<S;Z++)if(o=b(),o.positionScreen.copy(M[Z].position),G.multiplyVector4(o.positionScreen),N=h[m-2],E.copy(o.positionScreen),P.copy(N.positionScreen),c(E,P))E.multiplyScalar(1/E.w),P.multiplyScalar(1/P.w),ma=w[x]=w[x]||new THREE.RenderableLine,
+x++,t=ma,t.v1.positionScreen.copy(E),t.v2.positionScreen.copy(P),t.z=Math.max(E.z,P.z),t.materials=X.materials,F.elements.push(t)}else if(X instanceof THREE.Particle&&(D.set(X.matrixWorld.n14,X.matrixWorld.n24,X.matrixWorld.n34,1),B.multiplyVector4(D),D.z/=D.w,D.z>0&&D.z<1))ma=z[y]=z[y]||new THREE.RenderableParticle,y++,A=ma,A.x=D.x/D.w,A.y=D.y/D.w,A.z=D.z,A.rotation=X.rotation.z,A.scale.x=X.scale.x*Math.abs(A.x-(D.x+L.projectionMatrix.n11)/(D.w+L.projectionMatrix.n14)),A.scale.y=X.scale.y*Math.abs(A.y-
+(D.y+L.projectionMatrix.n22)/(D.w+L.projectionMatrix.n24)),A.materials=X.materials,F.elements.push(A);R&&F.elements.sort(e);return F}};THREE.Quaternion=function(b,e,c,f){this.set(b||0,e||0,c||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,e,c,f){this.x=b;this.y=e;this.z=c;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var e=Math.PI/360,c=b.x*e,f=b.y*e,m=b.z*e,b=Math.cos(f),f=Math.sin(f),e=Math.cos(-m),m=Math.sin(-m),h=Math.cos(c),c=Math.sin(c),k=b*e,n=f*m;this.w=k*h-n*c;this.x=k*c+n*h;this.y=f*e*h+b*m*c;this.z=b*m*h-f*e*c;return this},setFromAxisAngle:function(b,e){var c=e/2,f=Math.sin(c);
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,e,c,f){this.x=b;this.y=e;this.z=c;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var e=Math.PI/360,c=b.x*e,f=b.y*e,m=b.z*e,b=Math.cos(f),f=Math.sin(f),e=Math.cos(-m),m=Math.sin(-m),h=Math.cos(c),c=Math.sin(c),k=b*e,n=f*m;this.w=k*h-n*c;this.x=k*c+n*h;this.y=f*e*h+b*m*c;this.z=b*m*h-f*e*c;return this},setFromAxisAngle:function(b,e){var c=e/2,f=Math.sin(c);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(c);return this},setFromRotationMatrix:function(b){var e=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,e+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,e+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,e-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,e-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(c);return this},setFromRotationMatrix:function(b){var e=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,e+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,e+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,e-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,e-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var e=
 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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var e=
-this.x,c=this.y,f=this.z,m=this.w,h=b.x,k=b.y,n=b.z,b=b.w;this.x=e*b+m*h+c*n-f*k;this.y=c*b+m*k+f*h-e*n;this.z=f*b+m*n+e*k-c*h;this.w=m*b-e*h-c*k-f*n;return this},multiply:function(b,e){this.x=b.x*e.w+b.y*e.z-b.z*e.y+b.w*e.x;this.y=-b.x*e.z+b.y*e.w+b.z*e.x+b.w*e.y;this.z=b.x*e.y-b.y*e.x+b.z*e.w+b.w*e.z;this.w=-b.x*e.x-b.y*e.y-b.z*e.z+b.w*e.w;return this},multiplyVector3:function(b,e){e||(e=b);var c=b.x,f=b.y,m=b.z,h=this.x,k=this.y,n=this.z,p=this.w,t=p*c+k*m-n*f,u=p*f+n*c-h*m,v=p*m+h*f-k*c,c=-h*
-c-k*f-n*m;e.x=t*p+c*-h+u*-n-v*-k;e.y=u*p+c*-k+v*-h-t*-n;e.z=v*p+c*-n+t*-k-u*-h;return e}};
+this.x,c=this.y,f=this.z,m=this.w,h=b.x,k=b.y,n=b.z,b=b.w;this.x=e*b+m*h+c*n-f*k;this.y=c*b+m*k+f*h-e*n;this.z=f*b+m*n+e*k-c*h;this.w=m*b-e*h-c*k-f*n;return this},multiply:function(b,e){this.x=b.x*e.w+b.y*e.z-b.z*e.y+b.w*e.x;this.y=-b.x*e.z+b.y*e.w+b.z*e.x+b.w*e.y;this.z=b.x*e.y-b.y*e.x+b.z*e.w+b.w*e.z;this.w=-b.x*e.x-b.y*e.y-b.z*e.z+b.w*e.w;return this},multiplyVector3:function(b,e){e||(e=b);var c=b.x,f=b.y,m=b.z,h=this.x,k=this.y,n=this.z,p=this.w,v=p*c+k*m-n*f,u=p*f+n*c-h*m,t=p*m+h*f-k*c,c=-h*
+c-k*f-n*m;e.x=v*p+c*-h+u*-n-t*-k;e.y=u*p+c*-k+t*-h-v*-n;e.z=t*p+c*-n+v*-k-u*-h;return e}};
 THREE.Quaternion.slerp=function(b,e,c,f){var m=b.w*e.w+b.x*e.x+b.y*e.y+b.z*e.z;m<0?(c.w=-e.w,c.x=-e.x,c.y=-e.y,c.z=-e.z,m=-m):c.copy(e);if(Math.abs(m)>=1)return c.w=b.w,c.x=b.x,c.y=b.y,c.z=b.z,c;var h=Math.acos(m),m=Math.sqrt(1-m*m);if(Math.abs(m)<0.0010)return c.w=0.5*(b.w+e.w),c.x=0.5*(b.x+e.x),c.y=0.5*(b.y+e.y),c.z=0.5*(b.z+e.z),c;e=Math.sin((1-f)*h)/m;f=Math.sin(f*h)/m;c.w=b.w*e+c.w*f;c.x=b.x*e+c.x*f;c.y=b.y*e+c.y*f;c.z=b.z*e+c.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Quaternion.slerp=function(b,e,c,f){var m=b.w*e.w+b.x*e.x+b.y*e.y+b.z*e.z;m<0?(c.w=-e.w,c.x=-e.x,c.y=-e.y,c.z=-e.z,m=-m):c.copy(e);if(Math.abs(m)>=1)return c.w=b.w,c.x=b.x,c.y=b.y,c.z=b.z,c;var h=Math.acos(m),m=Math.sqrt(1-m*m);if(Math.abs(m)<0.0010)return c.w=0.5*(b.w+e.w),c.x=0.5*(b.x+e.x),c.y=0.5*(b.y+e.y),c.z=0.5*(b.z+e.z),c;e=Math.sin((1-f)*h)/m;f=Math.sin(f*h)/m;c.w=b.w*e+c.w*f;c.x=b.x*e+c.x*f;c.y=b.y*e+c.y*f;c.z=b.z*e+c.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,e,c,f,m,h){this.a=b;this.b=e;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face3=function(b,e,c,f,m,h){this.a=b;this.b=e;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,e,c,f,m,h,k){this.a=b;this.b=e;this.c=c;this.d=f;this.normal=m instanceof THREE.Vector3?m:new THREE.Vector3;this.vertexNormals=m instanceof Array?m:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,e){this.u=b||0;this.v=e||0};
 THREE.Face4=function(b,e,c,f,m,h,k){this.a=b;this.b=e;this.c=c;this.d=f;this.normal=m instanceof THREE.Vector3?m:new THREE.Vector3;this.vertexNormals=m instanceof Array?m:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,e){this.u=b||0;this.v=e||0};
@@ -79,15 +79,15 @@ e;b++)c=this.faces[b],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 c,f,m,h,k,n=new THREE.Vector3,p=new THREE.Vector3;f=0;for(m=this.faces.length;f<m;f++){h=this.faces[f];if(b&&h.vertexNormals.length){n.set(0,0,0);e=0;for(c=h.vertexNormals.length;e<c;e++)n.addSelf(h.vertexNormals[e]);n.divideScalar(3)}else e=this.vertices[h.a],c=this.vertices[h.b],k=this.vertices[h.c],n.sub(k.position,c.position),p.sub(e.position,c.position),n.crossSelf(p);n.isZero()||n.normalize();h.normal.copy(n)}},computeVertexNormals:function(){var b,e,c,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 c,f,m,h,k,n=new THREE.Vector3,p=new THREE.Vector3;f=0;for(m=this.faces.length;f<m;f++){h=this.faces[f];if(b&&h.vertexNormals.length){n.set(0,0,0);e=0;for(c=h.vertexNormals.length;e<c;e++)n.addSelf(h.vertexNormals[e]);n.divideScalar(3)}else e=this.vertices[h.a],c=this.vertices[h.b],k=this.vertices[h.c],n.sub(k.position,c.position),p.sub(e.position,c.position),n.crossSelf(p);n.isZero()||n.normalize();h.normal.copy(n)}},computeVertexNormals:function(){var b,e,c,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
 Array(this.vertices.length);b=0;for(e=this.vertices.length;b<e;b++)f[b]=new THREE.Vector3;b=0;for(e=this.faces.length;b<e;b++)if(c=this.faces[b],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{f=this.__tmpVertices;b=0;for(e=this.vertices.length;b<e;b++)f[b].set(0,0,0)}b=0;for(e=this.faces.length;b<e;b++)c=this.faces[b],c instanceof
 Array(this.vertices.length);b=0;for(e=this.vertices.length;b<e;b++)f[b]=new THREE.Vector3;b=0;for(e=this.faces.length;b<e;b++)if(c=this.faces[b],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{f=this.__tmpVertices;b=0;for(e=this.vertices.length;b<e;b++)f[b].set(0,0,0)}b=0;for(e=this.faces.length;b<e;b++)c=this.faces[b],c instanceof
 THREE.Face3?(f[c.a].addSelf(c.normal),f[c.b].addSelf(c.normal),f[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(f[c.a].addSelf(c.normal),f[c.b].addSelf(c.normal),f[c.c].addSelf(c.normal),f[c.d].addSelf(c.normal));b=0;for(e=this.vertices.length;b<e;b++)f[b].normalize();b=0;for(e=this.faces.length;b<e;b++)c=this.faces[b],c instanceof THREE.Face3?(c.vertexNormals[0].copy(f[c.a]),c.vertexNormals[1].copy(f[c.b]),c.vertexNormals[2].copy(f[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(f[c.a]),
 THREE.Face3?(f[c.a].addSelf(c.normal),f[c.b].addSelf(c.normal),f[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(f[c.a].addSelf(c.normal),f[c.b].addSelf(c.normal),f[c.c].addSelf(c.normal),f[c.d].addSelf(c.normal));b=0;for(e=this.vertices.length;b<e;b++)f[b].normalize();b=0;for(e=this.faces.length;b<e;b++)c=this.faces[b],c instanceof THREE.Face3?(c.vertexNormals[0].copy(f[c.a]),c.vertexNormals[1].copy(f[c.b]),c.vertexNormals[2].copy(f[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(f[c.a]),
-c.vertexNormals[1].copy(f[c.b]),c.vertexNormals[2].copy(f[c.c]),c.vertexNormals[3].copy(f[c.d]))},computeTangents:function(){function b(b,c,e,f,h,m,P){n=b.vertices[c].position;p=b.vertices[e].position;t=b.vertices[f].position;u=k[h];v=k[m];x=k[P];w=p.x-n.x;A=t.x-n.x;y=p.y-n.y;z=t.y-n.y;E=p.z-n.z;C=t.z-n.z;B=v.u-u.u;G=x.u-u.u;N=v.v-u.v;I=x.v-u.v;M=1/(B*I-G*N);L.set((I*w-N*A)*M,(I*y-N*z)*M,(I*E-N*C)*M);F.set((B*A-G*w)*M,(B*z-G*y)*M,(B*C-G*E)*M);J[c].addSelf(L);J[e].addSelf(L);J[f].addSelf(L);O[c].addSelf(F);
-O[e].addSelf(F);O[f].addSelf(F)}var e,c,f,m,h,k,n,p,t,u,v,x,w,A,y,z,E,C,B,G,N,I,M,Z,J=[],O=[],L=new THREE.Vector3,F=new THREE.Vector3,aa=new THREE.Vector3,Y=new THREE.Vector3,Q=new THREE.Vector3;e=0;for(c=this.vertices.length;e<c;e++)J[e]=new THREE.Vector3,O[e]=new THREE.Vector3;e=0;for(c=this.faces.length;e<c;e++)h=this.faces[e],k=this.faceVertexUvs[0][e],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var P=["a",
-"b","c","d"];e=0;for(c=this.faces.length;e<c;e++){h=this.faces[e];for(f=0;f<h.vertexNormals.length;f++)Q.copy(h.vertexNormals[f]),m=h[P[f]],Z=J[m],aa.copy(Z),aa.subSelf(Q.multiplyScalar(Q.dot(Z))).normalize(),Y.cross(h.vertexNormals[f],Z),m=Y.dot(O[m]),m=m<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(aa.x,aa.y,aa.z,m)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+c.vertexNormals[1].copy(f[c.b]),c.vertexNormals[2].copy(f[c.c]),c.vertexNormals[3].copy(f[c.d]))},computeTangents:function(){function b(b,c,e,f,h,m,M){n=b.vertices[c].position;p=b.vertices[e].position;v=b.vertices[f].position;u=k[h];t=k[m];x=k[M];w=p.x-n.x;A=v.x-n.x;y=p.y-n.y;z=v.y-n.y;F=p.z-n.z;D=v.z-n.z;B=t.u-u.u;G=x.u-u.u;O=t.v-u.v;E=x.v-u.v;P=1/(B*E-G*O);I.set((E*w-O*A)*P,(E*y-O*z)*P,(E*F-O*D)*P);K.set((B*A-G*w)*P,(B*z-G*y)*P,(B*D-G*F)*P);L[c].addSelf(I);L[e].addSelf(I);L[f].addSelf(I);R[c].addSelf(K);
+R[e].addSelf(K);R[f].addSelf(K)}var e,c,f,m,h,k,n,p,v,u,t,x,w,A,y,z,F,D,B,G,O,E,P,U,L=[],R=[],I=new THREE.Vector3,K=new THREE.Vector3,aa=new THREE.Vector3,Z=new THREE.Vector3,S=new THREE.Vector3;e=0;for(c=this.vertices.length;e<c;e++)L[e]=new THREE.Vector3,R[e]=new THREE.Vector3;e=0;for(c=this.faces.length;e<c;e++)h=this.faces[e],k=this.faceVertexUvs[0][e],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var M=["a",
+"b","c","d"];e=0;for(c=this.faces.length;e<c;e++){h=this.faces[e];for(f=0;f<h.vertexNormals.length;f++)S.copy(h.vertexNormals[f]),m=h[M[f]],U=L[m],aa.copy(U),aa.subSelf(S.multiplyScalar(S.dot(U))).normalize(),Z.cross(h.vertexNormals[f],U),m=Z.dot(R[m]),m=m<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(aa.x,aa.y,aa.z,m)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var e=1,c=this.vertices.length;e<c;e++){b=this.vertices[e];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var e=1,c=this.vertices.length;e<c;e++){b=this.vertices[e];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,e=0,c=this.vertices.length;e<c;e++)b=Math.max(b,this.vertices[e].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},e=[],c=[],f,m=Math.pow(10,4),h,k;h=0;for(k=this.vertices.length;h<k;h++)f=this.vertices[h].position,f=[Math.round(f.x*m),Math.round(f.y*m),Math.round(f.z*m)].join("_"),b[f]===void 0?(b[f]=h,e.push(this.vertices[h]),
 b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,e=0,c=this.vertices.length;e<c;e++)b=Math.max(b,this.vertices[e].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},e=[],c=[],f,m=Math.pow(10,4),h,k;h=0;for(k=this.vertices.length;h<k;h++)f=this.vertices[h].position,f=[Math.round(f.x*m),Math.round(f.y*m),Math.round(f.z*m)].join("_"),b[f]===void 0?(b[f]=h,e.push(this.vertices[h]),
 c[h]=e.length-1):c[h]=c[b[f]];h=0;for(k=this.faces.length;h<k;h++){b=this.faces[h];if(b instanceof THREE.Face3)b.a=c[b.a],b.b=c[b.b],b.c=c[b.c];if(b instanceof THREE.Face4)b.a=c[b.a],b.b=c[b.b],b.c=c[b.c],b.d=c[b.d]}this.vertices=e}};THREE.GeometryCount=0;
 c[h]=e.length-1):c[h]=c[b[f]];h=0;for(k=this.faces.length;h<k;h++){b=this.faces[h];if(b instanceof THREE.Face3)b.a=c[b.a],b.b=c[b.b],b.c=c[b.c];if(b instanceof THREE.Face4)b.a=c[b.a],b.b=c[b.b],b.c=c[b.c],b.d=c[b.d]}this.vertices=e}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function e(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+c}this.points=b;var c=[],f={x:0,y:0,z:0},m,h,k,n,p,t,u,v,x;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){m=(this.points.length-1)*b;h=Math.floor(m);k=m-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;t=this.points[c[0]];u=this.points[c[1]];
-v=this.points[c[2]];x=this.points[c[3]];n=k*k;p=k*n;f.x=e(t.x,u.x,v.x,x.x,k,n,p);f.y=e(t.y,u.y,v.y,x.y,k,n,p);f.z=e(t.z,u.z,v.z,x.z,k,n,p);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;b<e;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,e,f=c=c=0,h=new THREE.Vector3,m=new THREE.Vector3,k=[],n=0;k[0]=0;b||(b=100);e=this.points.length*b;h.copy(this.points[0]);for(b=1;b<e;b++)c=b/e,position=this.getPoint(c),m.copy(position),
-n+=m.distanceTo(h),h.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(k[c]=n,f=c);k[k.length]=n;return{chunks:k,total:n}};this.reparametrizeByArcLength=function(b){var c,e,f,h,m,k,n=[],p=new THREE.Vector3,t=this.getLength();n.push(p.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){e=t.chunks[c]-t.chunks[c-1];k=Math.ceil(b*e/t.total);h=(c-1)/(this.points.length-1);m=c/(this.points.length-1);for(e=1;e<k-1;e++)f=h+e*(1/k)*(m-h),position=this.getPoint(f),n.push(p.copy(position).clone());
+THREE.Spline=function(b){function e(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+c}this.points=b;var c=[],f={x:0,y:0,z:0},m,h,k,n,p,v,u,t,x;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){m=(this.points.length-1)*b;h=Math.floor(m);k=m-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;v=this.points[c[0]];u=this.points[c[1]];
+t=this.points[c[2]];x=this.points[c[3]];n=k*k;p=k*n;f.x=e(v.x,u.x,t.x,x.x,k,n,p);f.y=e(v.y,u.y,t.y,x.y,k,n,p);f.z=e(v.z,u.z,t.z,x.z,k,n,p);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;b<e;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,e,f=c=c=0,h=new THREE.Vector3,m=new THREE.Vector3,k=[],n=0;k[0]=0;b||(b=100);e=this.points.length*b;h.copy(this.points[0]);for(b=1;b<e;b++)c=b/e,position=this.getPoint(c),m.copy(position),
+n+=m.distanceTo(h),h.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(k[c]=n,f=c);k[k.length]=n;return{chunks:k,total:n}};this.reparametrizeByArcLength=function(b){var c,e,f,h,m,k,n=[],p=new THREE.Vector3,v=this.getLength();n.push(p.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){e=v.chunks[c]-v.chunks[c-1];k=Math.ceil(b*e/v.total);h=(c-1)/(this.points.length-1);m=c/(this.points.length-1);for(e=1;e<k-1;e++)f=h+e*(1/k)*(m-h),position=this.getPoint(f),n.push(p.copy(position).clone());
 n.push(p.copy(this.points[c]).clone())}this.points=n}};THREE.Edge=function(b,e,c,f){this.vertices=[b,e];this.vertexIndices=[c,f];this.faces=[];this.faceIndices=[]};
 n.push(p.copy(this.points[c]).clone())}this.points=n}};THREE.Edge=function(b,e,c,f){this.vertices=[b,e];this.vertexIndices=[c,f];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=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(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(b,e,c,f,m,h){THREE.Camera.call(this);this.left=b;this.right=e;this.top=c;this.bottom=f;this.near=m!==void 0?m:0.1;this.far=h!==void 0?h:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
 THREE.Camera.prototype.lookAt=function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(b,e,c,f,m,h){THREE.Camera.call(this);this.left=b;this.right=e;this.top=c;this.bottom=f;this.near=m!==void 0?m:0.1;this.far=h!==void 0?h:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
@@ -142,49 +142,49 @@ THREE.Sprite=function(b){THREE.Object3D.call(this);this.color=b.color!==void 0?n
 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.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.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};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Fog=function(b,e,c){this.color=new THREE.Color(b);this.near=e!==void 0?e:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(b,e){this.color=new THREE.Color(b);this.density=e!==void 0?e:2.5E-4};
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Fog=function(b,e,c){this.color=new THREE.Color(b);this.near=e!==void 0?e:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(b,e){this.color=new THREE.Color(b);this.density=e!==void 0?e:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,e=new THREE.Projector,c,f,m,h;this.domElement=document.createElement("div");this.setSize=function(b,e){c=b;f=e;m=c/2;h=f/2};this.render=function(c,f){var p,t,u,v,x,w,A,y;b=e.projectScene(c,f);p=0;for(t=b.length;p<t;p++)if(x=b[p],x instanceof THREE.RenderableParticle){A=x.x*m+m;y=x.y*h+h;u=0;for(v=x.material.length;u<v;u++)if(w=x.material[u],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=A+"px",w.style.top=y+"px"}}};
-THREE.CanvasRenderer=function(b){function e(b){if(C!=b)y.globalAlpha=C=b}function c(b){if(B!=b){switch(b){case THREE.NormalBlending:y.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:y.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:y.globalCompositeOperation="darker"}B=b}}function f(b){if(G!=b)y.strokeStyle=G=b}function m(b){if(N!=b)y.fillStyle=N=b}var h=this,k,n,p,t=new THREE.Projector,b=b||{},u=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-v,x,w,A,y=u.getContext("2d"),z=new THREE.Color(0),E=0,C=1,B=0,G=null,N=null,I=null,M=null,Z=null,J,O,L,F,aa=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,Q,P,o,T,$,da,ca,ra,qa,sa,va,ka,X=new THREE.Color,ha=new THREE.Color,fa=new THREE.Color,ga=new THREE.Color,K=new THREE.Color,ja=[],wa,ma,na,ia,ua,Ha,Fa,Ea,Ja,ea,U=new THREE.Rectangle,V=new THREE.Rectangle,pa=new THREE.Rectangle,R=!1,la=new THREE.Color,za=new THREE.Color,xa=new THREE.Color,oa=new THREE.Vector3,Aa,Ba,La,Da,Ga,W,b=16;Aa=document.createElement("canvas");
-Aa.width=Aa.height=2;Ba=Aa.getContext("2d");Ba.fillStyle="rgba(0,0,0,1)";Ba.fillRect(0,0,2,2);La=Ba.getImageData(0,0,2,2);Da=La.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;W=Ga.getContext("2d");W.translate(-b/2,-b/2);W.scale(b,b);b--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){v=b;x=c;w=Math.floor(v/2);A=Math.floor(x/2);u.width=v;u.height=x;U.set(-w,-A,w,A);V.set(-w,-A,w,A);C=1;B=0;Z=M=
-I=N=G=null};this.setClearColor=function(b,c){z.copy(b);E=c;V.set(-w,-A,w,A)};this.setClearColorHex=function(b,c){z.setHex(b);E=c;V.set(-w,-A,w,A)};this.clear=function(){y.setTransform(1,0,0,-1,w,A);V.isEmpty()||(V.minSelf(U),V.inflate(2),E<1&&y.clearRect(Math.floor(V.getX()),Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight())),E>0&&(c(THREE.NormalBlending),e(1),m("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+E+")"),y.fillRect(Math.floor(V.getX()),
-Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight()))),V.empty())};this.render=function(b,ya){function u(b){var c,e,f,h;la.setRGB(0,0,0);za.setRGB(0,0,0);xa.setRGB(0,0,0);c=0;for(e=b.length;c<e;c++)f=b[c],h=f.color,f instanceof THREE.AmbientLight?(la.r+=h.r,la.g+=h.g,la.b+=h.b):f instanceof THREE.DirectionalLight?(za.r+=h.r,za.g+=h.g,za.b+=h.b):f instanceof THREE.PointLight&&(xa.r+=h.r,xa.g+=h.g,xa.b+=h.b)}function v(b,c,e,f){var h,m,k,o,n,p;h=0;for(m=b.length;h<m;h++)k=b[h],o=
-k.color,k instanceof THREE.DirectionalLight?(n=k.matrixWorld.getPosition(),p=e.dot(n),p<=0||(p*=k.intensity,f.r+=o.r*p,f.g+=o.g*p,f.b+=o.b*p)):k instanceof THREE.PointLight&&(n=k.matrixWorld.getPosition(),p=e.dot(oa.sub(n,c).normalize()),p<=0||(p*=k.distance==0?1:1-Math.min(c.distanceTo(n)/k.distance,1),p!=0&&(p*=k.intensity,f.r+=o.r*p,f.g+=o.g*p,f.b+=o.b*p)))}function x(b,h,k){e(k.opacity);c(k.blending);var o,n,p,t,v,u;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)t=k.map.image,v=t.width>>
-1,u=t.height>>1,k=h.scale.x*w,p=h.scale.y*A,o=k*v,n=p*u,pa.set(b.x-o,b.y-n,b.x+o,b.y+n),U.intersects(pa)&&(y.save(),y.translate(b.x,b.y),y.rotate(-h.rotation),y.scale(k,-p),y.translate(-v,-u),y.drawImage(t,0,0),y.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(o=h.scale.x*w,n=h.scale.y*A,pa.set(b.x-o,b.y-n,b.x+o,b.y+n),U.intersects(pa)&&(f(k.color.getContextStyle()),m(k.color.getContextStyle()),y.save(),y.translate(b.x,b.y),y.rotate(-h.rotation),y.scale(o,n),k.program(y),y.restore()))}
-function z(b,h,k,m){e(m.opacity);c(m.blending);y.beginPath();y.moveTo(b.positionScreen.x,b.positionScreen.y);y.lineTo(h.positionScreen.x,h.positionScreen.y);y.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(I!=b)y.lineWidth=I=b;b=m.linecap;if(M!=b)y.lineCap=M=b;b=m.linejoin;if(Z!=b)y.lineJoin=Z=b;f(m.color.getContextStyle());y.stroke();pa.inflate(m.linewidth*2)}}function B(b,f,m,k,n,t,u,w){h.info.render.vertices+=3;h.info.render.faces++;e(w.opacity);c(w.blending);Q=b.positionScreen.x;
-P=b.positionScreen.y;o=f.positionScreen.x;T=f.positionScreen.y;$=m.positionScreen.x;da=m.positionScreen.y;E(Q,P,o,T,$,da);if(w instanceof THREE.MeshBasicMaterial)if(w.map)w.map.mapping instanceof THREE.UVMapping&&(ia=u.uvs[0],ab(Q,P,o,T,$,da,ia[k].u,ia[k].v,ia[n].u,ia[n].v,ia[t].u,ia[t].v,w.map));else if(w.envMap){if(w.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=ya.matrixWorldInverse,oa.copy(u.vertexNormalsWorld[k]),ua=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ha=-(oa.x*b.n21+oa.y*
-b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(u.vertexNormalsWorld[n]),Fa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ea=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(u.vertexNormalsWorld[t]),Ja=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,ea=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,ab(Q,P,o,T,$,da,ua,Ha,Fa,Ea,Ja,ea,w.envMap)}else w.wireframe?G(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(w.color);else if(w instanceof THREE.MeshLambertMaterial)w.map&&!w.wireframe&&(w.map.mapping instanceof
-THREE.UVMapping&&(ia=u.uvs[0],ab(Q,P,o,T,$,da,ia[k].u,ia[k].v,ia[n].u,ia[n].v,ia[t].u,ia[t].v,w.map)),c(THREE.SubtractiveBlending)),R?!w.wireframe&&w.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(ha.r=fa.r=ga.r=la.r,ha.g=fa.g=ga.g=la.g,ha.b=fa.b=ga.b=la.b,v(p,u.v1.positionWorld,u.vertexNormalsWorld[0],ha),v(p,u.v2.positionWorld,u.vertexNormalsWorld[1],fa),v(p,u.v3.positionWorld,u.vertexNormalsWorld[2],ga),ha.r=Math.max(0,Math.min(w.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(w.color.g*
-ha.g,1)),ha.b=Math.max(0,Math.min(w.color.b*ha.b,1)),fa.r=Math.max(0,Math.min(w.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(w.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(w.color.b*fa.b,1)),ga.r=Math.max(0,Math.min(w.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(w.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(w.color.b*ga.b,1)),K.r=(fa.r+ga.r)*0.5,K.g=(fa.g+ga.g)*0.5,K.b=(fa.b+ga.b)*0.5,na=Xa(ha,fa,ga,K),N(Q,P,o,T,$,da,0,0,1,0,0,1,na)):(X.r=la.r,X.g=la.g,X.b=la.b,v(p,u.centroidWorld,u.normalWorld,X),X.r=Math.max(0,
-Math.min(w.color.r*X.r,1)),X.g=Math.max(0,Math.min(w.color.g*X.g,1)),X.b=Math.max(0,Math.min(w.color.b*X.b,1)),w.wireframe?G(X,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(X)):w.wireframe?G(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(w.color);else if(w instanceof THREE.MeshDepthMaterial)wa=ya.near,ma=ya.far,ha.r=ha.g=ha.b=1-Ra(b.positionScreen.z,wa,ma),fa.r=fa.g=fa.b=1-Ra(f.positionScreen.z,wa,ma),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,wa,ma),K.r=(fa.r+
-ga.r)*0.5,K.g=(fa.g+ga.g)*0.5,K.b=(fa.b+ga.b)*0.5,na=Xa(ha,fa,ga,K),N(Q,P,o,T,$,da,0,0,1,0,0,1,na);else if(w instanceof THREE.MeshNormalMaterial)X.r=Va(u.normalWorld.x),X.g=Va(u.normalWorld.y),X.b=Va(u.normalWorld.z),w.wireframe?G(X,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(X)}function C(b,f,m,k,n,w,t,u,y){h.info.render.vertices+=4;h.info.render.faces++;e(u.opacity);c(u.blending);if(u.map||u.envMap)B(b,f,k,0,1,3,t,u,y),B(n,m,w,1,2,3,t,u,y);else if(Q=b.positionScreen.x,P=b.positionScreen.y,
-o=f.positionScreen.x,T=f.positionScreen.y,$=m.positionScreen.x,da=m.positionScreen.y,ca=k.positionScreen.x,ra=k.positionScreen.y,qa=n.positionScreen.x,sa=n.positionScreen.y,va=w.positionScreen.x,ka=w.positionScreen.y,u instanceof THREE.MeshBasicMaterial)Ya(Q,P,o,T,$,da,ca,ra),u.wireframe?G(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshLambertMaterial)R?!u.wireframe&&u.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(ha.r=
-fa.r=ga.r=K.r=la.r,ha.g=fa.g=ga.g=K.g=la.g,ha.b=fa.b=ga.b=K.b=la.b,v(p,t.v1.positionWorld,t.vertexNormalsWorld[0],ha),v(p,t.v2.positionWorld,t.vertexNormalsWorld[1],fa),v(p,t.v4.positionWorld,t.vertexNormalsWorld[3],ga),v(p,t.v3.positionWorld,t.vertexNormalsWorld[2],K),ha.r=Math.max(0,Math.min(u.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(u.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(u.color.b*ha.b,1)),fa.r=Math.max(0,Math.min(u.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(u.color.g*fa.g,1)),fa.b=Math.max(0,
-Math.min(u.color.b*fa.b,1)),ga.r=Math.max(0,Math.min(u.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(u.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(u.color.b*ga.b,1)),K.r=Math.max(0,Math.min(u.color.r*K.r,1)),K.g=Math.max(0,Math.min(u.color.g*K.g,1)),K.b=Math.max(0,Math.min(u.color.b*K.b,1)),na=Xa(ha,fa,ga,K),E(Q,P,o,T,ca,ra),N(Q,P,o,T,ca,ra,0,0,1,0,0,1,na),E(qa,sa,$,da,va,ka),N(qa,sa,$,da,va,ka,1,0,1,1,0,1,na)):(X.r=la.r,X.g=la.g,X.b=la.b,v(p,t.centroidWorld,t.normalWorld,X),X.r=Math.max(0,Math.min(u.color.r*
-X.r,1)),X.g=Math.max(0,Math.min(u.color.g*X.g,1)),X.b=Math.max(0,Math.min(u.color.b*X.b,1)),Ya(Q,P,o,T,$,da,ca,ra),u.wireframe?G(X,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(X)):(Ya(Q,P,o,T,$,da,ca,ra),u.wireframe?G(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color));else if(u instanceof THREE.MeshNormalMaterial)X.r=Va(t.normalWorld.x),X.g=Va(t.normalWorld.y),X.b=Va(t.normalWorld.z),Ya(Q,P,o,T,$,da,ca,ra),u.wireframe?G(X,u.wireframeLinewidth,u.wireframeLinecap,
-u.wireframeLinejoin):Oa(X);else if(u instanceof THREE.MeshDepthMaterial)wa=ya.near,ma=ya.far,ha.r=ha.g=ha.b=1-Ra(b.positionScreen.z,wa,ma),fa.r=fa.g=fa.b=1-Ra(f.positionScreen.z,wa,ma),ga.r=ga.g=ga.b=1-Ra(k.positionScreen.z,wa,ma),K.r=K.g=K.b=1-Ra(m.positionScreen.z,wa,ma),na=Xa(ha,fa,ga,K),E(Q,P,o,T,ca,ra),N(Q,P,o,T,ca,ra,0,0,1,0,0,1,na),E(qa,sa,$,da,va,ka),N(qa,sa,$,da,va,ka,1,0,1,1,0,1,na)}function E(b,c,e,f,h,m){y.beginPath();y.moveTo(b,c);y.lineTo(e,f);y.lineTo(h,m);y.lineTo(b,c);y.closePath()}
-function Ya(b,c,e,f,h,m,k,o){y.beginPath();y.moveTo(b,c);y.lineTo(e,f);y.lineTo(h,m);y.lineTo(k,o);y.lineTo(b,c);y.closePath()}function G(b,c,e,h){if(I!=c)y.lineWidth=I=c;if(M!=e)y.lineCap=M=e;if(Z!=h)y.lineJoin=Z=h;f(b.getContextStyle());y.stroke();pa.inflate(c*2)}function Oa(b){m(b.getContextStyle());y.fill()}function ab(b,c,e,f,h,k,o,n,p,u,t,w,v){if(v.image.width!=0){if(v.needsUpdate==!0||ja[v.id]==void 0){var ya=v.wrapS==THREE.RepeatWrapping,x=v.wrapT==THREE.RepeatWrapping;ja[v.id]=y.createPattern(v.image,
-ya&&x?"repeat":ya&&!x?"repeat-x":!ya&&x?"repeat-y":"no-repeat");v.needsUpdate=!1}m(ja[v.id]);var ya=v.offset.x/v.repeat.x,x=v.offset.y/v.repeat.y,z=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+ya)*z,n=(n+x)*v,p=(p+ya)*z,u=(u+x)*v,t=(t+ya)*z,w=(w+x)*v;e-=b;f-=c;h-=b;k-=c;p-=o;u-=n;t-=o;w-=n;ya=1/(p*w-t*u);v=(w*e-u*h)*ya;u=(w*f-u*k)*ya;e=(p*h-t*e)*ya;f=(p*k-t*f)*ya;b=b-v*o-e*n;c=c-u*o-f*n;y.save();y.transform(v,u,e,f,b,c);y.fill();y.restore()}}function N(b,c,e,f,h,m,k,o,n,p,u,t,
-w){var v,ya;v=w.width-1;ya=w.height-1;k*=v;o*=ya;n*=v;p*=ya;u*=v;t*=ya;e-=b;f-=c;h-=b;m-=c;n-=k;p-=o;u-=k;t-=o;ya=1/(n*t-u*p);v=(t*e-p*h)*ya;p=(t*f-p*m)*ya;e=(n*h-u*e)*ya;f=(n*m-u*f)*ya;b=b-v*k-e*o;c=c-p*k-f*o;y.save();y.transform(v,p,e,f,b,c);y.clip();y.drawImage(w,0,0);y.restore()}function Xa(b,c,e,f){var h=~~(b.r*255),m=~~(b.g*255),b=~~(b.b*255),k=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),u=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);Da[0]=h<0?0:h>255?255:h;
-Da[1]=m<0?0:m>255?255:m;Da[2]=b<0?0:b>255?255:b;Da[4]=k<0?0:k>255?255:k;Da[5]=o<0?0:o>255?255:o;Da[6]=c<0?0:c>255?255:c;Da[8]=n<0?0:n>255?255:n;Da[9]=p<0?0:p>255?255:p;Da[10]=e<0?0:e>255?255:e;Da[12]=u<0?0:u>255?255:u;Da[13]=t<0?0:t>255?255:t;Da[14]=f<0?0:f>255?255:f;Ba.putImageData(La,0,0);W.drawImage(Aa,0,0);return Ga}function Ra(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Va(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y-b.y,h=e*e+f*f;h!=0&&(h=1/Math.sqrt(h),e*=h,
-f*=h,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,ta,Ia,Qa,Wa,$a,Ca;this.autoClear?this.clear():y.setTransform(1,0,0,-1,w,A);h.info.render.vertices=0;h.info.render.faces=0;k=t.projectScene(b,ya,this.sortElements);n=k.elements;p=k.lights;(R=p.length>0)&&u(p);Za=0;for(bb=n.length;Za<bb;Za++){ta=n[Za];pa.empty();if(ta instanceof THREE.RenderableParticle){J=ta;J.x*=w;J.y*=A;Ia=0;for(Qa=ta.materials.length;Ia<Qa;)Ca=ta.materials[Ia++],Ca.opacity!=0&&x(J,ta,Ca,b)}else if(ta instanceof THREE.RenderableLine){if(J=
-ta.v1,O=ta.v2,J.positionScreen.x*=w,J.positionScreen.y*=A,O.positionScreen.x*=w,O.positionScreen.y*=A,pa.addPoint(J.positionScreen.x,J.positionScreen.y),pa.addPoint(O.positionScreen.x,O.positionScreen.y),U.intersects(pa)){Ia=0;for(Qa=ta.materials.length;Ia<Qa;)Ca=ta.materials[Ia++],Ca.opacity!=0&&z(J,O,ta,Ca,b)}}else if(ta instanceof THREE.RenderableFace3){if(J=ta.v1,O=ta.v2,L=ta.v3,J.positionScreen.x*=w,J.positionScreen.y*=A,O.positionScreen.x*=w,O.positionScreen.y*=A,L.positionScreen.x*=w,L.positionScreen.y*=
-A,ta.overdraw&&(Pa(J.positionScreen,O.positionScreen),Pa(O.positionScreen,L.positionScreen),Pa(L.positionScreen,J.positionScreen)),pa.add3Points(J.positionScreen.x,J.positionScreen.y,O.positionScreen.x,O.positionScreen.y,L.positionScreen.x,L.positionScreen.y),U.intersects(pa)){Ia=0;for(Qa=ta.meshMaterials.length;Ia<Qa;)if(Ca=ta.meshMaterials[Ia++],Ca instanceof THREE.MeshFaceMaterial){Wa=0;for($a=ta.faceMaterials.length;Wa<$a;)(Ca=ta.faceMaterials[Wa++])&&Ca.opacity!=0&&B(J,O,L,0,1,2,ta,Ca,b)}else Ca.opacity!=
-0&&B(J,O,L,0,1,2,ta,Ca,b)}}else if(ta instanceof THREE.RenderableFace4&&(J=ta.v1,O=ta.v2,L=ta.v3,F=ta.v4,J.positionScreen.x*=w,J.positionScreen.y*=A,O.positionScreen.x*=w,O.positionScreen.y*=A,L.positionScreen.x*=w,L.positionScreen.y*=A,F.positionScreen.x*=w,F.positionScreen.y*=A,aa.positionScreen.copy(O.positionScreen),Y.positionScreen.copy(F.positionScreen),ta.overdraw&&(Pa(J.positionScreen,O.positionScreen),Pa(O.positionScreen,F.positionScreen),Pa(F.positionScreen,J.positionScreen),Pa(L.positionScreen,
-aa.positionScreen),Pa(L.positionScreen,Y.positionScreen)),pa.addPoint(J.positionScreen.x,J.positionScreen.y),pa.addPoint(O.positionScreen.x,O.positionScreen.y),pa.addPoint(L.positionScreen.x,L.positionScreen.y),pa.addPoint(F.positionScreen.x,F.positionScreen.y),U.intersects(pa))){Ia=0;for(Qa=ta.meshMaterials.length;Ia<Qa;)if(Ca=ta.meshMaterials[Ia++],Ca instanceof THREE.MeshFaceMaterial){Wa=0;for($a=ta.faceMaterials.length;Wa<$a;)(Ca=ta.faceMaterials[Wa++])&&Ca.opacity!=0&&C(J,O,L,F,aa,Y,ta,Ca,b)}else Ca.opacity!=
-0&&C(J,O,L,F,aa,Y,ta,Ca,b)}V.addRectangle(pa)}y.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,c,e,f){var h,m,k,o,n,p;h=0;for(m=b.length;h<m;h++)k=b[h],o=k.color,k instanceof THREE.DirectionalLight?(n=k.matrixWorld.getPosition(),p=e.dot(n),p<=0||(p*=k.intensity,f.r+=o.r*p,f.g+=o.g*p,f.b+=o.b*p)):k instanceof THREE.PointLight&&(n=k.matrixWorld.getPosition(),p=e.dot(L.sub(n,c).normalize()),p<=0||(p*=k.distance==0?1:1-Math.min(c.distanceTo(n)/k.distance,1),p!=0&&(p*=k.intensity,f.r+=o.r*p,f.g+=o.g*p,f.b+=o.b*p)))}function e(c,e,k,o,n){h.info.render.vertices+=
-3;h.info.render.faces++;Y=f(Q++);Y.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.copy(n.color):n instanceof THREE.MeshLambertMaterial?N?(I.r=M.r,I.g=M.g,I.b=M.b,b(p,o.centroidWorld,o.normalWorld,I),I.r=Math.max(0,Math.min(n.color.r*I.r,1)),I.g=Math.max(0,Math.min(n.color.g*I.g,1)),I.b=Math.max(0,Math.min(n.color.b*I.b,1))):I.copy(n.color):n instanceof
-THREE.MeshDepthMaterial?(O=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear),I.setRGB(O,O,O)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(m(o.normalWorld.x),m(o.normalWorld.y),m(o.normalWorld.z));n.wireframe?Y.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Y.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+
-n.opacity);u.appendChild(Y)}function c(c,e,k,o,n,t){h.info.render.vertices+=4;h.info.render.faces++;Y=f(Q++);Y.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?I.copy(t.color):t instanceof THREE.MeshLambertMaterial?N?(I.r=M.r,I.g=M.g,I.b=M.b,b(p,n.centroidWorld,n.normalWorld,I),I.r=Math.max(0,Math.min(t.color.r*
-I.r,1)),I.g=Math.max(0,Math.min(t.color.g*I.g,1)),I.b=Math.max(0,Math.min(t.color.b*I.b,1))):I.copy(t.color):t instanceof THREE.MeshDepthMaterial?(O=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),I.setRGB(O,O,O)):t instanceof THREE.MeshNormalMaterial&&I.setRGB(m(n.normalWorld.x),m(n.normalWorld.y),m(n.normalWorld.z));t.wireframe?Y.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+
-"; stroke-linejoin: "+t.wireframeLinejoin):Y.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+t.opacity);u.appendChild(Y)}function f(b){F[b]==null&&(F[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&F[b].setAttribute("shape-rendering","crispEdges"));return F[b]}function m(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var h=this,k,n,p,t=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,x,w,A,y,z,E,C,B=new THREE.Rectangle,G=new THREE.Rectangle,
-N=!1,I=new THREE.Color,M=new THREE.Color,Z=new THREE.Color,J=new THREE.Color,O,L=new THREE.Vector3,F=[],aa=[],Y,Q,P,o=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){v=b;x=c;w=v/2;A=x/2;u.setAttribute("viewBox",-w+" "+-A+" "+v+" "+x);u.setAttribute("width",v);u.setAttribute("height",x);B.set(-w,-A,w,A)};this.clear=function(){for(;u.childNodes.length>
-0;)u.removeChild(u.childNodes[0])};this.render=function(b,f){var m,v,x,I,L,O,F,X;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=t.projectScene(b,f,this.sortElements);n=k.elements;p=k.lights;P=Q=0;if(N=p.length>0){m=p;M.setRGB(0,0,0);Z.setRGB(0,0,0);J.setRGB(0,0,0);v=0;for(x=m.length;v<x;v++)I=m[v],F=I.color,I instanceof THREE.AmbientLight?(M.r+=F.r,M.g+=F.g,M.b+=F.b):I instanceof THREE.DirectionalLight?(Z.r+=F.r,Z.g+=F.g,Z.b+=F.b):I instanceof THREE.PointLight&&(J.r+=
-F.r,J.g+=F.g,J.b+=F.b)}m=0;for(v=n.length;m<v;m++)if(F=n[m],G.empty(),F instanceof THREE.RenderableParticle){y=F;y.x*=w;y.y*=-A;x=0;for(I=F.materials.length;x<I;)x++}else if(F instanceof THREE.RenderableLine){if(y=F.v1,z=F.v2,y.positionScreen.x*=w,y.positionScreen.y*=-A,z.positionScreen.x*=w,z.positionScreen.y*=-A,G.addPoint(y.positionScreen.x,y.positionScreen.y),G.addPoint(z.positionScreen.x,z.positionScreen.y),B.intersects(G)){x=0;for(I=F.materials.length;x<I;)if((X=F.materials[x++])&&X.opacity!=
-0){L=y;O=z;var ha=P++;aa[ha]==null&&(aa[ha]=document.createElementNS("http://www.w3.org/2000/svg","line"),o==0&&aa[ha].setAttribute("shape-rendering","crispEdges"));Y=aa[ha];Y.setAttribute("x1",L.positionScreen.x);Y.setAttribute("y1",L.positionScreen.y);Y.setAttribute("x2",O.positionScreen.x);Y.setAttribute("y2",O.positionScreen.y);X instanceof THREE.LineBasicMaterial&&(Y.setAttribute("style","fill: none; stroke: "+X.color.getContextStyle()+"; stroke-width: "+X.linewidth+"; stroke-opacity: "+X.opacity+
-"; stroke-linecap: "+X.linecap+"; stroke-linejoin: "+X.linejoin),u.appendChild(Y))}}}else if(F instanceof THREE.RenderableFace3){if(y=F.v1,z=F.v2,E=F.v3,y.positionScreen.x*=w,y.positionScreen.y*=-A,z.positionScreen.x*=w,z.positionScreen.y*=-A,E.positionScreen.x*=w,E.positionScreen.y*=-A,G.addPoint(y.positionScreen.x,y.positionScreen.y),G.addPoint(z.positionScreen.x,z.positionScreen.y),G.addPoint(E.positionScreen.x,E.positionScreen.y),B.intersects(G)){x=0;for(I=F.meshMaterials.length;x<I;)if(X=F.meshMaterials[x++],
-X instanceof THREE.MeshFaceMaterial){L=0;for(O=F.faceMaterials.length;L<O;)(X=F.faceMaterials[L++])&&X.opacity!=0&&e(y,z,E,F,X,b)}else X&&X.opacity!=0&&e(y,z,E,F,X,b)}}else if(F instanceof THREE.RenderableFace4&&(y=F.v1,z=F.v2,E=F.v3,C=F.v4,y.positionScreen.x*=w,y.positionScreen.y*=-A,z.positionScreen.x*=w,z.positionScreen.y*=-A,E.positionScreen.x*=w,E.positionScreen.y*=-A,C.positionScreen.x*=w,C.positionScreen.y*=-A,G.addPoint(y.positionScreen.x,y.positionScreen.y),G.addPoint(z.positionScreen.x,
-z.positionScreen.y),G.addPoint(E.positionScreen.x,E.positionScreen.y),G.addPoint(C.positionScreen.x,C.positionScreen.y),B.intersects(G))){x=0;for(I=F.meshMaterials.length;x<I;)if(X=F.meshMaterials[x++],X instanceof THREE.MeshFaceMaterial){L=0;for(O=F.faceMaterials.length;L<O;)(X=F.faceMaterials[L++])&&X.opacity!=0&&c(y,z,E,C,F,X,b)}else X&&X.opacity!=0&&c(y,z,E,C,F,X,b)}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,e=new THREE.Projector,c,f,m,h;this.domElement=document.createElement("div");this.setSize=function(b,e){c=b;f=e;m=c/2;h=f/2};this.render=function(c,f){var p,v,u,t,x,w,A,y;b=e.projectScene(c,f);p=0;for(v=b.length;p<v;p++)if(x=b[p],x instanceof THREE.RenderableParticle){A=x.x*m+m;y=x.y*h+h;u=0;for(t=x.material.length;u<t;u++)if(w=x.material[u],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=A+"px",w.style.top=y+"px"}}};
+THREE.CanvasRenderer=function(b){function e(b){if(D!=b)y.globalAlpha=D=b}function c(b){if(B!=b){switch(b){case THREE.NormalBlending:y.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:y.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:y.globalCompositeOperation="darker"}B=b}}function f(b){if(G!=b)y.strokeStyle=G=b}function m(b){if(O!=b)y.fillStyle=O=b}var h=this,k,n,p,v=new THREE.Projector,b=b||{},u=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+t,x,w,A,y=u.getContext("2d"),z=new THREE.Color(0),F=0,D=1,B=0,G=null,O=null,E=null,P=null,U=null,L,R,I,K,aa=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,S,M,o,N,da,fa,X,ma,pa,ra,ya,la,Y=new THREE.Color,$=new THREE.Color,ha=new THREE.Color,ia=new THREE.Color,Q=new THREE.Color,qa=[],na,sa,va,ta,Da,Ga,Ba,Aa,Ea,ea,ga=new THREE.Rectangle,V=new THREE.Rectangle,ca=new THREE.Rectangle,xa=!1,J=new THREE.Color,ua=new THREE.Color,ka=new THREE.Color,ja=new THREE.Vector3,Ha,Fa,Ma,za,Ka,W,b=16;Ha=document.createElement("canvas");
+Ha.width=Ha.height=2;Fa=Ha.getContext("2d");Fa.fillStyle="rgba(0,0,0,1)";Fa.fillRect(0,0,2,2);Ma=Fa.getImageData(0,0,2,2);za=Ma.data;Ka=document.createElement("canvas");Ka.width=Ka.height=b;W=Ka.getContext("2d");W.translate(-b/2,-b/2);W.scale(b,b);b--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){t=b;x=c;w=Math.floor(t/2);A=Math.floor(x/2);u.width=t;u.height=x;ga.set(-w,-A,w,A);V.set(-w,-A,w,A);D=1;B=0;U=P=
+E=O=G=null};this.setClearColor=function(b,c){z.copy(b);F=c;V.set(-w,-A,w,A)};this.setClearColorHex=function(b,c){z.setHex(b);F=c;V.set(-w,-A,w,A)};this.clear=function(){y.setTransform(1,0,0,-1,w,A);V.isEmpty()||(V.minSelf(ga),V.inflate(2),F<1&&y.clearRect(Math.floor(V.getX()),Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight())),F>0&&(c(THREE.NormalBlending),e(1),m("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+F+")"),y.fillRect(Math.floor(V.getX()),
+Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight()))),V.empty())};this.render=function(b,oa){function u(b){var c,e,f,h;J.setRGB(0,0,0);ua.setRGB(0,0,0);ka.setRGB(0,0,0);c=0;for(e=b.length;c<e;c++)f=b[c],h=f.color,f instanceof THREE.AmbientLight?(J.r+=h.r,J.g+=h.g,J.b+=h.b):f instanceof THREE.DirectionalLight?(ua.r+=h.r,ua.g+=h.g,ua.b+=h.b):f instanceof THREE.PointLight&&(ka.r+=h.r,ka.g+=h.g,ka.b+=h.b)}function t(b,c,e,f){var h,m,k,o,n,p;h=0;for(m=b.length;h<m;h++)k=b[h],o=k.color,
+k instanceof THREE.DirectionalLight?(n=k.matrixWorld.getPosition(),p=e.dot(n),p<=0||(p*=k.intensity,f.r+=o.r*p,f.g+=o.g*p,f.b+=o.b*p)):k instanceof THREE.PointLight&&(n=k.matrixWorld.getPosition(),p=e.dot(ja.sub(n,c).normalize()),p<=0||(p*=k.distance==0?1:1-Math.min(c.distanceTo(n)/k.distance,1),p!=0&&(p*=k.intensity,f.r+=o.r*p,f.g+=o.g*p,f.b+=o.b*p)))}function Na(b,h,k){e(k.opacity);c(k.blending);var o,n,p,v,oa,t;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)v=k.map.image,oa=v.width>>1,t=
+v.height>>1,k=h.scale.x*w,p=h.scale.y*A,o=k*oa,n=p*t,ca.set(b.x-o,b.y-n,b.x+o,b.y+n),ga.intersects(ca)&&(y.save(),y.translate(b.x,b.y),y.rotate(-h.rotation),y.scale(k,-p),y.translate(-oa,-t),y.drawImage(v,0,0),y.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(o=h.scale.x*w,n=h.scale.y*A,ca.set(b.x-o,b.y-n,b.x+o,b.y+n),ga.intersects(ca)&&(f(k.color.getContextStyle()),m(k.color.getContextStyle()),y.save(),y.translate(b.x,b.y),y.rotate(-h.rotation),y.scale(o,n),k.program(y),y.restore()))}
+function x(b,h,k,m){e(m.opacity);c(m.blending);y.beginPath();y.moveTo(b.positionScreen.x,b.positionScreen.y);y.lineTo(h.positionScreen.x,h.positionScreen.y);y.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(E!=b)y.lineWidth=E=b;b=m.linecap;if(P!=b)y.lineCap=P=b;b=m.linejoin;if(U!=b)y.lineJoin=U=b;f(m.color.getContextStyle());y.stroke();ca.inflate(m.linewidth*2)}}function z(b,f,m,k,n,v,w,u){h.info.render.vertices+=3;h.info.render.faces++;e(u.opacity);c(u.blending);S=b.positionScreen.x;
+M=b.positionScreen.y;o=f.positionScreen.x;N=f.positionScreen.y;da=m.positionScreen.x;fa=m.positionScreen.y;D(S,M,o,N,da,fa);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(ta=w.uvs[0],Xa(S,M,o,N,da,fa,ta[k].u,ta[k].v,ta[n].u,ta[n].v,ta[v].u,ta[v].v,u.map));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=oa.matrixWorldInverse,ja.copy(w.vertexNormalsWorld[k]),Da=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,Ga=-(ja.x*b.n21+
+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,ja.copy(w.vertexNormalsWorld[n]),Ba=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,Aa=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,ja.copy(w.vertexNormalsWorld[v]),Ea=(ja.x*b.n11+ja.y*b.n12+ja.z*b.n13)*0.5+0.5,ea=-(ja.x*b.n21+ja.y*b.n22+ja.z*b.n23)*0.5+0.5,Xa(S,M,o,N,da,fa,Da,Ga,Ba,Aa,Ea,ea,u.envMap)}else u.wireframe?G(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof
+THREE.UVMapping&&(ta=w.uvs[0],Xa(S,M,o,N,da,fa,ta[k].u,ta[k].v,ta[n].u,ta[n].v,ta[v].u,ta[v].v,u.map)),c(THREE.SubtractiveBlending)),xa?!u.wireframe&&u.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==3?($.r=ha.r=ia.r=J.r,$.g=ha.g=ia.g=J.g,$.b=ha.b=ia.b=J.b,t(p,w.v1.positionWorld,w.vertexNormalsWorld[0],$),t(p,w.v2.positionWorld,w.vertexNormalsWorld[1],ha),t(p,w.v3.positionWorld,w.vertexNormalsWorld[2],ia),$.r=Math.max(0,Math.min(u.color.r*$.r,1)),$.g=Math.max(0,Math.min(u.color.g*$.g,1)),
+$.b=Math.max(0,Math.min(u.color.b*$.b,1)),ha.r=Math.max(0,Math.min(u.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(u.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(u.color.b*ha.b,1)),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(u.color.b*ia.b,1)),Q.r=(ha.r+ia.r)*0.5,Q.g=(ha.g+ia.g)*0.5,Q.b=(ha.b+ia.b)*0.5,va=Ua($,ha,ia,Q),Ra(S,M,o,N,da,fa,0,0,1,0,0,1,va)):(Y.r=J.r,Y.g=J.g,Y.b=J.b,t(p,w.centroidWorld,w.normalWorld,Y),Y.r=Math.max(0,Math.min(u.color.r*
+Y.r,1)),Y.g=Math.max(0,Math.min(u.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(u.color.b*Y.b,1)),u.wireframe?G(Y,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(Y)):u.wireframe?G(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshDepthMaterial)na=oa.near,sa=oa.far,$.r=$.g=$.b=1-O(b.positionScreen.z,na,sa),ha.r=ha.g=ha.b=1-O(f.positionScreen.z,na,sa),ia.r=ia.g=ia.b=1-O(m.positionScreen.z,na,sa),Q.r=(ha.r+ia.r)*0.5,Q.g=(ha.g+ia.g)*
+0.5,Q.b=(ha.b+ia.b)*0.5,va=Ua($,ha,ia,Q),Ra(S,M,o,N,da,fa,0,0,1,0,0,1,va);else if(u instanceof THREE.MeshNormalMaterial)Y.r=Sa(w.normalWorld.x),Y.g=Sa(w.normalWorld.y),Y.b=Sa(w.normalWorld.z),u.wireframe?G(Y,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(Y)}function B(b,f,m,k,n,u,v,w,y){h.info.render.vertices+=4;h.info.render.faces++;e(w.opacity);c(w.blending);if(w.map||w.envMap)z(b,f,k,0,1,3,v,w,y),z(n,m,u,1,2,3,v,w,y);else if(S=b.positionScreen.x,M=b.positionScreen.y,o=f.positionScreen.x,
+N=f.positionScreen.y,da=m.positionScreen.x,fa=m.positionScreen.y,X=k.positionScreen.x,ma=k.positionScreen.y,pa=n.positionScreen.x,ra=n.positionScreen.y,ya=u.positionScreen.x,la=u.positionScreen.y,w instanceof THREE.MeshBasicMaterial)F(S,M,o,N,da,fa,X,ma),w.wireframe?G(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(w.color);else if(w instanceof THREE.MeshLambertMaterial)xa?!w.wireframe&&w.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4?($.r=ha.r=ia.r=Q.r=J.r,$.g=
+ha.g=ia.g=Q.g=J.g,$.b=ha.b=ia.b=Q.b=J.b,t(p,v.v1.positionWorld,v.vertexNormalsWorld[0],$),t(p,v.v2.positionWorld,v.vertexNormalsWorld[1],ha),t(p,v.v4.positionWorld,v.vertexNormalsWorld[3],ia),t(p,v.v3.positionWorld,v.vertexNormalsWorld[2],Q),$.r=Math.max(0,Math.min(w.color.r*$.r,1)),$.g=Math.max(0,Math.min(w.color.g*$.g,1)),$.b=Math.max(0,Math.min(w.color.b*$.b,1)),ha.r=Math.max(0,Math.min(w.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(w.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(w.color.b*ha.b,1)),ia.r=
+Math.max(0,Math.min(w.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(w.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(w.color.b*ia.b,1)),Q.r=Math.max(0,Math.min(w.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(w.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(w.color.b*Q.b,1)),va=Ua($,ha,ia,Q),D(S,M,o,N,X,ma),Ra(S,M,o,N,X,ma,0,0,1,0,0,1,va),D(pa,ra,da,fa,ya,la),Ra(pa,ra,da,fa,ya,la,1,0,1,1,0,1,va)):(Y.r=J.r,Y.g=J.g,Y.b=J.b,t(p,v.centroidWorld,v.normalWorld,Y),Y.r=Math.max(0,Math.min(w.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(w.color.g*
+Y.g,1)),Y.b=Math.max(0,Math.min(w.color.b*Y.b,1)),F(S,M,o,N,da,fa,X,ma),w.wireframe?G(Y,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(Y)):(F(S,M,o,N,da,fa,X,ma),w.wireframe?G(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(w.color));else if(w instanceof THREE.MeshNormalMaterial)Y.r=Sa(v.normalWorld.x),Y.g=Sa(v.normalWorld.y),Y.b=Sa(v.normalWorld.z),F(S,M,o,N,da,fa,X,ma),w.wireframe?G(Y,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(Y);else if(w instanceof
+THREE.MeshDepthMaterial)na=oa.near,sa=oa.far,$.r=$.g=$.b=1-O(b.positionScreen.z,na,sa),ha.r=ha.g=ha.b=1-O(f.positionScreen.z,na,sa),ia.r=ia.g=ia.b=1-O(k.positionScreen.z,na,sa),Q.r=Q.g=Q.b=1-O(m.positionScreen.z,na,sa),va=Ua($,ha,ia,Q),D(S,M,o,N,X,ma),Ra(S,M,o,N,X,ma,0,0,1,0,0,1,va),D(pa,ra,da,fa,ya,la),Ra(pa,ra,da,fa,ya,la,1,0,1,1,0,1,va)}function D(b,c,e,f,h,m){y.beginPath();y.moveTo(b,c);y.lineTo(e,f);y.lineTo(h,m);y.lineTo(b,c);y.closePath()}function F(b,c,e,f,h,m,k,o){y.beginPath();y.moveTo(b,
+c);y.lineTo(e,f);y.lineTo(h,m);y.lineTo(k,o);y.lineTo(b,c);y.closePath()}function G(b,c,e,h){if(E!=c)y.lineWidth=E=c;if(P!=e)y.lineCap=P=e;if(U!=h)y.lineJoin=U=h;f(b.getContextStyle());y.stroke();ca.inflate(c*2)}function Oa(b){m(b.getContextStyle());y.fill()}function Xa(b,c,e,f,h,k,o,n,p,w,v,u,oa){if(oa.image.width!=0){if(oa.needsUpdate==!0||qa[oa.id]==void 0){var t=oa.wrapS==THREE.RepeatWrapping,Na=oa.wrapT==THREE.RepeatWrapping;qa[oa.id]=y.createPattern(oa.image,t&&Na?"repeat":t&&!Na?"repeat-x":
+!t&&Na?"repeat-y":"no-repeat");oa.needsUpdate=!1}m(qa[oa.id]);var t=oa.offset.x/oa.repeat.x,Na=oa.offset.y/oa.repeat.y,x=(oa.image.width-1)*oa.repeat.x,oa=(oa.image.height-1)*oa.repeat.y,o=(o+t)*x,n=(n+Na)*oa,p=(p+t)*x,w=(w+Na)*oa,v=(v+t)*x,u=(u+Na)*oa;e-=b;f-=c;h-=b;k-=c;p-=o;w-=n;v-=o;u-=n;t=1/(p*u-v*w);oa=(u*e-w*h)*t;w=(u*f-w*k)*t;e=(p*h-v*e)*t;f=(p*k-v*f)*t;b=b-oa*o-e*n;c=c-w*o-f*n;y.save();y.transform(oa,w,e,f,b,c);y.fill();y.restore()}}function Ra(b,c,e,f,h,m,k,o,n,p,w,v,u){var oa,t;oa=u.width-
+1;t=u.height-1;k*=oa;o*=t;n*=oa;p*=t;w*=oa;v*=t;e-=b;f-=c;h-=b;m-=c;n-=k;p-=o;w-=k;v-=o;t=1/(n*v-w*p);oa=(v*e-p*h)*t;p=(v*f-p*m)*t;e=(n*h-w*e)*t;f=(n*m-w*f)*t;b=b-oa*k-e*o;c=c-p*k-f*o;y.save();y.transform(oa,p,e,f,b,c);y.clip();y.drawImage(u,0,0);y.restore()}function Ua(b,c,e,f){var h=~~(b.r*255),m=~~(b.g*255),b=~~(b.b*255),k=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),w=~~(f.r*255),v=~~(f.g*255),f=~~(f.b*255);za[0]=h<0?0:h>255?255:h;za[1]=m<0?0:m>255?255:m;za[2]=
+b<0?0:b>255?255:b;za[4]=k<0?0:k>255?255:k;za[5]=o<0?0:o>255?255:o;za[6]=c<0?0:c>255?255:c;za[8]=n<0?0:n>255?255:n;za[9]=p<0?0:p>255?255:p;za[10]=e<0?0:e>255?255:e;za[12]=w<0?0:w>255?255:w;za[13]=v<0?0:v>255?255:v;za[14]=f<0?0:f>255?255:f;Fa.putImageData(Ma,0,0);W.drawImage(Ha,0,0);return Ka}function O(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Sa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y-b.y,h=e*e+f*f;h!=0&&(h=1/Math.sqrt(h),e*=h,f*=h,c.x+=e,c.y+=f,b.x-=e,b.y-=
+f)}var Va,Ya,wa,Ia,Qa,Ta,Wa,Ca;this.autoClear?this.clear():y.setTransform(1,0,0,-1,w,A);h.info.render.vertices=0;h.info.render.faces=0;k=v.projectScene(b,oa,this.sortElements);n=k.elements;p=k.lights;(xa=p.length>0)&&u(p);Va=0;for(Ya=n.length;Va<Ya;Va++){wa=n[Va];ca.empty();if(wa instanceof THREE.RenderableParticle){L=wa;L.x*=w;L.y*=A;Ia=0;for(Qa=wa.materials.length;Ia<Qa;)Ca=wa.materials[Ia++],Ca.opacity!=0&&Na(L,wa,Ca,b)}else if(wa instanceof THREE.RenderableLine){if(L=wa.v1,R=wa.v2,L.positionScreen.x*=
+w,L.positionScreen.y*=A,R.positionScreen.x*=w,R.positionScreen.y*=A,ca.addPoint(L.positionScreen.x,L.positionScreen.y),ca.addPoint(R.positionScreen.x,R.positionScreen.y),ga.intersects(ca)){Ia=0;for(Qa=wa.materials.length;Ia<Qa;)Ca=wa.materials[Ia++],Ca.opacity!=0&&x(L,R,wa,Ca,b)}}else if(wa instanceof THREE.RenderableFace3){if(L=wa.v1,R=wa.v2,I=wa.v3,L.positionScreen.x*=w,L.positionScreen.y*=A,R.positionScreen.x*=w,R.positionScreen.y*=A,I.positionScreen.x*=w,I.positionScreen.y*=A,wa.overdraw&&(Pa(L.positionScreen,
+R.positionScreen),Pa(R.positionScreen,I.positionScreen),Pa(I.positionScreen,L.positionScreen)),ca.add3Points(L.positionScreen.x,L.positionScreen.y,R.positionScreen.x,R.positionScreen.y,I.positionScreen.x,I.positionScreen.y),ga.intersects(ca)){Ia=0;for(Qa=wa.meshMaterials.length;Ia<Qa;)if(Ca=wa.meshMaterials[Ia++],Ca instanceof THREE.MeshFaceMaterial){Ta=0;for(Wa=wa.faceMaterials.length;Ta<Wa;)(Ca=wa.faceMaterials[Ta++])&&Ca.opacity!=0&&z(L,R,I,0,1,2,wa,Ca,b)}else Ca.opacity!=0&&z(L,R,I,0,1,2,wa,Ca,
+b)}}else if(wa instanceof THREE.RenderableFace4&&(L=wa.v1,R=wa.v2,I=wa.v3,K=wa.v4,L.positionScreen.x*=w,L.positionScreen.y*=A,R.positionScreen.x*=w,R.positionScreen.y*=A,I.positionScreen.x*=w,I.positionScreen.y*=A,K.positionScreen.x*=w,K.positionScreen.y*=A,aa.positionScreen.copy(R.positionScreen),Z.positionScreen.copy(K.positionScreen),wa.overdraw&&(Pa(L.positionScreen,R.positionScreen),Pa(R.positionScreen,K.positionScreen),Pa(K.positionScreen,L.positionScreen),Pa(I.positionScreen,aa.positionScreen),
+Pa(I.positionScreen,Z.positionScreen)),ca.addPoint(L.positionScreen.x,L.positionScreen.y),ca.addPoint(R.positionScreen.x,R.positionScreen.y),ca.addPoint(I.positionScreen.x,I.positionScreen.y),ca.addPoint(K.positionScreen.x,K.positionScreen.y),ga.intersects(ca))){Ia=0;for(Qa=wa.meshMaterials.length;Ia<Qa;)if(Ca=wa.meshMaterials[Ia++],Ca instanceof THREE.MeshFaceMaterial){Ta=0;for(Wa=wa.faceMaterials.length;Ta<Wa;)(Ca=wa.faceMaterials[Ta++])&&Ca.opacity!=0&&B(L,R,I,K,aa,Z,wa,Ca,b)}else Ca.opacity!=
+0&&B(L,R,I,K,aa,Z,wa,Ca,b)}V.addRectangle(ca)}y.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,c,e,f){var h,m,k,o,n,p;h=0;for(m=b.length;h<m;h++)k=b[h],o=k.color,k instanceof THREE.DirectionalLight?(n=k.matrixWorld.getPosition(),p=e.dot(n),p<=0||(p*=k.intensity,f.r+=o.r*p,f.g+=o.g*p,f.b+=o.b*p)):k instanceof THREE.PointLight&&(n=k.matrixWorld.getPosition(),p=e.dot(I.sub(n,c).normalize()),p<=0||(p*=k.distance==0?1:1-Math.min(c.distanceTo(n)/k.distance,1),p!=0&&(p*=k.intensity,f.r+=o.r*p,f.g+=o.g*p,f.b+=o.b*p)))}function e(c,e,k,o,n){h.info.render.vertices+=
+3;h.info.render.faces++;Z=f(S++);Z.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?E.copy(n.color):n instanceof THREE.MeshLambertMaterial?O?(E.r=P.r,E.g=P.g,E.b=P.b,b(p,o.centroidWorld,o.normalWorld,E),E.r=Math.max(0,Math.min(n.color.r*E.r,1)),E.g=Math.max(0,Math.min(n.color.g*E.g,1)),E.b=Math.max(0,Math.min(n.color.b*E.b,1))):E.copy(n.color):n instanceof
+THREE.MeshDepthMaterial?(R=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear),E.setRGB(R,R,R)):n instanceof THREE.MeshNormalMaterial&&E.setRGB(m(o.normalWorld.x),m(o.normalWorld.y),m(o.normalWorld.z));n.wireframe?Z.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Z.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+
+n.opacity);u.appendChild(Z)}function c(c,e,k,o,n,w){h.info.render.vertices+=4;h.info.render.faces++;Z=f(S++);Z.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");w instanceof THREE.MeshBasicMaterial?E.copy(w.color):w instanceof THREE.MeshLambertMaterial?O?(E.r=P.r,E.g=P.g,E.b=P.b,b(p,n.centroidWorld,n.normalWorld,E),E.r=Math.max(0,Math.min(w.color.r*
+E.r,1)),E.g=Math.max(0,Math.min(w.color.g*E.g,1)),E.b=Math.max(0,Math.min(w.color.b*E.b,1))):E.copy(w.color):w instanceof THREE.MeshDepthMaterial?(R=1-w.__2near/(w.__farPlusNear-n.z*w.__farMinusNear),E.setRGB(R,R,R)):w instanceof THREE.MeshNormalMaterial&&E.setRGB(m(n.normalWorld.x),m(n.normalWorld.y),m(n.normalWorld.z));w.wireframe?Z.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+w.wireframeLinewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.wireframeLinecap+
+"; stroke-linejoin: "+w.wireframeLinejoin):Z.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+w.opacity);u.appendChild(Z)}function f(b){K[b]==null&&(K[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&K[b].setAttribute("shape-rendering","crispEdges"));return K[b]}function m(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var h=this,k,n,p,v=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,x,w,A,y,z,F,D,B=new THREE.Rectangle,G=new THREE.Rectangle,
+O=!1,E=new THREE.Color,P=new THREE.Color,U=new THREE.Color,L=new THREE.Color,R,I=new THREE.Vector3,K=[],aa=[],Z,S,M,o=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){t=b;x=c;w=t/2;A=x/2;u.setAttribute("viewBox",-w+" "+-A+" "+t+" "+x);u.setAttribute("width",t);u.setAttribute("height",x);B.set(-w,-A,w,A)};this.clear=function(){for(;u.childNodes.length>
+0;)u.removeChild(u.childNodes[0])};this.render=function(b,f){var m,t,x,E,I,R,K,Y;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=v.projectScene(b,f,this.sortElements);n=k.elements;p=k.lights;M=S=0;if(O=p.length>0){m=p;P.setRGB(0,0,0);U.setRGB(0,0,0);L.setRGB(0,0,0);t=0;for(x=m.length;t<x;t++)E=m[t],K=E.color,E instanceof THREE.AmbientLight?(P.r+=K.r,P.g+=K.g,P.b+=K.b):E instanceof THREE.DirectionalLight?(U.r+=K.r,U.g+=K.g,U.b+=K.b):E instanceof THREE.PointLight&&(L.r+=
+K.r,L.g+=K.g,L.b+=K.b)}m=0;for(t=n.length;m<t;m++)if(K=n[m],G.empty(),K instanceof THREE.RenderableParticle){y=K;y.x*=w;y.y*=-A;x=0;for(E=K.materials.length;x<E;)x++}else if(K instanceof THREE.RenderableLine){if(y=K.v1,z=K.v2,y.positionScreen.x*=w,y.positionScreen.y*=-A,z.positionScreen.x*=w,z.positionScreen.y*=-A,G.addPoint(y.positionScreen.x,y.positionScreen.y),G.addPoint(z.positionScreen.x,z.positionScreen.y),B.intersects(G)){x=0;for(E=K.materials.length;x<E;)if((Y=K.materials[x++])&&Y.opacity!=
+0){I=y;R=z;var $=M++;aa[$]==null&&(aa[$]=document.createElementNS("http://www.w3.org/2000/svg","line"),o==0&&aa[$].setAttribute("shape-rendering","crispEdges"));Z=aa[$];Z.setAttribute("x1",I.positionScreen.x);Z.setAttribute("y1",I.positionScreen.y);Z.setAttribute("x2",R.positionScreen.x);Z.setAttribute("y2",R.positionScreen.y);Y instanceof THREE.LineBasicMaterial&&(Z.setAttribute("style","fill: none; stroke: "+Y.color.getContextStyle()+"; stroke-width: "+Y.linewidth+"; stroke-opacity: "+Y.opacity+
+"; stroke-linecap: "+Y.linecap+"; stroke-linejoin: "+Y.linejoin),u.appendChild(Z))}}}else if(K instanceof THREE.RenderableFace3){if(y=K.v1,z=K.v2,F=K.v3,y.positionScreen.x*=w,y.positionScreen.y*=-A,z.positionScreen.x*=w,z.positionScreen.y*=-A,F.positionScreen.x*=w,F.positionScreen.y*=-A,G.addPoint(y.positionScreen.x,y.positionScreen.y),G.addPoint(z.positionScreen.x,z.positionScreen.y),G.addPoint(F.positionScreen.x,F.positionScreen.y),B.intersects(G)){x=0;for(E=K.meshMaterials.length;x<E;)if(Y=K.meshMaterials[x++],
+Y instanceof THREE.MeshFaceMaterial){I=0;for(R=K.faceMaterials.length;I<R;)(Y=K.faceMaterials[I++])&&Y.opacity!=0&&e(y,z,F,K,Y,b)}else Y&&Y.opacity!=0&&e(y,z,F,K,Y,b)}}else if(K instanceof THREE.RenderableFace4&&(y=K.v1,z=K.v2,F=K.v3,D=K.v4,y.positionScreen.x*=w,y.positionScreen.y*=-A,z.positionScreen.x*=w,z.positionScreen.y*=-A,F.positionScreen.x*=w,F.positionScreen.y*=-A,D.positionScreen.x*=w,D.positionScreen.y*=-A,G.addPoint(y.positionScreen.x,y.positionScreen.y),G.addPoint(z.positionScreen.x,
+z.positionScreen.y),G.addPoint(F.positionScreen.x,F.positionScreen.y),G.addPoint(D.positionScreen.x,D.positionScreen.y),B.intersects(G))){x=0;for(E=K.meshMaterials.length;x<E;)if(Y=K.meshMaterials[x++],Y instanceof THREE.MeshFaceMaterial){I=0;for(R=K.faceMaterials.length;I<R;)(Y=K.faceMaterials[I++])&&Y.opacity!=0&&c(y,z,F,D,K,Y,b)}else Y&&Y.opacity!=0&&c(y,z,F,D,K,Y,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -217,122 +217,122 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,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.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,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,
 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}"}};
 "}"].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(b){function e(b,c,e){var f,h,k,m=b.vertices,n=m.length,p=b.colors,t=p.length,u=b.__vertexArray,w=b.__colorArray,v=b.__sortArray,y=b.__dirtyVertices,x=b.__dirtyColors,z=b.__webglCustomAttributes,ea,A;if(z)for(ea in z)z[ea].offset=0;if(e.sortParticles){ua.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)h=m[f].position,Ea.copy(h),ua.multiplyVector3(Ea),v[f]=[Ea.z,f];v.sort(function(b,c){return c[0]-b[0]});for(f=0;f<n;f++)h=m[v[f][1]].position,k=f*3,u[k]=h.x,u[k+1]=h.y,u[k+2]=
-h.z;for(f=0;f<t;f++)k=f*3,color=p[v[f][1]],w[k]=color.r,w[k+1]=color.g,w[k+2]=color.b;if(z)for(ea in z){f=z[ea];p=f.value.length;for(k=0;k<p;k++){index=v[k][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[index];f.size===2?(f.array[t]=A.x,f.array[t+1]=A.y):f.size===3?f.type==="c"?(f.array[t]=A.r,f.array[t+1]=A.g,f.array[t+2]=A.b):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z):(f.array[t]=
-A.x,f.array[t+1]=A.y,f.array[t+2]=A.z,f.array[t+3]=A.w)}f.offset+=f.size}}}else{if(y)for(f=0;f<n;f++)h=m[f].position,k=f*3,u[k]=h.x,u[k+1]=h.y,u[k+2]=h.z;if(x)for(f=0;f<t;f++)color=p[f],k=f*3,w[k]=color.r,w[k+1]=color.g,w[k+2]=color.b;if(z)for(ea in z)if(f=z[ea],f.__original.needsUpdate){p=f.value.length;for(k=0;k<p;k++){t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[k]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[k];f.size===2?(f.array[t]=
-A.x,f.array[t+1]=A.y):f.size===3?f.type==="c"?(f.array[t]=A.r,f.array[t+1]=A.g,f.array[t+2]=A.b):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z,f.array[t+3]=A.w)}f.offset+=f.size}}}if(y||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,c);if(z)for(ea in z)if(f=z[ea],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
-f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function c(b,c,e,f,h){f.program||P.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(P.maxMorphTargets);for(var k=0,m=P.maxMorphTargets;k<m;k++)h.__webglMorphTargetInfluences[k]=0}var n=!1,k=f.program,m=k.uniforms,p=f.uniforms;k!=$&&(o.useProgram(k),$=k,n=!0);if(f.id!=ca)ca=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ha);if(e&&f.fog)if(p.fogColor.value=e.color,e instanceof
-THREE.Fog)p.fogNear.value=e.near,p.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)p.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var t,u,w=0,v=0,y=0,x,z,A,V=Ja,U=V.directional.colors,B=V.directional.positions,C=V.point.colors,E=V.point.positions,G=V.point.distances,pa=0,K=0,e=t=A=0,n=c.length;e<n;e++)if(t=c[e],u=t.color,x=t.position,z=t.intensity,A=t.distance,t instanceof THREE.AmbientLight)w+=u.r,v+=u.g,y+=u.b;else if(t instanceof
-THREE.DirectionalLight)A=pa*3,U[A]=u.r*z,U[A+1]=u.g*z,U[A+2]=u.b*z,B[A]=x.x,B[A+1]=x.y,B[A+2]=x.z,pa+=1;else if(t instanceof THREE.SpotLight)A=pa*3,U[A]=u.r*z,U[A+1]=u.g*z,U[A+2]=u.b*z,u=1/x.length(),B[A]=x.x*u,B[A+1]=x.y*u,B[A+2]=x.z*u,pa+=1;else if(t instanceof THREE.PointLight)t=K*3,C[t]=u.r*z,C[t+1]=u.g*z,C[t+2]=u.b*z,E[t]=x.x,E[t+1]=x.y,E[t+2]=x.z,G[K]=A,K+=1;e=pa*3;for(n=U.length;e<n;e++)U[e]=0;e=K*3;for(n=C.length;e<n;e++)C[e]=0;V.point.length=K;V.directional.length=pa;V.ambient[0]=w;V.ambient[1]=
-v;V.ambient[2]=y;c=Ja;p.enableLighting.value=c.directional.length+c.point.length;p.ambientLightColor.value=c.ambient;p.directionalLightColor.value=c.directional.colors;p.directionalLightDirection.value=c.directional.positions;p.pointLightColor.value=c.point.colors;p.pointLightPosition.value=c.point.positions;p.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)p.diffuse.value=f.color,p.opacity.value=
-f.opacity,(p.map.texture=f.map)&&p.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),p.lightMap.texture=f.lightMap,p.envMap.texture=f.envMap,p.flipEnvMap.value=f.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,p.reflectivity.value=f.reflectivity,p.refractionRatio.value=f.refractionRatio,p.combine.value=f.combine,p.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)p.diffuse.value=f.color,p.opacity.value=
-f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)p.psColor.value=f.color,p.opacity.value=f.opacity,p.size.value=f.size,p.scale.value=ea.height/2,p.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)p.ambient.value=f.ambient,p.specular.value=f.specular,p.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)p.mNear.value=b.near,p.mFar.value=b.far,p.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)p.opacity.value=f.opacity;if(h.receiveShadow&&
-!f._shadowPass&&p.shadowMatrix){for(c=0;c<oa.length;c++)p.shadowMatrix.value[c]=oa[c],p.shadowMap.texture[c]=P.shadowMap[c];p.shadowDarkness.value=P.shadowMapDarkness;p.shadowBias.value=P.shadowMapBias}c=f.uniformsList;p=0;for(e=c.length;p<e;p++)if(v=k.uniforms[c[p][1]])if(w=c[p][0],y=w.type,n=w.value,y=="i")o.uniform1i(v,n);else if(y=="f")o.uniform1f(v,n);else if(y=="v2")o.uniform2f(v,n.x,n.y);else if(y=="v3")o.uniform3f(v,n.x,n.y,n.z);else if(y=="v4")o.uniform4f(v,n.x,n.y,n.z,n.w);else if(y=="c")o.uniform3f(v,
-n.r,n.g,n.b);else if(y=="fv1")o.uniform1fv(v,n);else if(y=="fv")o.uniform3fv(v,n);else if(y=="v3v"){if(!w._array)w._array=new Float32Array(3*n.length);y=0;for(x=n.length;y<x;y++)V=y*3,w._array[V]=n[y].x,w._array[V+1]=n[y].y,w._array[V+2]=n[y].z;o.uniform3fv(v,w._array)}else if(y=="m4"){if(!w._array)w._array=new Float32Array(16);n.flattenToArray(w._array);o.uniformMatrix4fv(v,!1,w._array)}else if(y=="m4v"){if(!w._array)w._array=new Float32Array(16*n.length);y=0;for(x=n.length;y<x;y++)n[y].flattenToArrayOffset(w._array,
-y*16);o.uniformMatrix4fv(v,!1,w._array)}else if(y=="t"){if(o.uniform1i(v,n),v=w.texture)if(v.image instanceof Array&&v.image.length==6){if(w=v,w.image.length==6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,w.image[n]);Z(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+
-n),o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else v instanceof THREE.WebGLRenderTargetCube?(w=v,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):J(v,n)}else if(y=="tv"){if(!w._array){w._array=[];y=0;for(x=w.texture.length;y<x;y++)w._array[y]=n+y}o.uniform1iv(v,w._array);y=0;for(x=w.texture.length;y<x;y++)(v=w.texture[y])&&J(v,w._array[y])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&
-o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Fa);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Fa),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,h.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,h._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,h._normalMatrixArray);
-(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,h._objectMatrixArray);return k}function f(b,e,f,h,k,m){if(h.opacity!=0){var n,f=c(b,e,f,h,m),b=f.attributes,e=!1,f=k.id*16777215+f.id*2+(h.wireframe?1:0);f!=ra&&(ra=f,e=!0);if(!h.morphTargets&&b.position>=0)e&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=h.program.attributes;m.morphTargetBase!==
--1?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var p=0,t=m.morphTargetForcedOrder,w=m.morphTargetInfluences;p<h.numSupportedMorphTargets&&p<t.length;)o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[t[p]]),o.vertexAttribPointer(f["morphTarget"+p],3,
-o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[p]=w[t[p]],p++;else{var t=[],u=-1,v=0,w=m.morphTargetInfluences,y,x=w.length,p=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);p<h.numSupportedMorphTargets;){for(y=0;y<x;y++)!t[y]&&w[y]>u&&(v=y,u=w[v]);o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=u;t[v]=1;u=-1;p++}}h.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(h.program.uniforms.morphTargetInfluences,
-m.__webglMorphTargetInfluences)}if(e){if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>=0&&(f=k.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
-k.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
-0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(h.wireframe?
-(o.lineWidth(h.wireframeLinewidth),e&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer),o.drawElements(o.LINES,k.__webglLineCount,o.UNSIGNED_SHORT,0)):(e&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),o.drawElements(o.TRIANGLES,k.__webglFaceCount,o.UNSIGNED_SHORT,0)),P.info.render.calls++,P.info.render.vertices+=k.__webglFaceCount,P.info.render.faces+=k.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(h.linewidth),o.drawArrays(m,
-0,k.__webglLineCount),P.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,k.__webglParticleCount),P.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,k.__webglVertexCount),P.info.render.calls++)}}function m(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,
-o.DYNAMIC_DRAW),o.enableVertexAttribArray(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,p,t,w,u,v,y=b.count*3;for(v=0;v<y;v+=9)e=b.normalArray,f=e[v],h=e[v+1],k=e[v+2],m=e[v+3],p=e[v+4],w=e[v+5],n=e[v+6],t=e[v+7],u=e[v+8],f=(f+m+n)/3,h=(h+p+t)/3,k=(k+w+u)/3,e[v]=f,e[v+1]=h,e[v+2]=k,e[v+3]=f,e[v+4]=h,e[v+5]=k,e[v+6]=f,e[v+7]=h,e[v+8]=k}o.bufferData(o.ARRAY_BUFFER,
-b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,b.count);b.count=0}function h(b){if(sa!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),sa=b.doubleSided;if(va!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),va=b.flipSided}function k(b){X!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),X=b)}function n(b){ha!=b&&(o.depthMask(b),ha=b)}function p(b,
-c,e){fa!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=b);if(b&&(ga!=c||K!=e))o.polygonOffset(c,e),ga=c,K=e}function t(b){ia[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ia[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ia[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ia[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ia[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ia[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);
-for(var c,b=0;b<6;b++)c=ia[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function u(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ia[f].x*c.n14+ia[f].y*c.n24+ia[f].z*c.n34+ia[f].w,b<=e)return!1;return!0}function v(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?v(k,e):v(h,e)}function w(b){var c,
-e,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?v(o,h):v(n,h))}else(h=c)&&(h.transparent?v(o,h):v(n,h))}function A(b,c){return c.z-b.z}function y(b){var e,n,p,w=0,v,y,x,z,A=b.lights;xa||(xa=new THREE.PerspectiveCamera(P.shadowCameraFov,P.shadowMapWidth/P.shadowMapHeight,P.shadowCameraNear,P.shadowCameraFar));
-e=0;for(n=A.length;e<n;e++)if(p=A[e],p instanceof THREE.SpotLight&&p.castShadow){ca=-1;P.shadowMap[w]||(P.shadowMap[w]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));oa[w]||(oa[w]=new THREE.Matrix4);v=P.shadowMap[w];y=oa[w];xa.position.copy(p.position);xa.lookAt(p.target.position);xa.update(void 0,!0);b.update(void 0,!1,xa);THREE.Matrix4.makeInvert(xa.matrixWorld,xa.matrixWorldInverse);y.set(0.5,
-0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);y.multiplySelf(xa.projectionMatrix);y.multiplySelf(xa.matrixWorldInverse);xa.matrixWorldInverse.flattenToArray(Fa);xa.projectionMatrix.flattenToArray(Ha);ua.multiply(xa.projectionMatrix,xa.matrixWorldInverse);t(ua);P.initWebGLObjects(b);L(v);o.clearColor(1,1,1,1);P.clear();o.clearColor(R.r,R.g,R.b,la);y=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(v=0;v<y;v++)x=b.__webglObjects[v],z=x.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||
-!z.frustumCulled||u(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,xa,!1),x.render=!0):x.render=!1:x.render=!1;k(!0);M(THREE.NormalBlending);for(v=0;v<y;v++)if(x=b.__webglObjects[v],x.render)z=x.object,buffer=x.buffer,h(z),x=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?La:Ba,f(xa,A,null,x,buffer,z);for(v=0;v<p;v++)x=b.__webglObjectsImmediate[v],z=x.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),ra=-1,
-E(z,xa,!1),h(z),program=c(xa,A,null,Ba,z),z.immediateRenderCallback?z.immediateRenderCallback(program,o,ia):z.render(function(b){m(b,program,Ba.shading)}));w++}}function z(b,c){var e,f,h;e=W.attributes;var k=W.uniforms,m=na/ma,n,p=[],t=ma*0.5,w=na*0.5,u=!0;o.useProgram(W.program);$=W.program;ra=X=ka=-1;Ka||(o.enableVertexAttribArray(W.attributes.position),o.enableVertexAttribArray(W.attributes.uv),Ka=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);
-o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ha);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)if(h=b.__webglSprites[e],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);
-b.__webglSprites.sort(A);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-t)/t,(w-h.position.y)/w,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/
-(h.scaleByViewport?na:1),p[0]=n*m*h.scale.x,p[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,p),h.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!h.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),M(h.blending),J(h.map,0),o.drawElements(o.TRIANGLES,
-6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ha)}function E(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function C(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function B(b){var c,e,f,h;h=b.__materials;b=0;for(e=
-h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function N(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}var e,f,h,k,m,n,o,p,t={},w=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=c(n),t[o]==void 0&&(t[o]={hash:o,counter:0}),
-p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=qa++,b.geometryGroupsList.push(b.geometryGroups[u])}
-function I(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,
-o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ka=b}}function Z(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Q(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Q(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Q(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,Q(c.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(c.magFilter)),
-o.texParameteri(b,o.TEXTURE_MIN_FILTER,Y(c.minFilter)))}function J(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),P.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Q(b.format),b.image.width,b.image.height,0,Q(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);Z(o.TEXTURE_2D,b,b.image);b.needsUpdate=
-!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function O(b,c){o.bindRenderbuffer(o.RENDERBUFFER,b);c.depthBuffer&&!c.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,c.width,c.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b)):c.depthBuffer&&c.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,c.width,c.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,
-b)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,c.width,c.height)}function L(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglTexture=o.createTexture();if(c){b.__webglFramebuffer=[];b.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);Z(o.TEXTURE_CUBE_MAP,b,b);for(var e=0;e<6;e++){b.__webglFramebuffer[e]=o.createFramebuffer();b.__webglRenderbuffer[e]=
-o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,Q(b.format),b.width,b.height,0,Q(b.format),Q(b.type),null);var f=b,h=o.TEXTURE_CUBE_MAP_POSITIVE_X+e;o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[e]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,h,f.__webglTexture,0);O(b.__webglRenderbuffer[e],b)}}else b.__webglFramebuffer=o.createFramebuffer(),b.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),Z(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,
-0,Q(b.format),b.width,b.height,0,Q(b.format),Q(b.type),null),e=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,e,b.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer),O(b.__webglRenderbuffer,b);c?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,
-e=b.width,b=b.height,h=f=0):(c=null,e=ma,b=na,f=ja,h=wa);c!=da&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,h,e,b),da=c)}function F(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function aa(b,c){var e;b=="fragment"?e=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&
-(e=o.createShader(o.VERTEX_SHADER));o.shaderSource(e,c);o.compileShader(e);if(!o.getShaderParameter(e,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(e)),console.error(c),null;return e}function Y(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Q(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;
-case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;
-case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var P=this,o,T=[],$=null,da=null,ca=-1,ra=null,qa=0,sa=null,va=null,ka=null,X=null,ha=null,fa=null,ga=null,K=null,ja=0,wa=0,ma=0,na=0,ia=[new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,Ha=new Float32Array(16),Fa=new Float32Array(16),Ea=new THREE.Vector4,Ja={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ea=b.canvas!==void 0?b.canvas:document.createElement("canvas"),U=b.stencil!==void 0?b.stencil:!0,V=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,pa=b.antialias!==void 0?b.antialias:!1,R=b.clearColor!==
-void 0?new THREE.Color(b.clearColor):new THREE.Color(0),la=b.clearAlpha!==void 0?b.clearAlpha:0,za=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=ea;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=
-5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var xa,oa=[],b=THREE.ShaderLib.depthRGBA,Aa=THREE.UniformsUtils.clone(b.uniforms),Ba=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Aa}),La=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Aa,morphTargets:!0});Ba._shadowPass=!0;La._shadowPass=!0;try{if(!(o=ea.getContext("experimental-webgl",{antialias:pa,stencil:U,
-preserveDrawingBuffer:V})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Da){console.error(Da)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,
-o.ONE_MINUS_SRC_ALPHA);o.clearColor(R.r,R.g,R.b,la);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);U=0;W.vertices[U++]=-1;W.vertices[U++]=-1;W.vertices[U++]=0;W.vertices[U++]=1;W.vertices[U++]=1;W.vertices[U++]=-1;W.vertices[U++]=1;W.vertices[U++]=1;W.vertices[U++]=1;W.vertices[U++]=1;W.vertices[U++]=1;W.vertices[U++]=0;W.vertices[U++]=-1;W.vertices[U++]=1;W.vertices[U++]=0;U=W.vertices[U++]=0;W.faces[U++]=0;
-W.faces[U++]=1;W.faces[U++]=2;W.faces[U++]=0;W.faces[U++]=2;W.faces[U++]=3;W.vertexBuffer=o.createBuffer();W.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,W.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,W.faces,o.STATIC_DRAW);W.program=o.createProgram();o.attachShader(W.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(W.program,aa("vertex",THREE.ShaderLib.sprite.vertexShader));
-o.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=o.getAttribLocation(W.program,"position");W.attributes.uv=o.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=o.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=o.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=o.getUniformLocation(W.program,"rotation");W.uniforms.scale=o.getUniformLocation(W.program,"scale");W.uniforms.alignment=o.getUniformLocation(W.program,"alignment");W.uniforms.color=o.getUniformLocation(W.program,
-"color");W.uniforms.map=o.getUniformLocation(W.program,"map");W.uniforms.opacity=o.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=o.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=o.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=o.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=o.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=o.getUniformLocation(W.program,
-"projectionMatrix");var Ka=!1;this.setSize=function(b,c){ea.width=b;ea.height=c;this.setViewport(0,0,ea.width,ea.height)};this.setViewport=function(b,c,e,f){ja=b;wa=c;ma=e;na=f;o.viewport(ja,wa,ma,na)};this.setScissor=function(b,c,e,f){o.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,c){R.setHex(b);la=c;o.clearColor(R.r,R.g,R.b,la)};this.setClearColor=function(b,c){R.copy(b);la=c;o.clearColor(R.r,R.g,R.b,
-la)};this.getClearColor=function(){return R};this.getClearAlpha=function(){return la};this.clear=function(b,c,e){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(c==void 0||c)f|=o.DEPTH_BUFFER_BIT;if(e==void 0||e)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=
-b.geometry.geometryGroups[g];o.deleteBuffer(c.__webglVertexBuffer);o.deleteBuffer(c.__webglNormalBuffer);o.deleteBuffer(c.__webglTangentBuffer);o.deleteBuffer(c.__webglColorBuffer);o.deleteBuffer(c.__webglUVBuffer);o.deleteBuffer(c.__webglUV2Buffer);o.deleteBuffer(c.__webglSkinVertexABuffer);o.deleteBuffer(c.__webglSkinVertexBBuffer);o.deleteBuffer(c.__webglSkinIndicesBuffer);o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=
-0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);P.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),P.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),P.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
-P.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),P.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof
-THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(p.uniforms);b.vertexShader=p.vertexShader;b.fragmentShader=p.fragmentShader}var t,w,u;t=u=p=0;for(w=c.length;t<w;t++)m=c[t],m instanceof THREE.SpotLight&&u++,m instanceof THREE.DirectionalLight&&u++,m instanceof THREE.PointLight&&p++;p+u<=za?t=u:(t=Math.ceil(za*u/(p+u)),p=za-t);m={directional:t,point:p};p=u=0;for(t=c.length;p<t;p++)w=c[p],w instanceof THREE.SpotLight&&w.castShadow&&
-u++;var v=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)v=f.bones.length;var y;a:{t=b.fragmentShader;w=b.vertexShader;var p=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:m.directional,maxPointLights:m.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,
-shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},x,f=[];n?f.push(n):(f.push(t),f.push(w));for(x in e)f.push(x),f.push(e[x]);n=f.join();x=0;for(f=T.length;x<f;x++)if(T[x].code==n){y=T[x].program;break a}x=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?
-"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.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");
+THREE.WebGLRenderer=function(b){function e(b,c,e){var f,h,k,m=b.vertices,n=m.length,p=b.colors,w=p.length,v=b.__vertexArray,u=b.__colorArray,t=b.__sortArray,y=b.__dirtyVertices,x=b.__dirtyColors,z=b.__webglCustomAttributes,ea,A;if(z)for(ea in z)z[ea].offset=0;if(e.sortParticles){Da.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)h=m[f].position,Aa.copy(h),Da.multiplyVector3(Aa),t[f]=[Aa.z,f];t.sort(function(b,c){return c[0]-b[0]});for(f=0;f<n;f++)h=m[t[f][1]].position,k=f*3,v[k]=h.x,v[k+1]=h.y,v[k+2]=
+h.z;for(f=0;f<w;f++)k=f*3,color=p[t[f][1]],u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;if(z)for(ea in z){f=z[ea];p=f.value.length;for(k=0;k<p;k++){index=t[k][1];w=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[w]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[index];f.size===2?(f.array[w]=A.x,f.array[w+1]=A.y):f.size===3?f.type==="c"?(f.array[w]=A.r,f.array[w+1]=A.g,f.array[w+2]=A.b):(f.array[w]=A.x,f.array[w+1]=A.y,f.array[w+2]=A.z):(f.array[w]=
+A.x,f.array[w+1]=A.y,f.array[w+2]=A.z,f.array[w+3]=A.w)}f.offset+=f.size}}}else{if(y)for(f=0;f<n;f++)h=m[f].position,k=f*3,v[k]=h.x,v[k+1]=h.y,v[k+2]=h.z;if(x)for(f=0;f<w;f++)color=p[f],k=f*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;if(z)for(ea in z)if(f=z[ea],f.__original.needsUpdate){p=f.value.length;for(k=0;k<p;k++){w=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[w]=f.value[k]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[k];f.size===2?(f.array[w]=
+A.x,f.array[w+1]=A.y):f.size===3?f.type==="c"?(f.array[w]=A.r,f.array[w+1]=A.g,f.array[w+2]=A.b):(f.array[w]=A.x,f.array[w+1]=A.y,f.array[w+2]=A.z):(f.array[w]=A.x,f.array[w+1]=A.y,f.array[w+2]=A.z,f.array[w+3]=A.w)}f.offset+=f.size}}}if(y||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,v,c);if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(z)for(ea in z)if(f=z[ea],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function c(b,c,e,f,h){f.program||M.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var k=0,m=M.maxMorphTargets;k<m;k++)h.__webglMorphTargetInfluences[k]=0}var n=!1,k=f.program,m=k.uniforms,p=f.uniforms;k!=da&&(o.useProgram(k),da=k,n=!0);if(f.id!=X)X=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ga);if(e&&f.fog)if(p.fogColor.value=e.color,e instanceof
+THREE.Fog)p.fogNear.value=e.near,p.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)p.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var w,v,u=0,t=0,y=0,x,z,A,V=Ea,ga=V.directional.colors,B=V.directional.positions,D=V.point.colors,F=V.point.positions,G=V.point.distances,ca=0,Q=0,e=w=A=0,n=c.length;e<n;e++)if(w=c[e],v=w.color,x=w.position,z=w.intensity,A=w.distance,w instanceof THREE.AmbientLight)u+=v.r,t+=v.g,y+=v.b;else if(w instanceof
+THREE.DirectionalLight)A=ca*3,ga[A]=v.r*z,ga[A+1]=v.g*z,ga[A+2]=v.b*z,B[A]=x.x,B[A+1]=x.y,B[A+2]=x.z,ca+=1;else if(w instanceof THREE.SpotLight)A=ca*3,ga[A]=v.r*z,ga[A+1]=v.g*z,ga[A+2]=v.b*z,v=1/x.length(),B[A]=x.x*v,B[A+1]=x.y*v,B[A+2]=x.z*v,ca+=1;else if(w instanceof THREE.PointLight)w=Q*3,D[w]=v.r*z,D[w+1]=v.g*z,D[w+2]=v.b*z,F[w]=x.x,F[w+1]=x.y,F[w+2]=x.z,G[Q]=A,Q+=1;e=ca*3;for(n=ga.length;e<n;e++)ga[e]=0;e=Q*3;for(n=D.length;e<n;e++)D[e]=0;V.point.length=Q;V.directional.length=ca;V.ambient[0]=
+u;V.ambient[1]=t;V.ambient[2]=y;c=Ea;p.enableLighting.value=c.directional.length+c.point.length;p.ambientLightColor.value=c.ambient;p.directionalLightColor.value=c.directional.colors;p.directionalLightDirection.value=c.directional.positions;p.pointLightColor.value=c.point.colors;p.pointLightPosition.value=c.point.positions;p.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)p.diffuse.value=
+f.color,p.opacity.value=f.opacity,(p.map.texture=f.map)&&p.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),p.lightMap.texture=f.lightMap,p.envMap.texture=f.envMap,p.flipEnvMap.value=f.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,p.reflectivity.value=f.reflectivity,p.refractionRatio.value=f.refractionRatio,p.combine.value=f.combine,p.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)p.diffuse.value=
+f.color,p.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)p.psColor.value=f.color,p.opacity.value=f.opacity,p.size.value=f.size,p.scale.value=ea.height/2,p.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)p.ambient.value=f.ambient,p.specular.value=f.specular,p.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)p.mNear.value=b.near,p.mFar.value=b.far,p.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)p.opacity.value=
+f.opacity;if(h.receiveShadow&&!f._shadowPass&&p.shadowMatrix){for(c=0;c<ja.length;c++)p.shadowMatrix.value[c]=ja[c],p.shadowMap.texture[c]=M.shadowMap[c];p.shadowDarkness.value=M.shadowMapDarkness;p.shadowBias.value=M.shadowMapBias}c=f.uniformsList;p=0;for(e=c.length;p<e;p++)if(t=k.uniforms[c[p][1]])if(u=c[p][0],y=u.type,n=u.value,y=="i")o.uniform1i(t,n);else if(y=="f")o.uniform1f(t,n);else if(y=="v2")o.uniform2f(t,n.x,n.y);else if(y=="v3")o.uniform3f(t,n.x,n.y,n.z);else if(y=="v4")o.uniform4f(t,
+n.x,n.y,n.z,n.w);else if(y=="c")o.uniform3f(t,n.r,n.g,n.b);else if(y=="fv1")o.uniform1fv(t,n);else if(y=="fv")o.uniform3fv(t,n);else if(y=="v3v"){if(!u._array)u._array=new Float32Array(3*n.length);y=0;for(x=n.length;y<x;y++)V=y*3,u._array[V]=n[y].x,u._array[V+1]=n[y].y,u._array[V+2]=n[y].z;o.uniform3fv(t,u._array)}else if(y=="m4"){if(!u._array)u._array=new Float32Array(16);n.flattenToArray(u._array);o.uniformMatrix4fv(t,!1,u._array)}else if(y=="m4v"){if(!u._array)u._array=new Float32Array(16*n.length);
+y=0;for(x=n.length;y<x;y++)n[y].flattenToArrayOffset(u._array,y*16);o.uniformMatrix4fv(t,!1,u._array)}else if(y=="t"){if(o.uniform1i(t,n),t=u.texture)if(t.image instanceof Array&&t.image.length==6){if(u=t,u.image.length==6)if(u.needsUpdate){if(!u.image.__webglTextureCube)u.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,
+u.image[n]);U(o.TEXTURE_CUBE_MAP,u,u.image[0]);u.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(u=t,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,u.__webglTexture)):L(t,n)}else if(y=="tv"){if(!u._array){u._array=[];y=0;for(x=u.texture.length;y<x;y++)u._array[y]=n+y}o.uniform1iv(t,u._array);y=0;for(x=u.texture.length;y<x;y++)(t=u.texture[y])&&L(t,u._array[y])}(f instanceof
+THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Ba);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Ba),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,h.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,
+!1,h._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,h._objectMatrixArray);return k}function f(b,e,f,h,k,m){if(h.opacity!=0){var n,f=c(b,e,f,h,m),b=f.attributes,e=!1,f=k.id*16777215+f.id*2+(h.wireframe?1:0);f!=ma&&(ma=f,e=!0);if(!h.morphTargets&&b.position>=0)e&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),
+o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=h.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var p=0,w=m.morphTargetForcedOrder,u=m.morphTargetInfluences;p<h.numSupportedMorphTargets&&
+p<w.length;)o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[w[p]]),o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[p]=u[w[p]],p++;else{var w=[],v=-1,t=0,u=m.morphTargetInfluences,y,x=u.length,p=0;for(m.morphTargetBase!==-1&&(w[m.morphTargetBase]=!0);p<h.numSupportedMorphTargets;){for(y=0;y<x;y++)!w[y]&&u[y]>v&&(t=y,v=u[t]);o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[t]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=
+v;w[t]=1;v=-1;p++}}h.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(h.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(e){if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>=0&&(f=k.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
+k.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,
+0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,
+k.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(h.wireframe?(o.lineWidth(h.wireframeLinewidth),e&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer),o.drawElements(o.LINES,k.__webglLineCount,o.UNSIGNED_SHORT,0)):(e&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),o.drawElements(o.TRIANGLES,k.__webglFaceCount,o.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=k.__webglFaceCount,M.info.render.faces+=k.__webglFaceCount/
+3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(h.linewidth),o.drawArrays(m,0,k.__webglLineCount),M.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,k.__webglParticleCount),M.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,k.__webglVertexCount),M.info.render.calls++)}}function m(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=
+o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,p,w,u,v,t,y=b.count*3;for(t=0;t<y;t+=9)e=b.normalArray,f=e[t],h=e[t+1],k=e[t+2],m=e[t+3],p=e[t+4],u=e[t+5],n=e[t+6],w=e[t+7],v=e[t+8],f=(f+m+n)/
+3,h=(h+p+w)/3,k=(k+u+v)/3,e[t]=f,e[t+1]=h,e[t+2]=k,e[t+3]=f,e[t+4]=h,e[t+5]=k,e[t+6]=f,e[t+7]=h,e[t+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,b.count);b.count=0}function h(b){if(ra!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ra=b.doubleSided;if(ya!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ya=b.flipSided}
+function k(b){Y!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),Y=b)}function n(b){$!=b&&(o.depthMask(b),$=b)}function p(b,c,e){ha!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ha=b);if(b&&(ia!=c||Q!=e))o.polygonOffset(c,e),ia=c,Q=e}function v(b){ta[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ta[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ta[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ta[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,
+b.n44-b.n24);ta[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ta[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=ta[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function u(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ta[f].x*c.n14+ta[f].y*c.n24+ta[f].z*c.n34+ta[f].w,b<=e)return!1;return!0}function t(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,
+h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?t(k,e):t(h,e)}function w(b){var c,e,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?t(o,h):t(n,h))}else(h=c)&&(h.transparent?t(o,h):t(n,h))}function A(b,c){return c.z-b.z}function y(b){var e,n,p,w=0,
+t,y,x,z,A;M.initWebGLObjects(b);A=b.__webglLights;ka||(ka=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));e=0;for(n=A.length;e<n;e++)if(p=A[e],p instanceof THREE.SpotLight&&p.castShadow){X=-1;M.shadowMap[w]||(M.shadowMap[w]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ja[w]||(ja[w]=new THREE.Matrix4);t=M.shadowMap[w];y=ja[w];
+ka.position.copy(p.position);ka.lookAt(p.target.position);ka.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),b.add(ka));b.updateMatrixWorld();ka.matrixWorldInverse.getInverse(ka.matrixWorld);y.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);y.multiplySelf(ka.projectionMatrix);y.multiplySelf(ka.matrixWorldInverse);ka.matrixWorldInverse.flattenToArray(Ba);ka.projectionMatrix.flattenToArray(Ga);Da.multiply(ka.projectionMatrix,ka.matrixWorldInverse);v(Da);I(t);o.clearColor(1,
+1,1,1);M.clear();o.clearColor(xa.r,xa.g,xa.b,J);y=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(t=0;t<y;t++)x=b.__webglObjects[t],z=x.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||u(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,ka,!1),x.render=!0):x.render=!1:x.render=!1;k(!0);P(THREE.NormalBlending);for(t=0;t<y;t++)if(x=b.__webglObjects[t],x.render)z=x.object,buffer=x.buffer,h(z),x=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?
+Ma:Fa,f(ka,A,null,x,buffer,z);for(t=0;t<p;t++)x=b.__webglObjectsImmediate[t],z=x.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),ma=-1,F(z,ka,!1),h(z),program=c(ka,A,null,Fa,z),z.immediateRenderCallback?z.immediateRenderCallback(program,o,ta):z.render(function(b){m(b,program,Fa.shading)}));w++}}function z(b,c){var e,f,h;e=W.attributes;var k=W.uniforms,m=va/sa,n,p=[],w=sa*0.5,u=va*0.5,v=!0;o.useProgram(W.program);da=W.program;ma=Y=la=-1;Ja||(o.enableVertexAttribArray(W.attributes.position),
+o.enableVertexAttribArray(W.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ga);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)if(h=b.__webglSprites[e],h.visible&&h.opacity!=0)h.useScreenCoordinates?
+h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(A);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-w)/w,(u-h.position.y)/u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,
+0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?va:1),p[0]=n*m*h.scale.x,p[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,p),
+h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),P(h.blending),L(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask($)}function F(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function D(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<
+e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function B(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b){var c,f,h;if(b instanceof THREE.Mesh){c=b.geometry;for(var k=0,m=c.geometryGroupsList.length;k<m;k++)if(f=c.geometryGroupsList[k],h=D(f),c.__dirtyVertices||c.__dirtyMorphTargets||c.__dirtyElements||c.__dirtyUvs||c.__dirtyNormals||c.__dirtyColors||
+c.__dirtyTangents||h){h=f;var n=o.DYNAMIC_DRAW,p=!c.dynamic;if(h.__inittedArrays){var w=void 0,u=void 0,v=void 0,t=void 0,y=v=void 0,x=void 0,z=void 0,A=void 0,ea=void 0,V=void 0,ga=void 0,F=void 0,G=void 0,ca=void 0,Q=void 0,E=void 0,I=void 0,H=t=A=t=z=x=void 0,C=void 0,J=C=H=x=void 0,L=void 0,K=J=C=H=v=v=y=A=t=J=C=H=L=J=C=H=L=J=C=H=void 0,M=0,qa=0,P=0,O=0,xa=0,R=0,N=0,Y=0,S=0,T=0,U=0,J=H=0,J=void 0,na=h.__vertexArray,aa=h.__uvArray,Z=h.__uv2Array,sa=h.__normalArray,ua=h.__tangentArray,W=h.__colorArray,
+X=h.__skinVertexAArray,ja=h.__skinVertexBArray,$=h.__skinIndexArray,ka=h.__skinWeightArray,ia=h.__morphTargetsArrays,da=h.__webglCustomAttributes,C=void 0,ha=h.__faceArray,va=h.__lineArray,fa=h.__needsSmoothNormals,V=h.__vertexColorType,ea=h.__uvType,ga=h.__normalType,la=b.geometry,ta=la.__dirtyVertices,ma=la.__dirtyElements,Fa=la.__dirtyUvs,pa=la.__dirtyNormals,Ha=la.__dirtyTangents,ra=la.__dirtyColors,Da=la.__dirtyMorphTargets,za=la.vertices,Ma=h.faces,Ka=la.faces,ya=la.faceVertexUvs[0],Ga=la.faceVertexUvs[1],
+Aa=la.skinVerticesA,Ba=la.skinVerticesB,Ja=la.skinIndices,Ea=la.skinWeights,La=la.morphTargets;if(da)for(K in da)da[K].offset=0,da[K].offsetSrc=0;w=0;for(u=Ma.length;w<u;w++)if(v=Ma[w],t=Ka[v],ya&&(F=ya[v]),Ga&&(G=Ga[v]),v=t.vertexNormals,y=t.normal,x=t.vertexColors,z=t.color,A=t.vertexTangents,t instanceof THREE.Face3){if(ta)ca=za[t.a].position,Q=za[t.b].position,E=za[t.c].position,na[qa]=ca.x,na[qa+1]=ca.y,na[qa+2]=ca.z,na[qa+3]=Q.x,na[qa+4]=Q.y,na[qa+5]=Q.z,na[qa+6]=E.x,na[qa+7]=E.y,na[qa+8]=E.z,
+qa+=9;if(da)for(K in da)if(C=da[K],C.__original.needsUpdate)H=C.offset,J=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H]=C.value[t.a],C.array[H+1]=C.value[t.b],C.array[H+2]=C.value[t.c]):C.boundTo==="faces"?(J=C.value[J],C.array[H]=J,C.array[H+1]=J,C.array[H+2]=J,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[H]=C.value[J],C.array[H+1]=C.value[J+1],C.array[H+2]=C.value[J+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(ca=C.value[t.a],
+Q=C.value[t.b],E=C.value[t.c]):C.boundTo==="faces"?(E=Q=ca=J=C.value[J],C.offsetSrc++):C.boundTo==="faceVertices"&&(ca=C.value[J],Q=C.value[J+1],E=C.value[J+2],C.offsetSrc+=3),C.size===2?(C.array[H]=ca.x,C.array[H+1]=ca.y,C.array[H+2]=Q.x,C.array[H+3]=Q.y,C.array[H+4]=E.x,C.array[H+5]=E.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[H]=ca.r,C.array[H+1]=ca.g,C.array[H+2]=ca.b,C.array[H+3]=Q.r,C.array[H+4]=Q.g,C.array[H+5]=Q.b,C.array[H+6]=E.r,C.array[H+7]=E.g,C.array[H+8]=E.b):(C.array[H]=ca.x,
+C.array[H+1]=ca.y,C.array[H+2]=ca.z,C.array[H+3]=Q.x,C.array[H+4]=Q.y,C.array[H+5]=Q.z,C.array[H+6]=E.x,C.array[H+7]=E.y,C.array[H+8]=E.z),C.offset+=9):(C.array[H]=ca.x,C.array[H+1]=ca.y,C.array[H+2]=ca.z,C.array[H+3]=ca.w,C.array[H+4]=Q.x,C.array[H+5]=Q.y,C.array[H+6]=Q.z,C.array[H+7]=Q.w,C.array[H+8]=E.x,C.array[H+9]=E.y,C.array[H+10]=E.z,C.array[H+11]=E.w,C.offset+=12));if(Da){H=0;for(C=La.length;H<C;H++)ca=La[H].vertices[t.a].position,Q=La[H].vertices[t.b].position,E=La[H].vertices[t.c].position,
+J=ia[H],J[U]=ca.x,J[U+1]=ca.y,J[U+2]=ca.z,J[U+3]=Q.x,J[U+4]=Q.y,J[U+5]=Q.z,J[U+6]=E.x,J[U+7]=E.y,J[U+8]=E.z;U+=9}if(Ea.length)H=Ea[t.a],C=Ea[t.b],J=Ea[t.c],ka[T]=H.x,ka[T+1]=H.y,ka[T+2]=H.z,ka[T+3]=H.w,ka[T+4]=C.x,ka[T+5]=C.y,ka[T+6]=C.z,ka[T+7]=C.w,ka[T+8]=J.x,ka[T+9]=J.y,ka[T+10]=J.z,ka[T+11]=J.w,H=Ja[t.a],C=Ja[t.b],J=Ja[t.c],$[T]=H.x,$[T+1]=H.y,$[T+2]=H.z,$[T+3]=H.w,$[T+4]=C.x,$[T+5]=C.y,$[T+6]=C.z,$[T+7]=C.w,$[T+8]=J.x,$[T+9]=J.y,$[T+10]=J.z,$[T+11]=J.w,H=Aa[t.a],C=Aa[t.b],J=Aa[t.c],X[T]=H.x,
+X[T+1]=H.y,X[T+2]=H.z,X[T+3]=1,X[T+4]=C.x,X[T+5]=C.y,X[T+6]=C.z,X[T+7]=1,X[T+8]=J.x,X[T+9]=J.y,X[T+10]=J.z,X[T+11]=1,H=Ba[t.a],C=Ba[t.b],J=Ba[t.c],ja[T]=H.x,ja[T+1]=H.y,ja[T+2]=H.z,ja[T+3]=1,ja[T+4]=C.x,ja[T+5]=C.y,ja[T+6]=C.z,ja[T+7]=1,ja[T+8]=J.x,ja[T+9]=J.y,ja[T+10]=J.z,ja[T+11]=1,T+=12;if(ra&&V)x.length==3&&V==THREE.VertexColors?(t=x[0],H=x[1],C=x[2]):C=H=t=z,W[S]=t.r,W[S+1]=t.g,W[S+2]=t.b,W[S+3]=H.r,W[S+4]=H.g,W[S+5]=H.b,W[S+6]=C.r,W[S+7]=C.g,W[S+8]=C.b,S+=9;if(Ha&&la.hasTangents)x=A[0],z=A[1],
+t=A[2],ua[N]=x.x,ua[N+1]=x.y,ua[N+2]=x.z,ua[N+3]=x.w,ua[N+4]=z.x,ua[N+5]=z.y,ua[N+6]=z.z,ua[N+7]=z.w,ua[N+8]=t.x,ua[N+9]=t.y,ua[N+10]=t.z,ua[N+11]=t.w,N+=12;if(pa&&ga)if(v.length==3&&fa)for(A=0;A<3;A++)y=v[A],sa[R]=y.x,sa[R+1]=y.y,sa[R+2]=y.z,R+=3;else for(A=0;A<3;A++)sa[R]=y.x,sa[R+1]=y.y,sa[R+2]=y.z,R+=3;if(Fa&&F!==void 0&&ea)for(A=0;A<3;A++)v=F[A],aa[P]=v.u,aa[P+1]=v.v,P+=2;if(Fa&&G!==void 0&&ea)for(A=0;A<3;A++)v=G[A],Z[O]=v.u,Z[O+1]=v.v,O+=2;ma&&(ha[xa]=M,ha[xa+1]=M+1,ha[xa+2]=M+2,xa+=3,va[Y]=
+M,va[Y+1]=M+1,va[Y+2]=M,va[Y+3]=M+2,va[Y+4]=M+1,va[Y+5]=M+2,Y+=6,M+=3)}else if(t instanceof THREE.Face4){if(ta)ca=za[t.a].position,Q=za[t.b].position,E=za[t.c].position,I=za[t.d].position,na[qa]=ca.x,na[qa+1]=ca.y,na[qa+2]=ca.z,na[qa+3]=Q.x,na[qa+4]=Q.y,na[qa+5]=Q.z,na[qa+6]=E.x,na[qa+7]=E.y,na[qa+8]=E.z,na[qa+9]=I.x,na[qa+10]=I.y,na[qa+11]=I.z,qa+=12;if(da)for(K in da)if(C=da[K],C.__original.needsUpdate)H=C.offset,J=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H]=C.value[t.a],
+C.array[H+1]=C.value[t.b],C.array[H+2]=C.value[t.c],C.array[H+3]=C.value[t.d]):C.boundTo==="faces"?(J=C.value[J],C.array[H]=J,C.array[H+1]=J,C.array[H+2]=J,C.array[H+3]=J,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[H]=C.value[J],C.array[H+1]=C.value[J+1],C.array[H+2]=C.value[J+2],C.array[H+3]=C.value[J+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(ca=C.value[t.a],Q=C.value[t.b],E=C.value[t.c],I=C.value[t.d]):C.boundTo==="faces"?(I=E=Q=ca=J=C.value[J],C.offsetSrc++):
+C.boundTo==="faceVertices"&&(ca=C.value[J],Q=C.value[J+1],E=C.value[J+2],I=C.value[J+3],C.offsetSrc+=4),C.size===2?(C.array[H]=ca.x,C.array[H+1]=ca.y,C.array[H+2]=Q.x,C.array[H+3]=Q.y,C.array[H+4]=E.x,C.array[H+5]=E.y,C.array[H+6]=I.x,C.array[H+7]=I.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[H]=ca.r,C.array[H+1]=ca.g,C.array[H+2]=ca.b,C.array[H+3]=Q.r,C.array[H+4]=Q.g,C.array[H+5]=Q.b,C.array[H+6]=E.r,C.array[H+7]=E.g,C.array[H+8]=E.b,C.array[H+9]=I.r,C.array[H+10]=I.g,C.array[H+11]=I.b):(C.array[H]=
+ca.x,C.array[H+1]=ca.y,C.array[H+2]=ca.z,C.array[H+3]=Q.x,C.array[H+4]=Q.y,C.array[H+5]=Q.z,C.array[H+6]=E.x,C.array[H+7]=E.y,C.array[H+8]=E.z,C.array[H+9]=I.x,C.array[H+10]=I.y,C.array[H+11]=I.z),C.offset+=12):(C.array[H]=ca.x,C.array[H+1]=ca.y,C.array[H+2]=ca.z,C.array[H+3]=ca.w,C.array[H+4]=Q.x,C.array[H+5]=Q.y,C.array[H+6]=Q.z,C.array[H+7]=Q.w,C.array[H+8]=E.x,C.array[H+9]=E.y,C.array[H+10]=E.z,C.array[H+11]=E.w,C.array[H+12]=I.x,C.array[H+13]=I.y,C.array[H+14]=I.z,C.array[H+15]=I.w,C.offset+=
+16));if(Da){H=0;for(C=La.length;H<C;H++)ca=La[H].vertices[t.a].position,Q=La[H].vertices[t.b].position,E=La[H].vertices[t.c].position,I=La[H].vertices[t.d].position,J=ia[H],J[U]=ca.x,J[U+1]=ca.y,J[U+2]=ca.z,J[U+3]=Q.x,J[U+4]=Q.y,J[U+5]=Q.z,J[U+6]=E.x,J[U+7]=E.y,J[U+8]=E.z,J[U+9]=I.x,J[U+10]=I.y,J[U+11]=I.z;U+=12}if(Ea.length)H=Ea[t.a],C=Ea[t.b],J=Ea[t.c],L=Ea[t.d],ka[T]=H.x,ka[T+1]=H.y,ka[T+2]=H.z,ka[T+3]=H.w,ka[T+4]=C.x,ka[T+5]=C.y,ka[T+6]=C.z,ka[T+7]=C.w,ka[T+8]=J.x,ka[T+9]=J.y,ka[T+10]=J.z,ka[T+
+11]=J.w,ka[T+12]=L.x,ka[T+13]=L.y,ka[T+14]=L.z,ka[T+15]=L.w,H=Ja[t.a],C=Ja[t.b],J=Ja[t.c],L=Ja[t.d],$[T]=H.x,$[T+1]=H.y,$[T+2]=H.z,$[T+3]=H.w,$[T+4]=C.x,$[T+5]=C.y,$[T+6]=C.z,$[T+7]=C.w,$[T+8]=J.x,$[T+9]=J.y,$[T+10]=J.z,$[T+11]=J.w,$[T+12]=L.x,$[T+13]=L.y,$[T+14]=L.z,$[T+15]=L.w,H=Aa[t.a],C=Aa[t.b],J=Aa[t.c],L=Aa[t.d],X[T]=H.x,X[T+1]=H.y,X[T+2]=H.z,X[T+3]=1,X[T+4]=C.x,X[T+5]=C.y,X[T+6]=C.z,X[T+7]=1,X[T+8]=J.x,X[T+9]=J.y,X[T+10]=J.z,X[T+11]=1,X[T+12]=L.x,X[T+13]=L.y,X[T+14]=L.z,X[T+15]=1,H=Ba[t.a],
+C=Ba[t.b],J=Ba[t.c],t=Ba[t.d],ja[T]=H.x,ja[T+1]=H.y,ja[T+2]=H.z,ja[T+3]=1,ja[T+4]=C.x,ja[T+5]=C.y,ja[T+6]=C.z,ja[T+7]=1,ja[T+8]=J.x,ja[T+9]=J.y,ja[T+10]=J.z,ja[T+11]=1,ja[T+12]=t.x,ja[T+13]=t.y,ja[T+14]=t.z,ja[T+15]=1,T+=16;if(ra&&V)x.length==4&&V==THREE.VertexColors?(t=x[0],H=x[1],C=x[2],x=x[3]):x=C=H=t=z,W[S]=t.r,W[S+1]=t.g,W[S+2]=t.b,W[S+3]=H.r,W[S+4]=H.g,W[S+5]=H.b,W[S+6]=C.r,W[S+7]=C.g,W[S+8]=C.b,W[S+9]=x.r,W[S+10]=x.g,W[S+11]=x.b,S+=12;if(Ha&&la.hasTangents)x=A[0],z=A[1],t=A[2],A=A[3],ua[N]=
+x.x,ua[N+1]=x.y,ua[N+2]=x.z,ua[N+3]=x.w,ua[N+4]=z.x,ua[N+5]=z.y,ua[N+6]=z.z,ua[N+7]=z.w,ua[N+8]=t.x,ua[N+9]=t.y,ua[N+10]=t.z,ua[N+11]=t.w,ua[N+12]=A.x,ua[N+13]=A.y,ua[N+14]=A.z,ua[N+15]=A.w,N+=16;if(pa&&ga)if(v.length==4&&fa)for(A=0;A<4;A++)y=v[A],sa[R]=y.x,sa[R+1]=y.y,sa[R+2]=y.z,R+=3;else for(A=0;A<4;A++)sa[R]=y.x,sa[R+1]=y.y,sa[R+2]=y.z,R+=3;if(Fa&&F!==void 0&&ea)for(A=0;A<4;A++)v=F[A],aa[P]=v.u,aa[P+1]=v.v,P+=2;if(Fa&&G!==void 0&&ea)for(A=0;A<4;A++)v=G[A],Z[O]=v.u,Z[O+1]=v.v,O+=2;ma&&(ha[xa]=
+M,ha[xa+1]=M+1,ha[xa+2]=M+3,ha[xa+3]=M+1,ha[xa+4]=M+2,ha[xa+5]=M+3,xa+=6,va[Y]=M,va[Y+1]=M+1,va[Y+2]=M,va[Y+3]=M+3,va[Y+4]=M+1,va[Y+5]=M+2,va[Y+6]=M+2,va[Y+7]=M+3,Y+=8,M+=4)}ta&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,na,n));if(da)for(K in da)C=da[K],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,n));if(Da){H=0;for(C=La.length;H<C;H++)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[H]),o.bufferData(o.ARRAY_BUFFER,
+ia[H],n)}ra&&S>0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,W,n));pa&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,sa,n));Ha&&la.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ua,n));Fa&&P>0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,aa,n));Fa&&O>0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,Z,n));ma&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
+h.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ha,n),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,va,n));T>0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,X,n),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ja,n),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,$,n),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
+ka,n));p&&(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}c.__dirtyVertices=!1;c.__dirtyMorphTargets=!1;c.__dirtyElements=!1;c.__dirtyUvs=!1;c.__dirtyNormals=!1;c.__dirtyTangents=!1;c.__dirtyColors=!1;B(f)}else if(b instanceof THREE.Ribbon){c=
+b.geometry;if(c.__dirtyVertices||c.__dirtyColors){b=c;f=o.DYNAMIC_DRAW;u=b.vertices;m=b.colors;ea=u.length;h=m.length;V=b.__vertexArray;n=b.__colorArray;ga=b.__dirtyColors;if(b.__dirtyVertices){for(p=0;p<ea;p++)w=u[p].position,k=p*3,V[k]=w.x,V[k+1]=w.y,V[k+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,V,f)}if(ga){for(p=0;p<h;p++)color=m[p],k=p*3,n[k]=color.r,n[k+1]=color.g,n[k+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
+n,f)}}c.__dirtyVertices=!1;c.__dirtyColors=!1}else if(b instanceof THREE.Line){c=b.geometry;if(c.__dirtyVertices||c.__dirtyColors){b=c;f=o.DYNAMIC_DRAW;u=b.vertices;m=b.colors;ea=u.length;h=m.length;V=b.__vertexArray;n=b.__colorArray;ga=b.__dirtyColors;if(b.__dirtyVertices){for(p=0;p<ea;p++)w=u[p].position,k=p*3,V[k]=w.x,V[k+1]=w.y,V[k+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,V,f)}if(ga){for(p=0;p<h;p++)color=m[p],k=p*3,n[k]=color.r,n[k+1]=color.g,n[k+
+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,n,f)}}c.__dirtyVertices=!1;c.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)c=b.geometry,h=D(c),(c.__dirtyVertices||c.__dirtyColors||b.sortParticles||h)&&e(c,o.DYNAMIC_DRAW,b),c.__dirtyVertices=!1,c.__dirtyColors=!1,B(c)}function O(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}var e,f,h,k,m,n,o,p,t={},w=b.morphTargets!==void 0?
+b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=c(n),t[o]==void 0&&(t[o]={hash:o,counter:0}),p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w})),
+b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=pa++,b.geometryGroupsList.push(b.geometryGroups[v])}function E(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function P(b){if(b!=la){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,
+o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}la=b}}function U(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,S(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,S(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,S(c.magFilter)),o.texParameteri(b,
+o.TEXTURE_MIN_FILTER,S(c.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Z(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,Z(c.minFilter)))}function L(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),M.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?
+o.texImage2D(o.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);U(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function R(b,c){o.bindRenderbuffer(o.RENDERBUFFER,b);c.depthBuffer&&!c.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,c.width,c.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
+o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b)):c.depthBuffer&&c.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,c.width,c.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,c.width,c.height)}function I(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglTexture=o.createTexture();
+if(c){b.__webglFramebuffer=[];b.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);U(o.TEXTURE_CUBE_MAP,b,b);for(var e=0;e<6;e++){b.__webglFramebuffer[e]=o.createFramebuffer();b.__webglRenderbuffer[e]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);var f=b,h=o.TEXTURE_CUBE_MAP_POSITIVE_X+e;o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[e]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,
+h,f.__webglTexture,0);R(b.__webglRenderbuffer[e],b)}}else b.__webglFramebuffer=o.createFramebuffer(),b.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),U(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null),e=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,e,b.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer),
+R(b.__webglRenderbuffer,b);c?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,h=f=0):(c=null,e=sa,b=va,f=qa,h=na);c!=fa&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,h,e,b),fa=c)}function K(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),
+o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function aa(b,c){var e;b=="fragment"?e=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(e=o.createShader(o.VERTEX_SHADER));o.shaderSource(e,c);o.compileShader(e);if(!o.getShaderParameter(e,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(e)),console.error(c),null;return e}function Z(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;
+default:return o.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}
+var M=this,o,N=[],da=null,fa=null,X=-1,ma=null,pa=0,ra=null,ya=null,la=null,Y=null,$=null,ha=null,ia=null,Q=null,qa=0,na=0,sa=0,va=0,ta=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Ga=new Float32Array(16),Ba=new Float32Array(16),Aa=new THREE.Vector4,Ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ea=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+ga=b.stencil!==void 0?b.stencil:!0,V=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ca=b.antialias!==void 0?b.antialias:!1,xa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),J=b.clearAlpha!==void 0?b.clearAlpha:0,ua=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=ea;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
+!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var ka,ja=[],b=THREE.ShaderLib.depthRGBA,Ha=THREE.UniformsUtils.clone(b.uniforms),Fa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ha}),Ma=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
+uniforms:Ha,morphTargets:!0});Fa._shadowPass=!0;Ma._shadowPass=!0;try{if(!(o=ea.getContext("experimental-webgl",{antialias:ca,stencil:ga,preserveDrawingBuffer:V})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(za){console.error(za)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);
+o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(xa.r,xa.g,xa.b,J);this.context=o;var Ka=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);ga=0;W.vertices[ga++]=-1;W.vertices[ga++]=-1;W.vertices[ga++]=0;W.vertices[ga++]=1;W.vertices[ga++]=1;W.vertices[ga++]=-1;W.vertices[ga++]=1;W.vertices[ga++]=1;W.vertices[ga++]=1;W.vertices[ga++]=
+1;W.vertices[ga++]=1;W.vertices[ga++]=0;W.vertices[ga++]=-1;W.vertices[ga++]=1;W.vertices[ga++]=0;ga=W.vertices[ga++]=0;W.faces[ga++]=0;W.faces[ga++]=1;W.faces[ga++]=2;W.faces[ga++]=0;W.faces[ga++]=2;W.faces[ga++]=3;W.vertexBuffer=o.createBuffer();W.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,W.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,W.faces,o.STATIC_DRAW);W.program=
+o.createProgram();o.attachShader(W.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(W.program,aa("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=o.getAttribLocation(W.program,"position");W.attributes.uv=o.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=o.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=o.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=o.getUniformLocation(W.program,
+"rotation");W.uniforms.scale=o.getUniformLocation(W.program,"scale");W.uniforms.alignment=o.getUniformLocation(W.program,"alignment");W.uniforms.color=o.getUniformLocation(W.program,"color");W.uniforms.map=o.getUniformLocation(W.program,"map");W.uniforms.opacity=o.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=o.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=o.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=
+o.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=o.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=o.getUniformLocation(W.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,c){ea.width=b;ea.height=c;this.setViewport(0,0,ea.width,ea.height)};this.setViewport=function(b,c,e,f){qa=b;na=c;sa=e;va=f;o.viewport(qa,na,sa,va)};this.setScissor=function(b,c,e,f){o.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):
+o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,c){xa.setHex(b);J=c;o.clearColor(xa.r,xa.g,xa.b,J)};this.setClearColor=function(b,c){xa.copy(b);J=c;o.clearColor(xa.r,xa.g,xa.b,J)};this.getClearColor=function(){return xa};this.getClearAlpha=function(){return J};this.clear=function(b,c,e){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(c==void 0||c)f|=o.DEPTH_BUFFER_BIT;if(e==void 0||e)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=
+!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];o.deleteBuffer(c.__webglVertexBuffer);o.deleteBuffer(c.__webglNormalBuffer);o.deleteBuffer(c.__webglTangentBuffer);o.deleteBuffer(c.__webglColorBuffer);o.deleteBuffer(c.__webglUVBuffer);o.deleteBuffer(c.__webglUV2Buffer);o.deleteBuffer(c.__webglSkinVertexABuffer);o.deleteBuffer(c.__webglSkinVertexBBuffer);
+o.deleteBuffer(c.__webglSkinIndicesBuffer);o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);M.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),
+o.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),M.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof
+THREE.MeshBasicMaterial?n="basic":b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(p.uniforms);b.vertexShader=p.vertexShader;b.fragmentShader=p.fragmentShader}var t,w,v;t=v=p=0;for(w=c.length;t<w;t++)m=c[t],m instanceof THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&
+v++,m instanceof THREE.PointLight&&p++;p+v<=ua?t=v:(t=Math.ceil(ua*v/(p+v)),p=ua-t);m={directional:t,point:p};p=v=0;for(t=c.length;p<t;p++)w=c[p],w instanceof THREE.SpotLight&&w.castShadow&&v++;var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var y;a:{t=b.fragmentShader;w=b.vertexShader;var p=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,
+maxMorphTargets:this.maxMorphTargets,maxDirLights:m.directional,maxPointLights:m.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest},x,f=[];n?f.push(n):(f.push(t),f.push(w));for(x in e)f.push(x),f.push(e[x]);n=f.join();x=0;for(f=N.length;x<f;x++)if(N[x].code==n){y=N[x].program;break a}x=o.createProgram();f=[Ka?"#define VERTEX_TEXTURES":"",
+"#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.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");
 m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",
 m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",
 e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,aa("fragment",m+t));o.attachShader(x,aa("vertex",f+w));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+
 e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,aa("fragment",m+t));o.attachShader(x,aa("vertex",f+w));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+
 o.getError()+"]");x.uniforms={};x.attributes={};var z,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(z in p)f.push(z);z=f;f=0;for(p=z.length;f<p;f++)t=z[f],x.uniforms[t]=o.getUniformLocation(x,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(z=0;z<e.maxMorphTargets;z++)f.push("morphTarget"+z);for(y in c)f.push(y);
 o.getError()+"]");x.uniforms={};x.attributes={};var z,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(z in p)f.push(z);z=f;f=0;for(p=z.length;f<p;f++)t=z[f],x.uniforms[t]=o.getUniformLocation(x,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(z=0;z<e.maxMorphTargets;z++)f.push("morphTarget"+z);for(y in c)f.push(y);
-y=f;z=0;for(c=y.length;z<c;z++)e=y[z],x.attributes[e]=o.getAttribLocation(x,e);x.id=T.length;T.push({program:x,code:n});P.info.memory.programs=T.length;y=x}b.program=y;y=b.program.attributes;y.position>=0&&o.enableVertexAttribArray(y.position);y.color>=0&&o.enableVertexAttribArray(y.color);y.normal>=0&&o.enableVertexAttribArray(y.normal);y.tangent>=0&&o.enableVertexAttribArray(y.tangent);b.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0&&(o.enableVertexAttribArray(y.skinVertexA),
-o.enableVertexAttribArray(y.skinVertexB),o.enableVertexAttribArray(y.skinIndex),o.enableVertexAttribArray(y.skinWeight));if(b.attributes)for(k in b.attributes)y[k]!==void 0&&y[k]>=0&&o.enableVertexAttribArray(y[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)z="morphTarget"+k,y[z]>=0&&(o.enableVertexAttribArray(y[z]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){L(b);
-this.clear(c,e,f)};this.render=function(b,e,v,ea){var V,U,B,C,G,pa,K,I,la=b.lights,J=b.fog;ca=-1;this.shadowMapEnabled&&y(b,e);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;if(e.matrixAutoUpdate){for(G=e;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,!1,e);THREE.Matrix4.makeInvert(e.matrixWorld,e.matrixWorldInverse);e.matrixWorldInverse.flattenToArray(Fa);e.projectionMatrix.flattenToArray(Ha);ua.multiply(e.projectionMatrix,e.matrixWorldInverse);t(ua);this.initWebGLObjects(b);
-L(v);(this.autoClear||ea)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(ea=0;ea<G;ea++)if(V=b.__webglObjects[ea],K=V.object,K.visible)if(!(K instanceof THREE.Mesh)||!K.frustumCulled||u(K)){if(K.matrixWorld.flattenToArray(K._objectMatrixArray),E(K,e,!0),w(V),V.render=!0,this.sortObjects)V.object.renderDepth?V.z=V.object.renderDepth:(Ea.copy(K.position),ua.multiplyVector3(Ea),V.z=Ea.z)}else V.render=!1;else V.render=!1;this.sortObjects&&b.__webglObjects.sort(A);
-pa=b.__webglObjectsImmediate.length;for(ea=0;ea<pa;ea++)V=b.__webglObjectsImmediate[ea],K=V.object,K.visible&&(K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray),E(K,e,!0),x(V));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);M(b.overrideMaterial.blending);for(ea=0;ea<G;ea++)if(V=b.__webglObjects[ea],V.render)K=V.object,I=V.buffer,h(K),f(e,la,J,b.overrideMaterial,I,K);for(ea=0;ea<pa;ea++)V=b.__webglObjectsImmediate[ea],K=V.object,K.visible&&(ra=-1,h(K),U=c(e,la,J,b.overrideMaterial,
-K),K.immediateRenderCallback?K.immediateRenderCallback(U,o,ia):K.render(function(c){m(c,U,b.overrideMaterial.shading)}))}else{M(THREE.NormalBlending);for(ea=G-1;ea>=0;ea--)if(V=b.__webglObjects[ea],V.render){K=V.object;I=V.buffer;B=V.opaque;h(K);for(V=0;V<B.count;V++)C=B.list[V],k(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(e,la,J,C,I,K)}for(ea=0;ea<pa;ea++)if(V=b.__webglObjectsImmediate[ea],K=V.object,K.visible){ra=-1;B=V.opaque;h(K);for(V=0;V<B.count;V++)C=
-B.list[V],k(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),U=c(e,la,J,C,K),K.immediateRenderCallback?K.immediateRenderCallback(U,o,ia):K.render(function(b){m(b,U,C.shading)})}for(ea=0;ea<G;ea++)if(V=b.__webglObjects[ea],V.render){K=V.object;I=V.buffer;B=V.transparent;h(K);for(V=0;V<B.count;V++)C=B.list[V],M(C.blending),k(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(e,la,J,C,I,K)}for(ea=0;ea<pa;ea++)if(V=b.__webglObjectsImmediate[ea],
-K=V.object,K.visible){ra=-1;B=V.transparent;h(K);for(V=0;V<B.count;V++)C=B.list[V],M(C.blending),k(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),U=c(e,la,J,C,K),K.immediateRenderCallback?K.immediateRenderCallback(U,o,ia):K.render(function(b){m(b,U,C.shading)})}}b.__webglSprites.length&&z(b,e);v&&v.minFilter!==THREE.NearestFilter&&v.minFilter!==THREE.LinearFilter&&F(v)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=
-[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=b.__objectsAdded[0],f=b,h=void 0,k=void 0,m=void 0;if(!c.__webglInit)if(c.__webglInit=!0,c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray),c instanceof THREE.Mesh)for(h in k=c.geometry,k.geometryGroups==void 0&&N(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=
-m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var p=
-void 0,t=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(t=n.numMorphTargets;p<t;p++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}P.info.memory.geometries++;for(var n=c,w=void 0,u=void 0,v=void 0,y=v=void 0,x=void 0,z=void 0,ea=z=p=0,A=v=u=void 0,v=t=A=u=w=void 0,y=n.geometry,x=y.faces,A=m.faces,w=0,u=A.length;w<u;w++)v=A[w],v=x[v],v instanceof THREE.Face3?(p+=3,z+=1,ea+=3):v instanceof THREE.Face4&&(p+=4,z+=2,ea+=4);for(var w=m,u=n,V=A=x=void 0,U=void 0,V=void 0,v=[],x=0,A=u.materials.length;x<
-A;x++)if(V=u.materials[x],V instanceof THREE.MeshFaceMaterial){V=0;for(l=w.materials.length;V<l;V++)(U=w.materials[V])&&v.push(U)}else(U=V)&&v.push(U);w=v;m.__materials=w;a:{x=u=void 0;A=w.length;for(u=0;u<A;u++)if(x=w[u],x.map||x.lightMap||x instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{A=x=void 0;v=w.length;for(x=0;x<v;x++)if(A=w[x],!(A instanceof THREE.MeshBasicMaterial&&!A.envMap||A instanceof THREE.MeshDepthMaterial)){A=A&&A.shading!=void 0&&A.shading==THREE.SmoothShading?THREE.SmoothShading:
-THREE.FlatShading;break a}A=!1}a:{v=x=void 0;V=w.length;for(x=0;x<V;x++)if(v=w[x],v.vertexColors){v=v.vertexColors;break a}v=!1}m.__vertexArray=new Float32Array(p*3);if(A)m.__normalArray=new Float32Array(p*3);if(y.hasTangents)m.__tangentArray=new Float32Array(p*4);if(v)m.__colorArray=new Float32Array(p*3);if(u){if(y.faceUvs.length>0||y.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(y.faceUvs.length>1||y.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&
-n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(ea*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];y=0;for(x=m.numMorphTargets;y<x;y++)m.__morphTargetsArrays.push(new Float32Array(p*3))}m.__needsSmoothNormals=A==THREE.SmoothShading;
-m.__uvType=u;m.__vertexColorType=v;m.__normalType=A;m.__webglFaceCount=z*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=ea*2;y=0;for(x=w.length;y<x;y++)if(u=w[y],u.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in u.attributes){v=u.attributes[a];A={};for(t in v)A[t]=v[t];if(!A.__webglInitialized||A.createUniqueBuffers)A.__webglInitialized=!0,z=1,A.type==="v2"?z=2:A.type==="v3"?z=3:A.type==="v4"?z=4:A.type==="c"&&(z=3),A.size=z,A.array=
-new Float32Array(p*z),A.buffer=o.createBuffer(),A.buffer.belongsToAttribute=a,v.needsUpdate=!0,A.__original=v;m.__webglCustomAttributes[a]=A}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(c instanceof THREE.Ribbon){if(k=c.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),P.info.memory.geometries++,m=k,n=m.vertices.length,
-m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(c instanceof THREE.Line){if(k=c.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),P.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(c instanceof THREE.ParticleSystem&&
-(k=c.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();m.__webglColorBuffer=o.createBuffer();P.info.geometries++;m=k;n=c;p=m.vertices.length;m.__vertexArray=new Float32Array(p*3);m.__colorArray=new Float32Array(p*3);m.__sortArray=[];m.__webglParticleCount=p;m.__materials=n.materials;ea=z=t=void 0;t=0;for(z=n.materials.length;t<z;t++)if(ea=n.materials[t],ea.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in ea.attributes){originalAttribute=
-ea.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(p*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=
-originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!c.__webglActive){if(c instanceof THREE.Mesh)for(h in k=c.geometry,k.geometryGroups)m=k.geometryGroups[h],I(f.__webglObjects,m,c);else c instanceof THREE.Ribbon||c instanceof THREE.Line||c instanceof THREE.ParticleSystem?(k=c.geometry,I(f.__webglObjects,k,c)):THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes||c.immediateRenderCallback?f.__webglObjectsImmediate.push({object:c,opaque:{list:[],
-count:0},transparent:{list:[],count:0}}):c instanceof THREE.Sprite&&f.__webglSprites.push(c);c.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];f=b;if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)G(f.__webglObjects,c);else if(c instanceof THREE.Sprite){f=f.__webglSprites;h=c;k=void 0;for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else(c instanceof THREE.MarchingCubes||c.immediateRenderCallback)&&
-G(f.__webglObjectsImmediate,c);c.__webglActive=!1;b.__objectsRemoved.splice(0,1)}c=0;for(f=b.__webglObjects.length;c<f;c++)if(k=b.__webglObjects[c].object,t=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(p=h.geometryGroupsList.length;n<p;n++)if(m=h.geometryGroupsList[n],t=C(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||t)if(t=m,z=o.DYNAMIC_DRAW,ea=!h.dynamic,t.__inittedArrays){var E=w=y=void 0,K=void 0,
-pa=E=void 0,la=void 0,L=void 0,J=void 0,F=U=V=v=A=x=u=void 0,ja=void 0,M=void 0,H=K=J=K=L=la=void 0,D=void 0,R=D=H=la=void 0,O=void 0,T=R=D=H=E=E=pa=J=K=R=D=H=O=R=D=H=O=R=D=H=void 0,X=0,Q=0,Z=0,wa=0,aa=0,Y=0,ma=0,za=0,W=0,S=0,ca=0,R=H=0,R=void 0,oa=t.__vertexArray,ha=t.__uvArray,xa=t.__uv2Array,ga=t.__normalArray,$=t.__tangentArray,fa=t.__colorArray,na=t.__skinVertexAArray,da=t.__skinVertexBArray,ka=t.__skinIndexArray,ia=t.__skinWeightArray,ra=t.__morphTargetsArrays,Ba=t.__webglCustomAttributes,D=
-void 0,qa=t.__faceArray,Aa=t.__lineArray,sa=t.__needsSmoothNormals,x=t.__vertexColorType,u=t.__uvType,A=t.__normalType,ua=k.geometry,Da=ua.__dirtyVertices,La=ua.__dirtyElements,Ga=ua.__dirtyUvs,va=ua.__dirtyNormals,Ha=ua.__dirtyTangents,Ea=ua.__dirtyColors,Fa=ua.__dirtyMorphTargets,Ka=ua.vertices,Ja=t.faces,eb=ua.faces,cb=ua.faceVertexUvs[0],db=ua.faceVertexUvs[1],Sa=ua.skinVerticesA,Ta=ua.skinVerticesB,Ua=ua.skinIndices,Na=ua.skinWeights,Ma=ua.morphTargets;if(Ba)for(T in Ba)Ba[T].offset=0,Ba[T].offsetSrc=
-0;y=0;for(w=Ja.length;y<w;y++)if(E=Ja[y],K=eb[E],cb&&(v=cb[E]),db&&(V=db[E]),E=K.vertexNormals,pa=K.normal,la=K.vertexColors,L=K.color,J=K.vertexTangents,K instanceof THREE.Face3){if(Da)U=Ka[K.a].position,F=Ka[K.b].position,ja=Ka[K.c].position,oa[Q]=U.x,oa[Q+1]=U.y,oa[Q+2]=U.z,oa[Q+3]=F.x,oa[Q+4]=F.y,oa[Q+5]=F.z,oa[Q+6]=ja.x,oa[Q+7]=ja.y,oa[Q+8]=ja.z,Q+=9;if(Ba)for(T in Ba)if(D=Ba[T],D.__original.needsUpdate)H=D.offset,R=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[H]=
-D.value[K.a],D.array[H+1]=D.value[K.b],D.array[H+2]=D.value[K.c]):D.boundTo==="faces"?(R=D.value[R],D.array[H]=R,D.array[H+1]=R,D.array[H+2]=R,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[H]=D.value[R],D.array[H+1]=D.value[R+1],D.array[H+2]=D.value[R+2],D.offsetSrc+=3),D.offset+=3):(D.boundTo===void 0||D.boundTo==="vertices"?(U=D.value[K.a],F=D.value[K.b],ja=D.value[K.c]):D.boundTo==="faces"?(ja=F=U=R=D.value[R],D.offsetSrc++):D.boundTo==="faceVertices"&&(U=D.value[R],F=D.value[R+1],ja=D.value[R+
-2],D.offsetSrc+=3),D.size===2?(D.array[H]=U.x,D.array[H+1]=U.y,D.array[H+2]=F.x,D.array[H+3]=F.y,D.array[H+4]=ja.x,D.array[H+5]=ja.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[H]=U.r,D.array[H+1]=U.g,D.array[H+2]=U.b,D.array[H+3]=F.r,D.array[H+4]=F.g,D.array[H+5]=F.b,D.array[H+6]=ja.r,D.array[H+7]=ja.g,D.array[H+8]=ja.b):(D.array[H]=U.x,D.array[H+1]=U.y,D.array[H+2]=U.z,D.array[H+3]=F.x,D.array[H+4]=F.y,D.array[H+5]=F.z,D.array[H+6]=ja.x,D.array[H+7]=ja.y,D.array[H+8]=ja.z),D.offset+=9):(D.array[H]=
-U.x,D.array[H+1]=U.y,D.array[H+2]=U.z,D.array[H+3]=U.w,D.array[H+4]=F.x,D.array[H+5]=F.y,D.array[H+6]=F.z,D.array[H+7]=F.w,D.array[H+8]=ja.x,D.array[H+9]=ja.y,D.array[H+10]=ja.z,D.array[H+11]=ja.w,D.offset+=12));if(Fa){H=0;for(D=Ma.length;H<D;H++)U=Ma[H].vertices[K.a].position,F=Ma[H].vertices[K.b].position,ja=Ma[H].vertices[K.c].position,R=ra[H],R[ca]=U.x,R[ca+1]=U.y,R[ca+2]=U.z,R[ca+3]=F.x,R[ca+4]=F.y,R[ca+5]=F.z,R[ca+6]=ja.x,R[ca+7]=ja.y,R[ca+8]=ja.z;ca+=9}if(Na.length)H=Na[K.a],D=Na[K.b],R=Na[K.c],
-ia[S]=H.x,ia[S+1]=H.y,ia[S+2]=H.z,ia[S+3]=H.w,ia[S+4]=D.x,ia[S+5]=D.y,ia[S+6]=D.z,ia[S+7]=D.w,ia[S+8]=R.x,ia[S+9]=R.y,ia[S+10]=R.z,ia[S+11]=R.w,H=Ua[K.a],D=Ua[K.b],R=Ua[K.c],ka[S]=H.x,ka[S+1]=H.y,ka[S+2]=H.z,ka[S+3]=H.w,ka[S+4]=D.x,ka[S+5]=D.y,ka[S+6]=D.z,ka[S+7]=D.w,ka[S+8]=R.x,ka[S+9]=R.y,ka[S+10]=R.z,ka[S+11]=R.w,H=Sa[K.a],D=Sa[K.b],R=Sa[K.c],na[S]=H.x,na[S+1]=H.y,na[S+2]=H.z,na[S+3]=1,na[S+4]=D.x,na[S+5]=D.y,na[S+6]=D.z,na[S+7]=1,na[S+8]=R.x,na[S+9]=R.y,na[S+10]=R.z,na[S+11]=1,H=Ta[K.a],D=Ta[K.b],
-R=Ta[K.c],da[S]=H.x,da[S+1]=H.y,da[S+2]=H.z,da[S+3]=1,da[S+4]=D.x,da[S+5]=D.y,da[S+6]=D.z,da[S+7]=1,da[S+8]=R.x,da[S+9]=R.y,da[S+10]=R.z,da[S+11]=1,S+=12;if(Ea&&x)la.length==3&&x==THREE.VertexColors?(K=la[0],H=la[1],D=la[2]):D=H=K=L,fa[W]=K.r,fa[W+1]=K.g,fa[W+2]=K.b,fa[W+3]=H.r,fa[W+4]=H.g,fa[W+5]=H.b,fa[W+6]=D.r,fa[W+7]=D.g,fa[W+8]=D.b,W+=9;if(Ha&&ua.hasTangents)la=J[0],L=J[1],K=J[2],$[ma]=la.x,$[ma+1]=la.y,$[ma+2]=la.z,$[ma+3]=la.w,$[ma+4]=L.x,$[ma+5]=L.y,$[ma+6]=L.z,$[ma+7]=L.w,$[ma+8]=K.x,$[ma+
-9]=K.y,$[ma+10]=K.z,$[ma+11]=K.w,ma+=12;if(va&&A)if(E.length==3&&sa)for(J=0;J<3;J++)pa=E[J],ga[Y]=pa.x,ga[Y+1]=pa.y,ga[Y+2]=pa.z,Y+=3;else for(J=0;J<3;J++)ga[Y]=pa.x,ga[Y+1]=pa.y,ga[Y+2]=pa.z,Y+=3;if(Ga&&v!==void 0&&u)for(J=0;J<3;J++)E=v[J],ha[Z]=E.u,ha[Z+1]=E.v,Z+=2;if(Ga&&V!==void 0&&u)for(J=0;J<3;J++)E=V[J],xa[wa]=E.u,xa[wa+1]=E.v,wa+=2;La&&(qa[aa]=X,qa[aa+1]=X+1,qa[aa+2]=X+2,aa+=3,Aa[za]=X,Aa[za+1]=X+1,Aa[za+2]=X,Aa[za+3]=X+2,Aa[za+4]=X+1,Aa[za+5]=X+2,za+=6,X+=3)}else if(K instanceof THREE.Face4){if(Da)U=
-Ka[K.a].position,F=Ka[K.b].position,ja=Ka[K.c].position,M=Ka[K.d].position,oa[Q]=U.x,oa[Q+1]=U.y,oa[Q+2]=U.z,oa[Q+3]=F.x,oa[Q+4]=F.y,oa[Q+5]=F.z,oa[Q+6]=ja.x,oa[Q+7]=ja.y,oa[Q+8]=ja.z,oa[Q+9]=M.x,oa[Q+10]=M.y,oa[Q+11]=M.z,Q+=12;if(Ba)for(T in Ba)if(D=Ba[T],D.__original.needsUpdate)H=D.offset,R=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[H]=D.value[K.a],D.array[H+1]=D.value[K.b],D.array[H+2]=D.value[K.c],D.array[H+3]=D.value[K.d]):D.boundTo==="faces"?(R=D.value[R],D.array[H]=
-R,D.array[H+1]=R,D.array[H+2]=R,D.array[H+3]=R,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[H]=D.value[R],D.array[H+1]=D.value[R+1],D.array[H+2]=D.value[R+2],D.array[H+3]=D.value[R+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(U=D.value[K.a],F=D.value[K.b],ja=D.value[K.c],M=D.value[K.d]):D.boundTo==="faces"?(M=ja=F=U=R=D.value[R],D.offsetSrc++):D.boundTo==="faceVertices"&&(U=D.value[R],F=D.value[R+1],ja=D.value[R+2],M=D.value[R+3],D.offsetSrc+=4),D.size===2?(D.array[H]=
-U.x,D.array[H+1]=U.y,D.array[H+2]=F.x,D.array[H+3]=F.y,D.array[H+4]=ja.x,D.array[H+5]=ja.y,D.array[H+6]=M.x,D.array[H+7]=M.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[H]=U.r,D.array[H+1]=U.g,D.array[H+2]=U.b,D.array[H+3]=F.r,D.array[H+4]=F.g,D.array[H+5]=F.b,D.array[H+6]=ja.r,D.array[H+7]=ja.g,D.array[H+8]=ja.b,D.array[H+9]=M.r,D.array[H+10]=M.g,D.array[H+11]=M.b):(D.array[H]=U.x,D.array[H+1]=U.y,D.array[H+2]=U.z,D.array[H+3]=F.x,D.array[H+4]=F.y,D.array[H+5]=F.z,D.array[H+6]=ja.x,D.array[H+
-7]=ja.y,D.array[H+8]=ja.z,D.array[H+9]=M.x,D.array[H+10]=M.y,D.array[H+11]=M.z),D.offset+=12):(D.array[H]=U.x,D.array[H+1]=U.y,D.array[H+2]=U.z,D.array[H+3]=U.w,D.array[H+4]=F.x,D.array[H+5]=F.y,D.array[H+6]=F.z,D.array[H+7]=F.w,D.array[H+8]=ja.x,D.array[H+9]=ja.y,D.array[H+10]=ja.z,D.array[H+11]=ja.w,D.array[H+12]=M.x,D.array[H+13]=M.y,D.array[H+14]=M.z,D.array[H+15]=M.w,D.offset+=16));if(Fa){H=0;for(D=Ma.length;H<D;H++)U=Ma[H].vertices[K.a].position,F=Ma[H].vertices[K.b].position,ja=Ma[H].vertices[K.c].position,
-M=Ma[H].vertices[K.d].position,R=ra[H],R[ca]=U.x,R[ca+1]=U.y,R[ca+2]=U.z,R[ca+3]=F.x,R[ca+4]=F.y,R[ca+5]=F.z,R[ca+6]=ja.x,R[ca+7]=ja.y,R[ca+8]=ja.z,R[ca+9]=M.x,R[ca+10]=M.y,R[ca+11]=M.z;ca+=12}if(Na.length)H=Na[K.a],D=Na[K.b],R=Na[K.c],O=Na[K.d],ia[S]=H.x,ia[S+1]=H.y,ia[S+2]=H.z,ia[S+3]=H.w,ia[S+4]=D.x,ia[S+5]=D.y,ia[S+6]=D.z,ia[S+7]=D.w,ia[S+8]=R.x,ia[S+9]=R.y,ia[S+10]=R.z,ia[S+11]=R.w,ia[S+12]=O.x,ia[S+13]=O.y,ia[S+14]=O.z,ia[S+15]=O.w,H=Ua[K.a],D=Ua[K.b],R=Ua[K.c],O=Ua[K.d],ka[S]=H.x,ka[S+1]=H.y,
-ka[S+2]=H.z,ka[S+3]=H.w,ka[S+4]=D.x,ka[S+5]=D.y,ka[S+6]=D.z,ka[S+7]=D.w,ka[S+8]=R.x,ka[S+9]=R.y,ka[S+10]=R.z,ka[S+11]=R.w,ka[S+12]=O.x,ka[S+13]=O.y,ka[S+14]=O.z,ka[S+15]=O.w,H=Sa[K.a],D=Sa[K.b],R=Sa[K.c],O=Sa[K.d],na[S]=H.x,na[S+1]=H.y,na[S+2]=H.z,na[S+3]=1,na[S+4]=D.x,na[S+5]=D.y,na[S+6]=D.z,na[S+7]=1,na[S+8]=R.x,na[S+9]=R.y,na[S+10]=R.z,na[S+11]=1,na[S+12]=O.x,na[S+13]=O.y,na[S+14]=O.z,na[S+15]=1,H=Ta[K.a],D=Ta[K.b],R=Ta[K.c],K=Ta[K.d],da[S]=H.x,da[S+1]=H.y,da[S+2]=H.z,da[S+3]=1,da[S+4]=D.x,da[S+
-5]=D.y,da[S+6]=D.z,da[S+7]=1,da[S+8]=R.x,da[S+9]=R.y,da[S+10]=R.z,da[S+11]=1,da[S+12]=K.x,da[S+13]=K.y,da[S+14]=K.z,da[S+15]=1,S+=16;if(Ea&&x)la.length==4&&x==THREE.VertexColors?(K=la[0],H=la[1],D=la[2],la=la[3]):la=D=H=K=L,fa[W]=K.r,fa[W+1]=K.g,fa[W+2]=K.b,fa[W+3]=H.r,fa[W+4]=H.g,fa[W+5]=H.b,fa[W+6]=D.r,fa[W+7]=D.g,fa[W+8]=D.b,fa[W+9]=la.r,fa[W+10]=la.g,fa[W+11]=la.b,W+=12;if(Ha&&ua.hasTangents)la=J[0],L=J[1],K=J[2],J=J[3],$[ma]=la.x,$[ma+1]=la.y,$[ma+2]=la.z,$[ma+3]=la.w,$[ma+4]=L.x,$[ma+5]=L.y,
-$[ma+6]=L.z,$[ma+7]=L.w,$[ma+8]=K.x,$[ma+9]=K.y,$[ma+10]=K.z,$[ma+11]=K.w,$[ma+12]=J.x,$[ma+13]=J.y,$[ma+14]=J.z,$[ma+15]=J.w,ma+=16;if(va&&A)if(E.length==4&&sa)for(J=0;J<4;J++)pa=E[J],ga[Y]=pa.x,ga[Y+1]=pa.y,ga[Y+2]=pa.z,Y+=3;else for(J=0;J<4;J++)ga[Y]=pa.x,ga[Y+1]=pa.y,ga[Y+2]=pa.z,Y+=3;if(Ga&&v!==void 0&&u)for(J=0;J<4;J++)E=v[J],ha[Z]=E.u,ha[Z+1]=E.v,Z+=2;if(Ga&&V!==void 0&&u)for(J=0;J<4;J++)E=V[J],xa[wa]=E.u,xa[wa+1]=E.v,wa+=2;La&&(qa[aa]=X,qa[aa+1]=X+1,qa[aa+2]=X+3,qa[aa+3]=X+1,qa[aa+4]=X+2,
-qa[aa+5]=X+3,aa+=6,Aa[za]=X,Aa[za+1]=X+1,Aa[za+2]=X,Aa[za+3]=X+3,Aa[za+4]=X+1,Aa[za+5]=X+2,Aa[za+6]=X+2,Aa[za+7]=X+3,za+=8,X+=4)}Da&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,oa,z));if(Ba)for(T in Ba)D=Ba[T],D.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,D.buffer),o.bufferData(o.ARRAY_BUFFER,D.array,z));if(Fa){H=0;for(D=Ma.length;H<D;H++)o.bindBuffer(o.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[H]),o.bufferData(o.ARRAY_BUFFER,ra[H],z)}Ea&&W>0&&(o.bindBuffer(o.ARRAY_BUFFER,
-t.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,fa,z));va&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ga,z));Ha&&ua.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,$,z));Ga&&Z>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ha,z));Ga&&wa>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,xa,z));La&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),
-o.bufferData(o.ELEMENT_ARRAY_BUFFER,qa,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Aa,z));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,na,z),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,da,z),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ka,z),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
-ia,z));ea&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;B(m)}else if(k instanceof THREE.Ribbon){h=
-k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=y=ea=ea=void 0;w=k.vertices;p=k.colors;u=w.length;t=p.length;x=k.__vertexArray;z=k.__colorArray;A=k.__dirtyColors;if(k.__dirtyVertices){for(ea=0;ea<u;ea++)y=w[ea].position,n=ea*3,x[n]=y.x,x[n+1]=y.y,x[n+2]=y.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,x,m)}if(A){for(ea=0;ea<t;ea++)color=p[ea],n=ea*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);
-o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=y=ea=ea=void 0;w=k.vertices;p=k.colors;u=w.length;t=p.length;x=k.__vertexArray;z=k.__colorArray;A=k.__dirtyColors;if(k.__dirtyVertices){for(ea=0;ea<u;ea++)y=w[ea].position,n=ea*3,x[n]=y.x,x[n+1]=y.y,x[n+2]=y.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,x,m)}if(A){for(ea=0;ea<t;ea++)color=
-p[ea],n=ea*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,t=C(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||t)&&e(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,B(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):
-o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ga}};
+y=f;z=0;for(c=y.length;z<c;z++)e=y[z],x.attributes[e]=o.getAttribLocation(x,e);x.id=N.length;N.push({program:x,code:n});M.info.memory.programs=N.length;y=x}b.program=y;y=b.program.attributes;y.position>=0&&o.enableVertexAttribArray(y.position);y.color>=0&&o.enableVertexAttribArray(y.color);y.normal>=0&&o.enableVertexAttribArray(y.normal);y.tangent>=0&&o.enableVertexAttribArray(y.tangent);b.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0&&(o.enableVertexAttribArray(y.skinVertexA),
+o.enableVertexAttribArray(y.skinVertexB),o.enableVertexAttribArray(y.skinIndex),o.enableVertexAttribArray(y.skinWeight));if(b.attributes)for(k in b.attributes)y[k]!==void 0&&y[k]>=0&&o.enableVertexAttribArray(y[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)z="morphTarget"+k,y[z]>=0&&(o.enableVertexAttribArray(y[z]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){I(b);
+this.clear(c,e,f)};this.render=function(b,e,t,ea){var V,ga,B,J,D,ca,Q,E,G,L=b.fog;X=-1;this.shadowMapEnabled&&y(b,e);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),b.add(e));b.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);e.matrixWorldInverse.flattenToArray(Ba);e.projectionMatrix.flattenToArray(Ga);Da.multiply(e.projectionMatrix,e.matrixWorldInverse);v(Da);this.initWebGLObjects(b);
+G=b.__webglLights;I(t);(this.autoClear||ea)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);D=b.__webglObjects.length;for(ea=0;ea<D;ea++)if(V=b.__webglObjects[ea],Q=V.object,Q.visible)if(!(Q instanceof THREE.Mesh)||!Q.frustumCulled||u(Q)){if(Q.matrixWorld.flattenToArray(Q._objectMatrixArray),F(Q,e,!0),w(V),V.render=!0,this.sortObjects)V.object.renderDepth?V.z=V.object.renderDepth:(Aa.copy(Q.position),Da.multiplyVector3(Aa),V.z=Aa.z)}else V.render=!1;else V.render=!1;this.sortObjects&&
+b.__webglObjects.sort(A);ca=b.__webglObjectsImmediate.length;for(ea=0;ea<ca;ea++)V=b.__webglObjectsImmediate[ea],Q=V.object,Q.visible&&(Q.matrixAutoUpdate&&Q.matrixWorld.flattenToArray(Q._objectMatrixArray),F(Q,e,!0),x(V));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);P(b.overrideMaterial.blending);for(ea=0;ea<D;ea++)if(V=b.__webglObjects[ea],V.render)Q=V.object,E=V.buffer,h(Q),f(e,G,L,b.overrideMaterial,E,Q);for(ea=0;ea<ca;ea++)V=b.__webglObjectsImmediate[ea],Q=V.object,Q.visible&&(ma=-1,
+h(Q),ga=c(e,G,L,b.overrideMaterial,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(ga,o,ta):Q.render(function(c){m(c,ga,b.overrideMaterial.shading)}))}else{P(THREE.NormalBlending);for(ea=D-1;ea>=0;ea--)if(V=b.__webglObjects[ea],V.render){Q=V.object;E=V.buffer;B=V.opaque;h(Q);for(V=0;V<B.count;V++)J=B.list[V],k(J.depthTest),n(J.depthWrite),p(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),f(e,G,L,J,E,Q)}for(ea=0;ea<ca;ea++)if(V=b.__webglObjectsImmediate[ea],Q=V.object,Q.visible){ma=
+-1;B=V.opaque;h(Q);for(V=0;V<B.count;V++)J=B.list[V],k(J.depthTest),n(J.depthWrite),p(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),ga=c(e,G,L,J,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(ga,o,ta):Q.render(function(b){m(b,ga,J.shading)})}for(ea=0;ea<D;ea++)if(V=b.__webglObjects[ea],V.render){Q=V.object;E=V.buffer;B=V.transparent;h(Q);for(V=0;V<B.count;V++)J=B.list[V],P(J.blending),k(J.depthTest),n(J.depthWrite),p(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),
+f(e,G,L,J,E,Q)}for(ea=0;ea<ca;ea++)if(V=b.__webglObjectsImmediate[ea],Q=V.object,Q.visible){ma=-1;B=V.transparent;h(Q);for(V=0;V<B.count;V++)J=B.list[V],P(J.blending),k(J.depthTest),n(J.depthWrite),p(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),ga=c(e,G,L,J,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(ga,o,ta):Q.render(function(b){m(b,ga,J.shading)})}}b.__webglSprites.length&&z(b,e);t&&t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter&&K(t)};this.initWebGLObjects=
+function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[],b.__webglLights=[];THREE.SceneUtils.traverseHierarchy(b,function(c){var e,f,h;if(!c.__webglInit)if(c.__webglInit=!0,c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray),c instanceof THREE.Mesh)for(e in f=c.geometry,f.geometryGroups==void 0&&
+O(f),f.geometryGroups){if(h=f.geometryGroups[e],!h.__webglVertexBuffer){var k=h;k.__webglVertexBuffer=o.createBuffer();k.__webglNormalBuffer=o.createBuffer();k.__webglTangentBuffer=o.createBuffer();k.__webglColorBuffer=o.createBuffer();k.__webglUVBuffer=o.createBuffer();k.__webglUV2Buffer=o.createBuffer();k.__webglSkinVertexABuffer=o.createBuffer();k.__webglSkinVertexBBuffer=o.createBuffer();k.__webglSkinIndicesBuffer=o.createBuffer();k.__webglSkinWeightsBuffer=o.createBuffer();k.__webglFaceBuffer=
+o.createBuffer();k.__webglLineBuffer=o.createBuffer();if(k.numMorphTargets){var m=void 0,n=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(n=k.numMorphTargets;m<n;m++)k.__webglMorphTargetsBuffers.push(o.createBuffer())}M.info.memory.geometries++;for(var k=c,p=void 0,t=void 0,w=void 0,v=w=void 0,u=void 0,y=void 0,x=y=m=0,z=w=t=void 0,w=n=z=t=p=void 0,v=k.geometry,u=v.faces,z=h.faces,p=0,t=z.length;p<t;p++)w=z[p],w=u[w],w instanceof THREE.Face3?(m+=3,y+=1,x+=3):w instanceof THREE.Face4&&(m+=4,y+=2,x+=
+4);for(var p=h,t=k,A=z=u=void 0,ea=void 0,A=void 0,w=[],u=0,z=t.materials.length;u<z;u++)if(A=t.materials[u],A instanceof THREE.MeshFaceMaterial){A=0;for(l=p.materials.length;A<l;A++)(ea=p.materials[A])&&w.push(ea)}else(ea=A)&&w.push(ea);p=w;h.__materials=p;a:{u=t=void 0;z=p.length;for(t=0;t<z;t++)if(u=p[t],u.map||u.lightMap||u instanceof THREE.ShaderMaterial){t=!0;break a}t=!1}a:{z=u=void 0;w=p.length;for(u=0;u<w;u++)if(z=p[u],!(z instanceof THREE.MeshBasicMaterial&&!z.envMap||z instanceof THREE.MeshDepthMaterial)){z=
+z&&z.shading!=void 0&&z.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}z=!1}a:{w=u=void 0;A=p.length;for(u=0;u<A;u++)if(w=p[u],w.vertexColors){w=w.vertexColors;break a}w=!1}h.__vertexArray=new Float32Array(m*3);if(z)h.__normalArray=new Float32Array(m*3);if(v.hasTangents)h.__tangentArray=new Float32Array(m*4);if(w)h.__colorArray=new Float32Array(m*3);if(t){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)h.__uvArray=new Float32Array(m*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>
+1)h.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)h.__skinVertexAArray=new Float32Array(m*4),h.__skinVertexBArray=new Float32Array(m*4),h.__skinIndexArray=new Float32Array(m*4),h.__skinWeightArray=new Float32Array(m*4);h.__faceArray=new Uint16Array(y*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));h.__lineArray=new Uint16Array(x*2);if(h.numMorphTargets){h.__morphTargetsArrays=[];v=0;for(u=h.numMorphTargets;v<u;v++)h.__morphTargetsArrays.push(new Float32Array(m*
+3))}h.__needsSmoothNormals=z==THREE.SmoothShading;h.__uvType=t;h.__vertexColorType=w;h.__normalType=z;h.__webglFaceCount=y*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);h.__webglLineCount=x*2;v=0;for(u=p.length;v<u;v++)if(t=p[v],t.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in t.attributes){w=t.attributes[a];z={};for(n in w)z[n]=w[n];if(!z.__webglInitialized||z.createUniqueBuffers)z.__webglInitialized=!0,y=1,z.type==="v2"?y=2:z.type==="v3"?y=3:z.type===
+"v4"?y=4:z.type==="c"&&(y=3),z.size=y,z.array=new Float32Array(m*y),z.buffer=o.createBuffer(),z.buffer.belongsToAttribute=a,w.needsUpdate=!0,z.__original=w;h.__webglCustomAttributes[a]=z}}h.__inittedArrays=!0;f.__dirtyVertices=!0;f.__dirtyMorphTargets=!0;f.__dirtyElements=!0;f.__dirtyUvs=!0;f.__dirtyNormals=!0;f.__dirtyTangents=!0;f.__dirtyColors=!0}}else if(c instanceof THREE.Ribbon){if(f=c.geometry,!f.__webglVertexBuffer)h=f,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),
+M.info.memory.geometries++,h=f,k=h.vertices.length,h.__vertexArray=new Float32Array(k*3),h.__colorArray=new Float32Array(k*3),h.__webglVertexCount=k,f.__dirtyVertices=!0,f.__dirtyColors=!0}else if(c instanceof THREE.Line){if(f=c.geometry,!f.__webglVertexBuffer)h=f,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),M.info.memory.geometries++,h=f,k=h.vertices.length,h.__vertexArray=new Float32Array(k*3),h.__colorArray=new Float32Array(k*3),h.__webglLineCount=k,f.__dirtyVertices=
+!0,f.__dirtyColors=!0}else if(c instanceof THREE.ParticleSystem&&(f=c.geometry,!f.__webglVertexBuffer)){h=f;h.__webglVertexBuffer=o.createBuffer();h.__webglColorBuffer=o.createBuffer();M.info.geometries++;h=f;k=h.vertices.length;h.__vertexArray=new Float32Array(k*3);h.__colorArray=new Float32Array(k*3);h.__sortArray=[];h.__webglParticleCount=k;h.__materials=c.materials;m=0;for(n=c.materials.length;m<n;m++)if(y=c.materials[m],y.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes=
+{};for(a in y.attributes){originalAttribute=y.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=
+a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;h.__webglCustomAttributes[a]=attribute}}f.__dirtyVertices=!0;f.__dirtyColors=!0}if(!c.__webglActive){if(c instanceof THREE.Mesh)for(e in f=c.geometry,f.geometryGroups)h=f.geometryGroups[e],E(b.__webglObjects,h,c);else c instanceof THREE.Ribbon||c instanceof THREE.Line||c instanceof THREE.ParticleSystem?(f=c.geometry,E(b.__webglObjects,f,c)):THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes||c.immediateRenderCallback?
+b.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}}):c instanceof THREE.Sprite?b.__webglSprites.push(c):c instanceof THREE.Light&&b.__webglLights.push(c);c.__webglActive=!0}});for(var c=0,e=b.__webglObjects.length;c<e;c++)G(b.__webglObjects[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};
+this.supportsVertexTextures=function(){return Ka}};
 THREE.WebGLRenderTarget=function(b,e,c){this.width=b;this.height=e;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.WebGLRenderTarget=function(b,e,c){this.width=b;this.height=e;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,e,c){THREE.WebGLRenderTarget.call(this,b,e,c);this.activeCubeFace=0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,e,c){THREE.WebGLRenderTarget.call(this,b,e,c);this.activeCubeFace=0};
@@ -342,19 +342,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.ColorUtils={adjustHSV:function(b,e,c,f){var m=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,m);m.h=THREE.ColorUtils.clamp(m.h+e,0,1);m.s=THREE.ColorUtils.clamp(m.s+c,0,1);m.v=THREE.ColorUtils.clamp(m.v+f,0,1);b.setHSV(m.h,m.s,m.v)},rgbToHsv:function(b,e){var c=b.r,f=b.g,m=b.b,h=Math.max(Math.max(c,f),m),k=Math.min(Math.min(c,f),m);if(k==h)k=c=0;else{var n=h-k,k=n/h,c=c==h?(f-m)/n:f==h?2+(m-c)/n:4+(c-f)/n;c/=6;c<0&&(c+=1);c>1&&(c-=1)}e===void 0&&(e={h:0,s:0,v:0});e.h=c;e.s=k;e.v=h;return e},
 THREE.ColorUtils={adjustHSV:function(b,e,c,f){var m=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,m);m.h=THREE.ColorUtils.clamp(m.h+e,0,1);m.s=THREE.ColorUtils.clamp(m.s+c,0,1);m.v=THREE.ColorUtils.clamp(m.v+f,0,1);b.setHSV(m.h,m.s,m.v)},rgbToHsv:function(b,e){var c=b.r,f=b.g,m=b.b,h=Math.max(Math.max(c,f),m),k=Math.min(Math.min(c,f),m);if(k==h)k=c=0;else{var n=h-k,k=n/h,c=c==h?(f-m)/n:f==h?2+(m-c)/n:4+(c-f)/n;c/=6;c<0&&(c+=1);c>1&&(c-=1)}e===void 0&&(e={h:0,s:0,v:0});e.h=c;e.s=k;e.v=h;return e},
 clamp:function(b,e,c){return b<e?e:b>c?c:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 clamp:function(b,e,c){return b<e?e:b>c?c:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(b,e){var c,f,m=b.vertices.length,h=e instanceof THREE.Mesh?e.geometry:e,k=b.vertices,n=h.vertices,p=b.faces,t=h.faces,u=b.faceVertexUvs[0],h=h.faceVertexUvs[0];if(e instanceof THREE.Mesh)e.matrixAutoUpdate&&e.updateMatrix(),c=e.matrix,f=new THREE.Matrix4,f.extractRotation(c,e.scale);for(var v=0,x=n.length;v<x;v++){var w=new THREE.Vertex(n[v].position.clone());c&&c.multiplyVector3(w.position);k.push(w)}v=0;for(x=t.length;v<x;v++){var w=t[v],A,y,z=w.vertexNormals,
-E=w.vertexColors;w instanceof THREE.Face3?A=new THREE.Face3(w.a+m,w.b+m,w.c+m):w instanceof THREE.Face4&&(A=new THREE.Face4(w.a+m,w.b+m,w.c+m,w.d+m));A.normal.copy(w.normal);f&&f.multiplyVector3(A.normal);k=0;for(n=z.length;k<n;k++)y=z[k].clone(),f&&f.multiplyVector3(y),A.vertexNormals.push(y);A.color.copy(w.color);k=0;for(n=E.length;k<n;k++)y=E[k],A.vertexColors.push(y.clone());A.materials=w.materials.slice();A.centroid.copy(w.centroid);c&&c.multiplyVector3(A.centroid);p.push(A)}v=0;for(x=h.length;v<
-x;v++){c=h[v];f=[];k=0;for(n=c.length;k<n;k++)f.push(new THREE.UV(c[k].u,c[k].v));u.push(f)}},clone:function(b){var e=new THREE.Geometry,c,f=b.vertices,m=b.faces,h=b.faceVertexUvs[0],b=0;for(c=f.length;b<c;b++){var k=new THREE.Vertex(f[b].position.clone());e.vertices.push(k)}b=0;for(c=m.length;b<c;b++){var n=m[b],p,t,u=n.vertexNormals,v=n.vertexColors;n instanceof THREE.Face3?p=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(p=new THREE.Face4(n.a,n.b,n.c,n.d));p.normal.copy(n.normal);f=0;
-for(k=u.length;f<k;f++)t=u[f],p.vertexNormals.push(t.clone());p.color.copy(n.color);f=0;for(k=v.length;f<k;f++)t=v[f],p.vertexColors.push(t.clone());p.materials=n.materials.slice();p.centroid.copy(n.centroid);e.faces.push(p)}b=0;for(c=h.length;b<c;b++){m=h[b];p=[];f=0;for(k=m.length;f<k;f++)p.push(new THREE.UV(m[f].u,m[f].v));e.faceVertexUvs[0].push(p)}return e},randomPointInTriangle:function(b,e,c){var f,m,h,k=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();m=THREE.GeometryUtils.random();
+THREE.GeometryUtils={merge:function(b,e){var c,f,m=b.vertices.length,h=e instanceof THREE.Mesh?e.geometry:e,k=b.vertices,n=h.vertices,p=b.faces,v=h.faces,u=b.faceVertexUvs[0],h=h.faceVertexUvs[0];if(e instanceof THREE.Mesh)e.matrixAutoUpdate&&e.updateMatrix(),c=e.matrix,f=new THREE.Matrix4,f.extractRotation(c,e.scale);for(var t=0,x=n.length;t<x;t++){var w=new THREE.Vertex(n[t].position.clone());c&&c.multiplyVector3(w.position);k.push(w)}t=0;for(x=v.length;t<x;t++){var w=v[t],A,y,z=w.vertexNormals,
+F=w.vertexColors;w instanceof THREE.Face3?A=new THREE.Face3(w.a+m,w.b+m,w.c+m):w instanceof THREE.Face4&&(A=new THREE.Face4(w.a+m,w.b+m,w.c+m,w.d+m));A.normal.copy(w.normal);f&&f.multiplyVector3(A.normal);k=0;for(n=z.length;k<n;k++)y=z[k].clone(),f&&f.multiplyVector3(y),A.vertexNormals.push(y);A.color.copy(w.color);k=0;for(n=F.length;k<n;k++)y=F[k],A.vertexColors.push(y.clone());A.materials=w.materials.slice();A.centroid.copy(w.centroid);c&&c.multiplyVector3(A.centroid);p.push(A)}t=0;for(x=h.length;t<
+x;t++){c=h[t];f=[];k=0;for(n=c.length;k<n;k++)f.push(new THREE.UV(c[k].u,c[k].v));u.push(f)}},clone:function(b){var e=new THREE.Geometry,c,f=b.vertices,m=b.faces,h=b.faceVertexUvs[0],b=0;for(c=f.length;b<c;b++){var k=new THREE.Vertex(f[b].position.clone());e.vertices.push(k)}b=0;for(c=m.length;b<c;b++){var n=m[b],p,v,u=n.vertexNormals,t=n.vertexColors;n instanceof THREE.Face3?p=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(p=new THREE.Face4(n.a,n.b,n.c,n.d));p.normal.copy(n.normal);f=0;
+for(k=u.length;f<k;f++)v=u[f],p.vertexNormals.push(v.clone());p.color.copy(n.color);f=0;for(k=t.length;f<k;f++)v=t[f],p.vertexColors.push(v.clone());p.materials=n.materials.slice();p.centroid.copy(n.centroid);e.faces.push(p)}b=0;for(c=h.length;b<c;b++){m=h[b];p=[];f=0;for(k=m.length;f<k;f++)p.push(new THREE.UV(m[f].u,m[f].v));e.faceVertexUvs[0].push(p)}return e},randomPointInTriangle:function(b,e,c){var f,m,h,k=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();m=THREE.GeometryUtils.random();
 f+m>1&&(f=1-f,m=1-m);h=1-f-m;k.copy(b);k.multiplyScalar(f);n.copy(e);n.multiplyScalar(m);k.addSelf(n);n.copy(c);n.multiplyScalar(h);k.addSelf(n);return k},randomPointInFace:function(b,e,c){var f,m,h;if(b instanceof THREE.Face3)return f=e.vertices[b.a].position,m=e.vertices[b.b].position,h=e.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,m,h);else if(b instanceof THREE.Face4){f=e.vertices[b.a].position;m=e.vertices[b.b].position;h=e.vertices[b.c].position;var e=e.vertices[b.d].position,
 f+m>1&&(f=1-f,m=1-m);h=1-f-m;k.copy(b);k.multiplyScalar(f);n.copy(e);n.multiplyScalar(m);k.addSelf(n);n.copy(c);n.multiplyScalar(h);k.addSelf(n);return k},randomPointInFace:function(b,e,c){var f,m,h;if(b instanceof THREE.Face3)return f=e.vertices[b.a].position,m=e.vertices[b.b].position,h=e.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,m,h);else if(b instanceof THREE.Face4){f=e.vertices[b.a].position;m=e.vertices[b.b].position;h=e.vertices[b.c].position;var e=e.vertices[b.d].position,
-k;c?b._area1&&b._area2?(c=b._area1,k=b._area2):(c=THREE.GeometryUtils.triangleArea(f,m,e),k=THREE.GeometryUtils.triangleArea(m,h,e),b._area1=c,b._area2=k):(c=THREE.GeometryUtils.triangleArea(f,m,e),k=THREE.GeometryUtils.triangleArea(m,h,e));return THREE.GeometryUtils.random()*(c+k)<c?THREE.GeometryUtils.randomPointInTriangle(f,m,e):THREE.GeometryUtils.randomPointInTriangle(m,h,e)}},randomPointsInGeometry:function(b,e){function c(b){function c(e,f){if(f<e)return e;var h=e+Math.floor((f-e)/2);return t[h]>
-b?c(e,h-1):t[h]<b?c(h+1,f):h}return c(0,t.length-1)}var f,m,h=b.faces,k=b.vertices,n=h.length,p=0,t=[],u,v,x,w;for(m=0;m<n;m++){f=h[m];if(f instanceof THREE.Face3)u=k[f.a].position,v=k[f.b].position,x=k[f.c].position,f._area=THREE.GeometryUtils.triangleArea(u,v,x);else if(f instanceof THREE.Face4)u=k[f.a].position,v=k[f.b].position,x=k[f.c].position,w=k[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(u,v,w),f._area2=THREE.GeometryUtils.triangleArea(v,x,w),f._area=f._area1+f._area2;p+=f._area;
-t[m]=p}f=[];k={};for(m=0;m<e;m++)n=THREE.GeometryUtils.random()*p,n=c(n),f[m]=THREE.GeometryUtils.randomPointInFace(h[n],b,!0),k[n]?k[n]+=1:k[n]=1;return f},triangleArea:function(b,e,c){var f,m=THREE.GeometryUtils.__v1;m.sub(b,e);f=m.length();m.sub(b,c);b=m.length();m.sub(e,c);c=m.length();e=0.5*(f+b+c);return Math.sqrt(e*(e-f)*(e-b)*(e-c))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(b){b.computeBoundingBox();var e=new THREE.Matrix4;e.setTranslation(-0.5*
+k;c?b._area1&&b._area2?(c=b._area1,k=b._area2):(c=THREE.GeometryUtils.triangleArea(f,m,e),k=THREE.GeometryUtils.triangleArea(m,h,e),b._area1=c,b._area2=k):(c=THREE.GeometryUtils.triangleArea(f,m,e),k=THREE.GeometryUtils.triangleArea(m,h,e));return THREE.GeometryUtils.random()*(c+k)<c?THREE.GeometryUtils.randomPointInTriangle(f,m,e):THREE.GeometryUtils.randomPointInTriangle(m,h,e)}},randomPointsInGeometry:function(b,e){function c(b){function c(e,f){if(f<e)return e;var h=e+Math.floor((f-e)/2);return v[h]>
+b?c(e,h-1):v[h]<b?c(h+1,f):h}return c(0,v.length-1)}var f,m,h=b.faces,k=b.vertices,n=h.length,p=0,v=[],u,t,x,w;for(m=0;m<n;m++){f=h[m];if(f instanceof THREE.Face3)u=k[f.a].position,t=k[f.b].position,x=k[f.c].position,f._area=THREE.GeometryUtils.triangleArea(u,t,x);else if(f instanceof THREE.Face4)u=k[f.a].position,t=k[f.b].position,x=k[f.c].position,w=k[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(u,t,w),f._area2=THREE.GeometryUtils.triangleArea(t,x,w),f._area=f._area1+f._area2;p+=f._area;
+v[m]=p}f=[];k={};for(m=0;m<e;m++)n=THREE.GeometryUtils.random()*p,n=c(n),f[m]=THREE.GeometryUtils.randomPointInFace(h[n],b,!0),k[n]?k[n]+=1:k[n]=1;return f},triangleArea:function(b,e,c){var f,m=THREE.GeometryUtils.__v1;m.sub(b,e);f=m.length();m.sub(b,c);b=m.length();m.sub(e,c);c=m.length();e=0.5*(f+b+c);return Math.sqrt(e*(e-f)*(e-b)*(e-c))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(b){b.computeBoundingBox();var e=new THREE.Matrix4;e.setTranslation(-0.5*
 (b.boundingBox.x[1]+b.boundingBox.x[0]),-0.5*(b.boundingBox.y[1]+b.boundingBox.y[0]),-0.5*(b.boundingBox.z[1]+b.boundingBox.z[0]));b.applyMatrix(e);b.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 (b.boundingBox.x[1]+b.boundingBox.x[0]),-0.5*(b.boundingBox.y[1]+b.boundingBox.y[0]),-0.5*(b.boundingBox.z[1]+b.boundingBox.z[0]));b.applyMatrix(e);b.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(b,e,c){var f=new Image,m=new THREE.Texture(f,e);f.onload=function(){m.needsUpdate=!0;c&&c(this)};f.crossOrigin="";f.src=b;return m},loadTextureCube:function(b,e,c){var f,m=[],h=new THREE.Texture(m,e),e=m.loadCount=0;for(f=b.length;e<f;++e)m[e]=new Image,m[e].onload=function(){m.loadCount+=1;if(m.loadCount==6)h.needsUpdate=!0;c&&c(this)},m[e].crossOrigin="",m[e].src=b[e];return h},getNormalMap:function(b,e){var c=function(b){var c=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
 THREE.ImageUtils={loadTexture:function(b,e,c){var f=new Image,m=new THREE.Texture(f,e);f.onload=function(){m.needsUpdate=!0;c&&c(this)};f.crossOrigin="";f.src=b;return m},loadTextureCube:function(b,e,c){var f,m=[],h=new THREE.Texture(m,e),e=m.loadCount=0;for(f=b.length;e<f;++e)m[e]=new Image,m[e].onload=function(){m.loadCount+=1;if(m.loadCount==6)h.needsUpdate=!0;c&&c(this)},m[e].crossOrigin="",m[e].src=b[e];return h},getNormalMap:function(b,e){var c=function(b){var c=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
-b[2]*b[2]);return[b[0]/c,b[1]/c,b[2]/c]};e|=1;var f=b.width,m=b.height,h=document.createElement("canvas");h.width=f;h.height=m;var k=h.getContext("2d");k.drawImage(b,0,0);for(var n=k.getImageData(0,0,f,m).data,p=k.createImageData(f,m),t=p.data,u=0;u<f;u++)for(var v=1;v<m;v++){var x=v-1<0?m-1:v-1,w=(v+1)%m,A=u-1<0?f-1:u-1,y=(u+1)%f,z=[],E=[0,0,n[(v*f+u)*4]/255*e];z.push([-1,0,n[(v*f+A)*4]/255*e]);z.push([-1,-1,n[(x*f+A)*4]/255*e]);z.push([0,-1,n[(x*f+u)*4]/255*e]);z.push([1,-1,n[(x*f+y)*4]/255*e]);
-z.push([1,0,n[(v*f+y)*4]/255*e]);z.push([1,1,n[(w*f+y)*4]/255*e]);z.push([0,1,n[(w*f+u)*4]/255*e]);z.push([-1,1,n[(w*f+A)*4]/255*e]);x=[];A=z.length;for(w=0;w<A;w++){var y=z[w],C=z[(w+1)%A],y=[y[0]-E[0],y[1]-E[1],y[2]-E[2]],C=[C[0]-E[0],C[1]-E[1],C[2]-E[2]];x.push(c([y[1]*C[2]-y[2]*C[1],y[2]*C[0]-y[0]*C[2],y[0]*C[1]-y[1]*C[0]]))}z=[0,0,0];for(w=0;w<x.length;w++)z[0]+=x[w][0],z[1]+=x[w][1],z[2]+=x[w][2];z[0]/=x.length;z[1]/=x.length;z[2]/=x.length;E=(v*f+u)*4;t[E]=(z[0]+1)/2*255|0;t[E+1]=(z[1]+0.5)*
-255|0;t[E+2]=z[2]*255|0;t[E+3]=255}k.putImageData(p,0,0);return h}};THREE.SceneUtils={showHierarchy:function(b,e){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=e})},traverseHierarchy:function(b,e){var c,f,m=b.children.length;for(f=0;f<m;f++)c=b.children[f],e(c),THREE.SceneUtils.traverseHierarchy(c,e)}};
+b[2]*b[2]);return[b[0]/c,b[1]/c,b[2]/c]};e|=1;var f=b.width,m=b.height,h=document.createElement("canvas");h.width=f;h.height=m;var k=h.getContext("2d");k.drawImage(b,0,0);for(var n=k.getImageData(0,0,f,m).data,p=k.createImageData(f,m),v=p.data,u=0;u<f;u++)for(var t=1;t<m;t++){var x=t-1<0?m-1:t-1,w=(t+1)%m,A=u-1<0?f-1:u-1,y=(u+1)%f,z=[],F=[0,0,n[(t*f+u)*4]/255*e];z.push([-1,0,n[(t*f+A)*4]/255*e]);z.push([-1,-1,n[(x*f+A)*4]/255*e]);z.push([0,-1,n[(x*f+u)*4]/255*e]);z.push([1,-1,n[(x*f+y)*4]/255*e]);
+z.push([1,0,n[(t*f+y)*4]/255*e]);z.push([1,1,n[(w*f+y)*4]/255*e]);z.push([0,1,n[(w*f+u)*4]/255*e]);z.push([-1,1,n[(w*f+A)*4]/255*e]);x=[];A=z.length;for(w=0;w<A;w++){var y=z[w],D=z[(w+1)%A],y=[y[0]-F[0],y[1]-F[1],y[2]-F[2]],D=[D[0]-F[0],D[1]-F[1],D[2]-F[2]];x.push(c([y[1]*D[2]-y[2]*D[1],y[2]*D[0]-y[0]*D[2],y[0]*D[1]-y[1]*D[0]]))}z=[0,0,0];for(w=0;w<x.length;w++)z[0]+=x[w][0],z[1]+=x[w][1],z[2]+=x[w][2];z[0]/=x.length;z[1]/=x.length;z[2]/=x.length;F=(t*f+u)*4;v[F]=(z[0]+1)/2*255|0;v[F+1]=(z[1]+0.5)*
+255|0;v[F+2]=z[2]*255|0;v[F+3]=255}k.putImageData(p,0,0);return h}};THREE.SceneUtils={showHierarchy:function(b,e){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=e})},traverseHierarchy:function(b,e){var c,f,m=b.children.length;for(f=0;f<m;f++)c=b.children[f],e(c),THREE.SceneUtils.traverseHierarchy(c,e)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -393,37 +393,37 @@ THREE.Path.prototype.quadraticCurveTo=function(b,e,c,f){var m=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(b,e,c,f,m,h){var k=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(n[n.length-2],n[n.length-1]),new THREE.Vector2(b,e),new THREE.Vector2(c,f),new THREE.Vector2(m,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:k})};
 THREE.Path.prototype.bezierCurveTo=function(b,e,c,f,m,h){var k=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(n[n.length-2],n[n.length-1]),new THREE.Vector2(b,e),new THREE.Vector2(c,f),new THREE.Vector2(m,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:k})};
 THREE.Path.prototype.splineThru=function(b){var e=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,b);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:e})};
 THREE.Path.prototype.splineThru=function(b){var e=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,b);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:e})};
 THREE.Path.prototype.arc=function(b,e,c,f,m,h){var k=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,e,c,f,m,h));this.actions.push({action:THREE.PathActions.ARC,args:k})};THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var e=[],c=0;c<b;c++)e.push(this.getPoint(c/b));return e};
 THREE.Path.prototype.arc=function(b,e,c,f,m,h){var k=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,e,c,f,m,h));this.actions.push({action:THREE.PathActions.ARC,args:k})};THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var e=[],c=0;c<b;c++)e.push(this.getPoint(c/b));return e};
-THREE.Path.prototype.getPoints=function(b,e){var b=b||12,c=[],f,m,h,k,n,p,t,u,v,x,w,A,y;f=0;for(m=this.actions.length;f<m;f++)switch(h=this.actions[f],k=h.action,h=h.args,k){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=h[2];p=h[3];v=h[0];x=h[1];c.length>0?(k=c[c.length-1],w=k.x,A=k.y):(k=this.actions[f-1].args,w=k[k.length-2],A=k[k.length-1]);for(k=1;k<=b;k++)y=k/b,h=THREE.Shape.Utils.b2(y,w,v,n),y=THREE.Shape.Utils.b2(y,A,x,
-p),c.push(new THREE.Vector2(h,y));break;case THREE.PathActions.BEZIER_CURVE_TO:n=h[4];p=h[5];v=h[0];x=h[1];t=h[2];u=h[3];c.length>0?(k=c[c.length-1],w=k.x,A=k.y):(k=this.actions[f-1].args,w=k[k.length-2],A=k[k.length-1]);for(k=1;k<=b;k++)y=k/b,h=THREE.Shape.Utils.b3(y,w,v,t,n),y=THREE.Shape.Utils.b3(y,A,x,u,p),c.push(new THREE.Vector2(h,y));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];y=b*h[0].length;k=k.concat(h[0]);h=new THREE.SplineCurve(k);
-for(k=1;k<=y;k++)c.push(h.getPointAt(k/y));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=h[0];p=h[1];t=h[2];v=h[3];y=h[4];x=!!h[5];u=k[k.length-2];w=k[k.length-1];k.length==0&&(u=w=0);A=y-v;var z=b*2;for(k=1;k<=z;k++)y=k/z,x||(y=1-y),y=v+y*A,h=u+n+t*Math.cos(y),y=w+p+t*Math.sin(y),c.push(new THREE.Vector2(h,y))}e&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(b,e){this.getBoundingBox();return this.getWrapPoints(this.getPoints(e),b)};
-THREE.Path.prototype.nltransform=function(b,e,c,f,m,h){var k=this.getPoints(),n,p,t,u,v;n=0;for(p=k.length;n<p;n++)t=k[n],u=t.x,v=t.y,t.x=b*u+e*v+c,t.y=f*v+m*u+h;return k};
+THREE.Path.prototype.getPoints=function(b,e){var b=b||12,c=[],f,m,h,k,n,p,v,u,t,x,w,A,y;f=0;for(m=this.actions.length;f<m;f++)switch(h=this.actions[f],k=h.action,h=h.args,k){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=h[2];p=h[3];t=h[0];x=h[1];c.length>0?(k=c[c.length-1],w=k.x,A=k.y):(k=this.actions[f-1].args,w=k[k.length-2],A=k[k.length-1]);for(k=1;k<=b;k++)y=k/b,h=THREE.Shape.Utils.b2(y,w,t,n),y=THREE.Shape.Utils.b2(y,A,x,
+p),c.push(new THREE.Vector2(h,y));break;case THREE.PathActions.BEZIER_CURVE_TO:n=h[4];p=h[5];t=h[0];x=h[1];v=h[2];u=h[3];c.length>0?(k=c[c.length-1],w=k.x,A=k.y):(k=this.actions[f-1].args,w=k[k.length-2],A=k[k.length-1]);for(k=1;k<=b;k++)y=k/b,h=THREE.Shape.Utils.b3(y,w,t,v,n),y=THREE.Shape.Utils.b3(y,A,x,u,p),c.push(new THREE.Vector2(h,y));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];y=b*h[0].length;k=k.concat(h[0]);h=new THREE.SplineCurve(k);
+for(k=1;k<=y;k++)c.push(h.getPointAt(k/y));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=h[0];p=h[1];v=h[2];t=h[3];y=h[4];x=!!h[5];u=k[k.length-2];w=k[k.length-1];k.length==0&&(u=w=0);A=y-t;var z=b*2;for(k=1;k<=z;k++)y=k/z,x||(y=1-y),y=t+y*A,h=u+n+v*Math.cos(y),y=w+p+v*Math.sin(y),c.push(new THREE.Vector2(h,y))}e&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(b,e){this.getBoundingBox();return this.getWrapPoints(this.getPoints(e),b)};
+THREE.Path.prototype.nltransform=function(b,e,c,f,m,h){var k=this.getPoints(),n,p,v,u,t;n=0;for(p=k.length;n<p;n++)v=k[n],u=v.x,t=v.y,v.x=b*u+e*t+c,v.y=f*t+m*u+h;return k};
 THREE.Path.prototype.debug=function(b){var e=this.getBoundingBox();b||(b=document.createElement("canvas"),b.setAttribute("width",e.maxX+100),b.setAttribute("height",e.maxY+100),document.body.appendChild(b));e=b.getContext("2d");e.fillStyle="white";e.fillRect(0,0,b.width,b.height);e.strokeStyle="black";e.beginPath();var c,f,m,b=0;for(c=this.actions.length;b<c;b++)f=this.actions[b],m=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&e[f].apply(e,m);e.stroke();e.closePath();e.strokeStyle="red";f=
 THREE.Path.prototype.debug=function(b){var e=this.getBoundingBox();b||(b=document.createElement("canvas"),b.setAttribute("width",e.maxX+100),b.setAttribute("height",e.maxY+100),document.body.appendChild(b));e=b.getContext("2d");e.fillStyle="white";e.fillRect(0,0,b.width,b.height);e.strokeStyle="black";e.beginPath();var c,f,m,b=0;for(c=this.actions.length;b<c;b++)f=this.actions[b],m=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&e[f].apply(e,m);e.stroke();e.closePath();e.strokeStyle="red";f=
 this.getPoints();b=0;for(c=f.length;b<c;b++)m=f[b],e.beginPath(),e.arc(m.x,m.y,1.5,0,Math.PI*2,!1),e.stroke(),e.closePath()};
 this.getPoints();b=0;for(c=f.length;b<c;b++)m=f[b],e.beginPath(),e.arc(m.x,m.y,1.5,0,Math.PI*2,!1),e.stroke(),e.closePath()};
 THREE.Path.prototype.toShapes=function(){var b,e,c,f,m=[],h=new THREE.Path;b=0;for(e=this.actions.length;b<e;b++)c=this.actions[b],f=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(m.push(h),h=new THREE.Path),h[c].apply(h,f);h.actions.length!=0&&m.push(h);if(m.length==0)return[];var k,h=[];if(THREE.Shape.Utils.isClockWise(m[0].getPoints())){b=0;for(e=m.length;b<e;b++)f=m[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(k&&h.push(k),k=new THREE.Shape,k.actions=f.actions,k.curves=
 THREE.Path.prototype.toShapes=function(){var b,e,c,f,m=[],h=new THREE.Path;b=0;for(e=this.actions.length;b<e;b++)c=this.actions[b],f=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(m.push(h),h=new THREE.Path),h[c].apply(h,f);h.actions.length!=0&&m.push(h);if(m.length==0)return[];var k,h=[];if(THREE.Shape.Utils.isClockWise(m[0].getPoints())){b=0;for(e=m.length;b<e;b++)f=m[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(k&&h.push(k),k=new THREE.Shape,k.actions=f.actions,k.curves=
 f.curves):k.holes.push(f);h.push(k)}else{k=new THREE.Shape;b=0;for(e=m.length;b<e;b++)f=m[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(k.actions=f.actions,k.curves=f.curves,h.push(k),k=new THREE.Shape):k.holes.push(f)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
 f.curves):k.holes.push(f);h.push(k)}else{k=new THREE.Shape;b=0;for(e=m.length;b<e;b++)f=m[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(k.actions=f.actions,k.curves=f.curves,h.push(k),k=new THREE.Shape):k.holes.push(f)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
 THREE.Shape.prototype.getPointsHoles=function(b){var e,c=this.holes.length,f=[];for(e=0;e<c;e++)f[e]=this.holes[e].getTransformedPoints(b,this.bends);return f};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var e,c=this.holes.length,f=[];for(e=0;e<c;e++)f[e]=this.holes[e].getTransformedSpacedPoints(b,this.bends);return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getTransformedPoints(b),holes:this.getPointsHoles(b)}};
 THREE.Shape.prototype.getPointsHoles=function(b){var e,c=this.holes.length,f=[];for(e=0;e<c;e++)f[e]=this.holes[e].getTransformedPoints(b,this.bends);return f};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var e,c=this.holes.length,f=[];for(e=0;e<c;e++)f[e]=this.holes[e].getTransformedSpacedPoints(b,this.bends);return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getTransformedPoints(b),holes:this.getPointsHoles(b)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getTransformedSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getTransformedSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
-THREE.Shape.Utils={removeHoles:function(b,e){var c=b.concat(),f=c.concat(),m,h,k,n,p,t,u,v,x,w,A=[];for(p=0;p<e.length;p++){t=e[p];Array.prototype.push.apply(f,t);h=Number.POSITIVE_INFINITY;for(m=0;m<t.length;m++){x=t[m];w=[];for(v=0;v<c.length;v++)u=c[v],u=x.distanceToSquared(u),w.push(u),u<h&&(h=u,k=m,n=v)}m=n-1>=0?n-1:c.length-1;h=k-1>=0?k-1:t.length-1;var y=[t[k],c[n],c[m]];v=THREE.FontUtils.Triangulate.area(y);var z=[t[k],t[h],c[n]];x=THREE.FontUtils.Triangulate.area(z);w=n;u=k;n+=1;k+=-1;n<
-0&&(n+=c.length);n%=c.length;k<0&&(k+=t.length);k%=t.length;m=n-1>=0?n-1:c.length-1;h=k-1>=0?k-1:t.length-1;y=[t[k],c[n],c[m]];y=THREE.FontUtils.Triangulate.area(y);z=[t[k],t[h],c[n]];z=THREE.FontUtils.Triangulate.area(z);v+x>y+z&&(n=w,k=u,n<0&&(n+=c.length),n%=c.length,k<0&&(k+=t.length),k%=t.length,m=n-1>=0?n-1:c.length-1,h=k-1>=0?k-1:t.length-1);v=c.slice(0,n);x=c.slice(n);w=t.slice(k);u=t.slice(0,k);h=[t[k],t[h],c[n]];A.push([t[k],c[n],c[m]]);A.push(h);c=v.concat(w).concat(u).concat(x)}return{shape:c,
-isolatedPts:A,allpoints:f}},triangulateShape:function(b,e){var c=THREE.Shape.Utils.removeHoles(b,e),f=c.allpoints,m=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,k,n,p,t={};h=0;for(k=f.length;h<k;h++)p=f[h].x+":"+f[h].y,t[p]!==void 0&&console.log("Duplicate point",p),t[p]=h;h=0;for(k=c.length;h<k;h++){n=c[h];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=t[p],p!==void 0&&(n[f]=p)}h=0;for(k=m.length;h<k;h++){n=m[h];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=t[p],p!==void 0&&(n[f]=p)}return c.concat(m)},
+THREE.Shape.Utils={removeHoles:function(b,e){var c=b.concat(),f=c.concat(),m,h,k,n,p,v,u,t,x,w,A=[];for(p=0;p<e.length;p++){v=e[p];Array.prototype.push.apply(f,v);h=Number.POSITIVE_INFINITY;for(m=0;m<v.length;m++){x=v[m];w=[];for(t=0;t<c.length;t++)u=c[t],u=x.distanceToSquared(u),w.push(u),u<h&&(h=u,k=m,n=t)}m=n-1>=0?n-1:c.length-1;h=k-1>=0?k-1:v.length-1;var y=[v[k],c[n],c[m]];t=THREE.FontUtils.Triangulate.area(y);var z=[v[k],v[h],c[n]];x=THREE.FontUtils.Triangulate.area(z);w=n;u=k;n+=1;k+=-1;n<
+0&&(n+=c.length);n%=c.length;k<0&&(k+=v.length);k%=v.length;m=n-1>=0?n-1:c.length-1;h=k-1>=0?k-1:v.length-1;y=[v[k],c[n],c[m]];y=THREE.FontUtils.Triangulate.area(y);z=[v[k],v[h],c[n]];z=THREE.FontUtils.Triangulate.area(z);t+x>y+z&&(n=w,k=u,n<0&&(n+=c.length),n%=c.length,k<0&&(k+=v.length),k%=v.length,m=n-1>=0?n-1:c.length-1,h=k-1>=0?k-1:v.length-1);t=c.slice(0,n);x=c.slice(n);w=v.slice(k);u=v.slice(0,k);h=[v[k],v[h],c[n]];A.push([v[k],c[n],c[m]]);A.push(h);c=t.concat(w).concat(u).concat(x)}return{shape:c,
+isolatedPts:A,allpoints:f}},triangulateShape:function(b,e){var c=THREE.Shape.Utils.removeHoles(b,e),f=c.allpoints,m=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,k,n,p,v={};h=0;for(k=f.length;h<k;h++)p=f[h].x+":"+f[h].y,v[p]!==void 0&&console.log("Duplicate point",p),v[p]=h;h=0;for(k=c.length;h<k;h++){n=c[h];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=v[p],p!==void 0&&(n[f]=p)}h=0;for(k=m.length;h<k;h++){n=m[h];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=v[p],p!==void 0&&(n[f]=p)}return c.concat(m)},
 isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0},b2p0:function(b,e){var c=1-b;return c*c*e},b2p1:function(b,e){return 2*(1-b)*b*e},b2p2:function(b,e){return b*b*e},b2:function(b,e,c,f){return this.b2p0(b,e)+this.b2p1(b,c)+this.b2p2(b,f)},b3p0:function(b,e){var c=1-b;return c*c*c*e},b3p1:function(b,e){var c=1-b;return 3*c*c*b*e},b3p2:function(b,e){return 3*(1-b)*b*b*e},b3p3:function(b,e){return b*b*b*e},b3:function(b,e,c,f,m){return this.b3p0(b,e)+this.b3p1(b,c)+this.b3p2(b,f)+
 isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0},b2p0:function(b,e){var c=1-b;return c*c*e},b2p1:function(b,e){return 2*(1-b)*b*e},b2p2:function(b,e){return b*b*e},b2:function(b,e,c,f){return this.b2p0(b,e)+this.b2p1(b,c)+this.b2p2(b,f)},b3p0:function(b,e){var c=1-b;return c*c*c*e},b3p1:function(b,e){var c=1-b;return 3*c*c*b*e},b3p2:function(b,e){return 3*(1-b)*b*b*e},b3p3:function(b,e){return b*b*b*e},b3:function(b,e,c,f,m){return this.b3p0(b,e)+this.b3p1(b,c)+this.b3p2(b,f)+
 this.b3p3(b,m)}};THREE.TextPath=function(b,e){THREE.Path.call(this);this.parameters=e||{};this.set(b)};THREE.TextPath.prototype.set=function(b,e){this.text=b;var e=e||this.parameters,c=e.curveSegments!==void 0?e.curveSegments:4,f=e.font!==void 0?e.font:"helvetiker",m=e.weight!==void 0?e.weight:"normal",h=e.style!==void 0?e.style:"normal";THREE.FontUtils.size=e.size!==void 0?e.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=f;THREE.FontUtils.weight=m;THREE.FontUtils.style=h};
 this.b3p3(b,m)}};THREE.TextPath=function(b,e){THREE.Path.call(this);this.parameters=e||{};this.set(b)};THREE.TextPath.prototype.set=function(b,e){this.text=b;var e=e||this.parameters,c=e.curveSegments!==void 0?e.curveSegments:4,f=e.font!==void 0?e.font:"helvetiker",m=e.weight!==void 0?e.weight:"normal",h=e.style!==void 0?e.style:"normal";THREE.FontUtils.size=e.size!==void 0?e.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=f;THREE.FontUtils.weight=m;THREE.FontUtils.style=h};
 THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,e=[],c=0,f=b.length;c<f;c++)Array.prototype.push.apply(e,b[c].toShapes());return e};
 THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,e=[],c=0,f=b.length;c<f;c++)Array.prototype.push.apply(e,b[c].toShapes());return e};
 THREE.AnimationHandler=function(){var b=[],e={},c={update:function(c){for(var e=0;e<b.length;e++)b[e].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,1)},add:function(b){e[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");e[b.name]=b;if(b.initialized!==!0){for(var c=0;c<b.hierarchy.length;c++){for(var f=0;f<b.hierarchy[c].keys.length;f++){if(b.hierarchy[c].keys[f].time<
 THREE.AnimationHandler=function(){var b=[],e={},c={update:function(c){for(var e=0;e<b.length;e++)b[e].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,1)},add:function(b){e[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");e[b.name]=b;if(b.initialized!==!0){for(var c=0;c<b.hierarchy.length;c++){for(var f=0;f<b.hierarchy[c].keys.length;f++){if(b.hierarchy[c].keys[f].time<
-0)b.hierarchy[c].keys[f].time=0;if(b.hierarchy[c].keys[f].rot!==void 0&&!(b.hierarchy[c].keys[f].rot instanceof THREE.Quaternion)){var n=b.hierarchy[c].keys[f].rot;b.hierarchy[c].keys[f].rot=new THREE.Quaternion(n[0],n[1],n[2],n[3])}}if(b.hierarchy[c].keys[0].morphTargets!==void 0){n={};for(f=0;f<b.hierarchy[c].keys.length;f++)for(var p=0;p<b.hierarchy[c].keys[f].morphTargets.length;p++){var t=b.hierarchy[c].keys[f].morphTargets[p];n[t]=-1}b.hierarchy[c].usedMorphTargets=n;for(f=0;f<b.hierarchy[c].keys.length;f++){var u=
-{};for(t in n){for(p=0;p<b.hierarchy[c].keys[f].morphTargets.length;p++)if(b.hierarchy[c].keys[f].morphTargets[p]===t){u[t]=b.hierarchy[c].keys[f].morphTargetsInfluences[p];break}p===b.hierarchy[c].keys[f].morphTargets.length&&(u[t]=0)}b.hierarchy[c].keys[f].morphTargetsInfluences=u}}for(f=1;f<b.hierarchy[c].keys.length;f++)b.hierarchy[c].keys[f].time===b.hierarchy[c].keys[f-1].time&&(b.hierarchy[c].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[c].keys.length;f++)b.hierarchy[c].keys[f].index=f}f=parseInt(b.length*
+0)b.hierarchy[c].keys[f].time=0;if(b.hierarchy[c].keys[f].rot!==void 0&&!(b.hierarchy[c].keys[f].rot instanceof THREE.Quaternion)){var n=b.hierarchy[c].keys[f].rot;b.hierarchy[c].keys[f].rot=new THREE.Quaternion(n[0],n[1],n[2],n[3])}}if(b.hierarchy[c].keys[0].morphTargets!==void 0){n={};for(f=0;f<b.hierarchy[c].keys.length;f++)for(var p=0;p<b.hierarchy[c].keys[f].morphTargets.length;p++){var v=b.hierarchy[c].keys[f].morphTargets[p];n[v]=-1}b.hierarchy[c].usedMorphTargets=n;for(f=0;f<b.hierarchy[c].keys.length;f++){var u=
+{};for(v in n){for(p=0;p<b.hierarchy[c].keys[f].morphTargets.length;p++)if(b.hierarchy[c].keys[f].morphTargets[p]===v){u[v]=b.hierarchy[c].keys[f].morphTargetsInfluences[p];break}p===b.hierarchy[c].keys[f].morphTargets.length&&(u[v]=0)}b.hierarchy[c].keys[f].morphTargetsInfluences=u}}for(f=1;f<b.hierarchy[c].keys.length;f++)b.hierarchy[c].keys[f].time===b.hierarchy[c].keys[f-1].time&&(b.hierarchy[c].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[c].keys.length;f++)b.hierarchy[c].keys[f].index=f}f=parseInt(b.length*
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(c=0;c<b.hierarchy.length;c++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return e[b]?e[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var c=[];if(b instanceof THREE.SkinnedMesh)for(var e=0;e<b.bones.length;e++)c.push(b.bones[e]);else f(b,c);return c}},f=function(b,c){c.push(b);for(var e=0;e<b.children.length;e++)f(b.children[e],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(c=0;c<b.hierarchy.length;c++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return e[b]?e[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var c=[];if(b instanceof THREE.SkinnedMesh)for(var e=0;e<b.bones.length;e++)c.push(b.bones[e]);else f(b,c);return c}},f=function(b,c){c.push(b);for(var e=0;e<b.children.length;e++)f(b.children[e],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
 2;return c}();THREE.Animation=function(b,e,c,f){this.root=b;this.data=THREE.AnimationHandler.get(e);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
 2;return c}();THREE.Animation=function(b,e,c,f){this.root=b;this.data=THREE.AnimationHandler.get(e);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(b,e){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=e!==void 0?e:0;var c,f=this.hierarchy.length,m;for(c=0;c<f;c++){m=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)m.useQuaternion=!0;m.matrixAutoUpdate=!0;if(m.animationCache===void 0)m.animationCache={},m.animationCache.prevKey={pos:0,rot:0,scl:0},m.animationCache.nextKey={pos:0,rot:0,scl:0},m.animationCache.originalMatrix=m instanceof
 THREE.Animation.prototype.play=function(b,e){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=e!==void 0?e:0;var c,f=this.hierarchy.length,m;for(c=0;c<f;c++){m=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)m.useQuaternion=!0;m.matrixAutoUpdate=!0;if(m.animationCache===void 0)m.animationCache={},m.animationCache.prevKey={pos:0,rot:0,scl:0},m.animationCache.nextKey={pos:0,rot:0,scl:0},m.animationCache.originalMatrix=m instanceof
 THREE.Bone?m.skinMatrix:m.matrix;var h=m.animationCache.prevKey;m=m.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];m.pos=this.getNextKeyWith("pos",c,1);m.rot=this.getNextKeyWith("rot",c,1);m.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Bone?m.skinMatrix:m.matrix;var h=m.animationCache.prevKey;m=m.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];m.pos=this.getNextKeyWith("pos",c,1);m.rot=this.getNextKeyWith("rot",c,1);m.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var e=["pos","rot","scl"],c,f,m,h,k,n,p,t,u=this.data.JIT.hierarchy,v,x;this.currentTime+=b*this.timeScale;x=this.currentTime;v=this.currentTime%=this.data.length;t=parseInt(Math.min(v*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,A=this.hierarchy.length;w<A;w++)if(b=this.hierarchy[w],p=b.animationCache,this.JITCompile&&u[w][t]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=u[w][t],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=u[w][t],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var y=0;y<3;y++){c=e[y];k=p.prevKey[c];n=p.nextKey[c];if(n.time<=x){if(v<x)if(this.loop){k=this.data.hierarchy[w].keys[0];for(n=this.getNextKeyWith(c,w,1);n.time<v;)k=n,n=this.getNextKeyWith(c,w,n.index+1)}else{this.stop();return}else{do k=n,n=this.getNextKeyWith(c,w,n.index+1);while(n.time<
-v)}p.prevKey[c]=k;p.nextKey[c]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(v-k.time)/(n.time-k.time);m=k[c];h=n[c];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(c==="pos")if(c=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=m[0]+(h[0]-m[0])*f,c.y=m[1]+(h[1]-m[1])*f,c.z=m[2]+(h[2]-m[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var e=["pos","rot","scl"],c,f,m,h,k,n,p,v,u=this.data.JIT.hierarchy,t,x;this.currentTime+=b*this.timeScale;x=this.currentTime;t=this.currentTime%=this.data.length;v=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,A=this.hierarchy.length;w<A;w++)if(b=this.hierarchy[w],p=b.animationCache,this.JITCompile&&u[w][v]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=u[w][v],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=u[w][v],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var y=0;y<3;y++){c=e[y];k=p.prevKey[c];n=p.nextKey[c];if(n.time<=x){if(t<x)if(this.loop){k=this.data.hierarchy[w].keys[0];for(n=this.getNextKeyWith(c,w,1);n.time<t;)k=n,n=this.getNextKeyWith(c,w,n.index+1)}else{this.stop();return}else{do k=n,n=this.getNextKeyWith(c,w,n.index+1);while(n.time<
+t)}p.prevKey[c]=k;p.nextKey[c]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-k.time)/(n.time-k.time);m=k[c];h=n[c];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(c==="pos")if(c=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=m[0]+(h[0]-m[0])*f,c.y=m[1]+(h[1]-m[1])*f,c.z=m[2]+(h[2]-m[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",w,k.index-1).pos,this.points[1]=m,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",w,n.index+1).pos,f=f*0.33+0.33,m=this.interpolateCatmullRom(this.points,f),c.x=m[0],c.y=m[1],c.z=m[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(c===
 this.getPrevKeyWith("pos",w,k.index-1).pos,this.points[1]=m,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",w,n.index+1).pos,f=f*0.33+0.33,m=this.interpolateCatmullRom(this.points,f),c.x=m[0],c.y=m[1],c.z=m[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(c===
-"rot")THREE.Quaternion.slerp(m,h,b.quaternion,f);else if(c==="scl")c=b.scale,c.x=m[0]+(h[0]-m[0])*f,c.y=m[1]+(h[1]-m[1])*f,c.z=m[2]+(h[2]-m[2])*f}}if(this.JITCompile&&u[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;w<this.hierarchy.length;w++)u[w][t]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,e){var c=[],f=[],m,h,k,n,p,t;m=(b.length-1)*e;h=Math.floor(m);m-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>b.length-2?h:h+1;c[3]=h>b.length-3?h:h+2;h=b[c[0]];n=b[c[1]];p=b[c[2]];t=b[c[3]];c=m*m;k=m*c;f[0]=this.interpolate(h[0],n[0],p[0],t[0],m,c,k);f[1]=this.interpolate(h[1],n[1],p[1],t[1],m,c,k);f[2]=this.interpolate(h[2],n[2],p[2],t[2],m,c,k);return f};
+"rot")THREE.Quaternion.slerp(m,h,b.quaternion,f);else if(c==="scl")c=b.scale,c.x=m[0]+(h[0]-m[0])*f,c.y=m[1]+(h[1]-m[1])*f,c.z=m[2]+(h[2]-m[2])*f}}if(this.JITCompile&&u[0][v]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;w<this.hierarchy.length;w++)u[w][v]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,e){var c=[],f=[],m,h,k,n,p,v;m=(b.length-1)*e;h=Math.floor(m);m-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>b.length-2?h:h+1;c[3]=h>b.length-3?h:h+2;h=b[c[0]];n=b[c[1]];p=b[c[2]];v=b[c[3]];c=m*m;k=m*c;f[0]=this.interpolate(h[0],n[0],p[0],v[0],m,c,k);f[1]=this.interpolate(h[1],n[1],p[1],v[1],m,c,k);f[2]=this.interpolate(h[2],n[2],p[2],v[2],m,c,k);return f};
 THREE.Animation.prototype.interpolate=function(b,e,c,f,m,h,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*h+b*m+e};THREE.Animation.prototype.getNextKeyWith=function(b,e,c){var f=this.data.hierarchy[e].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<f.length-1?c:f.length-1:c%=f.length;c<f.length;c++)if(f[c][b]!==void 0)return f[c];return this.data.hierarchy[e].keys[0]};
 THREE.Animation.prototype.interpolate=function(b,e,c,f,m,h,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*h+b*m+e};THREE.Animation.prototype.getNextKeyWith=function(b,e,c){var f=this.data.hierarchy[e].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<f.length-1?c:f.length-1:c%=f.length;c<f.length;c++)if(f[c][b]!==void 0)return f[c];return this.data.hierarchy[e].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,e,c){for(var f=this.data.hierarchy[e].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==void 0)return f[c];return this.data.hierarchy[e].keys[f.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,e,c){for(var f=this.data.hierarchy[e].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==void 0)return f[c];return this.data.hierarchy[e].keys[f.length-1]};
 THREE.CubeCamera=function(b,e,c,f){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,b,e);this.cameraNX=new THREE.PerspectiveCamera(90,1,b,e);this.cameraPY=new THREE.PerspectiveCamera(90,1,b,e);this.cameraNY=new THREE.PerspectiveCamera(90,1,b,e);this.cameraPZ=new THREE.PerspectiveCamera(90,1,b,e);this.cameraNZ=new THREE.PerspectiveCamera(90,1,b,e);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 THREE.CubeCamera=function(b,e,c,f){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,b,e);this.cameraNX=new THREE.PerspectiveCamera(90,1,b,e);this.cameraPY=new THREE.PerspectiveCamera(90,1,b,e);this.cameraNY=new THREE.PerspectiveCamera(90,1,b,e);this.cameraPZ=new THREE.PerspectiveCamera(90,1,b,e);this.cameraNZ=new THREE.PerspectiveCamera(90,1,b,e);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
@@ -443,7 +443,7 @@ b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(b){sw
 Math.PI/180;var b=this.target,e=this.object.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-
 Math.PI/180;var b=this.target,e=this.object.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-
 this.verticalMin)/(Math.PI-0)+this.verticalMin;b=this.target;e=this.object.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
 this.verticalMin)/(Math.PI-0)+this.verticalMin;b=this.target;e=this.object.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
 c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
 c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
-THREE.PathControls=function(b,e){function c(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,c){return function(){c.apply(b,arguments)}}function m(b,c,e,f){var h={name:e,fps:0.6,length:f,hierarchy:[]},k,m=c.getControlPointsArray(),n=c.getLength(),z=m.length,E=0;k=z-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<z-1;k++)E=f*n.chunks[k]/n.total,c.keys[k]={time:E,pos:m[k]};h.hierarchy[0]=
+THREE.PathControls=function(b,e){function c(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,c){return function(){c.apply(b,arguments)}}function m(b,c,e,f){var h={name:e,fps:0.6,length:f,hierarchy:[]},k,m=c.getControlPointsArray(),n=c.getLength(),z=m.length,F=0;k=z-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<z-1;k++)F=f*n.chunks[k]/n.total,c.keys[k]={time:F,pos:m[k]};h.hierarchy[0]=
 c;THREE.AnimationHandler.add(h);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(b,c){var e,f,h=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),h.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}this.object=b;this.domElement=e!==void 0?e:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 c;THREE.AnimationHandler.add(h);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(b,c){var e,f,h=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),h.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}this.object=b;this.domElement=e!==void 0?e:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var k=Math.PI*2,n=Math.PI/180;this.update=function(){var b,e;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*n;this.theta=this.lon*n;b=this.phi%k;this.phi=b>=0?b:b+k;b=this.verticalAngleMap.srcRange;
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var k=Math.PI*2,n=Math.PI/180;this.update=function(){var b,e;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*n;this.theta=this.lon*n;b=this.phi%k;this.phi=b>=0?b:b+k;b=this.verticalAngleMap.srcRange;
@@ -461,201 +461,201 @@ THREE.FlyControls=function(b,e){function c(b,c){return function(){c.apply(b,argu
 1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};
 1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};
 this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,
 this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,
 0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
 0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(b,e){this.object=b;this.domElement=e!==void 0?e:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var c=new THREE.Vector3,f=new THREE.Vector3,m=new THREE.Vector3,h=new THREE.Matrix4,k=!1,n=1,p=0,t=0,u=0,v=0,x=0,w=window.innerWidth/2,A=window.innerHeight/2;this.update=function(){var b=
-(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(p>0||this.autoForward&&!(p<0)?1:p));this.object.translateX(b*t);this.object.translateY(b*u);k&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollControls=function(b,e){this.object=b;this.domElement=e!==void 0?e:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var c=new THREE.Vector3,f=new THREE.Vector3,m=new THREE.Vector3,h=new THREE.Matrix4,k=!1,n=1,p=0,v=0,u=0,t=0,x=0,w=window.innerWidth/2,A=window.innerHeight/2;this.update=function(){var b=
+(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*t),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(p>0||this.autoForward&&!(p<0)?1:p));this.object.translateX(b*v);this.object.translateY(b*u);k&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();m.copy(this.forward);f.set(0,1,0);c.cross(f,m).normalize();f.cross(m,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=f.x;this.object.matrix.n13=m.x;this.object.matrix.n21=c.y;this.object.matrix.n22=f.y;this.object.matrix.n23=m.y;this.object.matrix.n31=c.z;this.object.matrix.n32=f.z;this.object.matrix.n33=m.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();m.copy(this.forward);f.set(0,1,0);c.cross(f,m).normalize();f.cross(m,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=f.x;this.object.matrix.n13=m.x;this.object.matrix.n21=c.y;this.object.matrix.n22=f.y;this.object.matrix.n23=m.y;this.object.matrix.n31=c.z;this.object.matrix.n32=f.z;this.object.matrix.n33=m.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);
 h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(b){this.object.position.x+=this.object.matrix.n11*b;this.object.position.y+=this.object.matrix.n21*b;this.object.position.z+=this.object.matrix.n31*b};this.translateY=function(b){this.object.position.x+=this.object.matrix.n12*
 h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(b){this.object.position.x+=this.object.matrix.n11*b;this.object.position.y+=this.object.matrix.n21*b;this.object.position.z+=this.object.matrix.n31*b};this.translateY=function(b){this.object.position.x+=this.object.matrix.n12*
 b;this.object.position.y+=this.object.matrix.n22*b;this.object.position.z+=this.object.matrix.n32*b};this.translateZ=function(b){this.object.position.x-=this.object.matrix.n13*b;this.object.position.y-=this.object.matrix.n23*b;this.object.position.z-=this.object.matrix.n33*b};this.rotateHorizontally=function(b){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(b);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(b){f.set(this.object.matrix.n12,
 b;this.object.position.y+=this.object.matrix.n22*b;this.object.position.z+=this.object.matrix.n32*b};this.translateZ=function(b){this.object.position.x-=this.object.matrix.n13*b;this.object.position.y-=this.object.matrix.n23*b;this.object.position.z-=this.object.matrix.n33*b};this.rotateHorizontally=function(b){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(b);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(b){f.set(this.object.matrix.n12,
-this.object.matrix.n22,this.object.matrix.n32);f.multiplyScalar(b);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){v=(b.clientX-w)/window.innerWidth;x=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",
-function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:k=!0;n=1;break;case 69:k=!0;n=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=
-0;break;case 39:case 68:t=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:u=0;break;case 70:u=0}},!1)};
+this.object.matrix.n22,this.object.matrix.n32);f.multiplyScalar(b);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){t=(b.clientX-w)/window.innerWidth;x=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",
+function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:v=-1;break;case 40:case 83:p=-1;break;case 39:case 68:v=1;break;case 81:k=!0;n=1;break;case 69:k=!0;n=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:v=0;break;case 40:case 83:p=
+0;break;case 39:case 68:v=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:u=0;break;case 70:u=0}},!1)};
 THREE.TrackballControls=function(b,e){var c=this,f={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=b;this.domElement=e!==void 0?e:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
 THREE.TrackballControls=function(b,e){var c=this,f={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=b;this.domElement=e!==void 0?e:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
-new THREE.Vector3(0,0,0);var m=!1,h=f.NONE,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,t=new THREE.Vector2,u=new THREE.Vector2,v=new THREE.Vector2,x=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-c.screen.offsetLeft)/c.radius*0.5,(e-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var f=new THREE.Vector3((b-c.screen.width*0.5-c.screen.offsetLeft)/
+new THREE.Vector3(0,0,0);var m=!1,h=f.NONE,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,v=new THREE.Vector2,u=new THREE.Vector2,t=new THREE.Vector2,x=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-c.screen.offsetLeft)/c.radius*0.5,(e-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var f=new THREE.Vector3((b-c.screen.width*0.5-c.screen.offsetLeft)/
 c.radius,(c.screen.height*0.5+c.screen.offsetTop-e)/c.radius,0),h=f.length();h>1?f.normalize():f.z=Math.sqrt(1-h*h);k.copy(c.object.position).subSelf(c.target);h=c.object.up.clone().setLength(f.y);h.addSelf(c.object.up.clone().crossSelf(k).setLength(f.x));h.addSelf(k.setLength(f.z));return h};this.rotateCamera=function(){var b=Math.acos(n.dot(p)/n.length()/p.length());if(b){var e=(new THREE.Vector3).cross(n,p).normalize(),f=new THREE.Quaternion;b*=c.rotateSpeed;f.setFromAxisAngle(e,-b);f.multiplyVector3(k);
 c.radius,(c.screen.height*0.5+c.screen.offsetTop-e)/c.radius,0),h=f.length();h>1?f.normalize():f.z=Math.sqrt(1-h*h);k.copy(c.object.position).subSelf(c.target);h=c.object.up.clone().setLength(f.y);h.addSelf(c.object.up.clone().crossSelf(k).setLength(f.x));h.addSelf(k.setLength(f.z));return h};this.rotateCamera=function(){var b=Math.acos(n.dot(p)/n.length()/p.length());if(b){var e=(new THREE.Vector3).cross(n,p).normalize(),f=new THREE.Quaternion;b*=c.rotateSpeed;f.setFromAxisAngle(e,-b);f.multiplyVector3(k);
-f.multiplyVector3(c.object.up);f.multiplyVector3(p);c.staticMoving?n=p:(f.setFromAxisAngle(e,b*(c.dynamicDampingFactor-1)),f.multiplyVector3(n))}};this.zoomCamera=function(){var b=1+(u.y-t.y)*c.zoomSpeed;b!==1&&b>0&&(k.multiplyScalar(b),c.staticMoving?t=u:t.y+=(u.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=x.clone().subSelf(v);if(b.lengthSq()){b.multiplyScalar(k.length()*c.panSpeed);var e=k.clone().crossSelf(c.object.up).setLength(b.x);e.addSelf(c.object.up.clone().setLength(b.y));
-c.object.position.addSelf(e);c.target.addSelf(e);c.staticMoving?v=x:v.addSelf(b.sub(x,v).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),k.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,k.setLength(c.minDistance))};this.update=function(){k.copy(c.object.position).subSelf(this.target);c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||
-c.panCamera();c.object.position.add(c.target,k);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){c.enabled&&(m&&(n=p=c.getMouseProjectionOnBall(b.clientX,b.clientY),t=u=c.getMouseOnScreen(b.clientX,b.clientY),v=x=c.getMouseOnScreen(b.clientX,b.clientY),m=!1),h!==f.NONE&&(h===f.ROTATE?p=c.getMouseProjectionOnBall(b.clientX,b.clientY):h===f.ZOOM&&!c.noZoom?u=c.getMouseOnScreen(b.clientX,
-b.clientY):h===f.PAN&&!c.noPan&&(x=c.getMouseOnScreen(b.clientX,b.clientY))))},!1);this.domElement.addEventListener("mousedown",function(b){if(c.enabled&&(b.preventDefault(),b.stopPropagation(),h===f.NONE))h=b.button,h===f.ROTATE?n=p=c.getMouseProjectionOnBall(b.clientX,b.clientY):h===f.ZOOM&&!c.noZoom?t=u=c.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(v=x=c.getMouseOnScreen(b.clientX,b.clientY))},!1);this.domElement.addEventListener("mouseup",function(b){if(c.enabled)b.preventDefault(),b.stopPropagation(),
+f.multiplyVector3(c.object.up);f.multiplyVector3(p);c.staticMoving?n=p:(f.setFromAxisAngle(e,b*(c.dynamicDampingFactor-1)),f.multiplyVector3(n))}};this.zoomCamera=function(){var b=1+(u.y-v.y)*c.zoomSpeed;b!==1&&b>0&&(k.multiplyScalar(b),c.staticMoving?v=u:v.y+=(u.y-v.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=x.clone().subSelf(t);if(b.lengthSq()){b.multiplyScalar(k.length()*c.panSpeed);var e=k.clone().crossSelf(c.object.up).setLength(b.x);e.addSelf(c.object.up.clone().setLength(b.y));
+c.object.position.addSelf(e);c.target.addSelf(e);c.staticMoving?t=x:t.addSelf(b.sub(x,t).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),k.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,k.setLength(c.minDistance))};this.update=function(){k.copy(c.object.position).subSelf(this.target);c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||
+c.panCamera();c.object.position.add(c.target,k);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){c.enabled&&(m&&(n=p=c.getMouseProjectionOnBall(b.clientX,b.clientY),v=u=c.getMouseOnScreen(b.clientX,b.clientY),t=x=c.getMouseOnScreen(b.clientX,b.clientY),m=!1),h!==f.NONE&&(h===f.ROTATE?p=c.getMouseProjectionOnBall(b.clientX,b.clientY):h===f.ZOOM&&!c.noZoom?u=c.getMouseOnScreen(b.clientX,
+b.clientY):h===f.PAN&&!c.noPan&&(x=c.getMouseOnScreen(b.clientX,b.clientY))))},!1);this.domElement.addEventListener("mousedown",function(b){if(c.enabled&&(b.preventDefault(),b.stopPropagation(),h===f.NONE))h=b.button,h===f.ROTATE?n=p=c.getMouseProjectionOnBall(b.clientX,b.clientY):h===f.ZOOM&&!c.noZoom?v=u=c.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(t=x=c.getMouseOnScreen(b.clientX,b.clientY))},!1);this.domElement.addEventListener("mouseup",function(b){if(c.enabled)b.preventDefault(),b.stopPropagation(),
 h=f.NONE},!1);window.addEventListener("keydown",function(b){if(c.enabled&&h===f.NONE){if(b.keyCode===c.keys[f.ROTATE])h=f.ROTATE;else if(b.keyCode===c.keys[f.ZOOM]&&!c.noZoom)h=f.ZOOM;else if(b.keyCode===c.keys[f.PAN]&&!c.noPan)h=f.PAN;h!==f.NONE&&(m=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&h!==f.NONE)h=f.NONE},!1)};
 h=f.NONE},!1);window.addEventListener("keydown",function(b){if(c.enabled&&h===f.NONE){if(b.keyCode===c.keys[f.ROTATE])h=f.ROTATE;else if(b.keyCode===c.keys[f.ZOOM]&&!c.noZoom)h=f.ZOOM;else if(b.keyCode===c.keys[f.PAN]&&!c.noPan)h=f.PAN;h!==f.NONE&&(m=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&h!==f.NONE)h=f.NONE},!1)};
-THREE.CubeGeometry=function(b,e,c,f,m,h,k,n){function p(b,c,e,k,n,p,u,v){var w,x,A=f||1,O=m||1,L=n/2,F=p/2,aa=t.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")w="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")w="y",O=h||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")w="x",A=h||1;var Y=A+1,Q=O+1;n/=A;var P=p/O;for(x=0;x<Q;x++)for(p=0;p<Y;p++){var o=new THREE.Vector3;o[b]=(p*n-L)*e;o[c]=(x*P-F)*k;o[w]=u;t.vertices.push(new THREE.Vertex(o))}for(x=0;x<O;x++)for(p=0;p<A;p++)t.faces.push(new THREE.Face4(p+Y*x+
-aa,p+Y*(x+1)+aa,p+1+Y*(x+1)+aa,p+1+Y*x+aa,null,null,v)),t.faceVertexUvs[0].push([new THREE.UV(p/A,x/O),new THREE.UV(p/A,(x+1)/O),new THREE.UV((p+1)/A,(x+1)/O),new THREE.UV((p+1)/A,x/O)])}THREE.Geometry.call(this);var t=this,u=b/2,v=e/2,x=c/2;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var A in n)this.sides[A]!=void 0&&(this.sides[A]=
-n[A]);this.sides.px&&p("z","y",-1,-1,c,e,u,this.materials[0]);this.sides.nx&&p("z","y",1,-1,c,e,-u,this.materials[1]);this.sides.py&&p("x","z",1,1,b,c,v,this.materials[2]);this.sides.ny&&p("x","z",1,-1,b,c,-v,this.materials[3]);this.sides.pz&&p("x","y",1,-1,b,e,x,this.materials[4]);this.sides.nz&&p("x","y",-1,-1,b,e,-x,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(b,e,c,f,m,h,k,n){function p(b,c,e,k,n,p,t,w){var u,x,A=f||1,R=m||1,I=n/2,K=p/2,aa=v.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",R=h||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",A=h||1;var Z=A+1,S=R+1;n/=A;var M=p/R;for(x=0;x<S;x++)for(p=0;p<Z;p++){var o=new THREE.Vector3;o[b]=(p*n-I)*e;o[c]=(x*M-K)*k;o[u]=t;v.vertices.push(new THREE.Vertex(o))}for(x=0;x<R;x++)for(p=0;p<A;p++)v.faces.push(new THREE.Face4(p+Z*x+
+aa,p+Z*(x+1)+aa,p+1+Z*(x+1)+aa,p+1+Z*x+aa,null,null,w)),v.faceVertexUvs[0].push([new THREE.UV(p/A,x/R),new THREE.UV(p/A,(x+1)/R),new THREE.UV((p+1)/A,(x+1)/R),new THREE.UV((p+1)/A,x/R)])}THREE.Geometry.call(this);var v=this,u=b/2,t=e/2,x=c/2;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var A in n)this.sides[A]!=void 0&&(this.sides[A]=
+n[A]);this.sides.px&&p("z","y",-1,-1,c,e,u,this.materials[0]);this.sides.nx&&p("z","y",1,-1,c,e,-u,this.materials[1]);this.sides.py&&p("x","z",1,1,b,c,t,this.materials[2]);this.sides.ny&&p("x","z",1,-1,b,c,-t,this.materials[3]);this.sides.pz&&p("x","y",1,-1,b,e,x,this.materials[4]);this.sides.nz&&p("x","y",-1,-1,b,e,-x,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(b,e,c,f,m,h){THREE.Geometry.call(this);var b=b!=null?b:20,e=e!=null?e:20,c=c||100,k=c/2,f=f||8,m=m||1,n,p,t=[],u=[];for(p=0;p<=m;p++){var v=[],x=[],w=p/m,A=w*(e-b)+b;for(n=0;n<=f;n++){var y=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(A*Math.sin(y*Math.PI*2),-w*c+k,A*Math.cos(y*Math.PI*2))));v.push(this.vertices.length-1);x.push(new THREE.UV(y,w))}t.push(v);u.push(x)}for(p=0;p<m;p++)for(n=0;n<f;n++){var c=t[p][n],v=t[p+1][n],x=t[p+1][n+1],w=t[p][n+1],A=
-this.vertices[c].position.clone().setY(0).normalize(),y=this.vertices[v].position.clone().setY(0).normalize(),z=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[w].position.clone().setY(0).normalize(),C=u[p][n].clone(),B=u[p+1][n].clone(),G=u[p+1][n+1].clone(),N=u[p][n+1].clone();this.faces.push(new THREE.Face4(c,v,x,w,[A,y,z,E]));this.faceVertexUvs[0].push([C,B,G,N])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n<f;n++)c=t[0][n],v=t[0][n+
-1],x=this.vertices.length-1,A=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),C=u[0][n].clone(),B=u[0][n+1].clone(),G=new THREE.UV(B.u,0),this.faces.push(new THREE.Face3(c,v,x,[A,y,z])),this.faceVertexUvs[0].push([C,B,G])}if(!h&&e>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;n<f;n++)c=t[p][n+1],v=t[p][n],x=this.vertices.length-1,A=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),C=u[p][n+1].clone(),B=u[p][n].clone(),
-G=new THREE.UV(B.u,1),this.faces.push(new THREE.Face3(c,v,x,[A,y,z])),this.faceVertexUvs[0].push([C,B,G])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(b,e,c,f,m,h){THREE.Geometry.call(this);var b=b!=null?b:20,e=e!=null?e:20,c=c||100,k=c/2,f=f||8,m=m||1,n,p,v=[],u=[];for(p=0;p<=m;p++){var t=[],x=[],w=p/m,A=w*(e-b)+b;for(n=0;n<=f;n++){var y=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(A*Math.sin(y*Math.PI*2),-w*c+k,A*Math.cos(y*Math.PI*2))));t.push(this.vertices.length-1);x.push(new THREE.UV(y,w))}v.push(t);u.push(x)}for(p=0;p<m;p++)for(n=0;n<f;n++){var c=v[p][n],t=v[p+1][n],x=v[p+1][n+1],w=v[p][n+1],A=
+this.vertices[c].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),z=this.vertices[x].position.clone().setY(0).normalize(),F=this.vertices[w].position.clone().setY(0).normalize(),D=u[p][n].clone(),B=u[p+1][n].clone(),G=u[p+1][n+1].clone(),O=u[p][n+1].clone();this.faces.push(new THREE.Face4(c,t,x,w,[A,y,z,F]));this.faceVertexUvs[0].push([D,B,G,O])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n<f;n++)c=v[0][n],t=v[0][n+
+1],x=this.vertices.length-1,A=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),D=u[0][n].clone(),B=u[0][n+1].clone(),G=new THREE.UV(B.u,0),this.faces.push(new THREE.Face3(c,t,x,[A,y,z])),this.faceVertexUvs[0].push([D,B,G])}if(!h&&e>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;n<f;n++)c=v[p][n+1],t=v[p][n],x=this.vertices.length-1,A=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),D=u[p][n+1].clone(),B=u[p][n].clone(),
+G=new THREE.UV(B.u,1),this.faces.push(new THREE.Face3(c,t,x,[A,y,z])),this.faceVertexUvs[0].push([D,B,G])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(b,e){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],c,f=b.length,m;this.shapebb=b[f-1].getBoundingBox();for(c=0;c<f;c++)m=b[c],this.addShape(m,e);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry=function(b,e){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],c,f=b.length,m;this.shapebb=b[f-1].getBoundingBox();for(c=0;c<f;c++)m=b[c],this.addShape(m,e);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(b,e){function c(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
 THREE.ExtrudeGeometry.prototype.addShape=function(b,e){function c(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
-n.copy(c).addSelf(k);o.copy(e).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function m(b){for(L=b.length;--L>=0;){qa=L;sa=L-1;sa<0&&(sa=b.length-
-1);for(var c=0,e=w+u*2,c=0;c<e;c++){var f=o*c,h=o*(c+1),k=va+qa+f,m=va+qa+h,t=k,f=va+sa+f,h=va+sa+h,v=m;t+=O;f+=O;h+=O;v+=O;J.faces.push(new THREE.Face4(t,f,h,v,null,null,G));G&&(t=c/e,f=(c+1)/e,h=n+p*2,k=(J.vertices[k].position.z+p)/h,m=(J.vertices[m].position.z+p)/h,J.faceVertexUvs[0].push([new THREE.UV(k,t),new THREE.UV(m,t),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function h(b,c,e){J.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=O;c+=O;e+=O;J.faces.push(new THREE.Face3(b,
-c,e,null,null,B));if(B){var f=N.maxY,h=N.maxX,k=J.vertices[c].position.x,c=J.vertices[c].position.y,m=J.vertices[e].position.x,e=J.vertices[e].position.y;J.faceVertexUvs[0].push([new THREE.UV(J.vertices[b].position.x/h,J.vertices[b].position.y/f),new THREE.UV(k/h,c/f),new THREE.UV(m/h,e/f)])}}var n=e.amount!==void 0?e.amount:100,p=e.bevelThickness!==void 0?e.bevelThickness:6,t=e.bevelSize!==void 0?e.bevelSize:p-2,u=e.bevelSegments!==void 0?e.bevelSegments:3,v=e.bevelEnabled!==void 0?e.bevelEnabled:
-!0,x=e.curveSegments!==void 0?e.curveSegments:12,w=e.steps!==void 0?e.steps:1,A=e.bendPath,y=e.extrudePath,z,E=!1,C=e.useSpacedPoints!==void 0?e.useSpacedPoints:!1,B=e.material,G=e.extrudeMaterial,N=this.shapebb;if(y)z=y.getPoints(x),w=z.length,E=!0,v=!1;v||(t=p=u=0);var I,M,Z,J=this,O=this.vertices.length;A&&b.addWrapPath(A);x=C?b.extractAllSpacedPoints(x):b.extractAllPoints(x);A=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();M=0;for(Z=x.length;M<Z;M++)I=x[M],THREE.Shape.Utils.isClockWise(I)&&
-(x[M]=I.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(A,x);C=A;M=0;for(Z=x.length;M<Z;M++)I=x[M],A=A.concat(I);var L,F,aa,Y,Q,P,o=A.length,T=y.length,$=[];L=0;F=C.length;qa=F-1;for(sa=L+1;L<F;L++,qa++,sa++)qa==F&&(qa=0),sa==F&&(sa=0),$[L]=f(C[L],C[qa],C[sa]);var da=[],ca,ra=$.concat();M=0;for(Z=x.length;M<Z;M++){I=x[M];ca=[];L=0;F=I.length;qa=F-1;for(sa=L+1;L<F;L++,qa++,sa++)qa==F&&(qa=0),sa==F&&(sa=0),ca[L]=f(I[L],I[qa],I[sa]);da.push(ca);ra=ra.concat(ca)}for(aa=0;aa<u;aa++){Y=aa/u;Q=p*(1-
-Y);Y=t*Math.sin(Y*Math.PI/2);L=0;for(F=C.length;L<F;L++)P=c(C[L],$[L],Y),h(P.x,P.y,-Q);M=0;for(Z=x.length;M<Z;M++){I=x[M];ca=da[M];L=0;for(F=I.length;L<F;L++)P=c(I[L],ca[L],Y),h(P.x,P.y,-Q)}}Y=t;for(L=0;L<o;L++)P=v?c(A[L],ra[L],Y):A[L],E?h(P.x,P.y+z[0].y,z[0].x):h(P.x,P.y,0);for(aa=1;aa<=w;aa++)for(L=0;L<o;L++)P=v?c(A[L],ra[L],Y):A[L],E?h(P.x,P.y+z[aa-1].y,z[aa-1].x):h(P.x,P.y,n/w*aa);for(aa=u-1;aa>=0;aa--){Y=aa/u;Q=p*(1-Y);Y=t*Math.sin(Y*Math.PI/2);L=0;for(F=C.length;L<F;L++)P=c(C[L],$[L],Y),h(P.x,
-P.y,n+Q);M=0;for(Z=x.length;M<Z;M++){I=x[M];ca=da[M];L=0;for(F=I.length;L<F;L++)P=c(I[L],ca[L],Y),E?h(P.x,P.y+z[w-1].y,z[w-1].x+Q):h(P.x,P.y,n+Q)}}if(v){v=o*0;for(L=0;L<T;L++)t=y[L],k(t[2]+v,t[1]+v,t[0]+v);v=o*(w+u*2);for(L=0;L<T;L++)t=y[L],k(t[0]+v,t[1]+v,t[2]+v)}else{for(L=0;L<T;L++)t=y[L],k(t[2],t[1],t[0]);for(L=0;L<T;L++)t=y[L],k(t[0]+o*w,t[1]+o*w,t[2]+o*w)}var qa,sa,va=0;m(C);va+=C.length;M=0;for(Z=x.length;M<Z;M++)I=x[M],m(I),va+=I.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+n.copy(c).addSelf(k);o.copy(e).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function m(b){for(I=b.length;--I>=0;){pa=I;ra=I-1;ra<0&&(ra=b.length-
+1);for(var c=0,e=w+u*2,c=0;c<e;c++){var f=o*c,h=o*(c+1),k=ya+pa+f,m=ya+pa+h,t=k,f=ya+ra+f,h=ya+ra+h,v=m;t+=R;f+=R;h+=R;v+=R;L.faces.push(new THREE.Face4(t,f,h,v,null,null,G));G&&(t=c/e,f=(c+1)/e,h=n+p*2,k=(L.vertices[k].position.z+p)/h,m=(L.vertices[m].position.z+p)/h,L.faceVertexUvs[0].push([new THREE.UV(k,t),new THREE.UV(m,t),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function h(b,c,e){L.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=R;c+=R;e+=R;L.faces.push(new THREE.Face3(b,
+c,e,null,null,B));if(B){var f=O.maxY,h=O.maxX,k=L.vertices[c].position.x,c=L.vertices[c].position.y,m=L.vertices[e].position.x,e=L.vertices[e].position.y;L.faceVertexUvs[0].push([new THREE.UV(L.vertices[b].position.x/h,L.vertices[b].position.y/f),new THREE.UV(k/h,c/f),new THREE.UV(m/h,e/f)])}}var n=e.amount!==void 0?e.amount:100,p=e.bevelThickness!==void 0?e.bevelThickness:6,v=e.bevelSize!==void 0?e.bevelSize:p-2,u=e.bevelSegments!==void 0?e.bevelSegments:3,t=e.bevelEnabled!==void 0?e.bevelEnabled:
+!0,x=e.curveSegments!==void 0?e.curveSegments:12,w=e.steps!==void 0?e.steps:1,A=e.bendPath,y=e.extrudePath,z,F=!1,D=e.useSpacedPoints!==void 0?e.useSpacedPoints:!1,B=e.material,G=e.extrudeMaterial,O=this.shapebb;if(y)z=y.getPoints(x),w=z.length,F=!0,t=!1;t||(v=p=u=0);var E,P,U,L=this,R=this.vertices.length;A&&b.addWrapPath(A);x=D?b.extractAllSpacedPoints(x):b.extractAllPoints(x);A=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();P=0;for(U=x.length;P<U;P++)E=x[P],THREE.Shape.Utils.isClockWise(E)&&
+(x[P]=E.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(A,x);D=A;P=0;for(U=x.length;P<U;P++)E=x[P],A=A.concat(E);var I,K,aa,Z,S,M,o=A.length,N=y.length,da=[];I=0;K=D.length;pa=K-1;for(ra=I+1;I<K;I++,pa++,ra++)pa==K&&(pa=0),ra==K&&(ra=0),da[I]=f(D[I],D[pa],D[ra]);var fa=[],X,ma=da.concat();P=0;for(U=x.length;P<U;P++){E=x[P];X=[];I=0;K=E.length;pa=K-1;for(ra=I+1;I<K;I++,pa++,ra++)pa==K&&(pa=0),ra==K&&(ra=0),X[I]=f(E[I],E[pa],E[ra]);fa.push(X);ma=ma.concat(X)}for(aa=0;aa<u;aa++){Z=aa/u;S=p*(1-Z);
+Z=v*Math.sin(Z*Math.PI/2);I=0;for(K=D.length;I<K;I++)M=c(D[I],da[I],Z),h(M.x,M.y,-S);P=0;for(U=x.length;P<U;P++){E=x[P];X=fa[P];I=0;for(K=E.length;I<K;I++)M=c(E[I],X[I],Z),h(M.x,M.y,-S)}}Z=v;for(I=0;I<o;I++)M=t?c(A[I],ma[I],Z):A[I],F?h(M.x,M.y+z[0].y,z[0].x):h(M.x,M.y,0);for(aa=1;aa<=w;aa++)for(I=0;I<o;I++)M=t?c(A[I],ma[I],Z):A[I],F?h(M.x,M.y+z[aa-1].y,z[aa-1].x):h(M.x,M.y,n/w*aa);for(aa=u-1;aa>=0;aa--){Z=aa/u;S=p*(1-Z);Z=v*Math.sin(Z*Math.PI/2);I=0;for(K=D.length;I<K;I++)M=c(D[I],da[I],Z),h(M.x,
+M.y,n+S);P=0;for(U=x.length;P<U;P++){E=x[P];X=fa[P];I=0;for(K=E.length;I<K;I++)M=c(E[I],X[I],Z),F?h(M.x,M.y+z[w-1].y,z[w-1].x+S):h(M.x,M.y,n+S)}}if(t){t=o*0;for(I=0;I<N;I++)v=y[I],k(v[2]+t,v[1]+t,v[0]+t);t=o*(w+u*2);for(I=0;I<N;I++)v=y[I],k(v[0]+t,v[1]+t,v[2]+t)}else{for(I=0;I<N;I++)v=y[I],k(v[2],v[1],v[0]);for(I=0;I<N;I++)v=y[I],k(v[0]+o*w,v[1]+o*w,v[2]+o*w)}var pa,ra,ya=0;m(D);ya+=D.length;P=0;for(U=x.length;P<U;P++)E=x[P],m(E),ya+=E.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(b){function e(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return m.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function c(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,c){var f=m.vertices[b].position,h=m.vertices[c].position;return e((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var m=this,h=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;e(-1,b,0);e(1,b,0);e(-1,-b,0);e(1,-b,0);e(0,-1,b);e(0,1,b);e(0,-1,
 THREE.IcosahedronGeometry=function(b){function e(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return m.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function c(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,c){var f=m.vertices[b].position,h=m.vertices[c].position;return e((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var m=this,h=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;e(-1,b,0);e(1,b,0);e(-1,-b,0);e(1,-b,0);e(0,-1,b);e(0,1,b);e(0,-1,
--b);e(0,1,-b);e(b,0,-1);e(b,0,1);e(-b,0,-1);e(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var k=0;k<this.subdivisions;k++){var b=new THREE.Geometry,n;for(n in h.faces){var p=f(h.faces[n].a,h.faces[n].b),t=f(h.faces[n].b,h.faces[n].c),u=f(h.faces[n].c,h.faces[n].a);c(h.faces[n].a,p,u,b);c(h.faces[n].b,t,
-p,b);c(h.faces[n].c,u,t,b);c(p,t,u,b)}h.faces=b.faces}m.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+-b);e(0,1,-b);e(b,0,-1);e(b,0,1);e(-b,0,-1);e(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var k=0;k<this.subdivisions;k++){var b=new THREE.Geometry,n;for(n in h.faces){var p=f(h.faces[n].a,h.faces[n].b),v=f(h.faces[n].b,h.faces[n].c),u=f(h.faces[n].c,h.faces[n].a);c(h.faces[n].a,p,u,b);c(h.faces[n].b,v,
+p,b);c(h.faces[n].c,u,v,b);c(p,v,u,b)}h.faces=b.faces}m.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.LatheGeometry=function(b,e,c){THREE.Geometry.call(this);this.steps=e||12;this.angle=c||2*Math.PI;for(var e=this.angle/this.steps,c=[],f=[],m=[],h=[],k=(new THREE.Matrix4).setRotationZ(e),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),c[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var p=0;p<=this.angle+0.0010;p+=e){for(n=0;n<c.length;n++)p<this.angle?(c[n]=k.multiplyVector3(c[n].clone()),this.vertices.push(new THREE.Vertex(c[n])),m[n]=this.vertices.length-1):m=h;p==0&&(h=f);
 THREE.LatheGeometry=function(b,e,c){THREE.Geometry.call(this);this.steps=e||12;this.angle=c||2*Math.PI;for(var e=this.angle/this.steps,c=[],f=[],m=[],h=[],k=(new THREE.Matrix4).setRotationZ(e),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),c[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var p=0;p<=this.angle+0.0010;p+=e){for(n=0;n<c.length;n++)p<this.angle?(c[n]=k.multiplyVector3(c[n].clone()),this.vertices.push(new THREE.Vertex(c[n])),m[n]=this.vertices.length-1):m=h;p==0&&(h=f);
 for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(m[n],m[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-p/this.angle,n/b.length),new THREE.UV(1-p/this.angle,(n+1)/b.length),new THREE.UV(1-(p-e)/this.angle,(n+1)/b.length),new THREE.UV(1-(p-e)/this.angle,n/b.length)]);f=m;m=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(m[n],m[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-p/this.angle,n/b.length),new THREE.UV(1-p/this.angle,(n+1)/b.length),new THREE.UV(1-(p-e)/this.angle,(n+1)/b.length),new THREE.UV(1-(p-e)/this.angle,n/b.length)]);f=m;m=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(b,e){function c(c){var e=c.clone().normalize(),e=new THREE.Vertex(e.clone().multiplyScalar(b));e.index=k.vertices.push(e)-1;e.uv=new THREE.UV(Math.atan2(c.z,-c.x)/2/Math.PI+0.5,Math.atan2(-c.y,Math.sqrt(c.x*c.x+c.z*c.z))/Math.PI+0.5);return e}function f(b,c,e,n){n<1?(n=new THREE.Face3(b.index,c.index,e.index,[b.position,c.position,e.position]),n.centroid.addSelf(b.position).addSelf(c.position).addSelf(e.position).divideScalar(3),n.normal=n.centroid.clone().normalize(),
 THREE.OctahedronGeometry=function(b,e){function c(c){var e=c.clone().normalize(),e=new THREE.Vertex(e.clone().multiplyScalar(b));e.index=k.vertices.push(e)-1;e.uv=new THREE.UV(Math.atan2(c.z,-c.x)/2/Math.PI+0.5,Math.atan2(-c.y,Math.sqrt(c.x*c.x+c.z*c.z))/Math.PI+0.5);return e}function f(b,c,e,n){n<1?(n=new THREE.Face3(b.index,c.index,e.index,[b.position,c.position,e.position]),n.centroid.addSelf(b.position).addSelf(c.position).addSelf(e.position).divideScalar(3),n.normal=n.centroid.clone().normalize(),
 k.faces.push(n),n=Math.atan2(n.centroid.z,-n.centroid.x),k.faceVertexUvs[0].push([h(b.uv,b.position,n),h(c.uv,c.position,n),h(e.uv,e.position,n)])):(n-=1,f(b,m(b,c),m(b,e),n),f(m(b,c),c,m(c,e),n),f(m(b,e),m(c,e),e,n),f(m(b,c),m(c,e),m(b,e),n))}function m(b,e){n[b.index]||(n[b.index]=[]);n[e.index]||(n[e.index]=[]);var f=n[b.index][e.index];f===void 0&&(n[b.index][e.index]=n[e.index][b.index]=f=c((new THREE.Vector3).add(b.position,e.position).divideScalar(2)));return f}function h(b,c,e){e<0&&b.u===
 k.faces.push(n),n=Math.atan2(n.centroid.z,-n.centroid.x),k.faceVertexUvs[0].push([h(b.uv,b.position,n),h(c.uv,c.position,n),h(e.uv,e.position,n)])):(n-=1,f(b,m(b,c),m(b,e),n),f(m(b,c),c,m(c,e),n),f(m(b,e),m(c,e),e,n),f(m(b,c),m(c,e),m(b,e),n))}function m(b,e){n[b.index]||(n[b.index]=[]);n[e.index]||(n[e.index]=[]);var f=n[b.index][e.index];f===void 0&&(n[b.index][e.index]=n[e.index][b.index]=f=c((new THREE.Vector3).add(b.position,e.position).divideScalar(2)));return f}function h(b,c,e){e<0&&b.u===
 1&&(b=new THREE.UV(b.u-1,b.v));c.x===0&&c.z===0&&(b=new THREE.UV(e/2/Math.PI+0.5,b.v));return b}THREE.Geometry.call(this);var e=e||0,k=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var n=[],p=this.vertices;f(p[0],p[2],p[4],e);f(p[0],p[4],p[3],e);f(p[0],p[3],p[5],e);f(p[0],p[5],p[2],e);f(p[1],p[2],p[5],e);f(p[1],p[5],p[3],e);f(p[1],p[3],p[4],e);f(p[1],p[4],p[2],e);this.boundingSphere=
 1&&(b=new THREE.UV(b.u-1,b.v));c.x===0&&c.z===0&&(b=new THREE.UV(e/2/Math.PI+0.5,b.v));return b}THREE.Geometry.call(this);var e=e||0,k=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var n=[],p=this.vertices;f(p[0],p[2],p[4],e);f(p[0],p[4],p[3],e);f(p[0],p[3],p[5],e);f(p[0],p[5],p[2],e);f(p[1],p[2],p[5],e);f(p[1],p[5],p[3],e);f(p[1],p[3],p[4],e);f(p[1],p[4],p[2],e);this.boundingSphere=
 {radius:b}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 {radius:b}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(b,e,c,f){THREE.Geometry.call(this);var m,h=b/2,k=e/2,c=c||1,f=f||1,n=c+1,p=f+1;b/=c;var t=e/f;for(m=0;m<p;m++)for(e=0;e<n;e++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(e*b-h,-(m*t-k),0)));for(m=0;m<f;m++)for(e=0;e<c;e++)this.faces.push(new THREE.Face4(e+n*m,e+n*(m+1),e+1+n*(m+1),e+1+n*m)),this.faceVertexUvs[0].push([new THREE.UV(e/c,m/f),new THREE.UV(e/c,(m+1)/f),new THREE.UV((e+1)/c,(m+1)/f),new THREE.UV((e+1)/c,m/f)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(b,e,c,f){THREE.Geometry.call(this);var m,h=b/2,k=e/2,c=c||1,f=f||1,n=c+1,p=f+1;b/=c;var v=e/f;for(m=0;m<p;m++)for(e=0;e<n;e++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(e*b-h,-(m*v-k),0)));for(m=0;m<f;m++)for(e=0;e<c;e++)this.faces.push(new THREE.Face4(e+n*m,e+n*(m+1),e+1+n*(m+1),e+1+n*m)),this.faceVertexUvs[0].push([new THREE.UV(e/c,m/f),new THREE.UV(e/c,(m+1)/f),new THREE.UV((e+1)/c,(m+1)/f),new THREE.UV((e+1)/c,m/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(b,e,c){THREE.Geometry.call(this);for(var b=b||50,f,m=Math.PI,h=Math.max(3,e||8),k=Math.max(2,c||6),e=[],c=0;c<k+1;c++){f=c/k;var n=b*Math.cos(f*m),p=b*Math.sin(f*m),t=[],u=0;for(f=0;f<h;f++){var v=2*f/h,x=p*Math.sin(v*m),v=p*Math.cos(v*m);(c==0||c==k)&&f>0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,n,x)))-1);t.push(u)}e.push(t)}for(var w,A,y,m=e.length,c=0;c<m;c++)if(h=e[c].length,c>0)for(f=0;f<h;f++){t=f==h-1;k=e[c][t?0:f+1];n=e[c][t?h-1:f];p=e[c-1][t?
-h-1:f];t=e[c-1][t?0:f+1];x=c/(m-1);w=(c-1)/(m-1);A=(f+1)/h;var v=f/h,u=new THREE.UV(1-A,x),x=new THREE.UV(1-v,x),v=new THREE.UV(1-v,w),z=new THREE.UV(1-A,w);c<e.length-1&&(w=this.vertices[k].position.clone(),A=this.vertices[n].position.clone(),y=this.vertices[p].position.clone(),w.normalize(),A.normalize(),y.normalize(),this.faces.push(new THREE.Face3(k,n,p,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([u,x,v]));c>1&&(w=
-this.vertices[k].position.clone(),A=this.vertices[p].position.clone(),y=this.vertices[t].position.clone(),w.normalize(),A.normalize(),y.normalize(),this.faces.push(new THREE.Face3(k,p,t,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([u,v,z]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(b,e,c){THREE.Geometry.call(this);for(var b=b||50,f,m=Math.PI,h=Math.max(3,e||8),k=Math.max(2,c||6),e=[],c=0;c<k+1;c++){f=c/k;var n=b*Math.cos(f*m),p=b*Math.sin(f*m),v=[],u=0;for(f=0;f<h;f++){var t=2*f/h,x=p*Math.sin(t*m),t=p*Math.cos(t*m);(c==0||c==k)&&f>0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,n,x)))-1);v.push(u)}e.push(v)}for(var w,A,y,m=e.length,c=0;c<m;c++)if(h=e[c].length,c>0)for(f=0;f<h;f++){v=f==h-1;k=e[c][v?0:f+1];n=e[c][v?h-1:f];p=e[c-1][v?
+h-1:f];v=e[c-1][v?0:f+1];x=c/(m-1);w=(c-1)/(m-1);A=(f+1)/h;var t=f/h,u=new THREE.UV(1-A,x),x=new THREE.UV(1-t,x),t=new THREE.UV(1-t,w),z=new THREE.UV(1-A,w);c<e.length-1&&(w=this.vertices[k].position.clone(),A=this.vertices[n].position.clone(),y=this.vertices[p].position.clone(),w.normalize(),A.normalize(),y.normalize(),this.faces.push(new THREE.Face3(k,n,p,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([u,x,t]));c>1&&(w=
+this.vertices[k].position.clone(),A=this.vertices[p].position.clone(),y=this.vertices[v].position.clone(),w.normalize(),A.normalize(),y.normalize(),this.faces.push(new THREE.Face3(k,p,v,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([u,t,z]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(b,e){var c=(new THREE.TextPath(b,e)).toShapes();e.amount=e.height!==void 0?e.height:50;if(e.bevelThickness===void 0)e.bevelThickness=10;if(e.bevelSize===void 0)e.bevelSize=8;if(e.bevelEnabled===void 0)e.bevelEnabled=!1;if(e.bend){var f=c[c.length-1].getBoundingBox().maxX;e.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,c,e)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry=function(b,e){var c=(new THREE.TextPath(b,e)).toShapes();e.amount=e.height!==void 0?e.height:50;if(e.bevelThickness===void 0)e.bevelThickness=10;if(e.bevelSize===void 0)e.bevelSize=8;if(e.bevelEnabled===void 0)e.bevelEnabled=!1;if(e.bend){var f=c[c.length-1].getBoundingBox().maxX;e.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,c,e)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,e){return(new TextPath(b,e)).toShapes()},loadFace:function(b){var e=b.familyName.toLowerCase();this.faces[e]=this.faces[e]||{};this.faces[e][b.cssFontWeight]=this.faces[e][b.cssFontWeight]||{};this.faces[e][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[e][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var e=
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,e){return(new TextPath(b,e)).toShapes()},loadFace:function(b){var e=b.familyName.toLowerCase();this.faces[e]=this.faces[e]||{};this.faces[e][b.cssFontWeight]=this.faces[e][b.cssFontWeight]||{};this.faces[e][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[e][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var e=
-this.getFace(),c=this.size/e.resolution,f=0,m=String(b).split(""),h=m.length,k=[],b=0;b<h;b++){var n=new THREE.Path,n=this.extractGlyphPoints(m[b],e,c,f,n);f+=n.offset;k.push(n.path)}return{paths:k,offset:f/2}},extractGlyphPoints:function(b,e,c,f,m){var h=[],k,n,p,t,u,v,x,w,A,y,z=e.glyphs[b]||e.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){e=z._cachedOutline||(z._cachedOutline=z.o.split(" "));p=e.length;for(b=0;b<p;)switch(n=e[b++],n){case "m":n=e[b++]*c+f;t=e[b++]*c;h.push(new THREE.Vector2(n,
-t));m.moveTo(n,t);break;case "l":n=e[b++]*c+f;t=e[b++]*c;h.push(new THREE.Vector2(n,t));m.lineTo(n,t);break;case "q":n=e[b++]*c+f;t=e[b++]*c;x=e[b++]*c+f;w=e[b++]*c;m.quadraticCurveTo(x,w,n,t);if(k=h[h.length-1]){u=k.x;v=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var E=k/divisions,C=THREE.Shape.Utils.b2(E,u,x,n),E=THREE.Shape.Utils.b2(E,v,w,t);h.push(new THREE.Vector2(C,E))}}break;case "b":if(n=e[b++]*c+f,t=e[b++]*c,x=e[b++]*c+f,w=e[b++]*-c,A=e[b++]*c+f,y=e[b++]*-c,m.bezierCurveTo(n,t,
-x,w,A,y),k=h[h.length-1]){u=k.x;v=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)E=k/divisions,C=THREE.Shape.Utils.b3(E,u,x,A,n),E=THREE.Shape.Utils.b3(E,v,w,y,t),h.push(new THREE.Vector2(C,E))}}}return{offset:z.ha*c,points:h,path:m}}}};
-(function(b){var e=function(b){for(var e=b.length,m=0,h=e-1,k=0;k<e;h=k++)m+=b[h].x*b[k].y-b[k].x*b[h].y;return m*0.5};b.Triangulate=function(b,f){var m=b.length;if(m<3)return null;var h=[],k=[],n=[],p,t,u;if(e(b)>0)for(t=0;t<m;t++)k[t]=t;else for(t=0;t<m;t++)k[t]=m-1-t;var v=2*m;for(t=m-1;m>2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return h}p=t;m<=p&&(p=0);t=p+1;m<=t&&(t=0);u=t+1;m<=u&&(u=0);var x;a:{x=b;var w=p,A=t,y=u,z=m,E=k,C=void 0,B=void 0,G=void 0,
-N=void 0,I=void 0,M=void 0,Z=void 0,J=void 0,O=void 0,B=x[E[w]].x,G=x[E[w]].y,N=x[E[A]].x,I=x[E[A]].y,M=x[E[y]].x,Z=x[E[y]].y;if(1.0E-10>(N-B)*(Z-G)-(I-G)*(M-B))x=!1;else{for(C=0;C<z;C++)if(!(C==w||C==A||C==y)){var J=x[E[C]].x,O=x[E[C]].y,L=void 0,F=void 0,aa=void 0,Y=void 0,Q=void 0,P=void 0,o=void 0,T=void 0,$=void 0,da=void 0,ca=void 0,ra=void 0,L=aa=Q=void 0,L=M-N,F=Z-I,aa=B-M,Y=G-Z,Q=N-B,P=I-G,o=J-B,T=O-G,$=J-N,da=O-I,ca=J-M,ra=O-Z,L=L*da-F*$,Q=Q*T-P*o,aa=aa*ra-Y*ca;if(L>=0&&aa>=0&&Q>=0){x=!1;
-break a}}x=!0}}if(x){h.push([b[k[p]],b[k[t]],b[k[u]]]);n.push([k[p],k[t],k[u]]);p=t;for(u=t+1;u<m;p++,u++)k[p]=k[u];m--;v=2*m}}if(f)return n;return h};b.Triangulate.area=e;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+this.getFace(),c=this.size/e.resolution,f=0,m=String(b).split(""),h=m.length,k=[],b=0;b<h;b++){var n=new THREE.Path,n=this.extractGlyphPoints(m[b],e,c,f,n);f+=n.offset;k.push(n.path)}return{paths:k,offset:f/2}},extractGlyphPoints:function(b,e,c,f,m){var h=[],k,n,p,v,u,t,x,w,A,y,z=e.glyphs[b]||e.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){e=z._cachedOutline||(z._cachedOutline=z.o.split(" "));p=e.length;for(b=0;b<p;)switch(n=e[b++],n){case "m":n=e[b++]*c+f;v=e[b++]*c;h.push(new THREE.Vector2(n,
+v));m.moveTo(n,v);break;case "l":n=e[b++]*c+f;v=e[b++]*c;h.push(new THREE.Vector2(n,v));m.lineTo(n,v);break;case "q":n=e[b++]*c+f;v=e[b++]*c;x=e[b++]*c+f;w=e[b++]*c;m.quadraticCurveTo(x,w,n,v);if(k=h[h.length-1]){u=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var F=k/divisions,D=THREE.Shape.Utils.b2(F,u,x,n),F=THREE.Shape.Utils.b2(F,t,w,v);h.push(new THREE.Vector2(D,F))}}break;case "b":if(n=e[b++]*c+f,v=e[b++]*c,x=e[b++]*c+f,w=e[b++]*-c,A=e[b++]*c+f,y=e[b++]*-c,m.bezierCurveTo(n,v,
+x,w,A,y),k=h[h.length-1]){u=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)F=k/divisions,D=THREE.Shape.Utils.b3(F,u,x,A,n),F=THREE.Shape.Utils.b3(F,t,w,y,v),h.push(new THREE.Vector2(D,F))}}}return{offset:z.ha*c,points:h,path:m}}}};
+(function(b){var e=function(b){for(var e=b.length,m=0,h=e-1,k=0;k<e;h=k++)m+=b[h].x*b[k].y-b[k].x*b[h].y;return m*0.5};b.Triangulate=function(b,f){var m=b.length;if(m<3)return null;var h=[],k=[],n=[],p,v,u;if(e(b)>0)for(v=0;v<m;v++)k[v]=v;else for(v=0;v<m;v++)k[v]=m-1-v;var t=2*m;for(v=m-1;m>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return h}p=v;m<=p&&(p=0);v=p+1;m<=v&&(v=0);u=v+1;m<=u&&(u=0);var x;a:{x=b;var w=p,A=v,y=u,z=m,F=k,D=void 0,B=void 0,G=void 0,
+O=void 0,E=void 0,P=void 0,U=void 0,L=void 0,R=void 0,B=x[F[w]].x,G=x[F[w]].y,O=x[F[A]].x,E=x[F[A]].y,P=x[F[y]].x,U=x[F[y]].y;if(1.0E-10>(O-B)*(U-G)-(E-G)*(P-B))x=!1;else{for(D=0;D<z;D++)if(!(D==w||D==A||D==y)){var L=x[F[D]].x,R=x[F[D]].y,I=void 0,K=void 0,aa=void 0,Z=void 0,S=void 0,M=void 0,o=void 0,N=void 0,da=void 0,fa=void 0,X=void 0,ma=void 0,I=aa=S=void 0,I=P-O,K=U-E,aa=B-P,Z=G-U,S=O-B,M=E-G,o=L-B,N=R-G,da=L-O,fa=R-E,X=L-P,ma=R-U,I=I*fa-K*da,S=S*N-M*o,aa=aa*ma-Z*X;if(I>=0&&aa>=0&&S>=0){x=!1;
+break a}}x=!0}}if(x){h.push([b[k[p]],b[k[v]],b[k[u]]]);n.push([k[p],k[v],k[u]]);p=v;for(u=v+1;u<m;p++,u++)k[p]=k[u];m--;t=2*m}}if(f)return n;return h};b.Triangulate.area=e;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,e,c,f,m){THREE.Geometry.call(this);this.radius=b||100;this.tube=e||40;this.segmentsR=c||8;this.segmentsT=f||6;this.arc=m||Math.PI*2;m=new THREE.Vector3;b=[];e=[];for(c=0;c<=this.segmentsR;c++)for(f=0;f<=this.segmentsT;f++){var h=f/this.segmentsT*this.arc,k=c/this.segmentsR*Math.PI*2;m.x=this.radius*Math.cos(h);m.y=this.radius*Math.sin(h);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(k))*Math.cos(h);n.y=(this.radius+this.tube*Math.cos(k))*Math.sin(h);n.z=
 THREE.TorusGeometry=function(b,e,c,f,m){THREE.Geometry.call(this);this.radius=b||100;this.tube=e||40;this.segmentsR=c||8;this.segmentsT=f||6;this.arc=m||Math.PI*2;m=new THREE.Vector3;b=[];e=[];for(c=0;c<=this.segmentsR;c++)for(f=0;f<=this.segmentsT;f++){var h=f/this.segmentsT*this.arc,k=c/this.segmentsR*Math.PI*2;m.x=this.radius*Math.cos(h);m.y=this.radius*Math.sin(h);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(k))*Math.cos(h);n.y=(this.radius+this.tube*Math.cos(k))*Math.sin(h);n.z=
 this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-c/this.segmentsR));e.push(n.clone().subSelf(m).normalize())}for(c=1;c<=this.segmentsR;c++)for(f=1;f<=this.segmentsT;f++){var m=(this.segmentsT+1)*c+f-1,h=(this.segmentsT+1)*(c-1)+f-1,k=(this.segmentsT+1)*(c-1)+f,n=(this.segmentsT+1)*c+f,p=new THREE.Face4(m,h,k,n,[e[m],e[h],e[k],e[n]]);p.normal.addSelf(e[m]);p.normal.addSelf(e[h]);p.normal.addSelf(e[k]);p.normal.addSelf(e[n]);p.normal.normalize();this.faces.push(p);
 this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-c/this.segmentsR));e.push(n.clone().subSelf(m).normalize())}for(c=1;c<=this.segmentsR;c++)for(f=1;f<=this.segmentsT;f++){var m=(this.segmentsT+1)*c+f-1,h=(this.segmentsT+1)*(c-1)+f-1,k=(this.segmentsT+1)*(c-1)+f,n=(this.segmentsT+1)*c+f,p=new THREE.Face4(m,h,k,n,[e[m],e[h],e[k],e[n]]);p.normal.addSelf(e[m]);p.normal.addSelf(e[h]);p.normal.addSelf(e[k]);p.normal.addSelf(e[n]);p.normal.normalize();this.faces.push(p);
 this.faceVertexUvs[0].push([b[m].clone(),b[h].clone(),b[k].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 this.faceVertexUvs[0].push([b[m].clone(),b[h].clone(),b[k].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(b,e,c,f,m,h,k){function n(b,c,e,f,h,k){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(h*(2+e)*0.5*Math.cos(b),h*(2+e)*Math.sin(b)*0.5,k*h*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=e||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=m||2;this.q=h||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(e=0;e<
 THREE.TorusKnotGeometry=function(b,e,c,f,m,h,k){function n(b,c,e,f,h,k){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(h*(2+e)*0.5*Math.cos(b),h*(2+e)*Math.sin(b)*0.5,k*h*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=e||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=m||2;this.q=h||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(e=0;e<
 this.segmentsT;++e){var p=b/this.segmentsR*2*this.p*Math.PI,k=e/this.segmentsT*2*Math.PI,m=n(p,k,this.q,this.p,this.radius,this.heightScale),p=n(p+0.01,k,this.q,this.p,this.radius,this.heightScale);c.x=p.x-m.x;c.y=p.y-m.y;c.z=p.z-m.z;f.x=p.x+m.x;f.y=p.y+m.y;f.z=p.z+m.z;h.cross(c,f);f.cross(h,c);h.normalize();f.normalize();p=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);m.x+=p*f.x+k*h.x;m.y+=p*f.y+k*h.y;m.z+=p*f.z+k*h.z;this.grid[b][e]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m.x,m.y,
 this.segmentsT;++e){var p=b/this.segmentsR*2*this.p*Math.PI,k=e/this.segmentsT*2*Math.PI,m=n(p,k,this.q,this.p,this.radius,this.heightScale),p=n(p+0.01,k,this.q,this.p,this.radius,this.heightScale);c.x=p.x-m.x;c.y=p.y-m.y;c.z=p.z-m.z;f.x=p.x+m.x;f.y=p.y+m.y;f.z=p.z+m.z;h.cross(c,f);f.cross(h,c);h.normalize();f.normalize();p=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);m.x+=p*f.x+k*h.x;m.y+=p*f.y+k*h.y;m.z+=p*f.z+k*h.z;this.grid[b][e]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m.x,m.y,
-m.z)))-1}}for(b=0;b<this.segmentsR;++b)for(e=0;e<this.segmentsT;++e){var f=(b+1)%this.segmentsR,h=(e+1)%this.segmentsT,m=this.grid[b][e],c=this.grid[f][e],f=this.grid[f][h],h=this.grid[b][h],k=new THREE.UV(b/this.segmentsR,e/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,e/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,(e+1)/this.segmentsT),u=new THREE.UV(b/this.segmentsR,(e+1)/this.segmentsT);this.faces.push(new THREE.Face4(m,c,f,h));this.faceVertexUvs[0].push([k,p,t,u])}this.computeCentroids();
+m.z)))-1}}for(b=0;b<this.segmentsR;++b)for(e=0;e<this.segmentsT;++e){var f=(b+1)%this.segmentsR,h=(e+1)%this.segmentsT,m=this.grid[b][e],c=this.grid[f][e],f=this.grid[f][h],h=this.grid[b][h],k=new THREE.UV(b/this.segmentsR,e/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,e/this.segmentsT),v=new THREE.UV((b+1)/this.segmentsR,(e+1)/this.segmentsT),u=new THREE.UV(b/this.segmentsR,(e+1)/this.segmentsT);this.faces.push(new THREE.Face4(m,c,f,h));this.faceVertexUvs[0].push([k,p,v,u])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(b){for(var e=this.subdivisions;e-- >0;)this.smooth(b)};
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(b){for(var e=this.subdivisions;e-- >0;)this.smooth(b)};
-THREE.SubdivisionModifier.prototype.smooth=function(b){function e(b,c,e,f,n,p){var t=new THREE.Face4(b,c,e,f,null,n.color,n.material);if(k.useOldVertexColors){t.vertexColors=[];for(var u,o,w,x=0;x<4;x++){w=p[x];u=new THREE.Color;u.setRGB(0,0,0);for(var y=0;y<w.length;y++)o=n.vertexColors[w[y]-1],u.r+=o.r,u.g+=o.g,u.b+=o.b;u.r/=w.length;u.g/=w.length;u.b/=w.length;t.vertexColors[x]=u}}m.push(t);(!k.supportUVs||v.length!=0)&&h.push([v[b],v[c],v[e],v[f]])}function c(b,c){return Math.min(b,c)+"_"+Math.max(b,
-c)}var f=[],m=[],h=[],k=this,n=b.vertices,f=b.faces,p=n.concat(),t=[],u={},v=[],x,w,A,y,z,E=b.faceVertexUvs[0];x=0;for(w=E.length;x<w;x++){A=0;for(y=E[x].length;A<y;A++)z=f[x]["abcd".charAt(A)],v[z]||(v[z]=E[x][A])}var C;x=0;for(w=f.length;x<w;x++)if(z=f[x],t.push(z.centroid),p.push(new THREE.Vertex(z.centroid)),k.supportUVs&&v.length!=0){C=new THREE.UV;if(z instanceof THREE.Face3)C.u=v[z.a].u+v[z.b].u+v[z.c].u,C.v=v[z.a].v+v[z.b].v+v[z.c].v,C.u/=3,C.v/=3;else if(z instanceof THREE.Face4)C.u=v[z.a].u+
-v[z.b].u+v[z.c].u+v[z.d].u,C.v=v[z.a].v+v[z.b].v+v[z.c].v+v[z.d].v,C.u/=4,C.v/=4;v.push(C)}y=function(b){function e(b,c,f){b[c]===void 0&&(b[c]=[]);b[c].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=c(k.a,k.b),e(n,m,f),m=c(k.b,k.c),e(n,m,f),m=c(k.c,k.a),e(n,m,f)):k instanceof THREE.Face4&&(m=c(k.a,k.b),e(n,m,f),m=c(k.b,k.c),e(n,m,f),m=c(k.c,k.d),e(n,m,f),m=c(k.d,k.a),e(n,m,f));return n}(b);var B,G,N=0,E=n.length,I;for(x in y)if(z=y[x],C=z[0],B=
-z[1],I=x.split("_"),w=I[0],I=I[1],G=new THREE.Vector3,z.length!=2?(G.addSelf(n[w].position),G.addSelf(n[I].position),G.multiplyScalar(0.5)):(G.addSelf(t[C]),G.addSelf(t[B]),G.addSelf(n[w].position),G.addSelf(n[I].position),G.multiplyScalar(0.25)),u[x]=E+f.length+N,p.push(new THREE.Vertex(G)),N++,k.supportUVs&&v.length!=0)C=new THREE.UV,C.u=v[w].u+v[I].u,C.v=v[w].v+v[I].v,C.u/=2,C.v/=2,v.push(C);x=0;for(w=t.length;x<w;x++)z=f[x],C=E+x,z instanceof THREE.Face3?(B=c(z.a,z.b),I=c(z.b,z.c),N=c(z.c,z.a),
-e(C,u[B],z.b,u[I],z,["123","12","2","23"]),e(C,u[I],z.c,u[N],z,["123","23","3","31"]),e(C,u[N],z.a,u[B],z,["123","31","1","12"])):z instanceof THREE.Face4?(B=c(z.a,z.b),I=c(z.b,z.c),N=c(z.c,z.d),G=c(z.d,z.a),e(C,u[B],z.b,u[I],z,["1234","12","2","23"]),e(C,u[I],z.c,u[N],z,["1234","23","3","34"]),e(C,u[N],z.d,u[G],z,["1234","34","4","41"]),e(C,u[G],z.a,u[B],z,["1234","41","1","12"])):console.log("face should be a face!",z);var f=p,M={},Z={},p=function(b,c){M[b]===void 0&&(M[b]=[]);M[b].push(c)},u=function(b,
-c){Z[b]===void 0&&(Z[b]={});Z[b][c]=null};for(x in y)z=y[x],I=x.split("_"),w=I[0],I=I[1],p(w,[w,I]),p(I,[w,I]),C=z[0],B=z[1],u(w,C),B?u(w,B):u(w,C),u(I,C),B?u(I,B):u(I,C);p=new THREE.Vector3;u=new THREE.Vector3;x=0;for(w=n.length;x<w;x++)if(M[x]!==void 0){p.set(0,0,0);u.set(0,0,0);y=new THREE.Vector3(0,0,0);E=0;for(A in Z[x])p.addSelf(t[A]),E++;p.divideScalar(E);E=M[x].length;for(A=0;A<E;A++)z=M[x][A],z=n[z[0]].position.clone().addSelf(n[z[1]].position).divideScalar(2),u.addSelf(z);u.divideScalar(E);
-y.addSelf(n[x].position);y.multiplyScalar(E-3);y.addSelf(p);y.addSelf(u.multiplyScalar(2));y.divideScalar(E);f[x].position=y}b.vertices=f;b.faces=m;b.faceVertexUvs[0]=h;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.SubdivisionModifier.prototype.smooth=function(b){function e(b,c,e,f,n,p){var w=new THREE.Face4(b,c,e,f,null,n.color,n.material);if(k.useOldVertexColors){w.vertexColors=[];for(var u,o,v,y=0;y<4;y++){v=p[y];u=new THREE.Color;u.setRGB(0,0,0);for(var x=0;x<v.length;x++)o=n.vertexColors[v[x]-1],u.r+=o.r,u.g+=o.g,u.b+=o.b;u.r/=v.length;u.g/=v.length;u.b/=v.length;w.vertexColors[y]=u}}m.push(w);(!k.supportUVs||t.length!=0)&&h.push([t[b],t[c],t[e],t[f]])}function c(b,c){return Math.min(b,c)+"_"+Math.max(b,
+c)}var f=[],m=[],h=[],k=this,n=b.vertices,f=b.faces,p=n.concat(),v=[],u={},t=[],x,w,A,y,z,F=b.faceVertexUvs[0];x=0;for(w=F.length;x<w;x++){A=0;for(y=F[x].length;A<y;A++)z=f[x]["abcd".charAt(A)],t[z]||(t[z]=F[x][A])}var D;x=0;for(w=f.length;x<w;x++)if(z=f[x],v.push(z.centroid),p.push(new THREE.Vertex(z.centroid)),k.supportUVs&&t.length!=0){D=new THREE.UV;if(z instanceof THREE.Face3)D.u=t[z.a].u+t[z.b].u+t[z.c].u,D.v=t[z.a].v+t[z.b].v+t[z.c].v,D.u/=3,D.v/=3;else if(z instanceof THREE.Face4)D.u=t[z.a].u+
+t[z.b].u+t[z.c].u+t[z.d].u,D.v=t[z.a].v+t[z.b].v+t[z.c].v+t[z.d].v,D.u/=4,D.v/=4;t.push(D)}y=function(b){function e(b,c,f){b[c]===void 0&&(b[c]=[]);b[c].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=c(k.a,k.b),e(n,m,f),m=c(k.b,k.c),e(n,m,f),m=c(k.c,k.a),e(n,m,f)):k instanceof THREE.Face4&&(m=c(k.a,k.b),e(n,m,f),m=c(k.b,k.c),e(n,m,f),m=c(k.c,k.d),e(n,m,f),m=c(k.d,k.a),e(n,m,f));return n}(b);var B,G,O=0,F=n.length,E;for(x in y)if(z=y[x],D=z[0],B=
+z[1],E=x.split("_"),w=E[0],E=E[1],G=new THREE.Vector3,z.length!=2?(G.addSelf(n[w].position),G.addSelf(n[E].position),G.multiplyScalar(0.5)):(G.addSelf(v[D]),G.addSelf(v[B]),G.addSelf(n[w].position),G.addSelf(n[E].position),G.multiplyScalar(0.25)),u[x]=F+f.length+O,p.push(new THREE.Vertex(G)),O++,k.supportUVs&&t.length!=0)D=new THREE.UV,D.u=t[w].u+t[E].u,D.v=t[w].v+t[E].v,D.u/=2,D.v/=2,t.push(D);x=0;for(w=v.length;x<w;x++)z=f[x],D=F+x,z instanceof THREE.Face3?(B=c(z.a,z.b),E=c(z.b,z.c),O=c(z.c,z.a),
+e(D,u[B],z.b,u[E],z,["123","12","2","23"]),e(D,u[E],z.c,u[O],z,["123","23","3","31"]),e(D,u[O],z.a,u[B],z,["123","31","1","12"])):z instanceof THREE.Face4?(B=c(z.a,z.b),E=c(z.b,z.c),O=c(z.c,z.d),G=c(z.d,z.a),e(D,u[B],z.b,u[E],z,["1234","12","2","23"]),e(D,u[E],z.c,u[O],z,["1234","23","3","34"]),e(D,u[O],z.d,u[G],z,["1234","34","4","41"]),e(D,u[G],z.a,u[B],z,["1234","41","1","12"])):console.log("face should be a face!",z);var f=p,P={},U={},p=function(b,c){P[b]===void 0&&(P[b]=[]);P[b].push(c)},u=function(b,
+c){U[b]===void 0&&(U[b]={});U[b][c]=null};for(x in y)z=y[x],E=x.split("_"),w=E[0],E=E[1],p(w,[w,E]),p(E,[w,E]),D=z[0],B=z[1],u(w,D),B?u(w,B):u(w,D),u(E,D),B?u(E,B):u(E,D);p=new THREE.Vector3;u=new THREE.Vector3;x=0;for(w=n.length;x<w;x++)if(P[x]!==void 0){p.set(0,0,0);u.set(0,0,0);y=new THREE.Vector3(0,0,0);F=0;for(A in U[x])p.addSelf(v[A]),F++;p.divideScalar(F);F=P[x].length;for(A=0;A<F;A++)z=P[x][A],z=n[z[0]].position.clone().addSelf(n[z[1]].position).divideScalar(2),u.addSelf(z);u.divideScalar(F);
+y.addSelf(n[x].position);y.multiplyScalar(F-3);y.addSelf(p);y.addSelf(u.multiplyScalar(2));y.divideScalar(F);f[x].position=y}b.vertices=f;b.faces=m;b.faceVertexUvs[0]=h;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var e="Loaded ";e+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var e="Loaded ";e+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=e},extractUrlbase:function(b){b=b.split("/");b.pop();return b.length<1?"":b.join("/")+"/"},init_materials:function(b,e,c){b.materials=[];for(var f=0;f<e.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(e[f],c)]},hasNormals:function(b){var e,c,f=b.materials.length;for(c=0;c<f;c++)if(e=b.materials[c][0],e instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(b,e){function c(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=e},extractUrlbase:function(b){b=b.split("/");b.pop();return b.length<1?"":b.join("/")+"/"},init_materials:function(b,e,c){b.materials=[];for(var f=0;f<e.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(e[f],c)]},hasNormals:function(b){var e,c,f=b.materials.length;for(c=0;c<f;c++)if(e=b.materials[c][0],e instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(b,e){function c(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==
 b}function f(b,e){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var e=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=e;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,e,f)}else b.image=this;b.needsUpdate=!0};f.src=e}function m(b,c,h,k,m,n){var p=document.createElement("canvas");b[c]=new THREE.Texture(p);b[c].sourceFile=h;if(k){b[c].repeat.set(k[0],k[1]);if(k[0]!=1)b[c].wrapS=THREE.RepeatWrapping;
 b}function f(b,e){var f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var e=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=e;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,e,f)}else b.image=this;b.needsUpdate=!0};f.src=e}function m(b,c,h,k,m,n){var p=document.createElement("canvas");b[c]=new THREE.Texture(p);b[c].sourceFile=h;if(k){b[c].repeat.set(k[0],k[1]);if(k[0]!=1)b[c].wrapS=THREE.RepeatWrapping;
 if(k[1]!=1)b[c].wrapT=THREE.RepeatWrapping}m&&b[c].offset.set(m[0],m[1]);if(n){k={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(k[n[0]]!==void 0)b[c].wrapS=k[n[0]];if(k[n[1]]!==void 0)b[c].wrapT=k[n[1]]}f(b[c],e+"/"+h)}function h(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var k,n,p;n="MeshLambertMaterial";k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?n="MeshPhongMaterial":b.shading=="Basic"&&(n="MeshBasicMaterial"));
 if(k[1]!=1)b[c].wrapT=THREE.RepeatWrapping}m&&b[c].offset.set(m[0],m[1]);if(n){k={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(k[n[0]]!==void 0)b[c].wrapS=k[n[0]];if(k[n[1]]!==void 0)b[c].wrapT=k[n[1]]}f(b[c],e+"/"+h)}function h(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var k,n,p;n="MeshLambertMaterial";k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?n="MeshPhongMaterial":b.shading=="Basic"&&(n="MeshBasicMaterial"));
 if(b.blending)if(b.blending=="Additive")k.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")k.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")k.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)k.transparent=b.transparent;if(b.depthTest!==void 0)k.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(b.vertexColors)k.vertexColors=THREE.VertexColors;if(b.colorDiffuse)k.color=h(b.colorDiffuse);
 if(b.blending)if(b.blending=="Additive")k.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")k.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")k.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)k.transparent=b.transparent;if(b.depthTest!==void 0)k.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(b.vertexColors)k.vertexColors=THREE.VertexColors;if(b.colorDiffuse)k.color=h(b.colorDiffuse);
 else if(b.DbgColor)k.color=b.DbgColor;if(b.colorSpecular)k.specular=h(b.colorSpecular);if(b.colorAmbient)k.ambient=h(b.colorAmbient);if(b.transparency)k.opacity=b.transparency;if(b.specularCoef)k.shininess=b.specularCoef;b.mapDiffuse&&e&&m(k,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&e&&m(k,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&e&&m(k,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
 else if(b.DbgColor)k.color=b.DbgColor;if(b.colorSpecular)k.specular=h(b.colorSpecular);if(b.colorAmbient)k.ambient=h(b.colorAmbient);if(b.transparency)k.opacity=b.transparency;if(b.specularCoef)k.shininess=b.specularCoef;b.mapDiffuse&&e&&m(k,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&e&&m(k,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&e&&m(k,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
-b.mapSpecular&&e&&m(k,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var t=THREE.ShaderUtils.lib.normal,u=THREE.UniformsUtils.clone(t.uniforms),v=k.color;n=k.specular;p=k.ambient;var x=k.shininess;u.tNormal.texture=k.normalMap;if(b.mapNormalFactor)u.uNormalScale.value=b.mapNormalFactor;if(k.map)u.tDiffuse.texture=k.map,u.enableDiffuse.value=!0;if(k.specularMap)u.tSpecular.texture=k.specularMap,u.enableSpecular.value=!0;if(k.lightMap)u.tAO.texture=
-k.lightMap,u.enableAO.value=!0;u.uDiffuseColor.value.setHex(v);u.uSpecularColor.value.setHex(n);u.uAmbientColor.value.setHex(p);u.uShininess.value=x;if(k.opacity)u.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:u,lights:!0,fog:!0})}else k=new THREE[n](k);return k}};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+b.mapSpecular&&e&&m(k,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var v=THREE.ShaderUtils.lib.normal,u=THREE.UniformsUtils.clone(v.uniforms),t=k.color;n=k.specular;p=k.ambient;var x=k.shininess;u.tNormal.texture=k.normalMap;if(b.mapNormalFactor)u.uNormalScale.value=b.mapNormalFactor;if(k.map)u.tDiffuse.texture=k.map,u.enableDiffuse.value=!0;if(k.specularMap)u.tSpecular.texture=k.specularMap,u.enableSpecular.value=!0;if(k.lightMap)u.tAO.texture=
+k.lightMap,u.enableAO.value=!0;u.uDiffuseColor.value.setHex(t);u.uSpecularColor.value.setHex(n);u.uAmbientColor.value.setHex(p);u.uShininess.value=x;if(k.opacity)u.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:v.fragmentShader,vertexShader:v.vertexShader,uniforms:u,lights:!0,fog:!0})}else k=new THREE[n](k);return k}};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(b){var e=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(e),m=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(e),b=(new Date).getTime(),e=new Worker(e),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;e.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,c,m,f,h)};e.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 THREE.BinaryLoader.prototype.load=function(b){var e=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(e),m=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(e),b=(new Date).getTime(),e=new Worker(e),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;e.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,c,m,f,h)};e.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 e.postMessage(b)};
 e.postMessage(b)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,e,c,f,m,h){var k=new XMLHttpRequest,n=f+"/"+b,p=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,c,m,e):alert("Couldn't load ["+n+"] ["+k.status+"]"):k.readyState==3?h&&(p==0&&(p=k.getResponseHeader("Content-Length")),h({total:p,loaded:k.responseText.length})):k.readyState==2&&(p=k.getResponseHeader("Content-Length"))};k.open("GET",n,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,e,c,f,m,h){var k=new XMLHttpRequest,n=f+"/"+b,p=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,c,m,e):alert("Couldn't load ["+n+"] ["+k.status+"]"):k.readyState==3?h&&(p==0&&(p=k.getResponseHeader("Content-Length")),h({total:p,loaded:k.responseText.length})):k.readyState==2&&(p=k.getResponseHeader("Content-Length"))};k.open("GET",n,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
 k.setRequestHeader("Content-Type","text/plain");k.send(null)};
 k.setRequestHeader("Content-Type","text/plain");k.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(b,e,c,f){var m=function(c){function e(b,c){var f=u(b,c),h=u(b,c+1),k=u(b,c+2),m=u(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function m(b,c){var e=u(b,c),f=u(b,c+1),h=u(b,c+2);return(u(b,c+3)<<24)+(h<<16)+(f<<8)+e}function p(b,c){var e=u(b,c);return(u(b,c+1)<<8)+e}function t(b,c){var e=u(b,c);return e>127?e-256:e}function u(b,c){return b.charCodeAt(c)&255}function v(c){var e,
-f,h;e=m(b,c);f=m(b,c+I);h=m(b,c+M);c=p(b,c+Z);E.faces.push(new THREE.Face3(e,f,h,null,null,E.materials[c]))}function x(c){var e,f,h,k,o,t;e=m(b,c);f=m(b,c+I);h=m(b,c+M);k=p(b,c+Z);o=m(b,c+J);t=m(b,c+O);c=m(b,c+L);k=E.materials[k];var u=G[t*3],v=G[t*3+1];t=G[t*3+2];var w=G[c*3],x=G[c*3+1],c=G[c*3+2];E.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,c)],null,k))}function w(c){var e,f,h,k;e=m(b,c);f=m(b,c+F);h=m(b,c+aa);k=m(b,
-c+Y);c=p(b,c+Q);E.faces.push(new THREE.Face4(e,f,h,k,null,null,E.materials[c]))}function A(c){var e,f,h,k,t,u,v,w;e=m(b,c);f=m(b,c+F);h=m(b,c+aa);k=m(b,c+Y);t=p(b,c+Q);u=m(b,c+P);v=m(b,c+o);w=m(b,c+T);c=m(b,c+$);t=E.materials[t];var x=G[v*3],y=G[v*3+1];v=G[v*3+2];var z=G[w*3],A=G[w*3+1];w=G[w*3+2];var V=G[c*3],B=G[c*3+1],c=G[c*3+2];E.faces.push(new THREE.Face4(e,f,h,k,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,y,v),new THREE.Vector3(z,A,w),new THREE.Vector3(V,B,c)],null,t))}
-function y(c){var e,f,h,k;e=m(b,c);f=m(b,c+da);h=m(b,c+ca);c=N[e*2];k=N[e*2+1];e=N[f*2];var o=E.faceVertexUvs[0];f=N[f*2+1];var p=N[h*2];h=N[h*2+1];var t=[];t.push(new THREE.UV(c,k));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}function z(c){var e,f,h,k,o,p;e=m(b,c);f=m(b,c+ra);h=m(b,c+qa);k=m(b,c+sa);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[h*2];var t=E.faceVertexUvs[0];h=N[h*2+1];var u=N[k*2];k=N[k*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
-h));v.push(new THREE.UV(u,k));t.push(v)}var E=this,C=0,B,G=[],N=[],I,M,Z,J,O,L,F,aa,Y,Q,P,o,T,$,da,ca,ra,qa,sa,va,ka,X,ha,fa,ga;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,c);B={signature:b.substr(C,8),header_bytes:u(b,C+8),vertex_coordinate_bytes:u(b,C+9),normal_coordinate_bytes:u(b,C+10),uv_coordinate_bytes:u(b,C+11),vertex_index_bytes:u(b,C+12),normal_index_bytes:u(b,C+13),uv_index_bytes:u(b,C+14),material_index_bytes:u(b,C+15),nvertices:m(b,C+16),nnormals:m(b,C+16+4),nuvs:m(b,
-C+16+8),ntri_flat:m(b,C+16+12),ntri_smooth:m(b,C+16+16),ntri_flat_uv:m(b,C+16+20),ntri_smooth_uv:m(b,C+16+24),nquad_flat:m(b,C+16+28),nquad_smooth:m(b,C+16+32),nquad_flat_uv:m(b,C+16+36),nquad_smooth_uv:m(b,C+16+40)};C+=B.header_bytes;I=B.vertex_index_bytes;M=B.vertex_index_bytes*2;Z=B.vertex_index_bytes*3;J=B.vertex_index_bytes*3+B.material_index_bytes;O=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;L=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;F=B.vertex_index_bytes;
-aa=B.vertex_index_bytes*2;Y=B.vertex_index_bytes*3;Q=B.vertex_index_bytes*4;P=B.vertex_index_bytes*4+B.material_index_bytes;o=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;T=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;$=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;da=B.uv_index_bytes;ca=B.uv_index_bytes*2;ra=B.uv_index_bytes;qa=B.uv_index_bytes*2;sa=B.uv_index_bytes*3;c=B.vertex_index_bytes*3+B.material_index_bytes;ga=B.vertex_index_bytes*
-4+B.material_index_bytes;va=B.ntri_flat*c;ka=B.ntri_smooth*(c+B.normal_index_bytes*3);X=B.ntri_flat_uv*(c+B.uv_index_bytes*3);ha=B.ntri_smooth_uv*(c+B.normal_index_bytes*3+B.uv_index_bytes*3);fa=B.nquad_flat*ga;c=B.nquad_smooth*(ga+B.normal_index_bytes*4);ga=B.nquad_flat_uv*(ga+B.uv_index_bytes*4);C+=function(c){for(var f,h,m,n=B.vertex_coordinate_bytes*3,o=c+B.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+B.vertex_coordinate_bytes),m=e(b,c+B.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-h,m)));return B.nvertices*n}(C);C+=function(c){for(var e,f,h,k=B.normal_coordinate_bytes*3,m=c+B.nnormals*k;c<m;c+=k)e=t(b,c),f=t(b,c+B.normal_coordinate_bytes),h=t(b,c+B.normal_coordinate_bytes*2),G.push(e/127,f/127,h/127);return B.nnormals*k}(C);C+=function(c){for(var f,h,m=B.uv_coordinate_bytes*2,n=c+B.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+B.uv_coordinate_bytes),N.push(f,h);return B.nuvs*m}(C);va=C+va;ka=va+ka;X=ka+X;ha=X+ha;fa=ha+fa;c=fa+c;ga=c+ga;(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,
-f=e+B.uv_index_bytes*3,h=b+B.ntri_flat_uv*f;for(c=b;c<h;c+=f)v(c),y(c+e);return h-b})(ka);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=e+B.uv_index_bytes*3,h=b+B.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),y(c+e);return h-b})(X);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=e+B.uv_index_bytes*4,h=b+B.nquad_flat_uv*f;for(c=b;c<h;c+=f)w(c),z(c+e);return h-b})(c);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
-4,f=e+B.uv_index_bytes*4,h=b+B.nquad_smooth_uv*f;for(c=b;c<h;c+=f)A(c),z(c+e);return h-b})(ga);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=b+B.ntri_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(C);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=b+B.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(va);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=b+B.nquad_flat*e;for(c=b;c<f;c+=e)w(c);return f-b})(ha);(function(b){var c,
-e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=b+B.nquad_smooth*e;for(c=b;c<f;c+=e)A(c);return f-b})(fa);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;e(new m(c))};
-THREE.ColladaLoader=function(){function b(b,f,m){ka=b;f=f||fa;m!==void 0&&(b=m.split("/"),b.pop(),Ha=b.length<1?"":b.join("/")+"/");K=e("//dae:library_images/dae:image",k,"image");na=e("//dae:library_materials/dae:material",Z,"material");ia=e("//dae:library_effects/dae:effect",aa,"effect");ma=e("//dae:library_geometries/dae:geometry",z,"geometry");wa=e("//dae:library_controllers/dae:controller",n,"controller");ja=e("//dae:library_animations/dae:animation",Q,"animation");ua=e(".//dae:library_visual_scenes/dae:visual_scene",
-u,"visual_scene");Fa=[];Ea=[];(b=ka.evaluate(".//dae:scene/dae:instance_visual_scene",ka,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(b=b.getAttribute("url").replace(/^#/,""),ha=ua[b]):ha=null;X=new THREE.Object3D;for(b=0;b<ha.nodes.length;b++)X.add(h(ha.nodes[b]));c();for(var o in ja);o={scene:X,morphs:Fa,skins:Ea,dae:{images:K,materials:na,effects:ia,geometries:ma,controllers:wa,animations:ja,visualScenes:ua,scene:ha}};f&&f(o);return o}function e(b,c,e){for(var b=ka.evaluate(b,
-ka,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=e+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,c=-b,e=0,f;for(f in ja)for(var h=ja[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function f(b,c,e,h){b.world=b.world||new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=
-b.channels[0].sampler.output[e];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)f(b.nodes[h],c,e,b.world)}function m(b,e,h){var k=wa[e.url];if(!k||!k.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!e.skeleton||!e.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var m=c(),e=ha.getChildById(e.skeleton[0],!0)||ha.getChildBySid(e.skeleton[0],!0),n,o,p,t,u=new THREE.Vector3,
-v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));f(e,w,h);n=w;o=k.skin;for(t=0;t<n.length;t++)if(p=n[t],v=-1,p.type=="JOINT"){for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];for(y=0;y<o.weights.length;y++)for(var z=
-0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&p.weights.push(A)}}else throw"ColladaLoader: Could not find joint '"+p.sid+"'.";}for(n=0;n<w.length;n++)if(w[n].type=="JOINT")for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var c=
-new THREE.Object3D,e,f,k;for(k=0;k<b.controllers.length;k++){var n=wa[b.controllers[k].url];switch(n.type){case "skin":if(ma[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[k].instance_material;b.geometries.push(o);e=b.controllers[k]}else if(wa[n.skin.source]&&(f=n=wa[n.skin.source],n.morph&&ma[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[k].instance_material,b.geometries.push(o);break;case "morph":if(ma[n.morph.source])o=new y,
-o.url=n.morph.source,o.instance_material=b.controllers[k].instance_material,b.geometries.push(o),f=b.controllers[k];console.log("ColladaLoader: Morph-controller partially supported.")}}for(k=0;k<b.geometries.length;k++){var n=b.geometries[k],o=n.instance_material,n=ma[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=ia[na[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=p[u.symbol]=
-v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(e!==void 0)m(n,e),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=e.skeleton,o.skinController=wa[e.url],o.skinInstanceController=e,o.name="skin_"+Ea.length,Ea.push(o);else if(f!==void 0){p=n;t=f instanceof w?wa[f.url]:f;if(!t||!t.morph)console.log("could not find morph controller!");
-else{t=t.morph;for(v=0;v<t.targets.length;v++){var x=ma[t.targets[v]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:x.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Fa.length;Fa.push(o)}else o=new THREE.Mesh(n,o);b.geometries.length>1?c.add(o):c=o}}c.name=b.id||"";b.matrix.decompose(c.position,c.rotation,
-c.scale);for(k=0;k<b.nodes.length;k++)c.add(h(b.nodes[k],b));return c}function k(){this.init_from=this.id=""}function n(){this.type=this.name=this.id="";this.morph=this.skin=null}function p(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function v(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
-[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function w(){this.url="";this.skeleton=[];this.instance_material=[]}function A(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function E(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function B(){this.material="";this.count=
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";this.stride=this.count=0;this.params=[]}function N(){this.input={}}function I(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(b){this.id=b;this.type=null}function Z(){this.name=this.id="";this.instance_effect=null}function J(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function O(b,
-c){this.type=b;this.effect=c;this.material=null}function L(b){this.effect=b;this.format=this.init_from=null}function F(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function aa(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Y(){this.url=""}function Q(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function P(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
-this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function T(b){var c=b.getAttribute("id");if(ga[c]!=void 0)return ga[c];ga[c]=(new M(c)).parse(b);return ga[c]}function $(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function da(b){for(var b=ra(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function ca(b){for(var b=ra(b),c=[],
-e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function ra(b){return b.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function qa(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function sa(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function va(b,c){var e="";e+=sa(b.x,c)+",";e+=sa(b.y,c)+",";e+=sa(b.z,c);return e}var ka=null,X=null,
-ha,fa=null,ga={},K={},ja={},wa={},ma={},na={},ia={},ua,Ha,Fa,Ea,Ja=THREE.SmoothShading;k.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="init_from")this.init_from=e.textContent}return this};n.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "skin":this.skin=(new t).parse(e);
-this.type=e.nodeName;break;case "morph":this.morph=(new p).parse(e),this.type=e.nodeName}}return this};p.prototype.parse=function(b){var c={},e=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new M).parse(h);c[h.id]=h;break;case "targets":e=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<e.length;f++)switch(b=e[f],h=c[b.source],
-b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};p.prototype.parseInputs=function(b){for(var c=[],e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":c.push((new I).parse(f))}}return c};t.prototype.parse=function(b){var c={},e,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];
-if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=da(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new M).parse(k);c[k.id]=k;break;case "joints":e=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(e,c);this.parseWeights(f,c);return this};t.prototype.parseJoints=function(b,c){for(var e=0;e<b.childNodes.length;e++){var f=
-b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new I).parse(f),h=c[f.source];if(f.semantic=="JOINT")this.joints=h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};t.prototype.parseWeights=function(b,c){for(var e,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new I).parse(m));break;case "v":e=ca(m.textContent);break;case "vcount":f=ca(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=
-f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=e[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;case "WEIGHT":t.weight=c[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};u.prototype.getChildById=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};u.prototype.getChildBySid=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,
-c);if(f)return f}return null};u.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.nodes=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new v).parse(e))}}return this};v.prototype.getChannelForTransform=function(b){for(var c=0;c<this.channels.length;c++){var e=this.channels[c],f=e.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),
-h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,""))}if(h==b)return e.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},e}return null};v.prototype.getChildById=function(b,c){if(this.id==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};v.prototype.getChildBySid=function(b,c){if(this.sid==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,
-c);if(f)return f}return null};v.prototype.getTransformBySid=function(b){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==b)return this.transforms[c];return null};v.prototype.parse=function(b){var c;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var e=
-0;e<b.childNodes.length;e++)if(c=b.childNodes[e],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new v).parse(c));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new w).parse(c));break;case "instance_geometry":this.geometries.push((new y).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=ka.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",ka,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null).iterateNext())&&this.nodes.push((new v).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(c));break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in ja)for(var h=ja[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=
-e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+1]-b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,t,o=0;o<p.input.length-1;o++)if(p.input[o+
-1]>c){t=p.output[o];break}m=t!==void 0?t instanceof THREE.Matrix4?m.multiply(m,t):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};x.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=
-b.nodeName;this.data=da(b.textContent);this.updateMatrix();return this};x.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=
+THREE.BinaryLoader.prototype.createBinModel=function(b,e,c,f){var m=function(c){function e(b,c){var f=u(b,c),h=u(b,c+1),k=u(b,c+2),m=u(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function m(b,c){var e=u(b,c),f=u(b,c+1),h=u(b,c+2);return(u(b,c+3)<<24)+(h<<16)+(f<<8)+e}function p(b,c){var e=u(b,c);return(u(b,c+1)<<8)+e}function v(b,c){var e=u(b,c);return e>127?e-256:e}function u(b,c){return b.charCodeAt(c)&255}function t(c){var e,
+f,h;e=m(b,c);f=m(b,c+E);h=m(b,c+P);c=p(b,c+U);F.faces.push(new THREE.Face3(e,f,h,null,null,F.materials[c]))}function x(c){var e,f,h,k,o,t;e=m(b,c);f=m(b,c+E);h=m(b,c+P);k=p(b,c+U);o=m(b,c+L);t=m(b,c+R);c=m(b,c+I);k=F.materials[k];var w=G[t*3],u=G[t*3+1];t=G[t*3+2];var v=G[c*3],x=G[c*3+1],c=G[c*3+2];F.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(w,u,t),new THREE.Vector3(v,x,c)],null,k))}function w(c){var e,f,h,k;e=m(b,c);f=m(b,c+K);h=m(b,c+aa);k=m(b,
+c+Z);c=p(b,c+S);F.faces.push(new THREE.Face4(e,f,h,k,null,null,F.materials[c]))}function A(c){var e,f,h,k,t,w,u,v;e=m(b,c);f=m(b,c+K);h=m(b,c+aa);k=m(b,c+Z);t=p(b,c+S);w=m(b,c+M);u=m(b,c+o);v=m(b,c+N);c=m(b,c+da);t=F.materials[t];var x=G[u*3],y=G[u*3+1];u=G[u*3+2];var z=G[v*3],A=G[v*3+1];v=G[v*3+2];var V=G[c*3],B=G[c*3+1],c=G[c*3+2];F.faces.push(new THREE.Face4(e,f,h,k,[new THREE.Vector3(G[w*3],G[w*3+1],G[w*3+2]),new THREE.Vector3(x,y,u),new THREE.Vector3(z,A,v),new THREE.Vector3(V,B,c)],null,t))}
+function y(c){var e,f,h,k;e=m(b,c);f=m(b,c+fa);h=m(b,c+X);c=O[e*2];k=O[e*2+1];e=O[f*2];var o=F.faceVertexUvs[0];f=O[f*2+1];var p=O[h*2];h=O[h*2+1];var t=[];t.push(new THREE.UV(c,k));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}function z(c){var e,f,h,k,o,p;e=m(b,c);f=m(b,c+ma);h=m(b,c+pa);k=m(b,c+ra);c=O[e*2];o=O[e*2+1];e=O[f*2];p=O[f*2+1];f=O[h*2];var t=F.faceVertexUvs[0];h=O[h*2+1];var u=O[k*2];k=O[k*2+1];var w=[];w.push(new THREE.UV(c,o));w.push(new THREE.UV(e,p));w.push(new THREE.UV(f,
+h));w.push(new THREE.UV(u,k));t.push(w)}var F=this,D=0,B,G=[],O=[],E,P,U,L,R,I,K,aa,Z,S,M,o,N,da,fa,X,ma,pa,ra,ya,la,Y,$,ha,ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,f,c);B={signature:b.substr(D,8),header_bytes:u(b,D+8),vertex_coordinate_bytes:u(b,D+9),normal_coordinate_bytes:u(b,D+10),uv_coordinate_bytes:u(b,D+11),vertex_index_bytes:u(b,D+12),normal_index_bytes:u(b,D+13),uv_index_bytes:u(b,D+14),material_index_bytes:u(b,D+15),nvertices:m(b,D+16),nnormals:m(b,D+16+4),nuvs:m(b,
+D+16+8),ntri_flat:m(b,D+16+12),ntri_smooth:m(b,D+16+16),ntri_flat_uv:m(b,D+16+20),ntri_smooth_uv:m(b,D+16+24),nquad_flat:m(b,D+16+28),nquad_smooth:m(b,D+16+32),nquad_flat_uv:m(b,D+16+36),nquad_smooth_uv:m(b,D+16+40)};D+=B.header_bytes;E=B.vertex_index_bytes;P=B.vertex_index_bytes*2;U=B.vertex_index_bytes*3;L=B.vertex_index_bytes*3+B.material_index_bytes;R=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;I=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;K=B.vertex_index_bytes;
+aa=B.vertex_index_bytes*2;Z=B.vertex_index_bytes*3;S=B.vertex_index_bytes*4;M=B.vertex_index_bytes*4+B.material_index_bytes;o=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;N=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;da=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;fa=B.uv_index_bytes;X=B.uv_index_bytes*2;ma=B.uv_index_bytes;pa=B.uv_index_bytes*2;ra=B.uv_index_bytes*3;c=B.vertex_index_bytes*3+B.material_index_bytes;ia=B.vertex_index_bytes*
+4+B.material_index_bytes;ya=B.ntri_flat*c;la=B.ntri_smooth*(c+B.normal_index_bytes*3);Y=B.ntri_flat_uv*(c+B.uv_index_bytes*3);$=B.ntri_smooth_uv*(c+B.normal_index_bytes*3+B.uv_index_bytes*3);ha=B.nquad_flat*ia;c=B.nquad_smooth*(ia+B.normal_index_bytes*4);ia=B.nquad_flat_uv*(ia+B.uv_index_bytes*4);D+=function(c){for(var f,h,m,n=B.vertex_coordinate_bytes*3,o=c+B.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+B.vertex_coordinate_bytes),m=e(b,c+B.vertex_coordinate_bytes*2),F.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+h,m)));return B.nvertices*n}(D);D+=function(c){for(var e,f,h,k=B.normal_coordinate_bytes*3,m=c+B.nnormals*k;c<m;c+=k)e=v(b,c),f=v(b,c+B.normal_coordinate_bytes),h=v(b,c+B.normal_coordinate_bytes*2),G.push(e/127,f/127,h/127);return B.nnormals*k}(D);D+=function(c){for(var f,h,m=B.uv_coordinate_bytes*2,n=c+B.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+B.uv_coordinate_bytes),O.push(f,h);return B.nuvs*m}(D);ya=D+ya;la=ya+la;Y=la+Y;$=Y+$;ha=$+ha;c=ha+c;ia=c+ia;(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,
+f=e+B.uv_index_bytes*3,h=b+B.ntri_flat_uv*f;for(c=b;c<h;c+=f)t(c),y(c+e);return h-b})(la);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=e+B.uv_index_bytes*3,h=b+B.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),y(c+e);return h-b})(Y);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=e+B.uv_index_bytes*4,h=b+B.nquad_flat_uv*f;for(c=b;c<h;c+=f)w(c),z(c+e);return h-b})(c);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
+4,f=e+B.uv_index_bytes*4,h=b+B.nquad_smooth_uv*f;for(c=b;c<h;c+=f)A(c),z(c+e);return h-b})(ia);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=b+B.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(D);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=b+B.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(ya);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=b+B.nquad_flat*e;for(c=b;c<f;c+=e)w(c);return f-b})($);(function(b){var c,
+e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=b+B.nquad_smooth*e;for(c=b;c<f;c+=e)A(c);return f-b})(ha);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;e(new m(c))};
+THREE.ColladaLoader=function(){function b(b,f,m){la=b;f=f||ha;m!==void 0&&(b=m.split("/"),b.pop(),Ga=b.length<1?"":b.join("/")+"/");Q=e("//dae:library_images/dae:image",k,"image");va=e("//dae:library_materials/dae:material",U,"material");ta=e("//dae:library_effects/dae:effect",aa,"effect");sa=e("//dae:library_geometries/dae:geometry",z,"geometry");na=e("//dae:library_controllers/dae:controller",n,"controller");qa=e("//dae:library_animations/dae:animation",S,"animation");Da=e(".//dae:library_visual_scenes/dae:visual_scene",
+u,"visual_scene");Ba=[];Aa=[];(b=la.evaluate(".//dae:scene/dae:instance_visual_scene",la,da,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(b=b.getAttribute("url").replace(/^#/,""),$=Da[b]):$=null;Y=new THREE.Object3D;for(b=0;b<$.nodes.length;b++)Y.add(h($.nodes[b]));c();for(var o in qa);o={scene:Y,morphs:Ba,skins:Aa,dae:{images:Q,materials:va,effects:ta,geometries:sa,controllers:na,animations:qa,visualScenes:Da,scene:$}};f&&f(o);return o}function e(b,c,e){for(var b=la.evaluate(b,la,
+da,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=e+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,c=-b,e=0,f;for(f in qa)for(var h=qa[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function f(b,c,e,h){b.world=b.world||new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=
+b.channels[0].sampler.output[e];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)f(b.nodes[h],c,e,b.world)}function m(b,e,h){var k=na[e.url];if(!k||!k.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!e.skeleton||!e.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var m=c(),e=$.getChildById(e.skeleton[0],!0)||$.getChildBySid(e.skeleton[0],!0),n,o,p,t,w=new THREE.Vector3,
+u;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var v=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));f(e,v,h);n=v;o=k.skin;for(t=0;t<n.length;t++)if(p=n[t],u=-1,p.type=="JOINT"){for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){u=y;break}if(u>=0){y=o.invBindMatrices[u];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];for(y=0;y<o.weights.length;y++)for(var z=
+0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==u&&p.weights.push(A)}}else throw"ColladaLoader: Could not find joint '"+p.sid+"'.";}for(n=0;n<v.length;n++)if(v[n].type=="JOINT")for(o=0;o<v[n].weights.length;o++)p=v[n].weights[o],t=p.index,p=p.weight,u=b.vertices[t],t=x[t],w.x=u.position.x,w.y=u.position.y,w.z=u.position.z,v[n].skinningMatrix.multiplyVector3(w),t.position.x+=w.x*p,t.position.y+=w.y*p,t.position.z+=w.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var c=
+new THREE.Object3D,e,f,k;for(k=0;k<b.controllers.length;k++){var n=na[b.controllers[k].url];switch(n.type){case "skin":if(sa[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[k].instance_material;b.geometries.push(o);e=b.controllers[k]}else if(na[n.skin.source]&&(f=n=na[n.skin.source],n.morph&&sa[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[k].instance_material,b.geometries.push(o);break;case "morph":if(sa[n.morph.source])o=new y,
+o.url=n.morph.source,o.instance_material=b.controllers[k].instance_material,b.geometries.push(o),f=b.controllers[k];console.log("ColladaLoader: Morph-controller partially supported.")}}for(k=0;k<b.geometries.length;k++){var n=b.geometries[k],o=n.instance_material,n=sa[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=ta[va[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=p[u.symbol]=
+v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(e!==void 0)m(n,e),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=e.skeleton,o.skinController=na[e.url],o.skinInstanceController=e,o.name="skin_"+Aa.length,Aa.push(o);else if(f!==void 0){p=n;t=f instanceof w?na[f.url]:f;if(!t||!t.morph)console.log("could not find morph controller!");
+else{t=t.morph;for(v=0;v<t.targets.length;v++){var x=sa[t.targets[v]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:x.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Ba.length;Ba.push(o)}else o=new THREE.Mesh(n,o);b.geometries.length>1?c.add(o):c=o}}c.name=b.id||"";b.matrix.decompose(c.position,c.rotation,
+c.scale);for(k=0;k<b.nodes.length;k++)c.add(h(b.nodes[k],b));return c}function k(){this.init_from=this.id=""}function n(){this.type=this.name=this.id="";this.morph=this.skin=null}function p(){this.weights=this.targets=this.source=this.method=null}function v(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function t(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
+[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function w(){this.url="";this.skeleton=[];this.instance_material=[]}function A(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function F(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function D(){}function B(){this.material="";this.count=
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";this.stride=this.count=0;this.params=[]}function O(){this.input={}}function E(){this.semantic="";this.offset=0;this.source="";this.set=0}function P(b){this.id=b;this.type=null}function U(){this.name=this.id="";this.instance_effect=null}function L(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function R(b,
+c){this.type=b;this.effect=c;this.material=null}function I(b){this.effect=b;this.format=this.init_from=null}function K(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function aa(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Z(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function M(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
+this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function N(b){var c=b.getAttribute("id");if(ia[c]!=void 0)return ia[c];ia[c]=(new P(c)).parse(b);return ia[c]}function da(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function fa(b){for(var b=ma(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function X(b){for(var b=ma(b),c=[],
+e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function ma(b){return b.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function pa(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function ra(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function ya(b,c){var e="";e+=ra(b.x,c)+",";e+=ra(b.y,c)+",";e+=ra(b.z,c);return e}var la=null,Y=null,
+$,ha=null,ia={},Q={},qa={},na={},sa={},va={},ta={},Da,Ga,Ba,Aa,Ea=THREE.SmoothShading;k.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="init_from")this.init_from=e.textContent}return this};n.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "skin":this.skin=(new v).parse(e);
+this.type=e.nodeName;break;case "morph":this.morph=(new p).parse(e),this.type=e.nodeName}}return this};p.prototype.parse=function(b){var c={},e=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new P).parse(h);c[h.id]=h;break;case "targets":e=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<e.length;f++)switch(b=e[f],h=c[b.source],
+b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};p.prototype.parseInputs=function(b){for(var c=[],e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":c.push((new E).parse(f))}}return c};v.prototype.parse=function(b){var c={},e,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];
+if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=fa(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new P).parse(k);c[k.id]=k;break;case "joints":e=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(e,c);this.parseWeights(f,c);return this};v.prototype.parseJoints=function(b,c){for(var e=0;e<b.childNodes.length;e++){var f=
+b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new E).parse(f),h=c[f.source];if(f.semantic=="JOINT")this.joints=h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};v.prototype.parseWeights=function(b,c){for(var e,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new E).parse(m));break;case "v":e=X(m.textContent);break;case "vcount":f=X(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=
+f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var w=h[u],v=e[m+w.offset];switch(w.semantic){case "JOINT":t.joint=v;break;case "WEIGHT":t.weight=c[w.source].data[v]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};u.prototype.getChildById=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};u.prototype.getChildBySid=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,
+c);if(f)return f}return null};u.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.nodes=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new t).parse(e))}}return this};t.prototype.getChannelForTransform=function(b){for(var c=0;c<this.channels.length;c++){var e=this.channels[c],f=e.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),
+h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,""))}if(h==b)return e.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},e}return null};t.prototype.getChildById=function(b,c){if(this.id==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};t.prototype.getChildBySid=function(b,c){if(this.sid==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,
+c);if(f)return f}return null};t.prototype.getTransformBySid=function(b){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==b)return this.transforms[c];return null};t.prototype.parse=function(b){var c;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var e=
+0;e<b.childNodes.length;e++)if(c=b.childNodes[e],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new t).parse(c));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new w).parse(c));break;case "instance_geometry":this.geometries.push((new y).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=la.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",la,da,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null).iterateNext())&&this.nodes.push((new t).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(c));break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in qa)for(var h=qa[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=
+e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+1]-b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,u,o=0;o<p.input.length-1;o++)if(p.input[o+
+1]>c){u=p.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};t.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};x.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=
+b.nodeName;this.data=fa(b.textContent);this.updateMatrix();return this};x.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=
 this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};w.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));
 this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};w.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));
-break;case "bind_material":if(e=ka.evaluate(".//dae:instance_material",e,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new A).parse(f)),f=e.iterateNext()}}return this};A.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=
-b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=ka.evaluate(".//dae:instance_material",e,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new A).parse(c)),c=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new E(this)).parse(e)}}return this};E.prototype.parse=function(b){function c(b,
-e){var f=va(b.position);h[f]===void 0&&(h[f]={v:b,index:e});return h[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":T(f);break;case "vertices":this.vertices=(new N).parse(f);break;case "triangles":this.primitives.push((new B).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new C).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ga[this.vertices.input.POSITION.source].data;
-for(b=e=0;e<f.length;e+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[e],f[e+1],f[e+2]));c(k,b);this.geometry3js.vertices.push(k)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};E.prototype.handlePrimitive=function(b,c,e){var f=
-0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=n[k],source=ga[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=va(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+
-2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var B;v==3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):v==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;c.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],c.faceVertexUvs[k].push([h[0],
-h[1],h[2]]);f+=n.length*v}};C.prototype=new B;C.prototype.constructor=C;B.prototype.setVertices=function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};B.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=qa(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new I).parse(b.childNodes[c]));break;case "vcount":this.vcount=
-ca(e.textContent);break;case "p":this.p=ca(e.textContent)}}return this};G.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=qa(b,"count",0);this.stride=qa(b,"stride",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};N.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName==
-"input"&&(input=(new I).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};I.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=qa(b,"set",-1);this.offset=qa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};M.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=
-ra(e.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=e.nodeName;break;case "float_array":this.data=da(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=ca(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=ra(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new G).parse(e.childNodes[f]);
-break}}}return this};M.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+c.type+".")}return b};Z.prototype.parse=function(b){this.id=
-b.getAttribute("id");this.name=b.getAttribute("name");for(var c=0;c<b.childNodes.length;c++)if(b.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new Y).parse(b.childNodes[c]);break}return this};J.prototype.isColor=function(){return this.texture==null};J.prototype.isTexture=function(){return this.texture!=null};J.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=da(e.textContent);this.color=new THREE.Color(0);
-this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};O.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=(new J).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=ka.evaluate(".//dae:float",
-e,$,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};O.prototype.create=function(){var b={},c=this.transparency!==void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];if(f instanceof J)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
-this.effect.surface.sid&&(f=K[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ha+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=this[e],c=!0}b.shading=Ja;return this.material=new THREE.MeshLambertMaterial(b)};L.prototype.parse=function(b){for(var c=
-0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+e.nodeName)}}return this};F.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":this.source=e.textContent;break;case "minfilter":this.minfilter=e.textContent;break;case "magfilter":this.magfilter=
-e.textContent;break;case "mipfilter":this.mipfilter=e.textContent;break;case "wrap_s":this.wrap_s=e.textContent;break;case "wrap_t":this.wrap_t=e.textContent;break;default:console.log("unhandled Sampler2D prop: "+e.nodeName)}}return this};aa.prototype.create=function(){if(this.shader==null)return null};aa.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};
-aa.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=(new L(this)).parse(f);this.surface.sid=c;break;case "sampler2D":this.sampler=(new F(this)).parse(f);this.sampler.sid=c;break;case "extra":break;default:console.log(f.nodeName)}}};aa.prototype.parseProfileCOMMON=function(b){for(var c,e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);
-break;case "technique":c=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return c};aa.prototype.parseTechnique=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new O(e.nodeName,this)).parse(e)}}};Y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};Q.prototype.parse=function(b){this.id=b.getAttribute("id");
-this.name=b.getAttribute("name");this.source={};for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new M).parse(e);this.source[e.id]=e;break;case "sampler":this.sampler.push((new o(this)).parse(e));break;case "channel":this.channel.push((new P(this)).parse(e))}}return this};P.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var c=this.target.split("/");c.shift();var b=
-c.shift(),e=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c<h.length;c++)h[c]=parseInt(h[c].replace(/\)/,""))}this.sid=b;this.dotSyntax=e;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");this.inputs=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":this.inputs.push((new I).parse(e))}}return this};
+break;case "bind_material":if(e=la.evaluate(".//dae:instance_material",e,da,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new A).parse(f)),f=e.iterateNext()}}return this};A.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=
+b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=la.evaluate(".//dae:instance_material",e,da,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new A).parse(c)),c=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new F(this)).parse(e)}}return this};F.prototype.parse=function(b){function c(b,
+e){var f=ya(b.position);h[f]===void 0&&(h[f]={v:b,index:e});return h[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":N(f);break;case "vertices":this.vertices=(new O).parse(f);break;case "triangles":this.primitives.push((new B).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new D).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ia[this.vertices.input.POSITION.source].data;
+for(b=e=0;e<f.length;e+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[e],f[e+1],f[e+2]));c(k,b);this.geometry3js.vertices.push(k)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};F.prototype.handlePrimitive=function(b,c,e){var f=
+0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,w=3,v=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":v.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(w=b.vcount[u++]);for(h=0;h<w;h++)for(k=0;k<n.length;k++)switch(o=n[k],source=ia[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=ya(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+
+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var B;w==3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):w==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;c.faces.push(B);for(k=0;k<v.length;k++)h=z[v[k]],c.faceVertexUvs[k].push([h[0],
+h[1],h[2]]);f+=n.length*w}};D.prototype=new B;D.prototype.constructor=D;B.prototype.setVertices=function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};B.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=pa(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new E).parse(b.childNodes[c]));break;case "vcount":this.vcount=
+X(e.textContent);break;case "p":this.p=X(e.textContent)}}return this};G.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=pa(b,"count",0);this.stride=pa(b,"stride",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};O.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName==
+"input"&&(input=(new E).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};E.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=pa(b,"set",-1);this.offset=pa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};P.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=
+ma(e.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=e.nodeName;break;case "float_array":this.data=fa(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=X(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=ma(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new G).parse(e.childNodes[f]);break}}}return this};
+P.prototype.read=function(){var b=[],c=this.accessor.params[0];switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var e=this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+c.type+".")}return b};U.prototype.parse=function(b){this.id=b.getAttribute("id");
+this.name=b.getAttribute("name");for(var c=0;c<b.childNodes.length;c++)if(b.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new Z).parse(b.childNodes[c]);break}return this};L.prototype.isColor=function(){return this.texture==null};L.prototype.isTexture=function(){return this.texture!=null};L.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=fa(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],
+e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};R.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=(new L).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=la.evaluate(".//dae:float",e,da,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};R.prototype.create=function(){var b={},c=this.transparency!==void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];if(f instanceof L)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=Q[this.effect.surface.init_from]))b.map=
+THREE.ImageUtils.loadTexture(Ga+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};I.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];
+if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+e.nodeName)}}return this};K.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":this.source=e.textContent;break;case "minfilter":this.minfilter=e.textContent;break;case "magfilter":this.magfilter=e.textContent;break;case "mipfilter":this.mipfilter=
+e.textContent;break;case "wrap_s":this.wrap_s=e.textContent;break;case "wrap_t":this.wrap_t=e.textContent;break;default:console.log("unhandled Sampler2D prop: "+e.nodeName)}}return this};aa.prototype.create=function(){if(this.shader==null)return null};aa.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};
+aa.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=(new I(this)).parse(f);this.surface.sid=c;break;case "sampler2D":this.sampler=(new K(this)).parse(f);this.sampler.sid=c;break;case "extra":break;default:console.log(f.nodeName)}}};aa.prototype.parseProfileCOMMON=function(b){for(var c,e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);
+break;case "technique":c=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return c};aa.prototype.parseTechnique=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new R(e.nodeName,this)).parse(e)}}};Z.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(b){this.id=b.getAttribute("id");
+this.name=b.getAttribute("name");this.source={};for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new P).parse(e);this.source[e.id]=e;break;case "sampler":this.sampler.push((new o(this)).parse(e));break;case "channel":this.channel.push((new M(this)).parse(e))}}return this};M.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var c=this.target.split("/");c.shift();var b=
+c.shift(),e=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c<h.length;c++)h[c]=parseInt(h[c].replace(/\)/,""))}this.sid=b;this.dotSyntax=e;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");this.inputs=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":this.inputs.push((new E).parse(e))}}return this};
 o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var c=this.inputs[b],e=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=e.read();break;case "OUTPUT":this.output=e.read();break;case "INTERPOLATION":this.interpolation=e.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=
 o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var c=this.inputs[b],e=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=e.read();break;case "OUTPUT":this.output=e.read();break;case "INTERPOLATION":this.interpolation=e.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=
 Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(c,e){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4&&(f.status==0||f.status==
 Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(c,e){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4&&(f.status==0||f.status==
-200))fa=e,b(f.responseXML,void 0,c)};f.open("GET",c,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:b,setPreferredShading:function(b){Ja=b},applySkin:m,geometries:ma}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+200))ha=e,b(f.responseXML,void 0,c)};f.open("GET",c,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:b,setPreferredShading:function(b){Ea=b},applySkin:m,geometries:sa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(b,e,c){var f=this,m;if(b instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),m=b,b=m.model,e=m.callback,c=m.texture_path;m=new Worker(b);c=c?c:this.extractUrlbase(b);m.onmessage=function(b){f.createModel(b.data,e,c);f.onLoadComplete()};this.onLoadStart();m.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.load=function(b,e,c){var f=this,m;if(b instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),m=b,b=m.model,e=m.callback,c=m.texture_path;m=new Worker(b);c=c?c:this.extractUrlbase(b);m.onmessage=function(b){f.createModel(b.data,e,c);f.onLoadComplete()};this.onLoadStart();m.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,e,c){var f=new THREE.Geometry,m=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,c);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,m,p,t,u,v,x,w,A,y,z,E,C,B,G=b.faces;v=b.vertices;var N=b.normals,I=b.colors,M=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&M++;for(e=0;e<M;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];t=0;for(u=v.length;t<u;)x=new THREE.Vertex,x.position.x=v[t++]*c,x.position.y=
-v[t++]*c,x.position.z=v[t++]*c,f.vertices.push(x);t=0;for(u=G.length;t<u;){c=G[t++];v=c&1;p=c&2;e=c&4;m=c&8;w=c&16;x=c&32;y=c&64;c&=128;v?(z=new THREE.Face4,z.a=G[t++],z.b=G[t++],z.c=G[t++],z.d=G[t++],v=4):(z=new THREE.Face3,z.a=G[t++],z.b=G[t++],z.c=G[t++],v=3);if(p)p=G[t++],z.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<M;e++)E=b.uvs[e],A=G[t++],B=E[A*2],A=E[A*2+1],f.faceUvs[e][p]=new THREE.UV(B,A);if(m)for(e=0;e<M;e++){E=b.uvs[e];C=[];for(m=0;m<v;m++)A=G[t++],B=E[A*2],A=E[A*2+1],C[m]=
-new THREE.UV(B,A);f.faceVertexUvs[e][p]=C}if(w)w=G[t++]*3,m=new THREE.Vector3,m.x=N[w++],m.y=N[w++],m.z=N[w],z.normal=m;if(x)for(e=0;e<v;e++)w=G[t++]*3,m=new THREE.Vector3,m.x=N[w++],m.y=N[w++],m.z=N[w],z.vertexNormals.push(m);if(y)x=G[t++],x=new THREE.Color(I[x]),z.color=x;if(c)for(e=0;e<v;e++)x=G[t++],x=new THREE.Color(I[x]),z.vertexColors.push(x);f.faces.push(z)}}})(m);(function(){var c,e,m,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)m=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(m,
-p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)m=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(m,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,m,p,t,u,v,x,w,A;e=0;for(m=b.morphTargets.length;e<m;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];w=f.morphTargets[e].vertices;A=b.morphTargets[e].vertices;p=0;for(t=A.length;p<t;p+=3)u=A[p]*c,v=A[p+1]*
-c,x=A[p+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(u,v,x)))}}if(b.morphColors!==void 0){e=0;for(m=b.morphColors.length;e<m;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];t=f.morphColors[e].colors;u=b.morphColors[e].colors;c=0;for(p=u.length;c<p;c+=3)v=new THREE.Color(16755200),v.setRGB(u[c],u[c+1],u[c+2]),t.push(v)}}})(m);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();e(f)};
+THREE.JSONLoader.prototype.createModel=function(b,e,c){var f=new THREE.Geometry,m=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,c);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,m,p,v,u,t,x,w,A,y,z,F,D,B,G=b.faces;t=b.vertices;var O=b.normals,E=b.colors,P=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&P++;for(e=0;e<P;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];v=0;for(u=t.length;v<u;)x=new THREE.Vertex,x.position.x=t[v++]*c,x.position.y=
+t[v++]*c,x.position.z=t[v++]*c,f.vertices.push(x);v=0;for(u=G.length;v<u;){c=G[v++];t=c&1;p=c&2;e=c&4;m=c&8;w=c&16;x=c&32;y=c&64;c&=128;t?(z=new THREE.Face4,z.a=G[v++],z.b=G[v++],z.c=G[v++],z.d=G[v++],t=4):(z=new THREE.Face3,z.a=G[v++],z.b=G[v++],z.c=G[v++],t=3);if(p)p=G[v++],z.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<P;e++)F=b.uvs[e],A=G[v++],B=F[A*2],A=F[A*2+1],f.faceUvs[e][p]=new THREE.UV(B,A);if(m)for(e=0;e<P;e++){F=b.uvs[e];D=[];for(m=0;m<t;m++)A=G[v++],B=F[A*2],A=F[A*2+1],D[m]=
+new THREE.UV(B,A);f.faceVertexUvs[e][p]=D}if(w)w=G[v++]*3,m=new THREE.Vector3,m.x=O[w++],m.y=O[w++],m.z=O[w],z.normal=m;if(x)for(e=0;e<t;e++)w=G[v++]*3,m=new THREE.Vector3,m.x=O[w++],m.y=O[w++],m.z=O[w],z.vertexNormals.push(m);if(y)x=G[v++],x=new THREE.Color(E[x]),z.color=x;if(c)for(e=0;e<t;e++)x=G[v++],x=new THREE.Color(E[x]),z.vertexColors.push(x);f.faces.push(z)}}})(m);(function(){var c,e,m,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)m=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(m,
+p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)m=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(m,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,m,p,v,u,t,x,w,A;e=0;for(m=b.morphTargets.length;e<m;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];w=f.morphTargets[e].vertices;A=b.morphTargets[e].vertices;p=0;for(v=A.length;p<v;p+=3)u=A[p]*c,t=A[p+1]*
+c,x=A[p+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(u,t,x)))}}if(b.morphColors!==void 0){e=0;for(m=b.morphColors.length;e<m;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];v=f.morphColors[e].colors;u=b.morphColors[e].colors;c=0;for(p=u.length;c<p;c+=3)t=new THREE.Color(16755200),t.setRGB(u[c],u[c+1],u[c+2]),v.push(t)}}})(m);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();e(f)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,e){var c=this,f=new Worker(b);f.postMessage(0);var m=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:m+"/"+b}function n(){for(w in F.objects)if(!T.objects[w])if(C=F.objects[w],C.geometry!==void 0){if(I=T.geometries[C.geometry]){var b=!1;O=[];for(da=0;da<C.materials.length;da++)O[da]=T.materials[C.materials[da]],b=O[da]instanceof THREE.ShaderMaterial;b&&I.computeTangents();B=C.position;r=C.rotation;
-q=C.quaternion;s=C.scale;q=0;O.length==0&&(O[0]=new THREE.MeshFaceMaterial);O.length>1&&(O=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(I,O);object.name=w;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=C.visible;T.scene.add(object);T.objects[w]=object;C.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
-if(C.castsShadow)b=new THREE.ShadowVolume(I),T.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;C.trigger&&C.trigger.toLowerCase()!="none"&&(b={type:C.trigger,object:C},T.triggers[object.name]=b)}}else B=C.position,r=C.rotation,q=C.quaternion,s=C.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=C.visible!==void 0?C.visible:!1,T.scene.add(object),T.objects[w]=object,T.empties[w]=object,C.trigger&&C.trigger.toLowerCase()!="none"&&(b={type:C.trigger,object:C},T.triggers[object.name]=b)}function p(b){return function(e){T.geometries[b]=e;n();Y-=1;c.onLoadComplete();u()}}function t(b){return function(c){T.geometries[b]=c}}function u(){c.callbackProgress({totalModels:P,totalTextures:o,loadedModels:P-Y,loadedTextures:o-Q},T);c.onLoadProgress();Y==0&&Q==0&&e(T)}var v,x,
-w,A,y,z,E,C,B,G,N,I,M,Z,J,O,L,F,aa,Y,Q,P,o,T;F=b.data;J=new THREE.BinaryLoader;aa=new THREE.JSONLoader;Q=Y=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in F.objects)if(C=F.objects[w],C.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(F.transform){b=F.transform.position;G=F.transform.rotation;var $=F.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);G&&T.scene.rotation.set(G[0],
-G[1],G[2]);$&&T.scene.scale.set($[0],$[1],$[2]);(b||G||$)&&T.scene.updateMatrix()}b=function(){Q-=1;u();c.onLoadComplete()};for(y in F.cameras)G=F.cameras[y],G.type=="perspective"?M=new THREE.PerspectiveCamera(G.fov,G.aspect,G.near,G.far):G.type=="ortho"&&(M=new THREE.OrthographicCamera(G.left,G.right,G.top,G.bottom,G.near,G.far)),B=G.position,G=G.target,M.position.set(B[0],B[1],B[2]),M.target=new THREE.Vector3(G[0],G[1],G[2]),T.cameras[y]=M;for(A in F.lights)y=F.lights[A],M=y.color!==void 0?y.color:
-16777215,G=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(B=y.direction,L=new THREE.DirectionalLight(M,G),L.position.set(B[0],B[1],B[2]),L.position.normalize()):y.type=="point"?(B=y.position,d=y.distance,L=new THREE.PointLight(M,G,d),L.position.set(B[0],B[1],B[2])):y.type=="ambient"&&(L=new THREE.AmbientLight(M)),T.scene.add(L),T.lights[A]=L;for(z in F.fogs)A=F.fogs[z],A.type=="linear"?Z=new THREE.Fog(0,A.near,A.far):A.type=="exp2"&&(Z=new THREE.FogExp2(0,A.density)),G=A.color,Z.color.setRGB(G[0],
-G[1],G[2]),T.fogs[z]=Z;if(T.cameras&&F.defaults.camera)T.currentCamera=T.cameras[F.defaults.camera];if(T.fogs&&F.defaults.fog)T.scene.fog=T.fogs[F.defaults.fog];G=F.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(G[0],G[1],G[2]);T.bgColorAlpha=F.defaults.bgalpha;for(v in F.geometries)if(z=F.geometries[v],z.type=="bin_mesh"||z.type=="ascii_mesh")Y+=1,c.onLoadStart();P=Y;for(v in F.geometries)z=F.geometries[v],z.type=="cube"?(I=new THREE.CubeGeometry(z.width,z.height,z.depth,z.segmentsWidth,
-z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),T.geometries[v]=I):z.type=="plane"?(I=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),T.geometries[v]=I):z.type=="sphere"?(I=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),T.geometries[v]=I):z.type=="cylinder"?(I=new THREE.CylinderGeometry(z.topRad,z.botRad,z.height,z.radSegs,z.heightSegs),T.geometries[v]=I):z.type=="torus"?(I=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),T.geometries[v]=
-I):z.type=="icosahedron"?(I=new THREE.IcosahedronGeometry(z.subdivisions),T.geometries[v]=I):z.type=="bin_mesh"?J.load({model:f(z.url,F.urlBaseType),callback:p(v)}):z.type=="ascii_mesh"?aa.load({model:f(z.url,F.urlBaseType),callback:p(v)}):z.type=="embedded_mesh"&&(z=F.embeds[z.id])&&aa.createModel(z,t(v),"");for(E in F.textures)if(v=F.textures[E],v.url instanceof Array){Q+=v.url.length;for(J=0;J<v.url.length;J++)c.onLoadStart()}else Q+=1,c.onLoadStart();o=Q;for(E in F.textures){v=F.textures[E];if(v.mapping!=
-void 0&&THREE[v.mapping]!=void 0)v.mapping=new THREE[v.mapping];if(v.url instanceof Array){J=[];for(var da=0;da<v.url.length;da++)J[da]=f(v.url[da],F.urlBaseType);J=THREE.ImageUtils.loadTextureCube(J,v.mapping,b)}else{J=THREE.ImageUtils.loadTexture(f(v.url,F.urlBaseType),v.mapping,b);if(THREE[v.minFilter]!=void 0)J.minFilter=THREE[v.minFilter];if(THREE[v.magFilter]!=void 0)J.magFilter=THREE[v.magFilter];if(v.repeat){J.repeat.set(v.repeat[0],v.repeat[1]);if(v.repeat[0]!=1)J.wrapS=THREE.RepeatWrapping;
-if(v.repeat[1]!=1)J.wrapT=THREE.RepeatWrapping}v.offset&&J.offset.set(v.offset[0],v.offset[1]);if(v.wrap){aa={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(aa[v.wrap[0]]!==void 0)J.wrapS=aa[v.wrap[0]];if(aa[v.wrap[1]]!==void 0)J.wrapT=aa[v.wrap[1]]}}T.textures[E]=J}for(x in F.materials){E=F.materials[x];for(N in E.parameters)if(N=="envMap"||N=="map"||N=="lightMap")E.parameters[N]=T.textures[E.parameters[N]];else if(N=="shading")E.parameters[N]=E.parameters[N]=="flat"?THREE.FlatShading:
-THREE.SmoothShading;else if(N=="blending")E.parameters[N]=THREE[E.parameters[N]]?THREE[E.parameters[N]]:THREE.NormalBlending;else if(N=="combine")E.parameters[N]=E.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(E.parameters[N]=="face")E.parameters[N]=THREE.FaceColors;else if(E.parameters[N])E.parameters[N]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=!0;if(E.parameters.normalMap){v=THREE.ShaderUtils.lib.normal;
-b=THREE.UniformsUtils.clone(v.uniforms);J=E.parameters.color;aa=E.parameters.specular;z=E.parameters.ambient;Z=E.parameters.shininess;b.tNormal.texture=T.textures[E.parameters.normalMap];if(E.parameters.normalMapFactor)b.uNormalScale.value=E.parameters.normalMapFactor;if(E.parameters.map)b.tDiffuse.texture=E.parameters.map,b.enableDiffuse.value=!0;if(E.parameters.lightMap)b.tAO.texture=E.parameters.lightMap,b.enableAO.value=!0;if(E.parameters.specularMap)b.tSpecular.texture=T.textures[E.parameters.specularMap],
-b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(J);b.uSpecularColor.value.setHex(aa);b.uAmbientColor.value.setHex(z);b.uShininess.value=Z;if(E.parameters.opacity)b.uOpacity.value=E.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:v.fragmentShader,vertexShader:v.vertexShader,uniforms:b,lights:!0,fog:!0})}else E=new THREE[E.type](E.parameters);T.materials[x]=E}n();c.callbackSync(T);u()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
-THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.SceneLoader.prototype={load:function(b,e){var c=this,f=new Worker(b);f.postMessage(0);var m=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:m+"/"+b}function n(){for(w in K.objects)if(!N.objects[w])if(D=K.objects[w],D.geometry!==void 0){if(E=N.geometries[D.geometry]){var b=!1;R=[];for(fa=0;fa<D.materials.length;fa++)R[fa]=N.materials[D.materials[fa]],b=R[fa]instanceof THREE.ShaderMaterial;b&&E.computeTangents();B=D.position;r=D.rotation;
+q=D.quaternion;s=D.scale;q=0;R.length==0&&(R[0]=new THREE.MeshFaceMaterial);R.length>1&&(R=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(E,R);object.name=w;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;N.scene.add(object);N.objects[w]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),N.scene.collisions.colliders.push(b));
+if(D.castsShadow)b=new THREE.ShadowVolume(E),N.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},N.triggers[object.name]=b)}}else B=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,N.scene.add(object),N.objects[w]=object,N.empties[w]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},N.triggers[object.name]=b)}function p(b){return function(e){N.geometries[b]=e;n();Z-=1;c.onLoadComplete();u()}}function v(b){return function(c){N.geometries[b]=c}}function u(){c.callbackProgress({totalModels:M,totalTextures:o,loadedModels:M-Z,loadedTextures:o-S},N);c.onLoadProgress();Z==0&&S==0&&e(N)}var t,x,
+w,A,y,z,F,D,B,G,O,E,P,U,L,R,I,K,aa,Z,S,M,o,N;K=b.data;L=new THREE.BinaryLoader;aa=new THREE.JSONLoader;S=Z=0;N={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in K.objects)if(D=K.objects[w],D.meshCollider){b=!0;break}if(b)N.scene.collisions=new THREE.CollisionSystem;if(K.transform){b=K.transform.position;G=K.transform.rotation;var da=K.transform.scale;b&&N.scene.position.set(b[0],b[1],b[2]);G&&N.scene.rotation.set(G[0],
+G[1],G[2]);da&&N.scene.scale.set(da[0],da[1],da[2]);(b||G||da)&&N.scene.updateMatrix()}b=function(){S-=1;u();c.onLoadComplete()};for(y in K.cameras)G=K.cameras[y],G.type=="perspective"?P=new THREE.PerspectiveCamera(G.fov,G.aspect,G.near,G.far):G.type=="ortho"&&(P=new THREE.OrthographicCamera(G.left,G.right,G.top,G.bottom,G.near,G.far)),B=G.position,G=G.target,P.position.set(B[0],B[1],B[2]),P.target=new THREE.Vector3(G[0],G[1],G[2]),N.cameras[y]=P;for(A in K.lights)y=K.lights[A],P=y.color!==void 0?
+y.color:16777215,G=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(B=y.direction,I=new THREE.DirectionalLight(P,G),I.position.set(B[0],B[1],B[2]),I.position.normalize()):y.type=="point"?(B=y.position,d=y.distance,I=new THREE.PointLight(P,G,d),I.position.set(B[0],B[1],B[2])):y.type=="ambient"&&(I=new THREE.AmbientLight(P)),N.scene.add(I),N.lights[A]=I;for(z in K.fogs)A=K.fogs[z],A.type=="linear"?U=new THREE.Fog(0,A.near,A.far):A.type=="exp2"&&(U=new THREE.FogExp2(0,A.density)),G=A.color,
+U.color.setRGB(G[0],G[1],G[2]),N.fogs[z]=U;if(N.cameras&&K.defaults.camera)N.currentCamera=N.cameras[K.defaults.camera];if(N.fogs&&K.defaults.fog)N.scene.fog=N.fogs[K.defaults.fog];G=K.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(G[0],G[1],G[2]);N.bgColorAlpha=K.defaults.bgalpha;for(t in K.geometries)if(z=K.geometries[t],z.type=="bin_mesh"||z.type=="ascii_mesh")Z+=1,c.onLoadStart();M=Z;for(t in K.geometries)z=K.geometries[t],z.type=="cube"?(E=new THREE.CubeGeometry(z.width,z.height,
+z.depth,z.segmentsWidth,z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),N.geometries[t]=E):z.type=="plane"?(E=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),N.geometries[t]=E):z.type=="sphere"?(E=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),N.geometries[t]=E):z.type=="cylinder"?(E=new THREE.CylinderGeometry(z.topRad,z.botRad,z.height,z.radSegs,z.heightSegs),N.geometries[t]=E):z.type=="torus"?(E=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,
+z.segmentsT),N.geometries[t]=E):z.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(z.subdivisions),N.geometries[t]=E):z.type=="bin_mesh"?L.load({model:f(z.url,K.urlBaseType),callback:p(t)}):z.type=="ascii_mesh"?aa.load({model:f(z.url,K.urlBaseType),callback:p(t)}):z.type=="embedded_mesh"&&(z=K.embeds[z.id])&&aa.createModel(z,v(t),"");for(F in K.textures)if(t=K.textures[F],t.url instanceof Array){S+=t.url.length;for(L=0;L<t.url.length;L++)c.onLoadStart()}else S+=1,c.onLoadStart();o=S;for(F in K.textures){t=
+K.textures[F];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){L=[];for(var fa=0;fa<t.url.length;fa++)L[fa]=f(t.url[fa],K.urlBaseType);L=THREE.ImageUtils.loadTextureCube(L,t.mapping,b)}else{L=THREE.ImageUtils.loadTexture(f(t.url,K.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)L.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)L.magFilter=THREE[t.magFilter];if(t.repeat){L.repeat.set(t.repeat[0],t.repeat[1]);if(t.repeat[0]!=
+1)L.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)L.wrapT=THREE.RepeatWrapping}t.offset&&L.offset.set(t.offset[0],t.offset[1]);if(t.wrap){aa={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(aa[t.wrap[0]]!==void 0)L.wrapS=aa[t.wrap[0]];if(aa[t.wrap[1]]!==void 0)L.wrapT=aa[t.wrap[1]]}}N.textures[F]=L}for(x in K.materials){F=K.materials[x];for(O in F.parameters)if(O=="envMap"||O=="map"||O=="lightMap")F.parameters[O]=N.textures[F.parameters[O]];else if(O=="shading")F.parameters[O]=
+F.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")F.parameters[O]=THREE[F.parameters[O]]?THREE[F.parameters[O]]:THREE.NormalBlending;else if(O=="combine")F.parameters[O]=F.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(O=="vertexColors")if(F.parameters[O]=="face")F.parameters[O]=THREE.FaceColors;else if(F.parameters[O])F.parameters[O]=THREE.VertexColors;if(F.parameters.opacity!==void 0&&F.parameters.opacity<1)F.parameters.transparent=
+!0;if(F.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);L=F.parameters.color;aa=F.parameters.specular;z=F.parameters.ambient;U=F.parameters.shininess;b.tNormal.texture=N.textures[F.parameters.normalMap];if(F.parameters.normalMapFactor)b.uNormalScale.value=F.parameters.normalMapFactor;if(F.parameters.map)b.tDiffuse.texture=F.parameters.map,b.enableDiffuse.value=!0;if(F.parameters.lightMap)b.tAO.texture=F.parameters.lightMap,b.enableAO.value=!0;if(F.parameters.specularMap)b.tSpecular.texture=
+N.textures[F.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(L);b.uSpecularColor.value.setHex(aa);b.uAmbientColor.value.setHex(z);b.uShininess.value=U;if(F.parameters.opacity)b.uOpacity.value=F.parameters.opacity;F=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else F=new THREE[F.type](F.parameters);N.materials[x]=F}n();c.callbackSync(N);u()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
+THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(b){var e=new XMLHttpRequest,c=b.model,f=b.callback,m=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,k=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,f,m,h,k,n):alert("Couldn't load ["+c+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",c,!0);e.send(null)};
 THREE.UTF8Loader.prototype.load=function(b){var e=new XMLHttpRequest,c=b.model,f=b.callback,m=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,k=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,f,m,h,k,n):alert("Couldn't load ["+c+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",c,!0);e.send(null)};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var e=b.charCodeAt(0);e>=57344&&(e-=2048);e++;for(var c=new Float32Array(8*e),f=1,m=0;m<8;m++){for(var h=0,k=0;k<e;++k){var n=b.charCodeAt(k+f);h+=n>>1^-(n&1);c[8*k+m]=h}f+=e}e=b.length-f;h=new Uint16Array(e);for(m=k=0;m<e;m++)n=b.charCodeAt(m+f),h[m]=k-n,n==0&&k++;return[c,h]};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var e=b.charCodeAt(0);e>=57344&&(e-=2048);e++;for(var c=new Float32Array(8*e),f=1,m=0;m<8;m++){for(var h=0,k=0;k<e;++k){var n=b.charCodeAt(k+f);h+=n>>1^-(n&1);c[8*k+m]=h}f+=e}e=b.length-f;h=new Uint16Array(e);for(m=k=0;m<e;m++)n=b.charCodeAt(m+f),h[m]=k-n,n==0&&k++;return[c,h]};
-THREE.UTF8Loader.prototype.createModel=function(b,e,c,f,m,h){var k=function(){var e=this;e.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(b),t=[],u=[];(function(b,k,p){for(var t,u,z,E=b.length;p<E;p+=k)t=b[p],u=b[p+1],z=b[p+2],t=t/16383*c,u=u/16383*c,z=z/16383*c,t+=f,u+=m,z+=h,e.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,z)))})(k[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,u.push(f,1-h)})(k[0],8,3);(function(b,
-c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,t.push(f,h,k)})(k[0],8,5);(function(b){var c,f,h,k,m,p,C,B,G,N=b.length;for(c=0;c<N;c+=3){f=b[c];h=b[c+1];k=b[c+2];m=e;B=f;G=h;p=k;C=f;var I=h,M=k,Z=m.materials[0],J=t[I*3],O=t[I*3+1],I=t[I*3+2],L=t[M*3],F=t[M*3+1],M=t[M*3+2];C=new THREE.Vector3(t[C*3],t[C*3+1],t[C*3+2]);I=new THREE.Vector3(J,O,I);M=new THREE.Vector3(L,F,M);m.faces.push(new THREE.Face3(B,G,p,[C,I,M],null,Z));m=u[f*2];f=u[f*2+
-1];p=u[h*2];C=u[h*2+1];B=u[k*2];G=u[k*2+1];k=e.faceVertexUvs[0];h=p;p=C;C=[];C.push(new THREE.UV(m,f));C.push(new THREE.UV(h,p));C.push(new THREE.UV(B,G));k.push(C)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;e(new k)};
+THREE.UTF8Loader.prototype.createModel=function(b,e,c,f,m,h){var k=function(){var e=this;e.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(b),v=[],u=[];(function(b,k,p){for(var u,v,z,F=b.length;p<F;p+=k)u=b[p],v=b[p+1],z=b[p+2],u=u/16383*c,v=v/16383*c,z=z/16383*c,u+=f,v+=m,z+=h,e.vertices.push(new THREE.Vertex(new THREE.Vector3(u,v,z)))})(k[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,u.push(f,1-h)})(k[0],8,3);(function(b,
+c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,v.push(f,h,k)})(k[0],8,5);(function(b){var c,f,h,k,m,p,D,B,G,O=b.length;for(c=0;c<O;c+=3){f=b[c];h=b[c+1];k=b[c+2];m=e;B=f;G=h;p=k;D=f;var E=h,P=k,U=m.materials[0],L=v[E*3],R=v[E*3+1],E=v[E*3+2],I=v[P*3],K=v[P*3+1],P=v[P*3+2];D=new THREE.Vector3(v[D*3],v[D*3+1],v[D*3+2]);E=new THREE.Vector3(L,R,E);P=new THREE.Vector3(I,K,P);m.faces.push(new THREE.Face3(B,G,p,[D,E,P],null,U));m=u[f*2];f=u[f*2+
+1];p=u[h*2];D=u[h*2+1];B=u[k*2];G=u[k*2+1];k=e.faceVertexUvs[0];h=p;p=D;D=[];D.push(new THREE.UV(m,f));D.push(new THREE.UV(h,p));D.push(new THREE.UV(B,G));k.push(D)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;e(new k)};
 THREE.Axes=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var e=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 THREE.Axes=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var e=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 c=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(b,e){THREE.Object3D.call(this);this.materials=e instanceof Array?e:[e];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(b,e){THREE.Object3D.call(this);this.materials=e instanceof Array?e:[e];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,m){return b+(e-b)*m};this.VIntX=function(b,e,m,h,k,n,p,t,u,v){k=(k-u)/(v-u);u=this.normal_cache;e[h]=n+k*this.delta;e[h+1]=p;e[h+2]=t;m[h]=this.lerp(u[b],u[b+3],k);m[h+1]=this.lerp(u[b+1],u[b+4],k);m[h+2]=this.lerp(u[b+2],u[b+5],k)};this.VIntY=function(b,e,m,h,k,n,p,t,u,v){k=(k-u)/(v-u);u=this.normal_cache;e[h]=n;e[h+1]=p+k*this.delta;e[h+
-2]=t;e=b+this.yd*3;m[h]=this.lerp(u[b],u[e],k);m[h+1]=this.lerp(u[b+1],u[e+1],k);m[h+2]=this.lerp(u[b+2],u[e+2],k)};this.VIntZ=function(b,e,m,h,k,n,p,t,u,v){k=(k-u)/(v-u);u=this.normal_cache;e[h]=n;e[h+1]=p;e[h+2]=t+k*this.delta;e=b+this.zd*3;m[h]=this.lerp(u[b],u[e],k);m[h+1]=this.lerp(u[b+1],u[e+1],k);m[h+2]=this.lerp(u[b+2],u[e+2],k)};this.compNorm=function(b){var e=b*3;this.normal_cache[e]==0&&(this.normal_cache[e]=this.field[b-1]-this.field[b+1],this.normal_cache[e+1]=this.field[b-this.yd]-this.field[b+
-this.yd],this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,e,m,h,k,n){var p=h+1,t=h+this.yd,u=h+this.zd,v=p+this.yd,x=p+this.zd,w=h+this.yd+this.zd,A=p+this.yd+this.zd,y=0,z=this.field[h],E=this.field[p],C=this.field[t],B=this.field[v],G=this.field[u],N=this.field[x],I=this.field[w],M=this.field[A];z<k&&(y|=1);E<k&&(y|=2);C<k&&(y|=8);B<k&&(y|=4);G<k&&(y|=16);N<k&&(y|=32);I<k&&(y|=128);M<k&&(y|=64);var Z=THREE.edgeTable[y];if(Z==0)return 0;var J=this.delta,
-O=b+J,L=e+J,J=m+J;Z&1&&(this.compNorm(h),this.compNorm(p),this.VIntX(h*3,this.vlist,this.nlist,0,k,b,e,m,z,E));Z&2&&(this.compNorm(p),this.compNorm(v),this.VIntY(p*3,this.vlist,this.nlist,3,k,O,e,m,E,B));Z&4&&(this.compNorm(t),this.compNorm(v),this.VIntX(t*3,this.vlist,this.nlist,6,k,b,L,m,C,B));Z&8&&(this.compNorm(h),this.compNorm(t),this.VIntY(h*3,this.vlist,this.nlist,9,k,b,e,m,z,C));Z&16&&(this.compNorm(u),this.compNorm(x),this.VIntX(u*3,this.vlist,this.nlist,12,k,b,e,J,G,N));Z&32&&(this.compNorm(x),
-this.compNorm(A),this.VIntY(x*3,this.vlist,this.nlist,15,k,O,e,J,N,M));Z&64&&(this.compNorm(w),this.compNorm(A),this.VIntX(w*3,this.vlist,this.nlist,18,k,b,L,J,I,M));Z&128&&(this.compNorm(u),this.compNorm(w),this.VIntY(u*3,this.vlist,this.nlist,21,k,b,e,J,G,I));Z&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,b,e,m,z,G));Z&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,k,O,e,m,E,N));Z&1024&&(this.compNorm(v),this.compNorm(A),this.VIntZ(v*
-3,this.vlist,this.nlist,30,k,O,L,m,B,M));Z&2048&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*3,this.vlist,this.nlist,33,k,b,L,m,C,I));y<<=4;for(k=h=0;THREE.triTable[y+k]!=-1;)b=y+k,e=b+1,m=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[m],n),k+=3,h++;return h};this.posnormtriv=function(b,e,m,h,k,n){var p=this.count*3;this.positionArray[p]=b[m];this.positionArray[p+1]=b[m+1];this.positionArray[p+2]=b[m+2];this.positionArray[p+3]=b[h];this.positionArray[p+
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,m){return b+(e-b)*m};this.VIntX=function(b,e,m,h,k,n,p,v,u,t){k=(k-u)/(t-u);u=this.normal_cache;e[h]=n+k*this.delta;e[h+1]=p;e[h+2]=v;m[h]=this.lerp(u[b],u[b+3],k);m[h+1]=this.lerp(u[b+1],u[b+4],k);m[h+2]=this.lerp(u[b+2],u[b+5],k)};this.VIntY=function(b,e,m,h,k,n,p,v,u,t){k=(k-u)/(t-u);u=this.normal_cache;e[h]=n;e[h+1]=p+k*this.delta;e[h+
+2]=v;e=b+this.yd*3;m[h]=this.lerp(u[b],u[e],k);m[h+1]=this.lerp(u[b+1],u[e+1],k);m[h+2]=this.lerp(u[b+2],u[e+2],k)};this.VIntZ=function(b,e,m,h,k,n,p,v,u,t){k=(k-u)/(t-u);u=this.normal_cache;e[h]=n;e[h+1]=p;e[h+2]=v+k*this.delta;e=b+this.zd*3;m[h]=this.lerp(u[b],u[e],k);m[h+1]=this.lerp(u[b+1],u[e+1],k);m[h+2]=this.lerp(u[b+2],u[e+2],k)};this.compNorm=function(b){var e=b*3;this.normal_cache[e]==0&&(this.normal_cache[e]=this.field[b-1]-this.field[b+1],this.normal_cache[e+1]=this.field[b-this.yd]-this.field[b+
+this.yd],this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,e,m,h,k,n){var p=h+1,v=h+this.yd,u=h+this.zd,t=p+this.yd,x=p+this.zd,w=h+this.yd+this.zd,A=p+this.yd+this.zd,y=0,z=this.field[h],F=this.field[p],D=this.field[v],B=this.field[t],G=this.field[u],O=this.field[x],E=this.field[w],P=this.field[A];z<k&&(y|=1);F<k&&(y|=2);D<k&&(y|=8);B<k&&(y|=4);G<k&&(y|=16);O<k&&(y|=32);E<k&&(y|=128);P<k&&(y|=64);var U=THREE.edgeTable[y];if(U==0)return 0;var L=this.delta,
+R=b+L,I=e+L,L=m+L;U&1&&(this.compNorm(h),this.compNorm(p),this.VIntX(h*3,this.vlist,this.nlist,0,k,b,e,m,z,F));U&2&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,3,k,R,e,m,F,B));U&4&&(this.compNorm(v),this.compNorm(t),this.VIntX(v*3,this.vlist,this.nlist,6,k,b,I,m,D,B));U&8&&(this.compNorm(h),this.compNorm(v),this.VIntY(h*3,this.vlist,this.nlist,9,k,b,e,m,z,D));U&16&&(this.compNorm(u),this.compNorm(x),this.VIntX(u*3,this.vlist,this.nlist,12,k,b,e,L,G,O));U&32&&(this.compNorm(x),
+this.compNorm(A),this.VIntY(x*3,this.vlist,this.nlist,15,k,R,e,L,O,P));U&64&&(this.compNorm(w),this.compNorm(A),this.VIntX(w*3,this.vlist,this.nlist,18,k,b,I,L,E,P));U&128&&(this.compNorm(u),this.compNorm(w),this.VIntY(u*3,this.vlist,this.nlist,21,k,b,e,L,G,E));U&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,b,e,m,z,G));U&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,k,R,e,m,F,O));U&1024&&(this.compNorm(t),this.compNorm(A),this.VIntZ(t*
+3,this.vlist,this.nlist,30,k,R,I,m,B,P));U&2048&&(this.compNorm(v),this.compNorm(w),this.VIntZ(v*3,this.vlist,this.nlist,33,k,b,I,m,D,E));y<<=4;for(k=h=0;THREE.triTable[y+k]!=-1;)b=y+k,e=b+1,m=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[m],n),k+=3,h++;return h};this.posnormtriv=function(b,e,m,h,k,n){var p=this.count*3;this.positionArray[p]=b[m];this.positionArray[p+1]=b[m+1];this.positionArray[p+2]=b[m+2];this.positionArray[p+3]=b[h];this.positionArray[p+
 4]=b[h+1];this.positionArray[p+5]=b[h+2];this.positionArray[p+6]=b[k];this.positionArray[p+7]=b[k+1];this.positionArray[p+8]=b[k+2];this.normalArray[p]=e[m];this.normalArray[p+1]=e[m+1];this.normalArray[p+2]=e[m+2];this.normalArray[p+3]=e[h];this.normalArray[p+4]=e[h+1];this.normalArray[p+5]=e[h+2];this.normalArray[p+6]=e[k];this.normalArray[p+7]=e[k+1];this.normalArray[p+8]=e[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
 4]=b[h+1];this.positionArray[p+5]=b[h+2];this.positionArray[p+6]=b[k];this.positionArray[p+7]=b[k+1];this.positionArray[p+8]=b[k+2];this.normalArray[p]=e[m];this.normalArray[p+1]=e[m+1];this.normalArray[p+2]=e[m+2];this.normalArray[p+3]=e[h];this.normalArray[p+4]=e[h+1];this.normalArray[p+5]=e[h+2];this.normalArray[p+6]=e[k];this.normalArray[p+7]=e[k+1];this.normalArray[p+8]=e[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,m,h,k){var n=this.size*Math.sqrt(h/k),p=m*this.size,t=e*this.size,u=b*this.size,v=Math.floor(p-n);v<1&&(v=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var x=Math.floor(t-n);x<1&&(x=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var w=Math.floor(u-n);w<1&&(w=1);n=Math.floor(u+n);n>this.size-1&&(n=this.size-
-1);for(var A,y,z,E,C,B;v<p;v++){u=this.size2*v;y=v/this.size-m;C=y*y;for(y=x;y<t;y++){z=u+this.size*y;A=y/this.size-e;B=A*A;for(A=w;A<n;A++)E=A/this.size-b,E=h/(1.0E-6+E*E+B+C)-k,E>0&&(this.field[z+A]+=E)}}};this.addPlaneX=function(b,e){var m,h,k,n,p,t=this.size,u=this.yd,v=this.zd,x=this.field,w=t*Math.sqrt(b/e);w>t&&(w=t);for(m=0;m<w;m++)if(h=m/t,h*=h,n=b/(1.0E-4+h)-e,n>0)for(h=0;h<t;h++){p=m+h*u;for(k=0;k<t;k++)x[v*k+p]+=n}};this.addPlaneY=function(b,e){var m,h,k,n,p,t,u=this.size,v=this.yd,x=
-this.zd,w=this.field,A=u*Math.sqrt(b/e);A>u&&(A=u);for(h=0;h<A;h++)if(m=h/u,m*=m,n=b/(1.0E-4+m)-e,n>0){p=h*v;for(m=0;m<u;m++){t=p+m;for(k=0;k<u;k++)w[x*k+t]+=n}}};this.addPlaneZ=function(b,e){var m,h,k,n,p,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(k=0;k<dist;k++)if(m=k/size,m*=m,n=b/(1.0E-4+m)-e,n>0){p=zd*k;for(h=0;h<size;h++){t=p+h*yd;for(m=0;m<size;m++)field[t+m]+=n}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
-3]=0,this.field[b]=0};this.render=function(b){this.begin();var e,m,h,k,n,p,t,u,v,x=this.size-2;for(k=1;k<x;k++){v=this.size2*k;t=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++){u=v+this.size*h;p=(h-this.halfsize)/this.halfsize;for(m=1;m<x;m++)n=(m-this.halfsize)/this.halfsize,e=u+m,this.polygonize(n,p,t,e,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry,m=[];this.render(function(h){var k,n,p,t,u,v,x,w;for(k=0;k<h.count;k++)x=k*3,u=x+1,w=x+2,n=h.positionArray[x],
-p=h.positionArray[u],t=h.positionArray[w],v=new THREE.Vector3(n,p,t),n=h.normalArray[x],p=h.normalArray[u],t=h.normalArray[w],x=new THREE.Vector3(n,p,t),x.normalize(),u=new THREE.Vertex(v),e.vertices.push(u),m.push(x);nfaces=h.count/3;for(k=0;k<nfaces;k++)x=(b+k)*3,u=x+1,w=x+2,v=m[x],n=m[u],p=m[w],x=new THREE.Face3(x,u,w,[v,n,p]),e.faces.push(x);b+=nfaces;h.count=0});return e};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,m,h,k){var n=this.size*Math.sqrt(h/k),p=m*this.size,v=e*this.size,u=b*this.size,t=Math.floor(p-n);t<1&&(t=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var x=Math.floor(v-n);x<1&&(x=1);v=Math.floor(v+n);v>this.size-1&&(v=this.size-1);var w=Math.floor(u-n);w<1&&(w=1);n=Math.floor(u+n);n>this.size-1&&(n=this.size-
+1);for(var A,y,z,F,D,B;t<p;t++){u=this.size2*t;y=t/this.size-m;D=y*y;for(y=x;y<v;y++){z=u+this.size*y;A=y/this.size-e;B=A*A;for(A=w;A<n;A++)F=A/this.size-b,F=h/(1.0E-6+F*F+B+D)-k,F>0&&(this.field[z+A]+=F)}}};this.addPlaneX=function(b,e){var m,h,k,n,p,v=this.size,u=this.yd,t=this.zd,x=this.field,w=v*Math.sqrt(b/e);w>v&&(w=v);for(m=0;m<w;m++)if(h=m/v,h*=h,n=b/(1.0E-4+h)-e,n>0)for(h=0;h<v;h++){p=m+h*u;for(k=0;k<v;k++)x[t*k+p]+=n}};this.addPlaneY=function(b,e){var m,h,k,n,p,v,u=this.size,t=this.yd,x=
+this.zd,w=this.field,A=u*Math.sqrt(b/e);A>u&&(A=u);for(h=0;h<A;h++)if(m=h/u,m*=m,n=b/(1.0E-4+m)-e,n>0){p=h*t;for(m=0;m<u;m++){v=p+m;for(k=0;k<u;k++)w[x*k+v]+=n}}};this.addPlaneZ=function(b,e){var m,h,k,n,p,v;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(k=0;k<dist;k++)if(m=k/size,m*=m,n=b/(1.0E-4+m)-e,n>0){p=zd*k;for(h=0;h<size;h++){v=p+h*yd;for(m=0;m<size;m++)field[v+m]+=n}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
+3]=0,this.field[b]=0};this.render=function(b){this.begin();var e,m,h,k,n,p,v,u,t,x=this.size-2;for(k=1;k<x;k++){t=this.size2*k;v=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++){u=t+this.size*h;p=(h-this.halfsize)/this.halfsize;for(m=1;m<x;m++)n=(m-this.halfsize)/this.halfsize,e=u+m,this.polygonize(n,p,v,e,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry,m=[];this.render(function(h){var k,n,p,v,u,t,x,w;for(k=0;k<h.count;k++)x=k*3,u=x+1,w=x+2,n=h.positionArray[x],
+p=h.positionArray[u],v=h.positionArray[w],t=new THREE.Vector3(n,p,v),n=h.normalArray[x],p=h.normalArray[u],v=h.normalArray[w],x=new THREE.Vector3(n,p,v),x.normalize(),u=new THREE.Vertex(t),e.vertices.push(u),m.push(x);nfaces=h.count/3;for(k=0;k<nfaces;k++)x=(b+k)*3,u=x+1,w=x+2,t=m[x],n=m[u],p=m[w],x=new THREE.Face3(x,u,w,[t,n,p]),e.faces.push(x);b+=nfaces;h.count=0});return e};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -684,20 +684,20 @@ THREE.MeshCollider=function(b,e){this.mesh=b;this.box=e;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var e,c,f,m,h=0;e=0;for(c=this.colliders.length;e<c;e++)if(m=this.colliders[e],f=this.rayCast(b,m),f<Number.MAX_VALUE)m.distance=f,f>h?this.hits.push(m):this.hits.unshift(m),h=f;return this.hits};
 THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var e,c,f,m,h=0;e=0;for(c=this.colliders.length;e<c;e++)if(m=this.colliders[e],f=this.rayCast(b,m),f<Number.MAX_VALUE)m.distance=f,f>h?this.hits.push(m):this.hits.unshift(m),h=f;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var e=this.rayCastAll(b);if(e.length==0)return null;for(var c=0;e[c]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,e[c]);if(f.dist<Number.MAX_VALUE){e[c].distance=f.dist;e[c].faceIndex=f.faceIndex;break}c++}if(c>e.length)return null;return e[c]};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var e=this.rayCastAll(b);if(e.length==0)return null;for(var c=0;e[c]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,e[c]);if(f.dist<Number.MAX_VALUE){e[c].distance=f.dist;e[c].faceIndex=f.faceIndex;break}c++}if(c>e.length)return null;return e[c]};
 THREE.CollisionSystem.prototype.rayCast=function(b,e){if(e instanceof THREE.PlaneCollider)return this.rayPlane(b,e);else if(e instanceof THREE.SphereCollider)return this.raySphere(b,e);else if(e instanceof THREE.BoxCollider)return this.rayBox(b,e);else if(e instanceof THREE.MeshCollider&&e.box)return this.rayBox(b,e.box)};
 THREE.CollisionSystem.prototype.rayCast=function(b,e){if(e instanceof THREE.PlaneCollider)return this.rayPlane(b,e);else if(e instanceof THREE.SphereCollider)return this.raySphere(b,e);else if(e instanceof THREE.BoxCollider)return this.rayBox(b,e);else if(e instanceof THREE.MeshCollider&&e.box)return this.rayBox(b,e.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(b,e){for(var c=this.makeRayLocal(b,e.mesh),f=Number.MAX_VALUE,m,h=0;h<e.numFaces;h++){var k=e.mesh.geometry.faces[h],n=e.mesh.geometry.vertices[k.a].position,p=e.mesh.geometry.vertices[k.b].position,t=e.mesh.geometry.vertices[k.c].position,u=k instanceof THREE.Face4?e.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(c,n,p,t,f,this.collisionNormal,e.mesh),k<f&&(f=k,m=h,e.normal.copy(this.collisionNormal),e.normal.normalize())):
-k instanceof THREE.Face4&&(k=this.rayTriangle(c,n,p,u,f,this.collisionNormal,e.mesh),k<f&&(f=k,m=h,e.normal.copy(this.collisionNormal),e.normal.normalize()),k=this.rayTriangle(c,p,t,u,f,this.collisionNormal,e.mesh),k<f&&(f=k,m=h,e.normal.copy(this.collisionNormal),e.normal.normalize()))}return{dist:f,faceIndex:m}};
+THREE.CollisionSystem.prototype.rayMesh=function(b,e){for(var c=this.makeRayLocal(b,e.mesh),f=Number.MAX_VALUE,m,h=0;h<e.numFaces;h++){var k=e.mesh.geometry.faces[h],n=e.mesh.geometry.vertices[k.a].position,p=e.mesh.geometry.vertices[k.b].position,v=e.mesh.geometry.vertices[k.c].position,u=k instanceof THREE.Face4?e.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(c,n,p,v,f,this.collisionNormal,e.mesh),k<f&&(f=k,m=h,e.normal.copy(this.collisionNormal),e.normal.normalize())):
+k instanceof THREE.Face4&&(k=this.rayTriangle(c,n,p,u,f,this.collisionNormal,e.mesh),k<f&&(f=k,m=h,e.normal.copy(this.collisionNormal),e.normal.normalize()),k=this.rayTriangle(c,p,v,u,f,this.collisionNormal,e.mesh),k<f&&(f=k,m=h,e.normal.copy(this.collisionNormal),e.normal.normalize()))}return{dist:f,faceIndex:m}};
 THREE.CollisionSystem.prototype.rayTriangle=function(b,e,c,f,m,h,k){var n=THREE.CollisionSystem.__v1,p=THREE.CollisionSystem.__v2;h.set(0,0,0);n.sub(c,e);p.sub(f,c);h.cross(n,p);n=h.dot(b.direction);if(!(n<0))if(k.doubleSided||k.flipSided)h.multiplyScalar(-1),n*=-1;else return Number.MAX_VALUE;k=h.dot(e)-h.dot(b.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=n*m))return Number.MAX_VALUE;k/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(k);n.addSelf(b.origin);Math.abs(h.x)>
 THREE.CollisionSystem.prototype.rayTriangle=function(b,e,c,f,m,h,k){var n=THREE.CollisionSystem.__v1,p=THREE.CollisionSystem.__v2;h.set(0,0,0);n.sub(c,e);p.sub(f,c);h.cross(n,p);n=h.dot(b.direction);if(!(n<0))if(k.doubleSided||k.flipSided)h.multiplyScalar(-1),n*=-1;else return Number.MAX_VALUE;k=h.dot(e)-h.dot(b.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=n*m))return Number.MAX_VALUE;k/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(k);n.addSelf(b.origin);Math.abs(h.x)>
 Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=n.y-e.y,h=c.y-e.y,m=f.y-e.y,n=n.z-e.z,c=c.z-e.z,f=f.z-e.z):(b=n.x-e.x,h=c.x-e.x,m=f.x-e.x,n=n.y-e.y,c=c.y-e.y,f=f.y-e.y):Math.abs(h.y)>Math.abs(h.z)?(b=n.x-e.x,h=c.x-e.x,m=f.x-e.x,n=n.z-e.z,c=c.z-e.z,f=f.z-e.z):(b=n.x-e.x,h=c.x-e.x,m=f.x-e.x,n=n.y-e.y,c=c.y-e.y,f=f.y-e.y);e=h*f-c*m;if(e==0)return Number.MAX_VALUE;e=1/e;f=(b*f-n*m)*e;if(!(f>=0))return Number.MAX_VALUE;e*=h*n-c*b;if(!(e>=0))return Number.MAX_VALUE;if(!(1-f-e>=0))return Number.MAX_VALUE;return k};
 Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=n.y-e.y,h=c.y-e.y,m=f.y-e.y,n=n.z-e.z,c=c.z-e.z,f=f.z-e.z):(b=n.x-e.x,h=c.x-e.x,m=f.x-e.x,n=n.y-e.y,c=c.y-e.y,f=f.y-e.y):Math.abs(h.y)>Math.abs(h.z)?(b=n.x-e.x,h=c.x-e.x,m=f.x-e.x,n=n.z-e.z,c=c.z-e.z,f=f.z-e.z):(b=n.x-e.x,h=c.x-e.x,m=f.x-e.x,n=n.y-e.y,c=c.y-e.y,f=f.y-e.y);e=h*f-c*m;if(e==0)return Number.MAX_VALUE;e=1/e;f=(b*f-n*m)*e;if(!(f>=0))return Number.MAX_VALUE;e*=h*n-c*b;if(!(e>=0))return Number.MAX_VALUE;if(!(1-f-e>=0))return Number.MAX_VALUE;return k};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,e){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(e.matrixWorld,c);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);c.multiplyVector3(f.origin);c.rotateAxis(f.direction);f.direction.normalize();return f};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,e){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(e.matrixWorld,c);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);c.multiplyVector3(f.origin);c.rotateAxis(f.direction);f.direction.normalize();return f};
-THREE.CollisionSystem.prototype.rayBox=function(b,e){var c;e.dynamic&&e.mesh&&e.mesh.matrixWorld?c=this.makeRayLocal(b,e.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(b.origin),c.direction.copy(b.direction));var f=0,m=0,h=0,k=0,n=0,p=0,t=!0;c.origin.x<e.min.x?(f=e.min.x-c.origin.x,f/=c.direction.x,t=!1,k=-1):c.origin.x>e.max.x&&(f=e.max.x-c.origin.x,f/=c.direction.x,t=!1,k=1);c.origin.y<e.min.y?(m=e.min.y-c.origin.y,m/=c.direction.y,t=!1,n=-1):c.origin.y>e.max.y&&(m=e.max.y-c.origin.y,m/=c.direction.y,
-t=!1,n=1);c.origin.z<e.min.z?(h=e.min.z-c.origin.z,h/=c.direction.z,t=!1,p=-1):c.origin.z>e.max.z&&(h=e.max.z-c.origin.z,h/=c.direction.z,t=!1,p=1);if(t)return-1;t=0;m>f&&(t=1,f=m);h>f&&(t=2,f=h);switch(t){case 0:n=c.origin.y+c.direction.y*f;if(n<e.min.y||n>e.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*f;if(c<e.min.z||c>e.max.z)return Number.MAX_VALUE;e.normal.set(k,0,0);break;case 1:k=c.origin.x+c.direction.x*f;if(k<e.min.x||k>e.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(b,e){var c;e.dynamic&&e.mesh&&e.mesh.matrixWorld?c=this.makeRayLocal(b,e.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(b.origin),c.direction.copy(b.direction));var f=0,m=0,h=0,k=0,n=0,p=0,v=!0;c.origin.x<e.min.x?(f=e.min.x-c.origin.x,f/=c.direction.x,v=!1,k=-1):c.origin.x>e.max.x&&(f=e.max.x-c.origin.x,f/=c.direction.x,v=!1,k=1);c.origin.y<e.min.y?(m=e.min.y-c.origin.y,m/=c.direction.y,v=!1,n=-1):c.origin.y>e.max.y&&(m=e.max.y-c.origin.y,m/=c.direction.y,
+v=!1,n=1);c.origin.z<e.min.z?(h=e.min.z-c.origin.z,h/=c.direction.z,v=!1,p=-1):c.origin.z>e.max.z&&(h=e.max.z-c.origin.z,h/=c.direction.z,v=!1,p=1);if(v)return-1;v=0;m>f&&(v=1,f=m);h>f&&(v=2,f=h);switch(v){case 0:n=c.origin.y+c.direction.y*f;if(n<e.min.y||n>e.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*f;if(c<e.min.z||c>e.max.z)return Number.MAX_VALUE;e.normal.set(k,0,0);break;case 1:k=c.origin.x+c.direction.x*f;if(k<e.min.x||k>e.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
 f;if(c<e.min.z||c>e.max.z)return Number.MAX_VALUE;e.normal.set(0,n,0);break;case 2:k=c.origin.x+c.direction.x*f;if(k<e.min.x||k>e.max.x)return Number.MAX_VALUE;n=c.origin.y+c.direction.y*f;if(n<e.min.y||n>e.max.y)return Number.MAX_VALUE;e.normal.set(0,0,p)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,e){var c=b.direction.dot(e.normal),f=e.point.dot(e.normal);if(c<0)c=(f-b.origin.dot(e.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
 f;if(c<e.min.z||c>e.max.z)return Number.MAX_VALUE;e.normal.set(0,n,0);break;case 2:k=c.origin.x+c.direction.x*f;if(k<e.min.x||k>e.max.x)return Number.MAX_VALUE;n=c.origin.y+c.direction.y*f;if(n<e.min.y||n>e.max.y)return Number.MAX_VALUE;e.normal.set(0,0,p)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,e){var c=b.direction.dot(e.normal),f=e.point.dot(e.normal);if(c<0)c=(f-b.origin.dot(e.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(b,e){var c=e.center.clone().subSelf(b.origin);if(c.lengthSq<e.radiusSq)return-1;var f=c.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;c=e.radiusSq-(c.lengthSq()-f*f);if(c>=0)return Math.abs(f)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.prototype.raySphere=function(b,e){var c=e.center.clone().subSelf(b.origin);if(c.lengthSq<e.radiusSq)return-1;var f=c.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;c=e.radiusSq-(c.lengthSq()-f*f);if(c>=0)return Math.abs(f)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var e=b.geometry.boundingBox,c=new THREE.Vector3(e.x[0],e.y[0],e.z[0]),e=new THREE.Vector3(e.x[1],e.y[1],e.z[1]),c=new THREE.BoxCollider(c,e);c.mesh=b;return c};THREE.CollisionUtils.MeshAABB=function(b){var e=THREE.CollisionUtils.MeshOBB(b);e.min.addSelf(b.position);e.max.addSelf(b.position);e.dynamic=!1;return e};
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var e=b.geometry.boundingBox,c=new THREE.Vector3(e.x[0],e.y[0],e.z[0]),e=new THREE.Vector3(e.x[1],e.y[1],e.z[1]),c=new THREE.BoxCollider(c,e);c.mesh=b;return c};THREE.CollisionUtils.MeshAABB=function(b){var e=THREE.CollisionUtils.MeshOBB(b);e.min.addSelf(b.position);e.max.addSelf(b.position);e.dynamic=!1;return e};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var e=this,c=this.setSize,f=this.render,m=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,k=new THREE.Matrix4,n=new THREE.Matrix4,p,t,u;m.matrixAutoUpdate=h.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},v=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.PerspectiveCamera(53,1,1,1E4);w.position.z=
-2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:v},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var A=new THREE.Scene;A.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){c.call(e,b,f);v.width=b;v.height=f;x.width=b;x.height=f};this.render=function(b,c){c.update(null,!0);if(p!==c.aspect||t!==c.near||u!==c.fov){p=c.aspect;t=c.near;u=c.fov;var E=c.projectionMatrix.clone(),C=125/30*0.5,B=C*t/125,G=t*Math.tan(u*Math.PI/360),N;k.n14=C;n.n14=-C;C=-G*p+B;N=G*p+B;E.n11=2*t/(N-C);E.n13=(N+C)/(N-C);m.projectionMatrix=E.clone();C=-G*p-B;N=G*p-B;E.n11=2*t/(N-C);E.n13=
-(N+C)/(N-C);h.projectionMatrix=E.clone()}m.matrix=c.matrixWorld.clone().multiplySelf(n);m.update(null,!0);m.position.copy(c.position);m.near=t;m.far=c.far;f.call(e,b,m,v,!0);h.matrix=c.matrixWorld.clone().multiplySelf(k);h.update(null,!0);h.position.copy(c.position);h.near=t;h.far=c.far;f.call(e,b,h,x,!0);f.call(e,A,w)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var e=this,c=this.setSize,f=this.render,m=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,k=new THREE.Matrix4,n=new THREE.Matrix4,p,v,u;m.matrixAutoUpdate=h.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.PerspectiveCamera(53,1,1,1E4);w.position.z=
+2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var A=new THREE.Scene;A.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){c.call(e,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,c){c.update(null,!0);if(p!==c.aspect||v!==c.near||u!==c.fov){p=c.aspect;v=c.near;u=c.fov;var F=c.projectionMatrix.clone(),D=125/30*0.5,B=D*v/125,G=v*Math.tan(u*Math.PI/360),O;k.n14=D;n.n14=-D;D=-G*p+B;O=G*p+B;F.n11=2*v/(O-D);F.n13=(O+D)/(O-D);m.projectionMatrix=F.clone();D=-G*p-B;O=G*p-B;F.n11=2*v/(O-D);F.n13=
+(O+D)/(O-D);h.projectionMatrix=F.clone()}m.matrix=c.matrixWorld.clone().multiplySelf(n);m.update(null,!0);m.position.copy(c.position);m.near=v;m.far=c.far;f.call(e,b,m,t,!0);h.matrix=c.matrixWorld.clone().multiplySelf(k);h.update(null,!0);h.position.copy(c.position);h.near=v;h.far=c.far;f.call(e,b,h,x,!0);f.call(e,A,w)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var e=this,c=this.setSize,f=this.render,m,h,k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);var n=new THREE.PerspectiveCamera;n.target=new THREE.Vector3(0,0,0);e.separation=10;if(b&&b.separation!==void 0)e.separation=b.separation;this.setSize=function(b,f){c.call(e,b,f);m=b/2;h=f};this.render=function(b,c){this.clear();k.fov=c.fov;k.aspect=0.5*c.aspect;k.near=c.near;k.far=
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var e=this,c=this.setSize,f=this.render,m,h,k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);var n=new THREE.PerspectiveCamera;n.target=new THREE.Vector3(0,0,0);e.separation=10;if(b&&b.separation!==void 0)e.separation=b.separation;this.setSize=function(b,f){c.call(e,b,f);m=b/2;h=f};this.render=function(b,c){this.clear();k.fov=c.fov;k.aspect=0.5*c.aspect;k.near=c.near;k.far=
 c.far;k.updateProjectionMatrix();k.position.copy(c.position);k.target.copy(c.target);k.translateX(e.separation);k.lookAt(k.target);n.projectionMatrix=k.projectionMatrix;n.position.copy(c.position);n.target.copy(c.target);n.translateX(-e.separation);n.lookAt(n.target);this.setViewport(0,0,m,h);f.call(e,b,k);this.setViewport(m,0,m,h);f.call(e,b,n,!1)}};
 c.far;k.updateProjectionMatrix();k.position.copy(c.position);k.target.copy(c.target);k.translateX(e.separation);k.lookAt(k.target);n.projectionMatrix=k.projectionMatrix;n.position.copy(c.position);n.target.copy(c.target);n.translateX(-e.separation);n.lookAt(n.target);this.setViewport(0,0,m,h);f.call(e,b,k);this.setViewport(m,0,m,h);f.call(e,b,n,!1)}};

+ 149 - 151
build/custom/ThreeWebGL.js

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

+ 35 - 22
src/renderers/WebGLRenderer.js

@@ -3484,9 +3484,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 			oil,
 			oil,
 			material,
 			material,
 			o, ol, webglObject, object,
 			o, ol, webglObject, object,
-			lights = scene.lights,
+			lights,
 			fog = null;
 			fog = null;
 
 
+		_this.initWebGLObjects( scene );
+
+		lights = scene.__webglLights;
+
 		if ( ! _cameraLight ) {
 		if ( ! _cameraLight ) {
 
 
 			_cameraLight = new THREE.PerspectiveCamera( _this.shadowCameraFov, _this.shadowMapWidth / _this.shadowMapHeight, _this.shadowCameraNear, _this.shadowCameraFar );
 			_cameraLight = new THREE.PerspectiveCamera( _this.shadowCameraFov, _this.shadowMapWidth / _this.shadowMapHeight, _this.shadowCameraNear, _this.shadowCameraFar );
@@ -3520,11 +3524,16 @@ THREE.WebGLRenderer = function ( parameters ) {
 				_cameraLight.position.copy( light.position );
 				_cameraLight.position.copy( light.position );
 				_cameraLight.lookAt( light.target.position );
 				_cameraLight.lookAt( light.target.position );
 
 
-				_cameraLight.update( undefined, true );
+				if ( _cameraLight.parent == null ) {
+
+					console.warn( "Camera is not on the Scene. Adding it..." );
+					scene.add( _cameraLight );
+
+				}
 
 
-				scene.update( undefined, false, _cameraLight );
+				scene.updateMatrixWorld();
 
 
-				THREE.Matrix4.makeInvert( _cameraLight.matrixWorld, _cameraLight.matrixWorldInverse );
+				_cameraLight.matrixWorldInverse.getInverse( _cameraLight.matrixWorld );
 
 
 				// compute shadow matrix
 				// compute shadow matrix
 
 
@@ -3547,7 +3556,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				computeFrustum( _projScreenMatrix );
 				computeFrustum( _projScreenMatrix );
 
 
-				_this.initWebGLObjects( scene );
+
 
 
 				setRenderTarget( shadowMap );
 				setRenderTarget( shadowMap );
 
 
@@ -3689,7 +3698,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		var i, program, opaque, transparent, material,
 		var i, program, opaque, transparent, material,
 			o, ol, oil, webglObject, object, buffer,
 			o, ol, oil, webglObject, object, buffer,
-			lights = scene.lights,
+			lights,
 			fog = scene.fog;
 			fog = scene.fog;
 
 
 		_currentMaterialId = -1;
 		_currentMaterialId = -1;
@@ -3700,25 +3709,16 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_this.info.render.vertices = 0;
 		_this.info.render.vertices = 0;
 		_this.info.render.faces = 0;
 		_this.info.render.faces = 0;
 
 
-		// hack: find parent of camera.
-
-		if ( camera.matrixAutoUpdate ) {
-
-			var parent = camera;
-
-			while ( parent.parent ) {
-
-				parent = parent.parent;
+		if ( camera.parent == null ) {
 
 
-			}
-
-			parent.update( undefined, true );
+			console.warn( "Camera is not on the Scene. Adding it..." );
+			scene.add( camera );
 
 
 		}
 		}
 
 
-		scene.update( undefined, false, camera );
+		scene.updateMatrixWorld();
 
 
-		THREE.Matrix4.makeInvert( camera.matrixWorld, camera.matrixWorldInverse );
+		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
 
 
 		camera.matrixWorldInverse.flattenToArray( _viewMatrixArray );
 		camera.matrixWorldInverse.flattenToArray( _viewMatrixArray );
 		camera.projectionMatrix.flattenToArray( _projectionMatrixArray );
 		camera.projectionMatrix.flattenToArray( _projectionMatrixArray );
@@ -3728,6 +3728,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		this.initWebGLObjects( scene );
 		this.initWebGLObjects( scene );
 
 
+		lights = scene.__webglLights;
+
 		setRenderTarget( renderTarget );
 		setRenderTarget( renderTarget );
 
 
 		if ( this.autoClear || forceClear ) {
 		if ( this.autoClear || forceClear ) {
@@ -4198,9 +4200,16 @@ THREE.WebGLRenderer = function ( parameters ) {
 			scene.__webglObjects = [];
 			scene.__webglObjects = [];
 			scene.__webglObjectsImmediate = [];
 			scene.__webglObjectsImmediate = [];
 			scene.__webglSprites = [];
 			scene.__webglSprites = [];
+			scene.__webglLights = [];
 
 
 		}
 		}
 
 
+		THREE.SceneUtils.traverseHierarchy( scene, function ( node ) {
+
+			addObject( node, scene );
+
+		} );
+/*
 		while ( scene.__objectsAdded.length ) {
 		while ( scene.__objectsAdded.length ) {
 
 
 			addObject( scene.__objectsAdded[ 0 ], scene );
 			addObject( scene.__objectsAdded[ 0 ], scene );
@@ -4214,7 +4223,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			scene.__objectsRemoved.splice( 0, 1 );
 			scene.__objectsRemoved.splice( 0, 1 );
 
 
 		}
 		}
-
+*/
 		// update must be called after objects adding / removal
 		// update must be called after objects adding / removal
 
 
 		for ( var o = 0, ol = scene.__webglObjects.length; o < ol; o ++ ) {
 		for ( var o = 0, ol = scene.__webglObjects.length; o < ol; o ++ ) {
@@ -4351,6 +4360,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				scene.__webglSprites.push( object );
 				scene.__webglSprites.push( object );
 
 
+			} else if ( object instanceof THREE.Light ) {
+
+				scene.__webglLights.push( object );
+
 			}
 			}
 
 
 			object.__webglActive = true;
 			object.__webglActive = true;
@@ -5705,7 +5718,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		// material must use some texture to require uvs
 		// material must use some texture to require uvs
 
 
-		for ( i = 0; i < ml; i++ ) {
+		for ( i = 0; i < ml; i ++ ) {
 
 
 			m = materials[ i ];
 			m = materials[ i ];