Przeglądaj źródła

Implemented again @ekitson's improvement to GeometyUrils.center. Increased light intensity in loader_json_blender example.

Mr.doob 13 lat temu
rodzic
commit
c5613ebb53

+ 133 - 132
build/Three.js

@@ -1,6 +1,6 @@
 // Three.js r47dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
-THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
+THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,f;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),f=c*(1-
 b*e),b=c*(1-b*(1-e)),d){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return Math.floor(this.r*255)<<16^Math.floor(this.g*255)<<8^Math.floor(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
@@ -30,7 +30,7 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,k,j,o,p,m,q,n){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,i||0,k||0,j!==void 0?j:1,o||0,p||0,m||0,q||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,k,j,o,p,m,q,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=k;this.n33=j;this.n34=o;this.n41=p;this.n42=m;this.n43=q;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();d.length()===0&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,k=a.n24,j=a.n31,o=a.n32,p=a.n33,m=a.n34,q=a.n41,n=a.n42,s=a.n43,
-r=a.n44,u=b.n11,t=b.n12,z=b.n13,A=b.n14,E=b.n21,D=b.n22,B=b.n23,w=b.n24,G=b.n31,y=b.n32,K=b.n33,$=b.n34,Q=b.n41,X=b.n42,S=b.n43,R=b.n44;this.n11=c*u+d*E+e*G+f*Q;this.n12=c*t+d*D+e*y+f*X;this.n13=c*z+d*B+e*K+f*S;this.n14=c*A+d*w+e*$+f*R;this.n21=g*u+h*E+i*G+k*Q;this.n22=g*t+h*D+i*y+k*X;this.n23=g*z+h*B+i*K+k*S;this.n24=g*A+h*w+i*$+k*R;this.n31=j*u+o*E+p*G+m*Q;this.n32=j*t+o*D+p*y+m*X;this.n33=j*z+o*B+p*K+m*S;this.n34=j*A+o*w+p*$+m*R;this.n41=q*u+n*E+s*G+r*Q;this.n42=q*t+n*D+s*y+r*X;this.n43=q*z+n*
+r=a.n44,u=b.n11,t=b.n12,z=b.n13,A=b.n14,E=b.n21,D=b.n22,B=b.n23,w=b.n24,G=b.n31,y=b.n32,K=b.n33,$=b.n34,Q=b.n41,Y=b.n42,S=b.n43,R=b.n44;this.n11=c*u+d*E+e*G+f*Q;this.n12=c*t+d*D+e*y+f*Y;this.n13=c*z+d*B+e*K+f*S;this.n14=c*A+d*w+e*$+f*R;this.n21=g*u+h*E+i*G+k*Q;this.n22=g*t+h*D+i*y+k*Y;this.n23=g*z+h*B+i*K+k*S;this.n24=g*A+h*w+i*$+k*R;this.n31=j*u+o*E+p*G+m*Q;this.n32=j*t+o*D+p*y+m*Y;this.n33=j*z+o*B+p*K+m*S;this.n34=j*A+o*w+p*$+m*R;this.n41=q*u+n*E+s*G+r*Q;this.n42=q*t+n*D+s*y+r*Y;this.n43=q*z+n*
 B+s*K+r*S;this.n44=q*A+n*w+s*$+r*R;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
@@ -64,12 +64,12 @@ this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWor
 THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,f,g=[],h,i,k=[],
 j,o,p=[],m,q=[],n,s,r=[],u,t,z=[],A={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,D=new THREE.Vector4,B=new THREE.Matrix4,w=new THREE.Matrix4,G=new THREE.Frustum,y=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,
 b.projectionMatrixInverse);B.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;A.objects.length=0;A.sprites.length=0;A.lights.length=0;var g=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||G.contains(b))?(B.multiplyVector3(E.copy(b.position)),e=a(),e.object=
-b,e.z=E.z,A.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(B.multiplyVector3(E.copy(b.position)),e=a(),e.object=b,e.z=E.z,A.sprites.push(e)):b instanceof THREE.Light&&A.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&A.objects.sort(c);return A};this.projectScene=function(a,e,f){var g=e.near,E=e.far,l,V,v,W,L,Z,da,ba,T,U,O,aa,ca,ga,va,fa;t=s=m=o=0;A.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);G.setFromMatrix(B);A=this.projectGraph(a,!1);a=0;for(l=A.objects.length;a<l;a++)if(T=A.objects[a].object,U=T.matrixWorld,aa=T.material,i=0,T instanceof THREE.Mesh){O=T.geometry;ca=T.geometry.materials;W=O.vertices;ga=O.faces;va=O.faceVertexUvs;O=T.matrixRotationWorld.extractRotation(U);V=0;for(v=W.length;V<v;V++)h=b(),h.positionWorld.copy(W[V].position),U.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),B.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<E;W=0;for(V=ga.length;W<V;W++){v=ga[W];if(v instanceof THREE.Face3)if(L=k[v.a],Z=k[v.b],da=k[v.c],L.visible&&Z.visible&&da.visible&&(T.doubleSided||T.flipSided!=(da.positionScreen.x-L.positionScreen.x)*(Z.positionScreen.y-L.positionScreen.y)-(da.positionScreen.y-L.positionScreen.y)*(Z.positionScreen.x-
+b,e.z=E.z,A.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(B.multiplyVector3(E.copy(b.position)),e=a(),e.object=b,e.z=E.z,A.sprites.push(e)):b instanceof THREE.Light&&A.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&A.objects.sort(c);return A};this.projectScene=function(a,e,f){var g=e.near,E=e.far,l,W,v,X,L,Z,da,ba,T,U,O,aa,ca,ga,va,fa;t=s=m=o=0;A.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);G.setFromMatrix(B);A=this.projectGraph(a,!1);a=0;for(l=A.objects.length;a<l;a++)if(T=A.objects[a].object,U=T.matrixWorld,aa=T.material,i=0,T instanceof THREE.Mesh){O=T.geometry;ca=T.geometry.materials;X=O.vertices;ga=O.faces;va=O.faceVertexUvs;O=T.matrixRotationWorld.extractRotation(U);W=0;for(v=X.length;W<v;W++)h=b(),h.positionWorld.copy(X[W].position),U.multiplyVector3(h.positionWorld),
+h.positionScreen.copy(h.positionWorld),B.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<E;X=0;for(W=ga.length;X<W;X++){v=ga[X];if(v instanceof THREE.Face3)if(L=k[v.a],Z=k[v.b],da=k[v.c],L.visible&&Z.visible&&da.visible&&(T.doubleSided||T.flipSided!=(da.positionScreen.x-L.positionScreen.x)*(Z.positionScreen.y-L.positionScreen.y)-(da.positionScreen.y-L.positionScreen.y)*(Z.positionScreen.x-
 L.positionScreen.x)<0))ba=p[o]=p[o]||new THREE.RenderableFace3,o++,j=ba,j.v1.copy(L),j.v2.copy(Z),j.v3.copy(da);else continue;else if(v instanceof THREE.Face4)if(L=k[v.a],Z=k[v.b],da=k[v.c],ba=k[v.d],L.visible&&Z.visible&&da.visible&&ba.visible&&(T.doubleSided||T.flipSided!=((ba.positionScreen.x-L.positionScreen.x)*(Z.positionScreen.y-L.positionScreen.y)-(ba.positionScreen.y-L.positionScreen.y)*(Z.positionScreen.x-L.positionScreen.x)<0||(Z.positionScreen.x-da.positionScreen.x)*(ba.positionScreen.y-
 da.positionScreen.y)-(Z.positionScreen.y-da.positionScreen.y)*(ba.positionScreen.x-da.positionScreen.x)<0)))fa=q[m]=q[m]||new THREE.RenderableFace4,m++,j=fa,j.v1.copy(L),j.v2.copy(Z),j.v3.copy(da),j.v4.copy(ba);else continue;j.normalWorld.copy(v.normal);O.multiplyVector3(j.normalWorld);j.centroidWorld.copy(v.centroid);U.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);B.multiplyVector3(j.centroidScreen);da=v.vertexNormals;L=0;for(Z=da.length;L<Z;L++)ba=j.vertexNormalsWorld[L],
-ba.copy(da[L]),O.multiplyVector3(ba);L=0;for(Z=va.length;L<Z;L++)if(fa=va[L][W]){da=0;for(ba=fa.length;da<ba;da++)j.uvs[L][da]=fa[da]}j.material=aa;j.faceMaterial=v.materialIndex!==null?ca[v.materialIndex]:null;j.z=j.centroidScreen.z;A.elements.push(j)}}else if(T instanceof THREE.Line){w.multiply(B,U);W=T.geometry.vertices;L=b();L.positionScreen.copy(W[0].position);w.multiplyVector4(L.positionScreen);V=1;for(v=W.length;V<v;V++)if(L=b(),L.positionScreen.copy(W[V].position),w.multiplyVector4(L.positionScreen),
+ba.copy(da[L]),O.multiplyVector3(ba);L=0;for(Z=va.length;L<Z;L++)if(fa=va[L][X]){da=0;for(ba=fa.length;da<ba;da++)j.uvs[L][da]=fa[da]}j.material=aa;j.faceMaterial=v.materialIndex!==null?ca[v.materialIndex]:null;j.z=j.centroidScreen.z;A.elements.push(j)}}else if(T instanceof THREE.Line){w.multiply(B,U);X=T.geometry.vertices;L=b();L.positionScreen.copy(X[0].position);w.multiplyVector4(L.positionScreen);W=1;for(v=X.length;W<v;W++)if(L=b(),L.positionScreen.copy(X[W].position),w.multiplyVector4(L.positionScreen),
 Z=k[i-2],y.copy(L.positionScreen),K.copy(Z.positionScreen),d(y,K))y.multiplyScalar(1/y.w),K.multiplyScalar(1/K.w),T=r[s]=r[s]||new THREE.RenderableLine,s++,n=T,n.v1.positionScreen.copy(y),n.v2.positionScreen.copy(K),n.z=Math.max(y.z,K.z),n.material=aa,A.elements.push(n)}a=0;for(l=A.sprites.length;a<l;a++)if(T=A.sprites[a].object,U=T.matrixWorld,T instanceof THREE.Particle&&(D.set(U.n14,U.n24,U.n34,1),B.multiplyVector4(D),D.z/=D.w,D.z>0&&D.z<1))g=z[t]=z[t]||new THREE.RenderableParticle,t++,u=g,u.x=
 D.x/D.w,u.y=D.y/D.w,u.z=D.z,u.rotation=T.rotation.z,u.scale.x=T.scale.x*Math.abs(u.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14)),u.scale.y=T.scale.y*Math.abs(u.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24)),u.material=T.material,A.elements.push(u);f&&A.elements.sort(c);return A}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
@@ -77,7 +77,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,i=this.w,k=i*c+g*e-h*d,j=i*d+h*c-f*e,o=i*e+f*d-g*c,c=-f*
 c-g*d-h*e;b.x=k*i+c*-f+j*-h-o*-g;b.y=j*i+c*-g+o*-f-k*-h;b.z=o*i+c*-h+k*-g-j*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -88,8 +88,8 @@ b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<
 this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
 d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
 b,c,d,e,f,B){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;j=g[e];o=g[f];p=g[B];m=i.x-h.x;q=k.x-h.x;n=i.y-h.y;s=k.y-h.y;r=i.z-h.z;u=k.z-h.z;t=o.u-j.u;z=p.u-j.u;A=o.v-j.v;E=p.v-j.v;D=1/(t*E-z*A);y.set((E*m-A*q)*D,(E*n-A*s)*D,(E*r-A*u)*D);K.set((t*q-z*m)*D,(t*s-z*n)*D,(t*u-z*r)*D);w[b].addSelf(y);w[c].addSelf(y);w[d].addSelf(y);G[b].addSelf(K);G[c].addSelf(K);G[d].addSelf(K)}var b,c,d,e,f,g,h,i,k,j,o,p,m,q,n,s,r,u,t,z,A,E,D,B,w=[],G=[],y=new THREE.Vector3,K=new THREE.Vector3,
-$=new THREE.Vector3,Q=new THREE.Vector3,X=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)w[b]=new THREE.Vector3,G[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var S=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)X.copy(f.vertexNormals[d]),e=f[S[d]],
-B=w[e],$.copy(B),$.subSelf(X.multiplyScalar(X.dot(B))).normalize(),Q.cross(f.vertexNormals[d],B),e=Q.dot(G[e]),e=e<0?-1:1,f.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
+$=new THREE.Vector3,Q=new THREE.Vector3,Y=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)w[b]=new THREE.Vector3,G[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var S=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)Y.copy(f.vertexNormals[d]),e=f[S[d]],
+B=w[e],$.copy(B),$.subSelf(Y.multiplyScalar(Y.dot(B))).normalize(),Q.cross(f.vertexNormals[d],B),e=Q.dot(G[e]),e=e<0?-1:1,f.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
 this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=
 0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),a[d]===void 0?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];f=0;for(g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=
 c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
@@ -155,38 +155,38 @@ THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var i,k,j,o,p,m,q,n;a=b.projectScene(c,d);i=0;for(k=a.length;i<k;i++)if(p=a[i],p instanceof THREE.RenderableParticle){q=p.x*e+e;n=p.y*f+f;j=0;for(o=p.material.length;j<o;j++)if(m=p.material[j],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=q+"px",m.style.top=n+"px"}}};
 THREE.CanvasRenderer=function(a){function b(a){if(u!=a)n.globalAlpha=u=a}function c(a){if(t!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}t=a}}function d(a){if(z!=a)n.strokeStyle=z=a}function e(a){if(A!=a)n.fillStyle=A=a}var f=this,g,h,i,k=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-o,p,m,q,n=j.getContext("2d"),s=new THREE.Color(0),r=0,u=1,t=0,z=null,A=null,E=null,D=null,B=null,w,G,y,K,$=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,X,S,R,l,V,v,W,L,Z,da,ba,T,U=new THREE.Color,O=new THREE.Color,aa=new THREE.Color,ca=new THREE.Color,ga=new THREE.Color,va=[],fa=[],na,la,sa,ja,Ba,wa,xa,ya,za,Aa,qa=new THREE.Rectangle,ta=new THREE.Rectangle,pa=new THREE.Rectangle,Ia=!1,ea=new THREE.Color,Y=new THREE.Color,H=new THREE.Color,ra=new THREE.Vector3,Ka,La,Oa,Ca,Ma,C,a=16;Ka=document.createElement("canvas");
-Ka.width=Ka.height=2;La=Ka.getContext("2d");La.fillStyle="rgba(0,0,0,1)";La.fillRect(0,0,2,2);Oa=La.getImageData(0,0,2,2);Ca=Oa.data;Ma=document.createElement("canvas");Ma.width=Ma.height=a;C=Ma.getContext("2d");C.translate(-a/2,-a/2);C.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;p=b;m=Math.floor(o/2);q=Math.floor(p/2);j.width=o;j.height=p;qa.set(-m,-q,m,q);ta.set(-m,-q,m,q);u=1;t=0;B=
-D=E=A=z=null};this.setClearColor=function(a,b){s.copy(a);r=b;ta.set(-m,-q,m,q)};this.setClearColorHex=function(a,b){s.setHex(a);r=b;ta.set(-m,-q,m,q)};this.clear=function(){n.setTransform(1,0,0,-1,m,q);ta.isEmpty()||(ta.minSelf(qa),ta.inflate(2),r<1&&n.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight())),r>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+r+")"),n.fillRect(Math.floor(ta.getX()),
-Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))),ta.empty())};this.render=function(a,j){function o(a){var b,c,d,e;ea.setRGB(0,0,0);Y.setRGB(0,0,0);H.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ea.r+=e.r,ea.g+=e.g,ea.b+=e.b):d instanceof THREE.DirectionalLight?(Y.r+=e.r,Y.g+=e.g,Y.b+=e.b):d instanceof THREE.PointLight&&(H.r+=e.r,H.g+=e.g,H.b+=e.b)}function p(a,b,c,d){var e,f,g,ea,h,l;e=0;for(f=a.length;e<f;e++)g=a[e],ea=g.color,
+o,p,m,q,n=j.getContext("2d"),s=new THREE.Color(0),r=0,u=1,t=0,z=null,A=null,E=null,D=null,B=null,w,G,y,K,$=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,Y,S,R,l,W,v,X,L,Z,da,ba,T,U=new THREE.Color,O=new THREE.Color,aa=new THREE.Color,ca=new THREE.Color,ga=new THREE.Color,va=[],fa=[],na,ja,sa,qa,Ba,wa,xa,ya,za,Aa,la=new THREE.Rectangle,ta=new THREE.Rectangle,pa=new THREE.Rectangle,Ia=!1,ea=new THREE.Color,V=new THREE.Color,H=new THREE.Color,ra=new THREE.Vector3,Ka,La,Oa,Ca,Ma,C,a=16;Ka=document.createElement("canvas");
+Ka.width=Ka.height=2;La=Ka.getContext("2d");La.fillStyle="rgba(0,0,0,1)";La.fillRect(0,0,2,2);Oa=La.getImageData(0,0,2,2);Ca=Oa.data;Ma=document.createElement("canvas");Ma.width=Ma.height=a;C=Ma.getContext("2d");C.translate(-a/2,-a/2);C.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;p=b;m=Math.floor(o/2);q=Math.floor(p/2);j.width=o;j.height=p;la.set(-m,-q,m,q);ta.set(-m,-q,m,q);u=1;t=0;B=
+D=E=A=z=null};this.setClearColor=function(a,b){s.copy(a);r=b;ta.set(-m,-q,m,q)};this.setClearColorHex=function(a,b){s.setHex(a);r=b;ta.set(-m,-q,m,q)};this.clear=function(){n.setTransform(1,0,0,-1,m,q);ta.isEmpty()||(ta.minSelf(la),ta.inflate(2),r<1&&n.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight())),r>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+r+")"),n.fillRect(Math.floor(ta.getX()),
+Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))),ta.empty())};this.render=function(a,j){function o(a){var b,c,d,e;ea.setRGB(0,0,0);V.setRGB(0,0,0);H.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ea.r+=e.r,ea.g+=e.g,ea.b+=e.b):d instanceof THREE.DirectionalLight?(V.r+=e.r,V.g+=e.g,V.b+=e.b):d instanceof THREE.PointLight&&(H.r+=e.r,H.g+=e.g,H.b+=e.b)}function p(a,b,c,d){var e,f,g,ea,h,l;e=0;for(f=a.length;e<f;e++)g=a[e],ea=g.color,
 g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),l=c.dot(h),l<=0||(l*=g.intensity,d.r+=ea.r*l,d.g+=ea.g*l,d.b+=ea.b*l)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),l=c.dot(ra.sub(h,b).normalize()),l<=0||(l*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),l!=0&&(l*=g.intensity,d.r+=ea.r*l,d.g+=ea.g*l,d.b+=ea.b*l)))}function s(a,f,g){b(g.opacity);c(g.blending);var ea,h,l,i,j,H;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=g.map.image,j=i.width>>
-1,H=i.height>>1,g=f.scale.x*m,l=f.scale.y*q,ea=g*j,h=l*H,pa.set(a.x-ea,a.y-h,a.x+ea,a.y+h),qa.intersects(pa)&&(n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(g,-l),n.translate(-j,-H),n.drawImage(i,0,0),n.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(ea=f.scale.x*m,h=f.scale.y*q,pa.set(a.x-ea,a.y-h,a.x+ea,a.y+h),qa.intersects(pa)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(ea,h),g.program(n),n.restore()))}
-function r(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(E!=a)n.lineWidth=E=a;a=g.linecap;if(D!=a)n.lineCap=D=a;a=g.linejoin;if(B!=a)n.lineJoin=B=a;d(g.color.getContextStyle());n.stroke();pa.inflate(g.linewidth*2)}}function u(a,d,e,g,h,H,k,Y){f.info.render.vertices+=3;f.info.render.faces++;b(Y.opacity);c(Y.blending);X=a.positionScreen.x;
-S=a.positionScreen.y;R=d.positionScreen.x;l=d.positionScreen.y;V=e.positionScreen.x;v=e.positionScreen.y;z(X,S,R,l,V,v);if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.mapping instanceof THREE.UVMapping&&(ja=k.uvs[0],Pa(X,S,R,l,V,v,ja[g].u,ja[g].v,ja[h].u,ja[h].v,ja[H].u,ja[H].v,Y.map));else if(Y.envMap){if(Y.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,ra.copy(k.vertexNormalsWorld[g]),Ba=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,wa=-(ra.x*a.n21+ra.y*a.n22+
-ra.z*a.n23)*0.5+0.5,ra.copy(k.vertexNormalsWorld[h]),xa=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,ya=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,ra.copy(k.vertexNormalsWorld[H]),za=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,Aa=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,Pa(X,S,R,l,V,v,Ba,wa,xa,ya,za,Aa,Y.envMap)}else Y.wireframe?J(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ea(Y.color);else if(Y instanceof THREE.MeshLambertMaterial)Y.map&&!Y.wireframe&&(Y.map.mapping instanceof
-THREE.UVMapping&&(ja=k.uvs[0],Pa(X,S,R,l,V,v,ja[g].u,ja[g].v,ja[h].u,ja[h].v,ja[H].u,ja[H].v,Y.map)),c(THREE.SubtractiveBlending)),Ia?!Y.wireframe&&Y.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(O.r=aa.r=ca.r=ea.r,O.g=aa.g=ca.g=ea.g,O.b=aa.b=ca.b=ea.b,p(i,k.v1.positionWorld,k.vertexNormalsWorld[0],O),p(i,k.v2.positionWorld,k.vertexNormalsWorld[1],aa),p(i,k.v3.positionWorld,k.vertexNormalsWorld[2],ca),O.r=Math.max(0,Math.min(Y.color.r*O.r,1)),O.g=Math.max(0,Math.min(Y.color.g*O.g,
-1)),O.b=Math.max(0,Math.min(Y.color.b*O.b,1)),aa.r=Math.max(0,Math.min(Y.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(Y.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(Y.color.b*aa.b,1)),ca.r=Math.max(0,Math.min(Y.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(Y.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(Y.color.b*ca.b,1)),ga.r=(aa.r+ca.r)*0.5,ga.g=(aa.g+ca.g)*0.5,ga.b=(aa.b+ca.b)*0.5,sa=P(O,aa,ca,ga),Ja(X,S,R,l,V,v,0,0,1,0,0,1,sa)):(U.r=ea.r,U.g=ea.g,U.b=ea.b,p(i,k.centroidWorld,k.normalWorld,U),U.r=Math.max(0,
-Math.min(Y.color.r*U.r,1)),U.g=Math.max(0,Math.min(Y.color.g*U.g,1)),U.b=Math.max(0,Math.min(Y.color.b*U.b,1)),Y.wireframe?J(U,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ea(U)):Y.wireframe?J(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ea(Y.color);else if(Y instanceof THREE.MeshDepthMaterial)na=j.near,la=j.far,O.r=O.g=O.b=1-M(a.positionScreen.z,na,la),aa.r=aa.g=aa.b=1-M(d.positionScreen.z,na,la),ca.r=ca.g=ca.b=1-M(e.positionScreen.z,na,la),ga.r=(aa.r+ca.r)*
-0.5,ga.g=(aa.g+ca.g)*0.5,ga.b=(aa.b+ca.b)*0.5,sa=P(O,aa,ca,ga),Ja(X,S,R,l,V,v,0,0,1,0,0,1,sa);else if(Y instanceof THREE.MeshNormalMaterial)U.r=N(k.normalWorld.x),U.g=N(k.normalWorld.y),U.b=N(k.normalWorld.z),Y.wireframe?J(U,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ea(U)}function t(a,d,e,g,h,Y,H,k,n){f.info.render.vertices+=4;f.info.render.faces++;b(k.opacity);c(k.blending);if(k.map||k.envMap)u(a,d,g,0,1,3,H,k,n),u(h,e,Y,1,2,3,H,k,n);else if(X=a.positionScreen.x,S=a.positionScreen.y,
-R=d.positionScreen.x,l=d.positionScreen.y,V=e.positionScreen.x,v=e.positionScreen.y,W=g.positionScreen.x,L=g.positionScreen.y,Z=h.positionScreen.x,da=h.positionScreen.y,ba=Y.positionScreen.x,T=Y.positionScreen.y,k instanceof THREE.MeshBasicMaterial)A(X,S,R,l,V,v,W,L),k.wireframe?J(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(k.color);else if(k instanceof THREE.MeshLambertMaterial)Ia?!k.wireframe&&k.shading==THREE.SmoothShading&&H.vertexNormalsWorld.length==4?(O.r=aa.r=ca.r=
+1,H=i.height>>1,g=f.scale.x*m,l=f.scale.y*q,ea=g*j,h=l*H,pa.set(a.x-ea,a.y-h,a.x+ea,a.y+h),la.intersects(pa)&&(n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(g,-l),n.translate(-j,-H),n.drawImage(i,0,0),n.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(ea=f.scale.x*m,h=f.scale.y*q,pa.set(a.x-ea,a.y-h,a.x+ea,a.y+h),la.intersects(pa)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(ea,h),g.program(n),n.restore()))}
+function r(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(E!=a)n.lineWidth=E=a;a=g.linecap;if(D!=a)n.lineCap=D=a;a=g.linejoin;if(B!=a)n.lineJoin=B=a;d(g.color.getContextStyle());n.stroke();pa.inflate(g.linewidth*2)}}function u(a,d,e,g,h,H,k,V){f.info.render.vertices+=3;f.info.render.faces++;b(V.opacity);c(V.blending);Y=a.positionScreen.x;
+S=a.positionScreen.y;R=d.positionScreen.x;l=d.positionScreen.y;W=e.positionScreen.x;v=e.positionScreen.y;z(Y,S,R,l,W,v);if(V instanceof THREE.MeshBasicMaterial)if(V.map)V.map.mapping instanceof THREE.UVMapping&&(qa=k.uvs[0],Pa(Y,S,R,l,W,v,qa[g].u,qa[g].v,qa[h].u,qa[h].v,qa[H].u,qa[H].v,V.map));else if(V.envMap){if(V.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,ra.copy(k.vertexNormalsWorld[g]),Ba=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,wa=-(ra.x*a.n21+ra.y*a.n22+
+ra.z*a.n23)*0.5+0.5,ra.copy(k.vertexNormalsWorld[h]),xa=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,ya=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,ra.copy(k.vertexNormalsWorld[H]),za=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,Aa=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,Pa(Y,S,R,l,W,v,Ba,wa,xa,ya,za,Aa,V.envMap)}else V.wireframe?J(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ea(V.color);else if(V instanceof THREE.MeshLambertMaterial)V.map&&!V.wireframe&&(V.map.mapping instanceof
+THREE.UVMapping&&(qa=k.uvs[0],Pa(Y,S,R,l,W,v,qa[g].u,qa[g].v,qa[h].u,qa[h].v,qa[H].u,qa[H].v,V.map)),c(THREE.SubtractiveBlending)),Ia?!V.wireframe&&V.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(O.r=aa.r=ca.r=ea.r,O.g=aa.g=ca.g=ea.g,O.b=aa.b=ca.b=ea.b,p(i,k.v1.positionWorld,k.vertexNormalsWorld[0],O),p(i,k.v2.positionWorld,k.vertexNormalsWorld[1],aa),p(i,k.v3.positionWorld,k.vertexNormalsWorld[2],ca),O.r=Math.max(0,Math.min(V.color.r*O.r,1)),O.g=Math.max(0,Math.min(V.color.g*O.g,
+1)),O.b=Math.max(0,Math.min(V.color.b*O.b,1)),aa.r=Math.max(0,Math.min(V.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(V.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(V.color.b*aa.b,1)),ca.r=Math.max(0,Math.min(V.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(V.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(V.color.b*ca.b,1)),ga.r=(aa.r+ca.r)*0.5,ga.g=(aa.g+ca.g)*0.5,ga.b=(aa.b+ca.b)*0.5,sa=P(O,aa,ca,ga),Ja(Y,S,R,l,W,v,0,0,1,0,0,1,sa)):(U.r=ea.r,U.g=ea.g,U.b=ea.b,p(i,k.centroidWorld,k.normalWorld,U),U.r=Math.max(0,
+Math.min(V.color.r*U.r,1)),U.g=Math.max(0,Math.min(V.color.g*U.g,1)),U.b=Math.max(0,Math.min(V.color.b*U.b,1)),V.wireframe?J(U,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ea(U)):V.wireframe?J(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ea(V.color);else if(V instanceof THREE.MeshDepthMaterial)na=j.near,ja=j.far,O.r=O.g=O.b=1-M(a.positionScreen.z,na,ja),aa.r=aa.g=aa.b=1-M(d.positionScreen.z,na,ja),ca.r=ca.g=ca.b=1-M(e.positionScreen.z,na,ja),ga.r=(aa.r+ca.r)*
+0.5,ga.g=(aa.g+ca.g)*0.5,ga.b=(aa.b+ca.b)*0.5,sa=P(O,aa,ca,ga),Ja(Y,S,R,l,W,v,0,0,1,0,0,1,sa);else if(V instanceof THREE.MeshNormalMaterial)U.r=N(k.normalWorld.x),U.g=N(k.normalWorld.y),U.b=N(k.normalWorld.z),V.wireframe?J(U,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ea(U)}function t(a,d,e,g,h,V,H,k,n){f.info.render.vertices+=4;f.info.render.faces++;b(k.opacity);c(k.blending);if(k.map||k.envMap)u(a,d,g,0,1,3,H,k,n),u(h,e,V,1,2,3,H,k,n);else if(Y=a.positionScreen.x,S=a.positionScreen.y,
+R=d.positionScreen.x,l=d.positionScreen.y,W=e.positionScreen.x,v=e.positionScreen.y,X=g.positionScreen.x,L=g.positionScreen.y,Z=h.positionScreen.x,da=h.positionScreen.y,ba=V.positionScreen.x,T=V.positionScreen.y,k instanceof THREE.MeshBasicMaterial)A(Y,S,R,l,W,v,X,L),k.wireframe?J(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(k.color);else if(k instanceof THREE.MeshLambertMaterial)Ia?!k.wireframe&&k.shading==THREE.SmoothShading&&H.vertexNormalsWorld.length==4?(O.r=aa.r=ca.r=
 ga.r=ea.r,O.g=aa.g=ca.g=ga.g=ea.g,O.b=aa.b=ca.b=ga.b=ea.b,p(i,H.v1.positionWorld,H.vertexNormalsWorld[0],O),p(i,H.v2.positionWorld,H.vertexNormalsWorld[1],aa),p(i,H.v4.positionWorld,H.vertexNormalsWorld[3],ca),p(i,H.v3.positionWorld,H.vertexNormalsWorld[2],ga),O.r=Math.max(0,Math.min(k.color.r*O.r,1)),O.g=Math.max(0,Math.min(k.color.g*O.g,1)),O.b=Math.max(0,Math.min(k.color.b*O.b,1)),aa.r=Math.max(0,Math.min(k.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(k.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(k.color.b*
-aa.b,1)),ca.r=Math.max(0,Math.min(k.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(k.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(k.color.b*ca.b,1)),ga.r=Math.max(0,Math.min(k.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(k.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(k.color.b*ga.b,1)),sa=P(O,aa,ca,ga),z(X,S,R,l,W,L),Ja(X,S,R,l,W,L,0,0,1,0,0,1,sa),z(Z,da,V,v,ba,T),Ja(Z,da,V,v,ba,T,1,0,1,1,0,1,sa)):(U.r=ea.r,U.g=ea.g,U.b=ea.b,p(i,H.centroidWorld,H.normalWorld,U),U.r=Math.max(0,Math.min(k.color.r*U.r,1)),U.g=Math.max(0,
-Math.min(k.color.g*U.g,1)),U.b=Math.max(0,Math.min(k.color.b*U.b,1)),A(X,S,R,l,V,v,W,L),k.wireframe?J(U,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(U)):(A(X,S,R,l,V,v,W,L),k.wireframe?J(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(k.color));else if(k instanceof THREE.MeshNormalMaterial)U.r=N(H.normalWorld.x),U.g=N(H.normalWorld.y),U.b=N(H.normalWorld.z),A(X,S,R,l,V,v,W,L),k.wireframe?J(U,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(U);
-else if(k instanceof THREE.MeshDepthMaterial)na=j.near,la=j.far,O.r=O.g=O.b=1-M(a.positionScreen.z,na,la),aa.r=aa.g=aa.b=1-M(d.positionScreen.z,na,la),ca.r=ca.g=ca.b=1-M(g.positionScreen.z,na,la),ga.r=ga.g=ga.b=1-M(e.positionScreen.z,na,la),sa=P(O,aa,ca,ga),z(X,S,R,l,W,L),Ja(X,S,R,l,W,L,0,0,1,0,0,1,sa),z(Z,da,V,v,ba,T),Ja(Z,da,V,v,ba,T,1,0,1,1,0,1,sa)}function z(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function A(a,b,c,d,e,f,g,ea){n.beginPath();
-n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,ea);n.lineTo(a,b);n.closePath()}function J(a,b,c,e){if(E!=b)n.lineWidth=E=b;if(D!=c)n.lineCap=D=c;if(B!=e)n.lineJoin=B=e;d(a.getContextStyle());n.stroke();pa.inflate(b*2)}function Ea(a){e(a.getContextStyle());n.fill()}function Pa(a,b,c,d,f,g,ea,h,l,i,k,j,H){if(H.image.width!=0){if(H.needsUpdate==!0||va[H.id]==void 0){var Y=H.wrapS==THREE.RepeatWrapping,m=H.wrapT==THREE.RepeatWrapping;va[H.id]=n.createPattern(H.image,Y&&m?"repeat":Y&&!m?"repeat-x":
-!Y&&m?"repeat-y":"no-repeat");H.needsUpdate=!1}e(va[H.id]);var Y=H.offset.x/H.repeat.x,m=H.offset.y/H.repeat.y,o=H.image.width*H.repeat.x,p=H.image.height*H.repeat.y,ea=(ea+Y)*o,h=(h+m)*p,l=(l+Y)*o,i=(i+m)*p,k=(k+Y)*o,j=(j+m)*p;c-=a;d-=b;f-=a;g-=b;l-=ea;i-=h;k-=ea;j-=h;Y=l*j-k*i;if(Y==0){if(fa[H.id]==void 0)b=document.createElement("canvas"),b.width=H.image.width,b.height=H.image.height,a=b.getContext("2d"),a.drawImage(H.image,0,0),fa[H.id]=a.getImageData(0,0,H.image.width,H.image.height).data,delete b;
-b=fa[H.id];ea=(Math.floor(ea)+Math.floor(h)*H.image.width)*4;U.setRGB(b[ea]/255,b[ea+1]/255,b[ea+2]/255);Ea(U)}else Y=1/Y,H=(j*c-i*f)*Y,i=(j*d-i*g)*Y,c=(l*f-k*c)*Y,d=(l*g-k*d)*Y,a=a-H*ea-c*h,ea=b-i*ea-d*h,n.save(),n.transform(H,i,c,d,a,ea),n.fill(),n.restore()}}function Ja(a,b,c,d,e,f,g,ea,h,l,i,k,H){var Y,j;Y=H.width-1;j=H.height-1;g*=Y;ea*=j;h*=Y;l*=j;i*=Y;k*=j;c-=a;d-=b;e-=a;f-=b;h-=g;l-=ea;i-=g;k-=ea;j=1/(h*k-i*l);Y=(k*c-l*e)*j;l=(k*d-l*f)*j;c=(h*e-i*c)*j;d=(h*f-i*d)*j;a=a-Y*g-c*ea;b=b-l*g-d*
-ea;n.save();n.transform(Y,l,c,d,a,b);n.clip();n.drawImage(H,0,0);n.restore()}function P(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),ea=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),l=~~(c.g*255),c=~~(c.b*255),i=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);Ca[0]=e<0?0:e>255?255:e;Ca[1]=f<0?0:f>255?255:f;Ca[2]=a<0?0:a>255?255:a;Ca[4]=g<0?0:g>255?255:g;Ca[5]=ea<0?0:ea>255?255:ea;Ca[6]=b<0?0:b>255?255:b;Ca[8]=h<0?0:h>255?255:h;Ca[9]=l<0?0:l>255?255:l;Ca[10]=c<0?0:c>255?255:c;Ca[12]=i<0?
-0:i>255?255:i;Ca[13]=k<0?0:k>255?255:k;Ca[14]=d<0?0:d>255?255:d;La.putImageData(Oa,0,0);C.drawImage(Ka,0,0);return Ma}function M(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function N(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Fa(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Na,Qa,ua,Da;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,q);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,j,this.sortElements);h=g.elements;
+aa.b,1)),ca.r=Math.max(0,Math.min(k.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(k.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(k.color.b*ca.b,1)),ga.r=Math.max(0,Math.min(k.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(k.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(k.color.b*ga.b,1)),sa=P(O,aa,ca,ga),z(Y,S,R,l,X,L),Ja(Y,S,R,l,X,L,0,0,1,0,0,1,sa),z(Z,da,W,v,ba,T),Ja(Z,da,W,v,ba,T,1,0,1,1,0,1,sa)):(U.r=ea.r,U.g=ea.g,U.b=ea.b,p(i,H.centroidWorld,H.normalWorld,U),U.r=Math.max(0,Math.min(k.color.r*U.r,1)),U.g=Math.max(0,
+Math.min(k.color.g*U.g,1)),U.b=Math.max(0,Math.min(k.color.b*U.b,1)),A(Y,S,R,l,W,v,X,L),k.wireframe?J(U,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(U)):(A(Y,S,R,l,W,v,X,L),k.wireframe?J(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(k.color));else if(k instanceof THREE.MeshNormalMaterial)U.r=N(H.normalWorld.x),U.g=N(H.normalWorld.y),U.b=N(H.normalWorld.z),A(Y,S,R,l,W,v,X,L),k.wireframe?J(U,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(U);
+else if(k instanceof THREE.MeshDepthMaterial)na=j.near,ja=j.far,O.r=O.g=O.b=1-M(a.positionScreen.z,na,ja),aa.r=aa.g=aa.b=1-M(d.positionScreen.z,na,ja),ca.r=ca.g=ca.b=1-M(g.positionScreen.z,na,ja),ga.r=ga.g=ga.b=1-M(e.positionScreen.z,na,ja),sa=P(O,aa,ca,ga),z(Y,S,R,l,X,L),Ja(Y,S,R,l,X,L,0,0,1,0,0,1,sa),z(Z,da,W,v,ba,T),Ja(Z,da,W,v,ba,T,1,0,1,1,0,1,sa)}function z(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function A(a,b,c,d,e,f,g,ea){n.beginPath();
+n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,ea);n.lineTo(a,b);n.closePath()}function J(a,b,c,e){if(E!=b)n.lineWidth=E=b;if(D!=c)n.lineCap=D=c;if(B!=e)n.lineJoin=B=e;d(a.getContextStyle());n.stroke();pa.inflate(b*2)}function Ea(a){e(a.getContextStyle());n.fill()}function Pa(a,b,c,d,f,g,ea,h,l,i,k,j,V){if(V.image.width!=0){if(V.needsUpdate==!0||va[V.id]==void 0){var H=V.wrapS==THREE.RepeatWrapping,m=V.wrapT==THREE.RepeatWrapping;va[V.id]=n.createPattern(V.image,H&&m?"repeat":H&&!m?"repeat-x":
+!H&&m?"repeat-y":"no-repeat");V.needsUpdate=!1}e(va[V.id]);var H=V.offset.x/V.repeat.x,m=V.offset.y/V.repeat.y,o=V.image.width*V.repeat.x,p=V.image.height*V.repeat.y,ea=(ea+H)*o,h=(h+m)*p,l=(l+H)*o,i=(i+m)*p,k=(k+H)*o,j=(j+m)*p;c-=a;d-=b;f-=a;g-=b;l-=ea;i-=h;k-=ea;j-=h;H=l*j-k*i;if(H==0){if(fa[V.id]==void 0)b=document.createElement("canvas"),b.width=V.image.width,b.height=V.image.height,a=b.getContext("2d"),a.drawImage(V.image,0,0),fa[V.id]=a.getImageData(0,0,V.image.width,V.image.height).data,delete b;
+b=fa[V.id];ea=(Math.floor(ea)+Math.floor(h)*V.image.width)*4;U.setRGB(b[ea]/255,b[ea+1]/255,b[ea+2]/255);Ea(U)}else H=1/H,V=(j*c-i*f)*H,i=(j*d-i*g)*H,c=(l*f-k*c)*H,d=(l*g-k*d)*H,a=a-V*ea-c*h,ea=b-i*ea-d*h,n.save(),n.transform(V,i,c,d,a,ea),n.fill(),n.restore()}}function Ja(a,b,c,d,e,f,g,ea,h,l,i,V,k){var j,H;j=k.width-1;H=k.height-1;g*=j;ea*=H;h*=j;l*=H;i*=j;V*=H;c-=a;d-=b;e-=a;f-=b;h-=g;l-=ea;i-=g;V-=ea;H=1/(h*V-i*l);j=(V*c-l*e)*H;l=(V*d-l*f)*H;c=(h*e-i*c)*H;d=(h*f-i*d)*H;a=a-j*g-c*ea;b=b-l*g-d*
+ea;n.save();n.transform(j,l,c,d,a,b);n.clip();n.drawImage(k,0,0);n.restore()}function P(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),ea=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),l=~~(c.g*255),c=~~(c.b*255),i=~~(d.r*255),V=~~(d.g*255),d=~~(d.b*255);Ca[0]=e<0?0:e>255?255:e;Ca[1]=f<0?0:f>255?255:f;Ca[2]=a<0?0:a>255?255:a;Ca[4]=g<0?0:g>255?255:g;Ca[5]=ea<0?0:ea>255?255:ea;Ca[6]=b<0?0:b>255?255:b;Ca[8]=h<0?0:h>255?255:h;Ca[9]=l<0?0:l>255?255:l;Ca[10]=c<0?0:c>255?255:c;Ca[12]=i<0?
+0:i>255?255:i;Ca[13]=V<0?0:V>255?255:V;Ca[14]=d<0?0:d>255?255:d;La.putImageData(Oa,0,0);C.drawImage(Ka,0,0);return Ma}function M(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function N(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Fa(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Na,Qa,ua,Da;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,q);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,j,this.sortElements);h=g.elements;
 i=g.lights;(Ia=i.length>0)&&o(i);Na=0;for(Qa=h.length;Na<Qa;Na++)if(ua=h[Na],Da=ua.material,Da=Da instanceof THREE.MeshFaceMaterial?ua.faceMaterial:Da,!(Da==null||Da.opacity==0)){pa.empty();if(ua instanceof THREE.RenderableParticle)w=ua,w.x*=m,w.y*=q,s(w,ua,Da,a);else if(ua instanceof THREE.RenderableLine)w=ua.v1,G=ua.v2,w.positionScreen.x*=m,w.positionScreen.y*=q,G.positionScreen.x*=m,G.positionScreen.y*=q,pa.addPoint(w.positionScreen.x,w.positionScreen.y),pa.addPoint(G.positionScreen.x,G.positionScreen.y),
-qa.intersects(pa)&&r(w,G,ua,Da,a);else if(ua instanceof THREE.RenderableFace3)w=ua.v1,G=ua.v2,y=ua.v3,w.positionScreen.x*=m,w.positionScreen.y*=q,G.positionScreen.x*=m,G.positionScreen.y*=q,y.positionScreen.x*=m,y.positionScreen.y*=q,Da.overdraw&&(Fa(w.positionScreen,G.positionScreen),Fa(G.positionScreen,y.positionScreen),Fa(y.positionScreen,w.positionScreen)),pa.add3Points(w.positionScreen.x,w.positionScreen.y,G.positionScreen.x,G.positionScreen.y,y.positionScreen.x,y.positionScreen.y),qa.intersects(pa)&&
+la.intersects(pa)&&r(w,G,ua,Da,a);else if(ua instanceof THREE.RenderableFace3)w=ua.v1,G=ua.v2,y=ua.v3,w.positionScreen.x*=m,w.positionScreen.y*=q,G.positionScreen.x*=m,G.positionScreen.y*=q,y.positionScreen.x*=m,y.positionScreen.y*=q,Da.overdraw&&(Fa(w.positionScreen,G.positionScreen),Fa(G.positionScreen,y.positionScreen),Fa(y.positionScreen,w.positionScreen)),pa.add3Points(w.positionScreen.x,w.positionScreen.y,G.positionScreen.x,G.positionScreen.y,y.positionScreen.x,y.positionScreen.y),la.intersects(pa)&&
 u(w,G,y,0,1,2,ua,Da,a);else if(ua instanceof THREE.RenderableFace4)w=ua.v1,G=ua.v2,y=ua.v3,K=ua.v4,w.positionScreen.x*=m,w.positionScreen.y*=q,G.positionScreen.x*=m,G.positionScreen.y*=q,y.positionScreen.x*=m,y.positionScreen.y*=q,K.positionScreen.x*=m,K.positionScreen.y*=q,$.positionScreen.copy(G.positionScreen),Q.positionScreen.copy(K.positionScreen),Da.overdraw&&(Fa(w.positionScreen,G.positionScreen),Fa(G.positionScreen,K.positionScreen),Fa(K.positionScreen,w.positionScreen),Fa(y.positionScreen,
-$.positionScreen),Fa(y.positionScreen,Q.positionScreen)),pa.addPoint(w.positionScreen.x,w.positionScreen.y),pa.addPoint(G.positionScreen.x,G.positionScreen.y),pa.addPoint(y.positionScreen.x,y.positionScreen.y),pa.addPoint(K.positionScreen.x,K.positionScreen.y),qa.intersects(pa)&&t(w,G,y,K,$,Q,ua,Da,a);ta.addRectangle(pa)}n.setTransform(1,0,0,1,0,0)}};
+$.positionScreen),Fa(y.positionScreen,Q.positionScreen)),pa.addPoint(w.positionScreen.x,w.positionScreen.y),pa.addPoint(G.positionScreen.x,G.positionScreen.y),pa.addPoint(y.positionScreen.x,y.positionScreen.y),pa.addPoint(K.positionScreen.x,K.positionScreen.y),la.intersects(pa)&&t(w,G,y,K,$,Q,ua,Da,a);ta.addRectangle(pa)}n.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,k;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),k<=0||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(w.sub(i,b).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),k!=0&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function b(a){G[a]==null&&(G[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),X==0&&G[a].setAttribute("shape-rendering","crispEdges"));return G[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,j,o,p,m,q,n,s,r=new THREE.Rectangle,u=new THREE.Rectangle,t=!1,z=new THREE.Color,A=new THREE.Color,E=new THREE.Color,D=new THREE.Color,B,w=new THREE.Vector3,G=[],y=[],K,$,Q,X=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":X=1;break;case "low":X=0}};this.setSize=function(a,b){k=a;j=b;o=k/2;p=j/2;i.setAttribute("viewBox",-o+" "+-p+" "+k+" "+j);i.setAttribute("width",k);i.setAttribute("height",j);r.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,j){var l,G,v,w;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,j,this.sortElements);f=e.elements;
+"path"),Y==0&&G[a].setAttribute("shape-rendering","crispEdges"));return G[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,j,o,p,m,q,n,s,r=new THREE.Rectangle,u=new THREE.Rectangle,t=!1,z=new THREE.Color,A=new THREE.Color,E=new THREE.Color,D=new THREE.Color,B,w=new THREE.Vector3,G=[],y=[],K,$,Q,Y=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":Y=1;break;case "low":Y=0}};this.setSize=function(a,b){k=a;j=b;o=k/2;p=j/2;i.setAttribute("viewBox",-o+" "+-p+" "+k+" "+j);i.setAttribute("width",k);i.setAttribute("height",j);r.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,j){var l,G,v,w;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,j,this.sortElements);f=e.elements;
 g=e.lights;Q=$=0;if(t=g.length>0){A.setRGB(0,0,0);E.setRGB(0,0,0);D.setRGB(0,0,0);l=0;for(G=g.length;l<G;l++)w=g[l],v=w.color,w instanceof THREE.AmbientLight?(A.r+=v.r,A.g+=v.g,A.b+=v.b):w instanceof THREE.DirectionalLight?(E.r+=v.r,E.g+=v.g,E.b+=v.b):w instanceof THREE.PointLight&&(D.r+=v.r,D.g+=v.g,D.b+=v.b)}l=0;for(G=f.length;l<G;l++)if(v=f[l],w=v.material,w=w instanceof THREE.MeshFaceMaterial?v.faceMaterial:w,!(w==null||w.opacity==0))if(u.empty(),v instanceof THREE.RenderableParticle)m=v,m.x*=
-o,m.y*=-p;else if(v instanceof THREE.RenderableLine){if(m=v.v1,q=v.v2,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),r.intersects(u)){v=m;var L=q,Z=Q++;y[Z]==null&&(y[Z]=document.createElementNS("http://www.w3.org/2000/svg","line"),X==0&&y[Z].setAttribute("shape-rendering","crispEdges"));K=y[Z];K.setAttribute("x1",v.positionScreen.x);K.setAttribute("y1",v.positionScreen.y);
+o,m.y*=-p;else if(v instanceof THREE.RenderableLine){if(m=v.v1,q=v.v2,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),r.intersects(u)){v=m;var L=q,Z=Q++;y[Z]==null&&(y[Z]=document.createElementNS("http://www.w3.org/2000/svg","line"),Y==0&&y[Z].setAttribute("shape-rendering","crispEdges"));K=y[Z];K.setAttribute("x1",v.positionScreen.x);K.setAttribute("y1",v.positionScreen.y);
 K.setAttribute("x2",L.positionScreen.x);K.setAttribute("y2",L.positionScreen.y);w instanceof THREE.LineBasicMaterial&&(K.setAttribute("style","fill: none; stroke: "+w.color.getContextStyle()+"; stroke-width: "+w.linewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.linecap+"; stroke-linejoin: "+w.linejoin),i.appendChild(K))}}else if(v instanceof THREE.RenderableFace3){if(m=v.v1,q=v.v2,n=v.v3,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,n.positionScreen.x*=
 o,n.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),r.intersects(u)){var L=m,Z=q,da=n;d.info.render.vertices+=3;d.info.render.faces++;K=b($++);K.setAttribute("d","M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+Z.positionScreen.x+" "+Z.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");w instanceof THREE.MeshBasicMaterial?z.copy(w.color):w instanceof THREE.MeshLambertMaterial?
 t?(z.r=A.r,z.g=A.g,z.b=A.b,a(g,v.centroidWorld,v.normalWorld,z),z.r=Math.max(0,Math.min(w.color.r*z.r,1)),z.g=Math.max(0,Math.min(w.color.g*z.g,1)),z.b=Math.max(0,Math.min(w.color.b*z.b,1))):z.copy(w.color):w instanceof THREE.MeshDepthMaterial?(B=1-w.__2near/(w.__farPlusNear-v.z*w.__farMinusNear),z.setRGB(B,B,B)):w instanceof THREE.MeshNormalMaterial&&z.setRGB(c(v.normalWorld.x),c(v.normalWorld.y),c(v.normalWorld.z));w.wireframe?K.setAttribute("style","fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+
@@ -253,12 +253,12 @@ d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&l.unif
 a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function D(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;
 default:return l.LINEAR}}function B(a){switch(a){case THREE.RepeatWrapping:return l.REPEAT;case THREE.ClampToEdgeWrapping:return l.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return l.MIRRORED_REPEAT;case THREE.NearestFilter:return l.NEAREST;case THREE.NearestMipMapNearestFilter:return l.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return l.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return l.LINEAR;case THREE.LinearMipMapNearestFilter:return l.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return l.LINEAR_MIPMAP_LINEAR;
 case THREE.ByteType:return l.BYTE;case THREE.UnsignedByteType:return l.UNSIGNED_BYTE;case THREE.ShortType:return l.SHORT;case THREE.UnsignedShortType:return l.UNSIGNED_SHORT;case THREE.IntType:return l.INT;case THREE.UnsignedShortType:return l.UNSIGNED_INT;case THREE.FloatType:return l.FLOAT;case THREE.AlphaFormat:return l.ALPHA;case THREE.RGBFormat:return l.RGB;case THREE.RGBAFormat:return l.RGBA;case THREE.LuminanceFormat:return l.LUMINANCE;case THREE.LuminanceAlphaFormat:return l.LUMINANCE_ALPHA}return 0}
-var a=a||{},w=a.canvas!==void 0?a.canvas:document.createElement("canvas"),G=a.precision!==void 0?a.precision:"highp",y=a.antialias!==void 0?a.antialias:!1,K=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,Q=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),X=a.clearAlpha!==void 0?a.clearAlpha:0,S=a.maxLights!==void 0?a.maxLights:4;this.domElement=w;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
+var a=a||{},w=a.canvas!==void 0?a.canvas:document.createElement("canvas"),G=a.precision!==void 0?a.precision:"highp",y=a.antialias!==void 0?a.antialias:!1,K=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,Q=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Y=a.clearAlpha!==void 0?a.clearAlpha:0,S=a.maxLights!==void 0?a.maxLights:4;this.domElement=w;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
 this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,
-vertices:0,faces:0,points:0}};var R=this,l,V=[],v=null,W=null,L=-1,Z=null,da=0,ba=null,T=null,U=null,O=null,aa=null,ca=null,ga=null,va=null,fa=null,na=0,la=0,sa=0,ja=0,Ba=0,wa=0,xa=new THREE.Frustum,ya=new THREE.Matrix4,za=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};l=function(){var a;try{if(!(a=w.getContext("experimental-webgl",{antialias:y,stencil:K,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";
-console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(Q.r,Q.g,Q.b,X);this.context=
-l;var qa=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return l};this.supportsVertexTextures=function(){return qa};this.setSize=function(a,b){w.width=a;w.height=b;this.setViewport(0,0,w.width,w.height)};this.setViewport=function(a,b,c,d){na=a;la=b;sa=c;ja=d;l.viewport(na,la,sa,ja)};this.setScissor=function(a,b,c,d){l.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Q.setHex(a);
-X=b;l.clearColor(Q.r,Q.g,Q.b,X)};this.setClearColor=function(a,b){Q.copy(a);X=b;l.clearColor(Q.r,Q.g,Q.b,X)};this.getClearColor=function(){return Q};this.getClearAlpha=function(){return X};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=l.COLOR_BUFFER_BIT;if(b===void 0||b)d|=l.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};
+vertices:0,faces:0,points:0}};var R=this,l,W=[],v=null,X=null,L=-1,Z=null,da=0,ba=null,T=null,U=null,O=null,aa=null,ca=null,ga=null,va=null,fa=null,na=0,ja=0,sa=0,qa=0,Ba=0,wa=0,xa=new THREE.Frustum,ya=new THREE.Matrix4,za=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};l=function(){var a;try{if(!(a=w.getContext("experimental-webgl",{antialias:y,stencil:K,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";
+console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(Q.r,Q.g,Q.b,Y);this.context=
+l;var la=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return l};this.supportsVertexTextures=function(){return la};this.setSize=function(a,b){w.width=a;w.height=b;this.setViewport(0,0,w.width,w.height)};this.setViewport=function(a,b,c,d){na=a;ja=b;sa=c;qa=d;l.viewport(na,ja,sa,qa)};this.setScissor=function(a,b,c,d){l.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Q.setHex(a);
+Y=b;l.clearColor(Q.r,Q.g,Q.b,Y)};this.setClearColor=function(a,b){Q.copy(a);Y=b;l.clearColor(Q.r,Q.g,Q.b,Y)};this.getClearColor=function(){return Q};this.getClearAlpha=function(){return Y};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=l.COLOR_BUFFER_BIT;if(b===void 0||b)d|=l.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};
 this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];l.deleteBuffer(c.__webglVertexBuffer);l.deleteBuffer(c.__webglNormalBuffer);l.deleteBuffer(c.__webglTangentBuffer);l.deleteBuffer(c.__webglColorBuffer);
 l.deleteBuffer(c.__webglUVBuffer);l.deleteBuffer(c.__webglUV2Buffer);l.deleteBuffer(c.__webglSkinVertexABuffer);l.deleteBuffer(c.__webglSkinVertexBBuffer);l.deleteBuffer(c.__webglSkinIndicesBuffer);l.deleteBuffer(c.__webglSkinWeightsBuffer);l.deleteBuffer(c.__webglFaceBuffer);l.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)l.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)l.deleteBuffer(c.__webglCustomAttributesList[d].buffer);
 R.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--};this.deallocateTexture=
@@ -290,17 +290,17 @@ l.createBuffer(),R.info.memory.geometries++,H=j,s=h,r=H.vertices.length,H.__vert
 [],H.__webglParticleCount=r,b(H,s),j.__dirtyVertices=!0,j.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(k in j=h.geometry,j.geometryGroups)H=j.geometryGroups[k],o(i.__webglObjects,H,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(j=h.geometry,o(i.__webglObjects,j,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof
 THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?q(i.__webglObjects,h):h instanceof THREE.Sprite?n(i.__webglSprites,h):h instanceof THREE.LensFlare?n(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&q(i.__webglObjectsImmediate,
 h),h.__webglActive=!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(K=a.__webglObjects[h].object,k=K.geometry,j=y=r=void 0,K instanceof THREE.Mesh){H=0;for(s=k.geometryGroupsList.length;H<s;H++)if(r=k.geometryGroupsList[H],j=c(K,r),y=j.attributes&&p(j),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||y){var G=K,y=l.DYNAMIC_DRAW,u=!k.dynamic,C=j;if(r.__inittedArrays){var t=d(C),w=e(C),B=f(C),
-E=t===THREE.SmoothShading,A=v=C=void 0,I=void 0,L=void 0,Q=void 0,J=void 0,D=void 0,$=void 0,Z=A=void 0,P=void 0,M=void 0,N=void 0,S=I=void 0,U=void 0,X=void 0,W=I=$=void 0,V=void 0,aa=N=M=P=J=void 0,T=I=N=M=P=aa=N=M=P=aa=N=M=P=void 0,O=void 0,ca=Q=void 0,ga=void 0,ba=void 0,va=void 0,fa=void 0,na=Z=ba=O=0,la=0,ja=T=A=0,ha=J=S=0,F=0,ma=void 0,ha=r.__vertexArray,ga=r.__uvArray,F=r.__uv2Array,ca=r.__normalArray,L=r.__tangentArray,U=r.__colorArray,W=r.__skinVertexAArray,V=r.__skinVertexBArray,D=r.__skinIndexArray,
-oa=r.__skinWeightArray,aa=r.__morphTargetsArrays,z=r.__webglCustomAttributesList,x=void 0,x=r.__faceArray,ma=r.__lineArray,X=G.geometry,qa=X.__dirtyElements,sa=X.__dirtyUvs,Q=X.__dirtyNormals,$=X.__dirtyTangents,za=X.__dirtyColors,va=X.__dirtyMorphTargets,fa=X.vertices,G=r.faces3,ia=r.faces4,ka=X.faces,ya=X.faceVertexUvs[0],Ba=X.faceVertexUvs[1],wa=X.skinVerticesA,xa=X.skinVerticesB,Aa=X.skinIndices,Ga=X.skinWeights,Ha=X.morphTargets;if(X.__dirtyVertices){C=0;for(v=G.length;C<v;C++)I=ka[G[C]],P=fa[I.a].position,
+E=t===THREE.SmoothShading,A=v=C=void 0,I=void 0,L=void 0,Q=void 0,J=void 0,D=void 0,$=void 0,Z=A=void 0,P=void 0,M=void 0,N=void 0,S=I=void 0,U=void 0,Y=void 0,X=I=$=void 0,W=void 0,aa=N=M=P=J=void 0,T=I=N=M=P=aa=N=M=P=aa=N=M=P=void 0,O=void 0,ca=Q=void 0,ga=void 0,ba=void 0,va=void 0,fa=void 0,na=Z=ba=O=0,la=0,ja=T=A=0,ha=J=S=0,F=0,ma=void 0,ha=r.__vertexArray,ga=r.__uvArray,F=r.__uv2Array,ca=r.__normalArray,L=r.__tangentArray,U=r.__colorArray,X=r.__skinVertexAArray,W=r.__skinVertexBArray,D=r.__skinIndexArray,
+oa=r.__skinWeightArray,aa=r.__morphTargetsArrays,z=r.__webglCustomAttributesList,x=void 0,x=r.__faceArray,ma=r.__lineArray,Y=G.geometry,qa=Y.__dirtyElements,sa=Y.__dirtyUvs,Q=Y.__dirtyNormals,$=Y.__dirtyTangents,za=Y.__dirtyColors,va=Y.__dirtyMorphTargets,fa=Y.vertices,G=r.faces3,ia=r.faces4,ka=Y.faces,ya=Y.faceVertexUvs[0],Ba=Y.faceVertexUvs[1],wa=Y.skinVerticesA,xa=Y.skinVerticesB,Aa=Y.skinIndices,Ga=Y.skinWeights,Ha=Y.morphTargets;if(Y.__dirtyVertices){C=0;for(v=G.length;C<v;C++)I=ka[G[C]],P=fa[I.a].position,
 M=fa[I.b].position,N=fa[I.c].position,ha[ba]=P.x,ha[ba+1]=P.y,ha[ba+2]=P.z,ha[ba+3]=M.x,ha[ba+4]=M.y,ha[ba+5]=M.z,ha[ba+6]=N.x,ha[ba+7]=N.y,ha[ba+8]=N.z,ba+=9;C=0;for(v=ia.length;C<v;C++)I=ka[ia[C]],P=fa[I.a].position,M=fa[I.b].position,N=fa[I.c].position,I=fa[I.d].position,ha[ba]=P.x,ha[ba+1]=P.y,ha[ba+2]=P.z,ha[ba+3]=M.x,ha[ba+4]=M.y,ha[ba+5]=M.z,ha[ba+6]=N.x,ha[ba+7]=N.y,ha[ba+8]=N.z,ha[ba+9]=I.x,ha[ba+10]=I.y,ha[ba+11]=I.z,ba+=12;l.bindBuffer(l.ARRAY_BUFFER,r.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,
 ha,y)}if(va){ba=0;for(va=Ha.length;ba<va;ba++){C=ha=0;for(v=G.length;C<v;C++)I=ka[G[C]],P=Ha[ba].vertices[I.a].position,M=Ha[ba].vertices[I.b].position,N=Ha[ba].vertices[I.c].position,fa=aa[ba],fa[ha]=P.x,fa[ha+1]=P.y,fa[ha+2]=P.z,fa[ha+3]=M.x,fa[ha+4]=M.y,fa[ha+5]=M.z,fa[ha+6]=N.x,fa[ha+7]=N.y,fa[ha+8]=N.z,ha+=9;C=0;for(v=ia.length;C<v;C++)I=ka[ia[C]],P=Ha[ba].vertices[I.a].position,M=Ha[ba].vertices[I.b].position,N=Ha[ba].vertices[I.c].position,I=Ha[ba].vertices[I.d].position,fa=aa[ba],fa[ha]=P.x,
 fa[ha+1]=P.y,fa[ha+2]=P.z,fa[ha+3]=M.x,fa[ha+4]=M.y,fa[ha+5]=M.z,fa[ha+6]=N.x,fa[ha+7]=N.y,fa[ha+8]=N.z,fa[ha+9]=I.x,fa[ha+10]=I.y,fa[ha+11]=I.z,ha+=12;l.bindBuffer(l.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[ba]);l.bufferData(l.ARRAY_BUFFER,aa[ba],y)}}if(Ga.length){C=0;for(v=G.length;C<v;C++)I=ka[G[C]],P=Ga[I.a],M=Ga[I.b],N=Ga[I.c],oa[J]=P.x,oa[J+1]=P.y,oa[J+2]=P.z,oa[J+3]=P.w,oa[J+4]=M.x,oa[J+5]=M.y,oa[J+6]=M.z,oa[J+7]=M.w,oa[J+8]=N.x,oa[J+9]=N.y,oa[J+10]=N.z,oa[J+11]=N.w,P=Aa[I.a],M=Aa[I.b],N=
-Aa[I.c],D[J]=P.x,D[J+1]=P.y,D[J+2]=P.z,D[J+3]=P.w,D[J+4]=M.x,D[J+5]=M.y,D[J+6]=M.z,D[J+7]=M.w,D[J+8]=N.x,D[J+9]=N.y,D[J+10]=N.z,D[J+11]=N.w,P=wa[I.a],M=wa[I.b],N=wa[I.c],W[J]=P.x,W[J+1]=P.y,W[J+2]=P.z,W[J+3]=1,W[J+4]=M.x,W[J+5]=M.y,W[J+6]=M.z,W[J+7]=1,W[J+8]=N.x,W[J+9]=N.y,W[J+10]=N.z,W[J+11]=1,P=xa[I.a],M=xa[I.b],N=xa[I.c],V[J]=P.x,V[J+1]=P.y,V[J+2]=P.z,V[J+3]=1,V[J+4]=M.x,V[J+5]=M.y,V[J+6]=M.z,V[J+7]=1,V[J+8]=N.x,V[J+9]=N.y,V[J+10]=N.z,V[J+11]=1,J+=12;C=0;for(v=ia.length;C<v;C++)I=ka[ia[C]],P=Ga[I.a],
-M=Ga[I.b],N=Ga[I.c],aa=Ga[I.d],oa[J]=P.x,oa[J+1]=P.y,oa[J+2]=P.z,oa[J+3]=P.w,oa[J+4]=M.x,oa[J+5]=M.y,oa[J+6]=M.z,oa[J+7]=M.w,oa[J+8]=N.x,oa[J+9]=N.y,oa[J+10]=N.z,oa[J+11]=N.w,oa[J+12]=aa.x,oa[J+13]=aa.y,oa[J+14]=aa.z,oa[J+15]=aa.w,P=Aa[I.a],M=Aa[I.b],N=Aa[I.c],aa=Aa[I.d],D[J]=P.x,D[J+1]=P.y,D[J+2]=P.z,D[J+3]=P.w,D[J+4]=M.x,D[J+5]=M.y,D[J+6]=M.z,D[J+7]=M.w,D[J+8]=N.x,D[J+9]=N.y,D[J+10]=N.z,D[J+11]=N.w,D[J+12]=aa.x,D[J+13]=aa.y,D[J+14]=aa.z,D[J+15]=aa.w,P=wa[I.a],M=wa[I.b],N=wa[I.c],aa=wa[I.d],W[J]=
-P.x,W[J+1]=P.y,W[J+2]=P.z,W[J+3]=1,W[J+4]=M.x,W[J+5]=M.y,W[J+6]=M.z,W[J+7]=1,W[J+8]=N.x,W[J+9]=N.y,W[J+10]=N.z,W[J+11]=1,W[J+12]=aa.x,W[J+13]=aa.y,W[J+14]=aa.z,W[J+15]=1,P=xa[I.a],M=xa[I.b],N=xa[I.c],I=xa[I.d],V[J]=P.x,V[J+1]=P.y,V[J+2]=P.z,V[J+3]=1,V[J+4]=M.x,V[J+5]=M.y,V[J+6]=M.z,V[J+7]=1,V[J+8]=N.x,V[J+9]=N.y,V[J+10]=N.z,V[J+11]=1,V[J+12]=I.x,V[J+13]=I.y,V[J+14]=I.z,V[J+15]=1,J+=16;J>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,W,y),l.bindBuffer(l.ARRAY_BUFFER,
-r.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,V,y),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,D,y),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,oa,y))}if(za&&w){C=0;for(v=G.length;C<v;C++)I=ka[G[C]],J=I.vertexColors,D=I.color,J.length===3&&w===THREE.VertexColors?(I=J[0],W=J[1],V=J[2]):V=W=I=D,U[S]=I.r,U[S+1]=I.g,U[S+2]=I.b,U[S+3]=W.r,U[S+4]=W.g,U[S+5]=W.b,U[S+6]=V.r,U[S+7]=V.g,U[S+8]=V.b,S+=9;C=0;for(v=ia.length;C<
-v;C++)I=ka[ia[C]],J=I.vertexColors,D=I.color,J.length===4&&w===THREE.VertexColors?(I=J[0],W=J[1],V=J[2],J=J[3]):J=V=W=I=D,U[S]=I.r,U[S+1]=I.g,U[S+2]=I.b,U[S+3]=W.r,U[S+4]=W.g,U[S+5]=W.b,U[S+6]=V.r,U[S+7]=V.g,U[S+8]=V.b,U[S+9]=J.r,U[S+10]=J.g,U[S+11]=J.b,S+=12;S>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,U,y))}if($&&X.hasTangents){C=0;for(v=G.length;C<v;C++)I=ka[G[C]],$=I.vertexTangents,S=$[0],U=$[1],X=$[2],L[T]=S.x,L[T+1]=S.y,L[T+2]=S.z,L[T+3]=S.w,L[T+4]=U.x,
-L[T+5]=U.y,L[T+6]=U.z,L[T+7]=U.w,L[T+8]=X.x,L[T+9]=X.y,L[T+10]=X.z,L[T+11]=X.w,T+=12;C=0;for(v=ia.length;C<v;C++)I=ka[ia[C]],$=I.vertexTangents,S=$[0],U=$[1],X=$[2],$=$[3],L[T]=S.x,L[T+1]=S.y,L[T+2]=S.z,L[T+3]=S.w,L[T+4]=U.x,L[T+5]=U.y,L[T+6]=U.z,L[T+7]=U.w,L[T+8]=X.x,L[T+9]=X.y,L[T+10]=X.z,L[T+11]=X.w,L[T+12]=$.x,L[T+13]=$.y,L[T+14]=$.z,L[T+15]=$.w,T+=16;l.bindBuffer(l.ARRAY_BUFFER,r.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,L,y)}if(Q&&t){C=0;for(v=G.length;C<v;C++)if(I=ka[G[C]],L=I.vertexNormals,
+Aa[I.c],D[J]=P.x,D[J+1]=P.y,D[J+2]=P.z,D[J+3]=P.w,D[J+4]=M.x,D[J+5]=M.y,D[J+6]=M.z,D[J+7]=M.w,D[J+8]=N.x,D[J+9]=N.y,D[J+10]=N.z,D[J+11]=N.w,P=wa[I.a],M=wa[I.b],N=wa[I.c],X[J]=P.x,X[J+1]=P.y,X[J+2]=P.z,X[J+3]=1,X[J+4]=M.x,X[J+5]=M.y,X[J+6]=M.z,X[J+7]=1,X[J+8]=N.x,X[J+9]=N.y,X[J+10]=N.z,X[J+11]=1,P=xa[I.a],M=xa[I.b],N=xa[I.c],W[J]=P.x,W[J+1]=P.y,W[J+2]=P.z,W[J+3]=1,W[J+4]=M.x,W[J+5]=M.y,W[J+6]=M.z,W[J+7]=1,W[J+8]=N.x,W[J+9]=N.y,W[J+10]=N.z,W[J+11]=1,J+=12;C=0;for(v=ia.length;C<v;C++)I=ka[ia[C]],P=Ga[I.a],
+M=Ga[I.b],N=Ga[I.c],aa=Ga[I.d],oa[J]=P.x,oa[J+1]=P.y,oa[J+2]=P.z,oa[J+3]=P.w,oa[J+4]=M.x,oa[J+5]=M.y,oa[J+6]=M.z,oa[J+7]=M.w,oa[J+8]=N.x,oa[J+9]=N.y,oa[J+10]=N.z,oa[J+11]=N.w,oa[J+12]=aa.x,oa[J+13]=aa.y,oa[J+14]=aa.z,oa[J+15]=aa.w,P=Aa[I.a],M=Aa[I.b],N=Aa[I.c],aa=Aa[I.d],D[J]=P.x,D[J+1]=P.y,D[J+2]=P.z,D[J+3]=P.w,D[J+4]=M.x,D[J+5]=M.y,D[J+6]=M.z,D[J+7]=M.w,D[J+8]=N.x,D[J+9]=N.y,D[J+10]=N.z,D[J+11]=N.w,D[J+12]=aa.x,D[J+13]=aa.y,D[J+14]=aa.z,D[J+15]=aa.w,P=wa[I.a],M=wa[I.b],N=wa[I.c],aa=wa[I.d],X[J]=
+P.x,X[J+1]=P.y,X[J+2]=P.z,X[J+3]=1,X[J+4]=M.x,X[J+5]=M.y,X[J+6]=M.z,X[J+7]=1,X[J+8]=N.x,X[J+9]=N.y,X[J+10]=N.z,X[J+11]=1,X[J+12]=aa.x,X[J+13]=aa.y,X[J+14]=aa.z,X[J+15]=1,P=xa[I.a],M=xa[I.b],N=xa[I.c],I=xa[I.d],W[J]=P.x,W[J+1]=P.y,W[J+2]=P.z,W[J+3]=1,W[J+4]=M.x,W[J+5]=M.y,W[J+6]=M.z,W[J+7]=1,W[J+8]=N.x,W[J+9]=N.y,W[J+10]=N.z,W[J+11]=1,W[J+12]=I.x,W[J+13]=I.y,W[J+14]=I.z,W[J+15]=1,J+=16;J>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,X,y),l.bindBuffer(l.ARRAY_BUFFER,
+r.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,W,y),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,D,y),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,oa,y))}if(za&&w){C=0;for(v=G.length;C<v;C++)I=ka[G[C]],J=I.vertexColors,D=I.color,J.length===3&&w===THREE.VertexColors?(I=J[0],X=J[1],W=J[2]):W=X=I=D,U[S]=I.r,U[S+1]=I.g,U[S+2]=I.b,U[S+3]=X.r,U[S+4]=X.g,U[S+5]=X.b,U[S+6]=W.r,U[S+7]=W.g,U[S+8]=W.b,S+=9;C=0;for(v=ia.length;C<
+v;C++)I=ka[ia[C]],J=I.vertexColors,D=I.color,J.length===4&&w===THREE.VertexColors?(I=J[0],X=J[1],W=J[2],J=J[3]):J=W=X=I=D,U[S]=I.r,U[S+1]=I.g,U[S+2]=I.b,U[S+3]=X.r,U[S+4]=X.g,U[S+5]=X.b,U[S+6]=W.r,U[S+7]=W.g,U[S+8]=W.b,U[S+9]=J.r,U[S+10]=J.g,U[S+11]=J.b,S+=12;S>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,U,y))}if($&&Y.hasTangents){C=0;for(v=G.length;C<v;C++)I=ka[G[C]],$=I.vertexTangents,S=$[0],U=$[1],Y=$[2],L[T]=S.x,L[T+1]=S.y,L[T+2]=S.z,L[T+3]=S.w,L[T+4]=U.x,
+L[T+5]=U.y,L[T+6]=U.z,L[T+7]=U.w,L[T+8]=Y.x,L[T+9]=Y.y,L[T+10]=Y.z,L[T+11]=Y.w,T+=12;C=0;for(v=ia.length;C<v;C++)I=ka[ia[C]],$=I.vertexTangents,S=$[0],U=$[1],Y=$[2],$=$[3],L[T]=S.x,L[T+1]=S.y,L[T+2]=S.z,L[T+3]=S.w,L[T+4]=U.x,L[T+5]=U.y,L[T+6]=U.z,L[T+7]=U.w,L[T+8]=Y.x,L[T+9]=Y.y,L[T+10]=Y.z,L[T+11]=Y.w,L[T+12]=$.x,L[T+13]=$.y,L[T+14]=$.z,L[T+15]=$.w,T+=16;l.bindBuffer(l.ARRAY_BUFFER,r.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,L,y)}if(Q&&t){C=0;for(v=G.length;C<v;C++)if(I=ka[G[C]],L=I.vertexNormals,
 Q=I.normal,L.length===3&&E)for(T=0;T<3;T++)Q=L[T],ca[A]=Q.x,ca[A+1]=Q.y,ca[A+2]=Q.z,A+=3;else for(T=0;T<3;T++)ca[A]=Q.x,ca[A+1]=Q.y,ca[A+2]=Q.z,A+=3;C=0;for(v=ia.length;C<v;C++)if(I=ka[ia[C]],L=I.vertexNormals,Q=I.normal,L.length===4&&E)for(T=0;T<4;T++)Q=L[T],ca[A]=Q.x,ca[A+1]=Q.y,ca[A+2]=Q.z,A+=3;else for(T=0;T<4;T++)ca[A]=Q.x,ca[A+1]=Q.y,ca[A+2]=Q.z,A+=3;l.bindBuffer(l.ARRAY_BUFFER,r.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,ca,y)}if(sa&&ya&&B){C=0;for(v=G.length;C<v;C++)if(A=G[C],A=ya[A],
 A!==void 0)for(T=0;T<3;T++)ca=A[T],ga[Z]=ca.u,ga[Z+1]=ca.v,Z+=2;C=0;for(v=ia.length;C<v;C++)if(A=ia[C],A=ya[A],A!==void 0)for(T=0;T<4;T++)ca=A[T],ga[Z]=ca.u,ga[Z+1]=ca.v,Z+=2;Z>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,ga,y))}if(sa&&Ba&&B){C=0;for(v=G.length;C<v;C++)if(A=G[C],Z=Ba[A],Z!==void 0)for(T=0;T<3;T++)ga=Z[T],F[na]=ga.u,F[na+1]=ga.v,na+=2;C=0;for(v=ia.length;C<v;C++)if(A=ia[C],Z=Ba[A],Z!==void 0)for(T=0;T<4;T++)ga=Z[T],F[na]=ga.u,F[na+1]=ga.v,na+=2;na>
 0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,F,y))}if(qa){C=0;for(v=G.length;C<v;C++)x[la]=O,x[la+1]=O+1,x[la+2]=O+2,la+=3,ma[ja]=O,ma[ja+1]=O+1,ma[ja+2]=O,ma[ja+3]=O+2,ma[ja+4]=O+1,ma[ja+5]=O+2,ja+=6,O+=3;C=0;for(v=ia.length;C<v;C++)x[la]=O,x[la+1]=O+1,x[la+2]=O+3,x[la+3]=O+1,x[la+4]=O+2,x[la+5]=O+3,la+=6,ma[ja]=O,ma[ja+1]=O+1,ma[ja+2]=O,ma[ja+3]=O+3,ma[ja+4]=O+1,ma[ja+5]=O+2,ma[ja+6]=O+2,ma[ja+7]=O+3,ja+=8,O+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer);
@@ -321,12 +321,12 @@ C=s=E=w=B=void 0;w=K.vertices;r=K.colors;C=w.length;y=r.length;v=K.__vertexArray
 THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,k,m;j=m=i=0;for(k=
 b.length;j<k;j++)g=b[j],g instanceof THREE.SpotLight&&m++,g instanceof THREE.DirectionalLight&&m++,g instanceof THREE.PointLight&&i++;i+m<=S?j=m:(j=Math.ceil(S*m/(i+m)),i=S-j);g={directional:j,point:i};i=m=0;for(j=b.length;i<j;i++)k=b[i],k instanceof THREE.SpotLight&&k.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{j=a.fragmentShader;k=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,
 fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(j),d.push(k));for(p in c)d.push(p),d.push(c[p]);
-h=d.join();p=0;for(d=V.length;p<d;p++)if(V[p].code===h){o=V[p].program;break a}p=l.createProgram();d=[qa?"#define VERTEX_TEXTURES":"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
+h=d.join();p=0;for(d=W.length;p<d;p++)if(W[p].code===h){o=W[p].program;break a}p=l.createProgram();d=[la?"#define VERTEX_TEXTURES":"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
 "",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 g=["#ifdef GL_ES","precision "+G+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
 "",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");l.attachShader(p,z("fragment",g+j));l.attachShader(p,
 z("vertex",d+k));l.linkProgram(p);l.getProgramParameter(p,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(p,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)j=q[d],p.uniforms[j]=l.getUniformLocation(p,
-j);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=l.getAttribLocation(p,c);p.id=V.length;V.push({program:p,code:h});R.info.memory.programs=V.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&l.enableVertexAttribArray(o.position);o.color>=0&&l.enableVertexAttribArray(o.color);o.normal>=0&&l.enableVertexAttribArray(o.normal);
+j);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=l.getAttribLocation(p,c);p.id=W.length;W.push({program:p,code:h});R.info.memory.programs=W.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&l.enableVertexAttribArray(o.position);o.color>=0&&l.enableVertexAttribArray(o.color);o.normal>=0&&l.enableVertexAttribArray(o.normal);
 o.tangent>=0&&l.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(l.enableVertexAttribArray(o.skinVertexA),l.enableVertexAttribArray(o.skinVertexB),l.enableVertexAttribArray(o.skinIndex),l.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&l.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)q="morphTarget"+f,o[q]>=0&&(l.enableVertexAttribArray(o[q]),
 a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?l.frontFace(l.CCW):l.frontFace(l.CW),a==="back"?l.cullFace(l.BACK):a==="front"?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE)):l.disable(l.CULL_FACE)};this.setObjectFaces=function(a){if(ba!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),ba=a.doubleSided;if(T!==a.flipSided)a.flipSided?l.frontFace(l.CW):
 l.frontFace(l.CCW),T=a.flipSided};this.setDepthTest=function(a){O!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),O=a)};this.setBlending=function(a){if(a!==U){switch(a){case THREE.AdditiveBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE);break;case THREE.SubtractiveBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.SRC_COLOR);break;default:l.blendEquationSeparate(l.FUNC_ADD,
@@ -334,7 +334,7 @@ l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MI
 0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,a.image);c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=l.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,
 a.__webglTexture);A(l.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=l.createFramebuffer();a.__webglRenderbuffer[c]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,B(a.format),a.width,a.height,0,B(a.format),B(a.type),null);var d=a,e=l.TEXTURE_CUBE_MAP_POSITIVE_X+c;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[c]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,e,d.__webglTexture,0);E(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=l.createFramebuffer(),
 a.__webglRenderbuffer=l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),A(l.TEXTURE_2D,a,a),l.texImage2D(l.TEXTURE_2D,0,B(a.format),a.width,a.height,0,B(a.format),B(a.type),null),c=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,c,a.__webglTexture,0),E(a.__webglRenderbuffer,a);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,
-null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=sa,a=ja,d=na,e=la);b!==W&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),W=b);Ba=c;wa=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=sa,a=qa,d=na,e=ja);b!==X&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),X=b);Ba=c;wa=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
@@ -352,8 +352,8 @@ g;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},r
 f=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,f);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+
 g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],j,o,p,m;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)j=g[d.a].position,o=g[d.b].position,p=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,o,p);else if(d instanceof
 THREE.Face4)j=g[d.a].position,o=g[d.b].position,p=g[d.c].position,m=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,o,m),d._area2=THREE.GeometryUtils.triangleArea(o,p,m),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];g={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),g[h]?g[h]+=1:g[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
-b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)d[e].u!==1&&(d[e].u-=Math.floor(d[e].u)),d[e].v!==1&&(d[e].v-=Math.floor(d[e].v))}};
-THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Vector3;b.x=-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]);b.y=-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]);b.z=-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]);a.applyMatrix((new THREE.Matrix4).setTranslation(b.x,b.y,b.z));a.computeBoundingBox();return b},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)d[e].u!==1&&(d[e].u-=Math.floor(d[e].u)),
+d[e].v!==1&&(d[e].v-=Math.floor(d[e].v))}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return f},getNormalMap:function(a,b){var c=function(a){var b=
 Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var o=1;o<e;o++){var p=o-1<0?e-1:o-1,m=(o+1)%e,q=j-1<0?d-1:j-1,n=(j+1)%d,s=[],r=[0,0,h[(o*d+j)*4]/255*b];s.push([-1,0,h[(o*d+q)*4]/255*b]);s.push([-1,-1,h[(p*d+q)*4]/255*b]);s.push([0,-1,h[(p*d+j)*4]/255*b]);s.push([1,
 -1,h[(p*d+n)*4]/255*b]);s.push([1,0,h[(o*d+n)*4]/255*b]);s.push([1,1,h[(m*d+n)*4]/255*b]);s.push([0,1,h[(m*d+j)*4]/255*b]);s.push([-1,1,h[(m*d+q)*4]/255*b]);p=[];q=s.length;for(m=0;m<q;m++){var n=s[m],u=s[(m+1)%q],n=[n[0]-r[0],n[1]-r[1],n[2]-r[2]],u=[u[0]-r[0],u[1]-r[1],u[2]-r[2]];p.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*u[0]]))}s=[0,0,0];for(m=0;m<p.length;m++)s[0]+=p[m][0],s[1]+=p[m][1],s[2]+=p[m][2];s[0]/=p.length;s[1]/=p.length;s[2]/=p.length;r=(o*d+j)*4;k[r]=(s[0]+1)/
@@ -435,7 +435,7 @@ this.getPrevKeyWith("pos",m,g.index-1).pos,this.points[1]=e,this.points[2]=f,thi
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,k;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],k[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
-THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=c!==void 0?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
+THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=c!==void 0?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
 d.matrixWorldNeedsUpdate=!0}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
 e.matrix;e=this.data.hierarchy[c].keys;if(e.length)f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
@@ -455,7 +455,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){b||(b=43.25);var c=2*Math.atan(b/(a*2));c*=180/Math.PI;this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
-THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
@@ -465,14 +465,14 @@ this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
 THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),s=g.length,r=0;f=s-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<s-1;f++)r=d*h.chunks[f]/h.total,b.keys[f]={time:r,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var g=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=a>=0?a:a+g;b=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,g=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(g,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -510,15 +510,15 @@ h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0
 0,c=m+j*2,b=0;b<c;b++){var d=R*b,e=R*(b+1),f=ba+Z+d,g=ba+Z+e,k=f,d=ba+da+d,e=ba+da+e,l=g;k+=G;d+=G;e+=G;l+=G;w.faces.push(new THREE.Face4(k,d,e,l,null,null,z));z&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(w.vertices[f].position.z+i)/e,g=(w.vertices[g].position.z+i)/e,w.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){w.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=G;b+=G;c+=G;w.faces.push(new THREE.Face3(a,b,c,
 null,null,t));if(t){var d=A.maxY,e=A.maxX,f=w.vertices[b].position.x,b=w.vertices[b].position.y,g=w.vertices[c].position.x,c=w.vertices[c].position.y;w.faceVertexUvs[0].push([new THREE.UV(w.vertices[a].position.x/e,w.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,
 p=b.curveSegments!==void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,q=b.bendPath,n=b.extrudePath,s,r=!1,u=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,z=b.extrudeMaterial,A=this.shapebb;if(n)s=n.getPoints(p),m=s.length,r=!0,o=!1;o||(k=i=j=0);var E,D,B,w=this,G=this.vertices.length;q&&a.addWrapPath(q);p=u?a.extractAllSpacedPoints(p):a.extractAllPoints(p);q=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();D=0;for(B=p.length;D<B;D++)E=p[D],THREE.Shape.Utils.isClockWise(E)&&
-(p[D]=E.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(q,p);u=q;D=0;for(B=p.length;D<B;D++)E=p[D],q=q.concat(E);var y,K,$,Q,X,S,R=q.length,l=n.length,V=[];y=0;K=u.length;Z=K-1;for(da=y+1;y<K;y++,Z++,da++)Z===K&&(Z=0),da===K&&(da=0),V[y]=d(u[y],u[Z],u[da]);var v=[],W,L=V.concat();D=0;for(B=p.length;D<B;D++){E=p[D];W=[];y=0;K=E.length;Z=K-1;for(da=y+1;y<K;y++,Z++,da++)Z===K&&(Z=0),da===K&&(da=0),W[y]=d(E[y],E[Z],E[da]);v.push(W);L=L.concat(W)}for($=0;$<j;$++){Q=$/j;X=i*(1-Q);Q=k*Math.sin(Q*Math.PI/
-2);y=0;for(K=u.length;y<K;y++)S=c(u[y],V[y],Q),f(S.x,S.y,-X);D=0;for(B=p.length;D<B;D++){E=p[D];W=v[D];y=0;for(K=E.length;y<K;y++)S=c(E[y],W[y],Q),f(S.x,S.y,-X)}}Q=k;for(y=0;y<R;y++)S=o?c(q[y],L[y],Q):q[y],r?f(S.x,S.y+s[0].y,s[0].x):f(S.x,S.y,0);for($=1;$<=m;$++)for(y=0;y<R;y++)S=o?c(q[y],L[y],Q):q[y],r?f(S.x,S.y+s[$-1].y,s[$-1].x):f(S.x,S.y,h/m*$);for($=j-1;$>=0;$--){Q=$/j;X=i*(1-Q);Q=k*Math.sin(Q*Math.PI/2);y=0;for(K=u.length;y<K;y++)S=c(u[y],V[y],Q),f(S.x,S.y,h+X);D=0;for(B=p.length;D<B;D++){E=
-p[D];W=v[D];y=0;for(K=E.length;y<K;y++)S=c(E[y],W[y],Q),r?f(S.x,S.y+s[m-1].y,s[m-1].x+X):f(S.x,S.y,h+X)}}if(o){o=R*0;for(y=0;y<l;y++)k=n[y],g(k[2]+o,k[1]+o,k[0]+o);o=R*(m+j*2);for(y=0;y<l;y++)k=n[y],g(k[0]+o,k[1]+o,k[2]+o)}else{for(y=0;y<l;y++)k=n[y],g(k[2],k[1],k[0]);for(y=0;y<l;y++)k=n[y],g(k[0]+R*m,k[1]+R*m,k[2]+R*m)}var Z,da,ba=0;e(u);ba+=u.length;D=0;for(B=p.length;D<B;D++)E=p[D],e(E),ba+=E.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+(p[D]=E.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(q,p);u=q;D=0;for(B=p.length;D<B;D++)E=p[D],q=q.concat(E);var y,K,$,Q,Y,S,R=q.length,l=n.length,W=[];y=0;K=u.length;Z=K-1;for(da=y+1;y<K;y++,Z++,da++)Z===K&&(Z=0),da===K&&(da=0),W[y]=d(u[y],u[Z],u[da]);var v=[],X,L=W.concat();D=0;for(B=p.length;D<B;D++){E=p[D];X=[];y=0;K=E.length;Z=K-1;for(da=y+1;y<K;y++,Z++,da++)Z===K&&(Z=0),da===K&&(da=0),X[y]=d(E[y],E[Z],E[da]);v.push(X);L=L.concat(X)}for($=0;$<j;$++){Q=$/j;Y=i*(1-Q);Q=k*Math.sin(Q*Math.PI/
+2);y=0;for(K=u.length;y<K;y++)S=c(u[y],W[y],Q),f(S.x,S.y,-Y);D=0;for(B=p.length;D<B;D++){E=p[D];X=v[D];y=0;for(K=E.length;y<K;y++)S=c(E[y],X[y],Q),f(S.x,S.y,-Y)}}Q=k;for(y=0;y<R;y++)S=o?c(q[y],L[y],Q):q[y],r?f(S.x,S.y+s[0].y,s[0].x):f(S.x,S.y,0);for($=1;$<=m;$++)for(y=0;y<R;y++)S=o?c(q[y],L[y],Q):q[y],r?f(S.x,S.y+s[$-1].y,s[$-1].x):f(S.x,S.y,h/m*$);for($=j-1;$>=0;$--){Q=$/j;Y=i*(1-Q);Q=k*Math.sin(Q*Math.PI/2);y=0;for(K=u.length;y<K;y++)S=c(u[y],W[y],Q),f(S.x,S.y,h+Y);D=0;for(B=p.length;D<B;D++){E=
+p[D];X=v[D];y=0;for(K=E.length;y<K;y++)S=c(E[y],X[y],Q),r?f(S.x,S.y+s[m-1].y,s[m-1].x+Y):f(S.x,S.y,h+Y)}}if(o){o=R*0;for(y=0;y<l;y++)k=n[y],g(k[2]+o,k[1]+o,k[0]+o);o=R*(m+j*2);for(y=0;y<l;y++)k=n[y],g(k[0]+o,k[1]+o,k[2]+o)}else{for(y=0;y<l;y++)k=n[y],g(k[2],k[1],k[0]);for(y=0;y<l;y++)k=n[y],g(k[0]+R*m,k[1]+R*m,k[2]+R*m)}var Z,da,ba=0;e(u);ba+=u.length;D=0;for(B=p.length;D<B;D++)E=p[D],e(E),ba+=E.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-
 (Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,f);c(0,5,1,f);c(0,
 1,7,f);c(0,7,10,f);c(0,10,11,f);c(1,5,9,f);c(5,11,4,f);c(11,10,2,f);c(10,7,6,f);c(7,1,8,f);c(3,9,4,f);c(3,4,2,f);c(3,2,6,f);c(3,6,8,f);c(3,8,9,f);c(4,9,5,f);c(2,4,11,f);c(6,2,10,f);c(8,6,7,f);c(9,8,1,f);for(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),k=d(f.faces[h].b,f.faces[h].c),j=d(f.faces[h].c,f.faces[h].a);c(f.faces[h].a,i,j,a);c(f.faces[h].b,k,i,a);c(f.faces[h].c,j,k,a);c(i,k,j,a)}f.faces=a.faces;f.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=
 f.faces;e.faceVertexUvs[0]=f.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;i==0&&(f=d);
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;i==0&&(f=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=g.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 g.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),g.faceVertexUvs[0].push([f(a.uv,a.position,h),f(b.uv,b.position,h),f(c.uv,c.position,h)])):(h-=1,d(a,e(a,b),e(a,c),h),d(e(a,b),b,e(b,c),h),d(e(a,c),e(b,c),c,h),d(e(a,b),e(b,c),e(a,c),h))}function e(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];d===void 0&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function f(a,b,c){c<0&&a.u===
@@ -536,7 +536,7 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
 j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;m=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(m,q,i,j);if(g=f[f.length-1]){o=g.x;p=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h,t=THREE.Shape.Utils.b2(u,o,m,i),u=THREE.Shape.Utils.b2(u,p,q,j);f.push(new THREE.Vector2(t,u))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,m=b[a++]*c+d,q=b[a++]*-c,n=b[a++]*c+d,s=b[a++]*-c,e.bezierCurveTo(i,j,m,q,n,s),g=f[f.length-1]){o=g.x;p=g.y;g=1;for(h=this.divisions;g<=h;g++)u=g/h,t=THREE.Shape.Utils.b3(u,o,m,
 n,i),u=THREE.Shape.Utils.b3(u,p,q,s,j),f.push(new THREE.Vector2(t,u))}}}return{offset:r.ha*c,points:f,path:e}}}};
 (function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],i,k,j;if(b(a)>0)for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var o=2*e;for(k=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var p;a:{p=a;var m=i,q=k,n=j,s=e,r=g,u=void 0,t=void 0,z=void 0,
-A=void 0,E=void 0,D=void 0,B=void 0,w=void 0,G=void 0,t=p[r[m]].x,z=p[r[m]].y,A=p[r[q]].x,E=p[r[q]].y,D=p[r[n]].x,B=p[r[n]].y;if(1.0E-10>(A-t)*(B-z)-(E-z)*(D-t))p=!1;else{for(u=0;u<s;u++)if(!(u==m||u==q||u==n)){var w=p[r[u]].x,G=p[r[u]].y,y=void 0,K=void 0,$=void 0,Q=void 0,X=void 0,S=void 0,R=void 0,l=void 0,V=void 0,v=void 0,W=void 0,L=void 0,y=$=X=void 0,y=D-A,K=B-E,$=t-D,Q=z-B,X=A-t,S=E-z,R=w-t,l=G-z,V=w-A,v=G-E,W=w-D,L=G-B,y=y*v-K*V,X=X*l-S*R,$=$*L-Q*W;if(y>=0&&$>=0&&X>=0){p=!1;break a}}p=!0}}if(p){f.push([a[g[i]],
+A=void 0,E=void 0,D=void 0,B=void 0,w=void 0,G=void 0,t=p[r[m]].x,z=p[r[m]].y,A=p[r[q]].x,E=p[r[q]].y,D=p[r[n]].x,B=p[r[n]].y;if(1.0E-10>(A-t)*(B-z)-(E-z)*(D-t))p=!1;else{for(u=0;u<s;u++)if(!(u==m||u==q||u==n)){var w=p[r[u]].x,G=p[r[u]].y,y=void 0,K=void 0,$=void 0,Q=void 0,Y=void 0,S=void 0,R=void 0,l=void 0,W=void 0,v=void 0,X=void 0,L=void 0,y=$=Y=void 0,y=D-A,K=B-E,$=t-D,Q=z-B,Y=A-t,S=E-z,R=w-t,l=G-z,W=w-A,v=G-E,X=w-D,L=G-B,y=y*v-K*W,Y=Y*l-S*R,$=$*L-Q*X;if(y>=0&&$>=0&&Y>=0){p=!1;break a}}p=!0}}if(p){f.push([a[g[i]],
 a[g[k]],a[g[j]]]);h.push([g[i],g[k],g[j]]);i=k;for(j=k+1;j<e;i++,j++)g[i]=g[j];e--;o=2*e}}if(d)return h;return f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
 this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
@@ -549,8 +549,8 @@ THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){v
 b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},o={},p=[],m,q,n,s,r,u=a.faceVertexUvs[0];m=0;for(q=u.length;m<q;m++){n=0;for(s=u[m].length;n<s;n++)r=d[m]["abcd".charAt(n)],p[r]||(p[r]=u[m][n])}var t;m=0;for(q=d.length;m<q;m++)if(r=d[m],k.push(r.centroid),i.push(new THREE.Vertex(r.centroid)),g.supportUVs&&p.length!=0){t=new THREE.UV;if(r instanceof THREE.Face3)t.u=p[r.a].u+p[r.b].u+p[r.c].u,t.v=p[r.a].v+p[r.b].v+p[r.c].v,t.u/=3,t.v/=3;else if(r instanceof THREE.Face4)t.u=
 p[r.a].u+p[r.b].u+p[r.c].u+p[r.d].u,t.v=p[r.a].v+p[r.b].v+p[r.c].v+p[r.d].v,t.u/=4,t.v/=4;p.push(t)}q=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var z=0,u=h.length,A,E,D={},B={},w=function(a,
 b){D[a]===void 0&&(D[a]=[]);D[a].push(b)},G=function(a,b){B[a]===void 0&&(B[a]={});B[a][b]=null};for(m in q){t=q[m];A=m.split("_");E=A[0];A=A[1];w(E,[E,A]);w(A,[E,A]);n=0;for(s=t.length;n<s;n++)r=t[n],G(E,r,m),G(A,r,m);t.length<2&&(o[m]=!0)}for(m in q)if(t=q[m],r=t[0],t=t[1],A=m.split("_"),E=A[0],A=A[1],s=new THREE.Vector3,o[m]?(s.addSelf(h[E].position),s.addSelf(h[A].position),s.multiplyScalar(0.5)):(s.addSelf(k[r]),s.addSelf(k[t]),s.addSelf(h[E].position),s.addSelf(h[A].position),s.multiplyScalar(0.25)),
-j[m]=u+d.length+z,i.push(new THREE.Vertex(s)),z++,g.supportUVs&&p.length!=0)t=new THREE.UV,t.u=p[E].u+p[A].u,t.v=p[E].v+p[A].v,t.u/=2,t.v/=2,p.push(t);var y,K;A=["123","12","2","23"];s=["123","23","3","31"];var w=["123","31","1","12"],G=["1234","12","2","23"],$=["1234","23","3","34"],Q=["1234","34","4","41"],X=["1234","41","1","12"];m=0;for(q=k.length;m<q;m++)r=d[m],t=u+m,r instanceof THREE.Face3?(z=c(r.a,r.b),E=c(r.b,r.c),y=c(r.c,r.a),b(t,j[z],r.b,j[E],r,A),b(t,j[E],r.c,j[y],r,s),b(t,j[y],r.a,j[z],
-r,w)):r instanceof THREE.Face4?(z=c(r.a,r.b),E=c(r.b,r.c),y=c(r.c,r.d),K=c(r.d,r.a),b(t,j[z],r.b,j[E],r,G),b(t,j[E],r.c,j[y],r,$),b(t,j[y],r.d,j[K],r,Q),b(t,j[K],r.a,j[z],r,X)):console.log("face should be a face!",r);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(q=h.length;m<q;m++)if(D[m]!==void 0){i.set(0,0,0);j.set(0,0,0);r=new THREE.Vector3(0,0,0);t=0;for(n in B[m])i.addSelf(k[n]),t++;z=0;u=D[m].length;for(n=0;n<u;n++)o[c(D[m][n][0],D[m][n][1])]&&z++;if(z!=2){i.divideScalar(t);for(n=0;n<
+j[m]=u+d.length+z,i.push(new THREE.Vertex(s)),z++,g.supportUVs&&p.length!=0)t=new THREE.UV,t.u=p[E].u+p[A].u,t.v=p[E].v+p[A].v,t.u/=2,t.v/=2,p.push(t);var y,K;A=["123","12","2","23"];s=["123","23","3","31"];var w=["123","31","1","12"],G=["1234","12","2","23"],$=["1234","23","3","34"],Q=["1234","34","4","41"],Y=["1234","41","1","12"];m=0;for(q=k.length;m<q;m++)r=d[m],t=u+m,r instanceof THREE.Face3?(z=c(r.a,r.b),E=c(r.b,r.c),y=c(r.c,r.a),b(t,j[z],r.b,j[E],r,A),b(t,j[E],r.c,j[y],r,s),b(t,j[y],r.a,j[z],
+r,w)):r instanceof THREE.Face4?(z=c(r.a,r.b),E=c(r.b,r.c),y=c(r.c,r.d),K=c(r.d,r.a),b(t,j[z],r.b,j[E],r,G),b(t,j[E],r.c,j[y],r,$),b(t,j[y],r.d,j[K],r,Q),b(t,j[K],r.a,j[z],r,Y)):console.log("face should be a face!",r);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(q=h.length;m<q;m++)if(D[m]!==void 0){i.set(0,0,0);j.set(0,0,0);r=new THREE.Vector3(0,0,0);t=0;for(n in B[m])i.addSelf(k[n]),t++;z=0;u=D[m].length;for(n=0;n<u;n++)o[c(D[m][n][0],D[m][n][1])]&&z++;if(z!=2){i.divideScalar(t);for(n=0;n<
 u;n++)t=D[m][n],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(u);r.addSelf(h[m].position);r.multiplyScalar(u-3);r.addSelf(i);r.addSelf(j.multiplyScalar(2));r.divideScalar(u);d[m].position=r}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+
@@ -578,70 +578,71 @@ s+=function(b){var c=r.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d
 b=B+b+c(r.nquad_smooth*2);w=b+w+c(r.nquad_flat_uv*2);(function(a){var b=r.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(A);(function(a){var b=r.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(E);(function(a){var b=r.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
 c)}})(b);(function(a){var b=r.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(w);(function(a){var b=r.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(s);(function(a){var b=r.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(z);(function(a){var b=r.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(D);(function(a){var b=
 r.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(B);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
-THREE.ColladaLoader=function(){function a(a,d,e){U=a;d=d||ca;e!==void 0&&(a=e.split("/"),a.pop(),xa=a.length<1?"":a.join("/")+"/");if((a=U.evaluate("//dae:asset",U,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":ta=i.textContent.charAt(0)}}if(!qa.convertUpAxis||ta===qa.upAxis)pa=null;else switch(ta){case "X":pa=qa.upAxis===
-"Y"?"XtoY":"XtoZ";break;case "Y":pa=qa.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":pa=qa.upAxis==="X"?"ZtoX":"ZtoY"}va=b("//dae:library_images/dae:image",g,"image");sa=b("//dae:library_materials/dae:material",B,"material");ja=b("//dae:library_effects/dae:effect",$,"effect");la=b("//dae:library_geometries/dae:geometry",s,"geometry");na=b("//dae:library_controllers/dae:controller",h,"controller");fa=b("//dae:library_animations/dae:animation",X,"animation");wa=b(".//dae:library_visual_scenes/dae:visual_scene",
-j,"visual_scene");ya=[];za=[];(a=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),aa=wa[a]):aa=null;O=new THREE.Object3D;for(a=0;a<aa.nodes.length;a++)O.add(f(aa.nodes[a]));Ba=[];c(O);a={scene:O,morphs:ya,skins:za,animations:Ba,dae:{images:va,materials:sa,effects:ja,geometries:la,controllers:na,animations:fa,visualScenes:wa,scene:aa}};d&&d(a);return a}function b(a,b,c){for(var a=U.evaluate(a,
-U,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=aa.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};Ba.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=
+THREE.ColladaLoader=function(){function a(a,d,e){U=a;d=d||ca;e!==void 0&&(a=e.split("/"),a.pop(),xa=a.length<1?"":a.join("/")+"/");if((a=U.evaluate("//dae:asset",U,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":ta=i.textContent.charAt(0)}}if(!la.convertUpAxis||ta===la.upAxis)pa=null;else switch(ta){case "X":pa=la.upAxis===
+"Y"?"XtoY":"XtoZ";break;case "Y":pa=la.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":pa=la.upAxis==="X"?"ZtoX":"ZtoY"}va=b("//dae:library_images/dae:image",g,"image");sa=b("//dae:library_materials/dae:material",B,"material");qa=b("//dae:library_effects/dae:effect",$,"effect");ja=b("//dae:library_geometries/dae:geometry",s,"geometry");na=b("//dae:library_controllers/dae:controller",h,"controller");fa=b("//dae:library_animations/dae:animation",Y,"animation");wa=b(".//dae:library_visual_scenes/dae:visual_scene",
+j,"visual_scene");ya=[];za=[];(a=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),aa=wa[a]):aa=null;O=new THREE.Object3D;for(a=0;a<aa.nodes.length;a++)O.add(f(aa.nodes[a]));Ba=[];c(O);a={scene:O,morphs:ya,skins:za,animations:Ba,dae:{images:va,materials:sa,effects:qa,geometries:ja,controllers:na,animations:fa,visualScenes:wa,scene:aa}};d&&d(a);return a}function b(a,b,c){for(var a=U.evaluate(a,
+U,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=aa.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};Ba.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=
 0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,c){var e=na[b.url];if(!e||!e.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||
 !b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var f,c=1E6,g=-c,h=0;for(f in fa)for(var i=fa[f],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}f={start:c,end:g,frames:h};for(var b=aa.getChildById(b.skeleton[0],!0)||aa.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,j=0;j<a.vertices.length;j++)e.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);
 for(c=0;c<f.frames;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=e.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var q=k.weights[o][p];q.joint==n&&l.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
-l.sid+"'.";}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=na[a.controllers[g].url];switch(i.type){case "skin":if(la[i.skin.source]){var j=
-new n;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(na[i.skin.source]&&(d=i=na[i.skin.source],i.morph&&la[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(la[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
-0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=la[i.url],k={},l=[],o=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=ja[sa[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=o;l.push(q.material);p=q.material;o++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(o>1){j=new THREE.MeshFaceMaterial;i.materials=
-l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(c!==void 0)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=na[c.url],j.skinInstanceController=c,j.name="skin_"+za.length,za.push(j);else if(d!==void 0){h=i;k=d instanceof m?na[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=la[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,
-o.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ya.length;ya.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){this.init_from=
-this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=
-this.sid="";this.data=[];this.obj=null}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function s(){this.id="";this.mesh=null}function r(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function z(){this.source="";this.stride=this.count=
-0;this.params=[]}function A(){this.input={}}function E(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function B(){this.name=this.id="";this.instance_effect=null}function w(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function G(a,b){this.type=a;this.effect=b;this.material=null}function y(a){this.effect=a;this.format=this.init_from=null}function K(a){this.effect=
-a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function $(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Q(){this.url=""}function X(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function S(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function R(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=
-this.strideOut=this.output=this.input=null;this.duration=0}function l(a){this.targets=[];this.time=a}function V(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function v(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function W(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function L(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function Z(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),
-10):c}function da(a,b){if(qa.convertUpAxis&&ta!==qa.upAxis)switch(pa){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function ba(a,b){var c=[a[b],a[b+1],a[b+2]];da(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function T(a){if(qa.convertUpAxis){var b=[a[0],a[4],a[8]];
-da(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];da(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];da(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];da(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];da(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];da(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];da(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}
-var U=null,O=null,aa,ca=null,ga={},va={},fa={},na={},la={},sa={},ja={},Ba,wa,xa,ya,za,Aa=THREE.SmoothShading,qa={convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},ta="Y",pa=null,Ia=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<
-a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new D).parse(e);b[e.id]=e;break;case "targets":c=
-this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new E).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,
-"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=v(f.textContent);this.bindShapeMatrix=T(f);break;case "source":f=(new D).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=
-a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new E).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new E).parse(g));break;case "v":c=W(g.textContent);break;case "vcount":d=W(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=
-d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],o=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[m.source].data[o]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,
-b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),
-e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,
-b);if(d)return d}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=
-0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=U.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",U,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&
-this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in fa)for(var e=fa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=
-a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(qa.convertUpAxis)switch(g){case "X":switch(pa){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(pa){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(pa){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);
-if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(var k=i.length;b<k;b++){var q=i[b],s=h.getData(j.type,b),r;r=null;for(var t=0,u=d.length;t<u&&r==null;t++){var v=d[t];if(v.time===q)r=v;else if(v.time>q)break}if(!r){r=new l(q);t=-1;u=0;for(v=d.length;u<v&&t==-1;u++)d[u].time>=q&&(t=u);q=t;d.splice(q==-1?d.length:q,0,r)}r.addTarget(f,j,g,s)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=
-b;g=e;i=void 0;a:{i=j?j-1:0;for(i=i>=0?i:i+h.length;i>=0;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;s=void 0;if(k.length){s=[];for(q=0;q<k.length;++q)s[q]=k[q]+(j[q]-k[q])*h}else s=k+(j-k)*h;f.addTarget(g,i.transform,i.member,s)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();
-for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=v(a.textContent);this.convert();return this};p.prototype.convert=function(){switch(this.type){case "matrix":this.obj=T(this.data);break;case "rotate":this.angle=this.data[3]*Ia;case "translate":da(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":da(this.data,1);this.obj=new THREE.Vector3(this.data[0],
-this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};p.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};p.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=
-a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*Ia;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*Ia}}};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=
-a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=U.evaluate(".//dae:instance_material",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=U.evaluate(".//dae:instance_material",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};s.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
-(new r(this)).parse(c)}}return this};r.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");ga[d]==void 0&&(ga[d]=(new D(d)).parse(c));break;case "vertices":this.vertices=(new A).parse(c);break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(c))}}this.geometry3js=
-new THREE.Geometry;a=ga[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ba(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};r.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,
-g=a.inputs,h,i,j,k,l=0,m=3,o=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":o.push(h.set)}for(;c<f.length;){var n=[],p=[],q={},r=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=ga[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":n.push(i);break;case "NORMAL":p.push(ba(k.data,j));break;case "TEXCOORD":q[h.set]===void 0&&(q[h.set]=[]);q[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(k.data[j],
-k.data[j+1],k.data[j+2]))}e=null;d=[];if(m===3)d.push(new THREE.Face3(n[0],n[1],n[2],[p[0],p[1],p[2]],r.length?r:new THREE.Color));else if(m===4)d.push(new THREE.Face4(n[0],n[1],n[2],n[3],[p[0],p[1],p[2],p[3]],r.length?r:new THREE.Color));else if(m>4&&qa.subdivideFaces){r=r.length?r:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(n[0],n[e],n[e+1],[p[0],p[e++],p[e]],r))}if(d.length){n=0;for(p=d.length;n<p;n++){e=d[n];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)r=q[o[e]],r=
-m>4?[r[0],r[n+1],r[n+2]]:m===4?[r[0],r[1],r[2],r[3]]:[r[0],r[1],r[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(r)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};u.prototype=new t;u.prototype.constructor=u;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");
-this.count=Z(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new E).parse(a.childNodes[b]));break;case "vcount":this.vcount=W(c.textContent);break;case "p":this.p=W(c.textContent)}}return this};z.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=Z(a,"count",0);this.stride=Z(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=
-c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new E).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};E.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=Z(a,"set",-1);this.offset=Z(a,"offset",0);if(this.semantic=="TEXCOORD"&&
-this.set<0)this.set=0;return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=L(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=v(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=W(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=
-L(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new z).parse(c.childNodes[d]);break}}}return this};D.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=T(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+
-b.type+".")}return a};B.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new Q).parse(a.childNodes[b]);break}return this};w.prototype.isColor=function(){return this.texture==null};w.prototype.isTexture=function(){return this.texture!=null};w.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=
-v(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};w.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&a.childNodes[1].nodeName==="extra"&&(a=a.childNodes[1],a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&
-(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=
-(new w).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=U.evaluate(".//dae:float",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};G.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];
-if(d instanceof w)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=va[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(xa+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else c==
-"diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Aa;return this.material=new THREE.MeshLambertMaterial(a)};y.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
-c.nodeName)}}return this};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
-$.prototype.create=function(){if(this.shader==null)return null};$.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};$.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=
-(new y(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new K(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};$.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};
-$.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new G(c.nodeName,this)).parse(c)}}};Q.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};X.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=
-(new D).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new R(this)).parse(c));break;case "channel":this.channel.push((new S(this)).parse(c))}}return this};S.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=
-0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};R.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new E).parse(c))}}return this};R.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];
-switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);
-this.duration=this.endTime-this.startTime}};R.prototype.getData=function(a,b){var c;if(this.strideOut>1){c=[];b*=this.strideOut;for(var d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":da(c,-1);break;case "scale":da(c,1)}}else c=this.output[b];return c};l.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};l.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];
-(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};l.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};l.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};l.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(f<0||f>
-1)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=f<0?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))d.responseXML?(ca=c,a(d.responseXML,void 0,
-b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Aa=a},applySkin:e,geometries:la,options:qa}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+l.sid+"'.";}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=na[a.controllers[g].url];switch(i.type){case "skin":if(ja[i.skin.source]){var j=
+new n;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(na[i.skin.source]&&(d=i=na[i.skin.source],i.morph&&ja[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(ja[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
+0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=ja[i.url],k={},l=[],o=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=qa[sa[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=o;l.push(q.material);p=q.material;o++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(o>1){j=new THREE.MeshFaceMaterial;i.materials=
+l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(c!==void 0)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=na[c.url],j.skinInstanceController=c,j.name="skin_"+za.length,za.push(j);else if(d!==void 0){h=i;k=d instanceof m?na[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=ja[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,
+o.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ya.length;ya.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];la.centerGeometry&&b.geometry&&(c=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(c.multiplySelf(b.scale)),
+b.position.subSelf(c));for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=
+[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.obj=null}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function s(){this.id="";this.mesh=null}function r(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function t(){this.material="";this.count=
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function z(){this.source="";this.stride=this.count=0;this.params=[]}function A(){this.input={}}function E(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function B(){this.name=this.id="";this.instance_effect=null}function w(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}
+function G(a,b){this.type=a;this.effect=b;this.material=null}function y(a){this.effect=a;this.format=this.init_from=null}function K(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function $(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Q(){this.url=""}function Y(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function S(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
+this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function R(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function l(a){this.targets=[];this.time=a}function W(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function v(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function X(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],
+10));return b}function L(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function Z(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function da(a,b){if(la.convertUpAxis&&ta!==la.upAxis)switch(pa){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=
+b*c}}function ba(a,b){var c=[a[b],a[b+1],a[b+2]];da(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function T(a){if(la.convertUpAxis){var b=[a[0],a[4],a[8]];da(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];da(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];da(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];da(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];da(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];da(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],
+a[11]];da(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var U=null,O=null,aa,ca=null,ga={},va={},fa={},na={},ja={},sa={},qa={},Ba,wa,xa,ya,za,Aa=THREE.SmoothShading,la={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},ta="Y",pa=null,Ia=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName==
+"init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,
+"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new D).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==
+1)switch(d.nodeName){case "input":b.push((new E).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=v(f.textContent);this.bindShapeMatrix=T(f);break;case "source":f=(new D).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,
+b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new E).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new E).parse(g));
+break;case "v":c=X(g.textContent);break;case "vcount":d=X(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],o=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[m.source].data[o]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};
+j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],
+d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};o.prototype.getChildBySid=
+function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:
+"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,
+"");(b=U.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",U,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in fa)for(var e=fa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),
+g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(la.convertUpAxis)switch(g){case "X":switch(pa){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(pa){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(pa){case "XtoZ":g=
+"X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(var k=i.length;b<k;b++){var q=i[b],s=h.getData(j.type,b),r;r=null;for(var t=0,u=d.length;t<u&&r==null;t++){var v=d[t];if(v.time===q)r=v;else if(v.time>q)break}if(!r){r=new l(q);t=-1;u=0;for(v=d.length;u<v&&t==-1;u++)d[u].time>=q&&(t=u);q=t;d.splice(q==-1?d.length:q,0,r)}r.addTarget(f,j,g,s)}}else console.log('Could not find transform "'+b.sid+'" in node '+
+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=i>=0?i:i+h.length;i>=0;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;s=void 0;if(k.length){s=[];for(q=0;q<k.length;++q)s[q]=k[q]+(j[q]-k[q])*h}else s=k+(j-k)*h;f.addTarget(g,i.transform,i.member,s)}}}this.keys=
+d;this.sids=a}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=v(a.textContent);this.convert();return this};p.prototype.convert=function(){switch(this.type){case "matrix":this.obj=T(this.data);break;case "rotate":this.angle=this.data[3]*Ia;case "translate":da(this.data,-1);this.obj=new THREE.Vector3(this.data[0],
+this.data[1],this.data[2]);break;case "scale":da(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};p.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};p.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");
+break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*Ia;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*Ia}}};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=
+[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=U.evaluate(".//dae:instance_material",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,
+"");return this};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=U.evaluate(".//dae:instance_material",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};s.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<
+a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new r(this)).parse(c)}}return this};r.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");ga[d]==void 0&&(ga[d]=(new D(d)).parse(c));break;case "vertices":this.vertices=(new A).parse(c);break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");
+case "polylist":this.primitives.push((new u).parse(c))}}this.geometry3js=new THREE.Geometry;a=ga[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ba(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
+return this};r.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,o=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":o.push(h.set)}for(;c<f.length;){var n=[],p=[],q={},r=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=ga[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":n.push(i);break;case "NORMAL":p.push(ba(k.data,j));break;case "TEXCOORD":q[h.set]===void 0&&(q[h.set]=
+[]);q[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(m===3)d.push(new THREE.Face3(n[0],n[1],n[2],[p[0],p[1],p[2]],r.length?r:new THREE.Color));else if(m===4)d.push(new THREE.Face4(n[0],n[1],n[2],n[3],[p[0],p[1],p[2],p[3]],r.length?r:new THREE.Color));else if(m>4&&la.subdivideFaces){r=r.length?r:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(n[0],n[e],n[e+1],[p[0],p[e++],p[e]],r))}if(d.length){n=
+0;for(p=d.length;n<p;n++){e=d[n];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)r=q[o[e]],r=m>4?[r[0],r[n+1],r[n+2]]:m===4?[r[0],r[1],r[2],r[3]]:[r[0],r[1],r[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(r)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};u.prototype=new t;u.prototype.constructor=u;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=
+a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=Z(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new E).parse(a.childNodes[b]));break;case "vcount":this.vcount=X(c.textContent);break;case "p":this.p=X(c.textContent)}}return this};z.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=Z(a,"count",0);this.stride=
+Z(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new E).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};E.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
+"");this.set=Z(a,"set",-1);this.offset=Z(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=L(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=v(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
+X(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=L(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new z).parse(c.childNodes[d]);break}}}return this};D.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
+this.data.slice(b,b+16),c=T(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};B.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new Q).parse(a.childNodes[b]);break}return this};w.prototype.isColor=function(){return this.texture==null};w.prototype.isTexture=function(){return this.texture!=
+null};w.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=v(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};w.prototype.parseTexture=function(a){if(!a.childNodes)return this;
+a.childNodes[1]&&a.childNodes[1].nodeName==="extra"&&(a=a.childNodes[1],a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};G.prototype.parse=
+function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new w).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=U.evaluate(".//dae:float",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
+return this};G.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof w)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=va[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(xa+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
+e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Aa;return this.material=new THREE.MeshLambertMaterial(a)};y.prototype.parse=function(a){for(var b=
+0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
+c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};$.prototype.create=function(){if(this.shader==null)return null};$.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+$.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new y(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new K(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};$.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};$.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new G(c.nodeName,this)).parse(c)}}};Q.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Y.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new D).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new R(this)).parse(c));break;case "channel":this.channel.push((new S(this)).parse(c))}}return this};S.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};R.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new E).parse(c))}}return this};
+R.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=
+0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};R.prototype.getData=function(a,b){var c;if(this.strideOut>1){c=[];b*=this.strideOut;for(var d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":da(c,-1);break;case "scale":da(c,1)}}else c=this.output[b];return c};l.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
+member:c,transform:b,data:d})};l.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};l.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};l.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};l.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
+this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(f<0||f>1)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=f<0?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=
+function(){if(f.readyState==4){if(f.status==0||f.status==200)f.responseXML?(ca=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else f.readyState==3&&d&&(e==0&&(e=f.getResponseHeader("Content-Length")),d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Aa=a},applySkin:e,geometries:ja,options:la}};
+THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0){try{var h=JSON.parse(f.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+f.status+"]");else f.readyState==3?e&&(g==0&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):
 f.readyState==2&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
@@ -653,20 +654,20 @@ q=a.morphTargets[c].vertices;i=0;for(k=q.length;i<k;i+=3)j=q[i]*b,o=q[i+1]*b,p=q
 d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(p in Q.objects)if(!v.objects[p])if(r=Q.objects[p],r.geometry!==void 0){if(G=v.geometries[r.geometry]){a=!1;for(W=0;W<r.materials.length;W++)$=v.materials[r.materials[W]],a=$ instanceof THREE.ShaderMaterial;a&&G.computeTangents();z=r.position;A=r.rotation;E=r.quaternion;D=r.scale;E=0;$.length==0&&($=new THREE.MeshFaceMaterial);$.length>1&&($=new THREE.MeshFaceMaterial);
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(p in Q.objects)if(!v.objects[p])if(r=Q.objects[p],r.geometry!==void 0){if(G=v.geometries[r.geometry]){a=!1;for(X=0;X<r.materials.length;X++)$=v.materials[r.materials[X]],a=$ instanceof THREE.ShaderMaterial;a&&G.computeTangents();z=r.position;A=r.rotation;E=r.quaternion;D=r.scale;E=0;$.length==0&&($=new THREE.MeshFaceMaterial);$.length>1&&($=new THREE.MeshFaceMaterial);
 a=new THREE.Mesh(G,$);a.name=p;a.position.set(z[0],z[1],z[2]);E?(a.quaternion.set(E[0],E[1],E[2],E[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]);a.scale.set(D[0],D[1],D[2]);a.visible=r.visible;v.scene.add(a);v.objects[p]=a;if(r.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);v.scene.collisions.colliders.push(b)}if(r.castsShadow)b=new THREE.ShadowVolume(G),v.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;r.trigger&&r.trigger.toLowerCase()!="none"&&(b=
 {type:r.trigger,object:r},v.triggers[a.name]=b)}}else z=r.position,A=r.rotation,E=r.quaternion,D=r.scale,E=0,a=new THREE.Object3D,a.name=p,a.position.set(z[0],z[1],z[2]),E?(a.quaternion.set(E[0],E[1],E[2],E[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]),a.scale.set(D[0],D[1],D[2]),a.visible=r.visible!==void 0?r.visible:!1,v.scene.add(a),v.objects[p]=a,v.empties[p]=a,r.trigger&&r.trigger.toLowerCase()!="none"&&(b={type:r.trigger,object:r},v.triggers[a.name]=b)}function f(a){return function(b){v.geometries[a]=
-b;e();S-=1;i.onLoadComplete();h()}}function g(a){return function(b){v.geometries[a]=b}}function h(){i.callbackProgress({totalModels:l,totalTextures:V,loadedModels:l-S,loadedTextures:V-R},v);i.onLoadProgress();S==0&&R==0&&b(v)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,o,p,m,q,n,s,r,u,t,z,A,E,D,B,w,G,y,K,$,Q,X,S,R,l,V,v;Q=a;c=new THREE.BinaryLoader;X=new THREE.JSONLoader;R=S=0;v={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+b;e();S-=1;i.onLoadComplete();h()}}function g(a){return function(b){v.geometries[a]=b}}function h(){i.callbackProgress({totalModels:l,totalTextures:W,loadedModels:l-S,loadedTextures:W-R},v);i.onLoadProgress();S==0&&R==0&&b(v)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,o,p,m,q,n,s,r,u,t,z,A,E,D,B,w,G,y,K,$,Q,Y,S,R,l,W,v;Q=a;c=new THREE.BinaryLoader;Y=new THREE.JSONLoader;R=S=0;v={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
 empties:{}};a=!1;for(p in Q.objects)if(r=Q.objects[p],r.meshCollider){a=!0;break}if(a)v.scene.collisions=new THREE.CollisionSystem;if(Q.transform)a=Q.transform.position,u=Q.transform.rotation,B=Q.transform.scale,a&&v.scene.position.set(a[0],a[1],a[2]),u&&v.scene.rotation.set(u[0],u[1],u[2]),B&&v.scene.scale.set(B[0],B[1],B[2]),(a||u||B)&&v.scene.updateMatrix();a=function(){R-=1;h();i.onLoadComplete()};for(q in Q.cameras)B=Q.cameras[q],B.type=="perspective"?y=new THREE.PerspectiveCamera(B.fov,B.aspect,
 B.near,B.far):B.type=="ortho"&&(y=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far)),z=B.position,u=B.target,B=B.up,y.position.set(z[0],z[1],z[2]),y.target=new THREE.Vector3(u[0],u[1],u[2]),B&&y.up.set(B[0],B[1],B[2]),v.cameras[q]=y;for(m in Q.lights)u=Q.lights[m],q=u.color!==void 0?u.color:16777215,y=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(z=u.direction,t=new THREE.DirectionalLight(q,y),t.position.set(z[0],z[1],z[2]),t.position.normalize()):u.type=="point"?
 (z=u.position,t=u.distance,t=new THREE.PointLight(q,y,t),t.position.set(z[0],z[1],z[2])):u.type=="ambient"&&(t=new THREE.AmbientLight(q)),v.scene.add(t),v.lights[m]=t;for(n in Q.fogs)m=Q.fogs[n],m.type=="linear"?K=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(K=new THREE.FogExp2(0,m.density)),B=m.color,K.color.setRGB(B[0],B[1],B[2]),v.fogs[n]=K;if(v.cameras&&Q.defaults.camera)v.currentCamera=v.cameras[Q.defaults.camera];if(v.fogs&&Q.defaults.fog)v.scene.fog=v.fogs[Q.defaults.fog];B=Q.defaults.bgcolor;
 v.bgColor=new THREE.Color;v.bgColor.setRGB(B[0],B[1],B[2]);v.bgColorAlpha=Q.defaults.bgalpha;for(j in Q.geometries)if(n=Q.geometries[j],n.type=="bin_mesh"||n.type=="ascii_mesh")S+=1,i.onLoadStart();l=S;for(j in Q.geometries)n=Q.geometries[j],n.type=="cube"?(G=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),v.geometries[j]=G):n.type=="plane"?(G=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),v.geometries[j]=
-G):n.type=="sphere"?(G=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),v.geometries[j]=G):n.type=="cylinder"?(G=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),v.geometries[j]=G):n.type=="torus"?(G=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),v.geometries[j]=G):n.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(n.subdivisions),v.geometries[j]=G):n.type=="bin_mesh"?c.load(d(n.url,Q.urlBaseType),f(j)):n.type=="ascii_mesh"?X.load(d(n.url,
-Q.urlBaseType),f(j)):n.type=="embedded_mesh"&&(n=Q.embeds[n.id])&&X.createModel(n,g(j),"");for(s in Q.textures)if(j=Q.textures[s],j.url instanceof Array){R+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else R+=1,i.onLoadStart();V=R;for(s in Q.textures){j=Q.textures[s];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=[];for(var W=0;W<j.url.length;W++)n[W]=d(j.url[W],Q.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=
+G):n.type=="sphere"?(G=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),v.geometries[j]=G):n.type=="cylinder"?(G=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),v.geometries[j]=G):n.type=="torus"?(G=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),v.geometries[j]=G):n.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(n.subdivisions),v.geometries[j]=G):n.type=="bin_mesh"?c.load(d(n.url,Q.urlBaseType),f(j)):n.type=="ascii_mesh"?Y.load(d(n.url,
+Q.urlBaseType),f(j)):n.type=="embedded_mesh"&&(n=Q.embeds[n.id])&&Y.createModel(n,g(j),"");for(s in Q.textures)if(j=Q.textures[s],j.url instanceof Array){R+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else R+=1,i.onLoadStart();W=R;for(s in Q.textures){j=Q.textures[s];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=[];for(var X=0;X<j.url.length;X++)n[X]=d(j.url[X],Q.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=
 THREE.ImageUtils.loadTexture(d(j.url,Q.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(K[j.wrap[0]]!==void 0)n.wrapS=K[j.wrap[0]];
 if(K[j.wrap[1]]!==void 0)n.wrapT=K[j.wrap[1]]}}v.textures[s]=n}for(o in Q.materials){s=Q.materials[o];for(w in s.parameters)if(w=="envMap"||w=="map"||w=="lightMap")s.parameters[w]=v.textures[s.parameters[w]];else if(w=="shading")s.parameters[w]=s.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w=="blending")s.parameters[w]=THREE[s.parameters[w]]?THREE[s.parameters[w]]:THREE.NormalBlending;else if(w=="combine")s.parameters[w]=s.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;
-else if(w=="vertexColors")if(s.parameters[w]=="face")s.parameters[w]=THREE.FaceColors;else if(s.parameters[w])s.parameters[w]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=!0;if(s.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);n=s.parameters.color;K=s.parameters.specular;c=s.parameters.ambient;X=s.parameters.shininess;a.tNormal.texture=v.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=
-s.parameters.normalMapFactor;if(s.parameters.map)a.tDiffuse.texture=s.parameters.map,a.enableDiffuse.value=!0;if(s.parameters.lightMap)a.tAO.texture=s.parameters.lightMap,a.enableAO.value=!0;if(s.parameters.specularMap)a.tSpecular.texture=v.textures[s.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(K);a.uAmbientColor.value.setHex(c);a.uShininess.value=X;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;s=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
+else if(w=="vertexColors")if(s.parameters[w]=="face")s.parameters[w]=THREE.FaceColors;else if(s.parameters[w])s.parameters[w]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=!0;if(s.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);n=s.parameters.color;K=s.parameters.specular;c=s.parameters.ambient;Y=s.parameters.shininess;a.tNormal.texture=v.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=
+s.parameters.normalMapFactor;if(s.parameters.map)a.tDiffuse.texture=s.parameters.map,a.enableDiffuse.value=!0;if(s.parameters.lightMap)a.tAO.texture=s.parameters.lightMap,a.enableAO.value=!0;if(s.parameters.specularMap)a.tSpecular.texture=v.textures[s.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(K);a.uAmbientColor.value.setHex(c);a.uShininess.value=Y;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;s=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
 vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else s=new THREE[s.type](s.parameters);v.materials[o]=s}e();i.callbackSync(v);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,f=c.offsetX!==void 0?c.offsetX:0,g=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 b,e,f,g,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d);f+=h>>1^-(h&1);c[8*g+e]=f}d+=b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++)h=a.charCodeAt(e+d),f[e]=g-h,h==0&&g++;return[c,f]};
@@ -722,7 +723,7 @@ b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB
 "color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,f,g,h){var a=a.__webglFlares,i=a.length;if(i){var k=new THREE.Vector3,j=h/g,o=g*0.5,p=h*0.5,m=16/h,q=new THREE.Vector2(m*j,m),n=new THREE.Vector3(1,1,0),s=new THREE.Vector2(1,1),r=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
 b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(r.occlusionMap,0);b.uniform1i(r.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var u,t,z,A,E;for(u=0;u<i;u++)if(m=16/h,q.set(m*j,m),A=a[u],k.set(A.matrixWorld.n14,A.matrixWorld.n24,A.matrixWorld.n34),f.matrixWorldInverse.multiplyVector3(k),
 f.projectionMatrix.multiplyVector3(k),n.copy(k),s.x=n.x*o+o,s.y=n.y*p+p,d.hasVertexTexture||s.x>0&&s.x<g&&s.y>0&&s.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,s.x-8,s.y-8,16,16,0);b.uniform1i(r.renderType,0);b.uniform2f(r.scale,q.x,q.y);b.uniform3f(r.screenPosition,n.x,n.y,n.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
-b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,s.x-8,s.y-8,16,16,0);b.uniform1i(r.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(n);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(r.renderType,2);b.enable(b.BLEND);t=0;for(z=A.lensFlares.length;t<z;t++)if(E=A.lensFlares[t],E.opacity>0.0010&&E.scale>0.0010)n.x=E.x,n.y=E.y,n.z=E.z,m=E.size*E.scale/
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,s.x-8,s.y-8,16,16,0);b.uniform1i(r.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(n);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(r.renderType,2);b.enable(b.BLEND);t=0;for(z=A.lensFlares.length;t<z;t++)if(E=A.lensFlares[t],E.opacity>0.001&&E.scale>0.001)n.x=E.x,n.y=E.y,n.z=E.z,m=E.size*E.scale/
 h,q.x=m*j,q.y=m,b.uniform3f(r.screenPosition,n.x,n.y,n.z),b.uniform2f(r.scale,q.x,q.y),b.uniform1f(r.rotation,E.rotation),b.uniform1f(r.opacity,E.opacity),b.uniform3f(r.color,E.color.r,E.color.g,E.color.b),c.setBlending(E.blending),c.setTexture(E.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f=new THREE.Frustum,g=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=
 function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,k,j,o,p,m,q,n,s=0,r=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(k=r.length;i<k;i++)if(q=r[i],q.castShadow&&q instanceof THREE.SpotLight){this.shadowMap[s]||(this.shadowMap[s]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -76,7 +76,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,j=a.z,a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,n=this.w,k=n*c+g*e-j*d,l=n*d+j*c-f*e,h=n*e+f*d-g*c,c=-f*
 c-g*d-j*e;b.x=k*n+c*-f+l*-j-h*-g;b.y=l*n+c*-g+h*-f-k*-j;b.z=h*n+c*-j+k*-g-l*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -76,7 +76,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,l=this.w,i=l*c+g*e-h*d,j=l*d+h*c-f*e,k=l*e+f*d-g*c,c=-f*
 c-g*d-h*e;b.x=i*l+c*-f+j*-h-k*-g;b.y=j*l+c*-g+k*-f-i*-h;b.z=k*l+c*-h+i*-g-j*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};

+ 62 - 61
build/custom/ThreeExtras.js

@@ -9,8 +9,8 @@ f;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},r
 g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
 f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return k[e]>a?b(d,e-1):k[e]<a?b(e+1,c):e}return b(0,k.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,k=[],j,q,p,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,q=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,q,p);else if(d instanceof
 THREE.Face4)j=f[d.a].position,q=f[d.b].position,p=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,m),d._area2=THREE.GeometryUtils.triangleArea(q,p,m),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
-b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,g=d.length;e<g;e++)d[e].u!==1&&(d[e].u-=Math.floor(d[e].u)),d[e].v!==1&&(d[e].v-=Math.floor(d[e].v))}};
-THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Vector3;b.x=-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]);b.y=-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]);b.z=-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]);a.applyMatrix((new THREE.Matrix4).setTranslation(b.x,b.y,b.z));a.computeBoundingBox();return b},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,g=d.length;e<g;e++)d[e].u!==1&&(d[e].u-=Math.floor(d[e].u)),
+d[e].v!==1&&(d[e].v-=Math.floor(d[e].v))}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},getNormalMap:function(a,b){var c=function(a){var b=
 Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var q=1;q<e;q++){var p=q-1<0?e-1:q-1,m=(q+1)%e,l=j-1<0?d-1:j-1,n=(j+1)%d,r=[],o=[0,0,h[(q*d+j)*4]/255*b];r.push([-1,0,h[(q*d+l)*4]/255*b]);r.push([-1,-1,h[(p*d+l)*4]/255*b]);r.push([0,-1,h[(p*d+j)*4]/255*b]);r.push([1,
 -1,h[(p*d+n)*4]/255*b]);r.push([1,0,h[(q*d+n)*4]/255*b]);r.push([1,1,h[(m*d+n)*4]/255*b]);r.push([0,1,h[(m*d+j)*4]/255*b]);r.push([-1,1,h[(m*d+l)*4]/255*b]);p=[];l=r.length;for(m=0;m<l;m++){var n=r[m],s=r[(m+1)%l],n=[n[0]-o[0],n[1]-o[1],n[2]-o[2]],s=[s[0]-o[0],s[1]-o[1],s[2]-o[2]];p.push(c([n[1]*s[2]-n[2]*s[1],n[2]*s[0]-n[0]*s[2],n[0]*s[1]-n[1]*s[0]]))}r=[0,0,0];for(m=0;m<p.length;m++)r[0]+=p[m][0],r[1]+=p[m][1],r[2]+=p[m][2];r[0]/=p.length;r[1]/=p.length;r[2]/=p.length;o=(q*d+j)*4;k[o]=(r[0]+1)/
@@ -92,7 +92,7 @@ this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=e,this.points[2]=g,thi
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,k;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],k[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],k[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],k[2],e,c,f);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
-THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=c!==void 0?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var g=c[e],f=this.getNextKeyWith(g,a,0);f&&f.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
+THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=c!==void 0?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var g=c[e],f=this.getNextKeyWith(g,a,0);f&&f.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
 d.matrixWorldNeedsUpdate=!0}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,g;for(c=0;c<d;c++){e=this.hierarchy[c];g=this.data.hierarchy[c];e.useQuaternion=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,g.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
 e.matrix;e=this.data.hierarchy[c].keys;if(e.length)g.animationCache.prevKey=e[0],g.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
@@ -112,7 +112,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){b||(b=43.25);var c=2*Math.atan(b/(a*2));c*=180/Math.PI;this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
-THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
@@ -122,14 +122,14 @@ this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
 THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},g,f=b.getControlPointsArray(),h=b.getLength(),r=f.length,o=0;g=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:d,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<r-1;g++)o=d*h.chunks[g]/h.total,b.keys[g]={time:o,pos:f[g]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;b=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,f=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(f,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -175,7 +175,7 @@ THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+
 (Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,g=e.vertices[c].position;return b((d.x+g.x)/2,(d.y+g.y)/2,(d.z+g.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
 1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),k=d(g.faces[h].b,g.faces[h].c),j=d(g.faces[h].c,g.faces[h].a);c(g.faces[h].a,i,j,a);c(g.faces[h].b,k,i,a);c(g.faces[h].c,j,k,a);c(i,k,j,a)}g.faces=a.faces;g.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=
 g.faces;e.faceVertexUvs[0]=g.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;i==0&&(g=d);
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;i==0&&(g=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,e(a,b),e(a,c),h),d(e(a,b),b,e(b,c),h),d(e(a,c),e(b,c),c,h),d(e(a,b),e(b,c),e(a,c),h))}function e(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];d===void 0&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function g(a,b,c){c<0&&a.u===
@@ -246,59 +246,60 @@ d(b,h,c);j=h;k=e.skin;for(n=0;n<j.length;n++)if(m=j[n],l=-1,m.type=="JOINT"){for
 a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(T[i.skin.source]&&(d=i=T[i.skin.source],i.morph&&V[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(V[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=
 a.geometries[f],j=i.instance_material,i=V[i.url],k={},l=[],o=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=ea[da[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=o;l.push(q.material);p=q.material;o++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(o>1){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=
 i.faces[h],l.materialIndex=k[l.daeMaterial]}if(c!==void 0)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=T[c.url],j.skinInstanceController=c,j.name="skin_"+aa.length,aa.push(j);else if(d!==void 0){h=i;k=d instanceof m?T[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=V[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
-h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+$.length;$.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=
-this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=
-[];this.obj=null}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function l(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function o(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}
-function z(){this.input={}}function u(){this.semantic="";this.offset=0;this.source="";this.set=0}function y(a){this.id=a;this.type=null}function x(){this.name=this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function D(a,b){this.type=a;this.effect=b;this.material=null}function v(a){this.effect=a;this.format=this.init_from=null}function E(a){this.effect=
-a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function F(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function C(){this.url=""}function K(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function G(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function J(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=
-this.strideOut=this.output=this.input=null;this.duration=0}function O(a){this.targets=[];this.time=a}function M(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function B(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function L(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),
-10):c}function I(a,b){if(Q.convertUpAxis&&Z!==Q.upAxis)switch(U){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function R(a,b){var c=[a[b],a[b+1],a[b+2]];I(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Q.convertUpAxis){var b=[a[0],a[4],a[8]];I(b,-1);
-a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];I(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];I(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];I(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];I(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];I(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];I(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var P=null,
-X=null,S,ia=null,Y={},ca={},W={},T={},V={},da={},ea={},ga,fa,ja,$,aa,ka=THREE.SmoothShading,Q={convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Z="Y",U=null,ha=Math.PI/180;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=
-a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new y).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=
-0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new u).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=
-0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=B(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new y).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
-(new u).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new u).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},m=0;m<e.length;m++){var l=
-e[m],o=c[g+l.offset];switch(l.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[l.source].data[o]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=
-a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new q).parse(c))}}return this};q.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();
-for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};q.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};q.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};q.prototype.getTransformBySid=
-function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};q.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
-1)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));
-break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in W)for(var e=W[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Q.convertUpAxis)switch(g){case "X":switch(U){case "XtoY":case "XtoZ":case "YtoX":g=
-"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(U){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(U){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],o=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&r==null;s++){var u=d[s];if(u.time===l)r=u;else if(u.time>l)break}if(!r){r=
-new O(l);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=l&&(s=t);l=s;d.splice(l==-1?d.length:l,0,r)}r.addTarget(f,j,g,o)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=i>=0?i:i+h.length;i>=0;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;o=void 0;if(k.length){o=[];for(l=0;l<k.length;++l)o[l]=k[l]+(j[l]-k[l])*h}else o=k+(j-k)*h;f.addTarget(g,i.transform,i.member,o)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=B(a.textContent);this.convert();
-return this};p.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*ha;case "translate":I(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":I(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};p.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
-break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};p.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
-a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*ha;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*ha}}};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",
-c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new l).parse(d)),d=c.iterateNext()}}return this};l.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=
-P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new l).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new o(this)).parse(c)}}return this};o.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-switch(c.nodeName){case "source":var d=c.getAttribute("id");Y[d]==void 0&&(Y[d]=(new y(d)).parse(c));break;case "vertices":this.vertices=(new z).parse(c);break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(c))}}this.geometry3js=new THREE.Geometry;a=Y[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(R(a,
-b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};o.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,m=0,l=3,o=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":o.push(h.set)}for(;c<f.length;){var n=[],p=[],
-r={},q=[];a.vcount&&(l=a.vcount[m++]);for(d=0;d<l;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Y[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":n.push(i);break;case "NORMAL":p.push(R(k.data,j));break;case "TEXCOORD":r[h.set]===void 0&&(r[h.set]=[]);r[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":q.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(l===3)d.push(new THREE.Face3(n[0],n[1],n[2],[p[0],p[1],
-p[2]],q.length?q:new THREE.Color));else if(l===4)d.push(new THREE.Face4(n[0],n[1],n[2],n[3],[p[0],p[1],p[2],p[3]],q.length?q:new THREE.Color));else if(l>4&&Q.subdivideFaces){q=q.length?q:new THREE.Color;for(e=1;e<l-1;)d.push(new THREE.Face3(n[0],n[e],n[e+1],[p[0],p[e++],p[e]],q))}if(d.length){n=0;for(p=d.length;n<p;n++){e=d[n];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)q=r[o[e]],q=l>4?[q[0],q[n+1],q[n+2]]:l===4?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=
-[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);c+=g.length*l}};s.prototype=new t;s.prototype.constructor=s;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=L(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new u).parse(a.childNodes[b]));
-break;case "vcount":this.vcount=H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=L(a,"count",0);this.stride=L(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
-"input"){var c=(new u).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};u.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=L(a,"set",-1);this.offset=L(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=N(c.textContent).split(/\s+/),
-e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=B(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};
-y.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};x.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
-"instance_effect"){this.instance_effect=(new C).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=B(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),
-this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};A.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&a.childNodes[1].nodeName==="extra"&&(a=a.childNodes[1],a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=
-parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",
-c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};D.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
-this.effect.surface.sid){var e=ca[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(ja+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=
-this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};v.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
-a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};F.prototype.create=function(){if(this.shader==null)return null};F.prototype.parse=
-function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};F.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new v(this)).parse(d);this.surface.sid=b;
-break;case "sampler2D":this.sampler=(new E(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};F.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};F.prototype.parseTechnique=function(a){for(var b=
-0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new D(c.nodeName,this)).parse(c)}}};C.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new y).parse(c);
-this.source[c.id]=c;break;case "sampler":this.sampler.push((new J(this)).parse(c));break;case "channel":this.channel.push((new G(this)).parse(c))}}return this};G.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=
-parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new u).parse(c))}}return this};J.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=
-c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};
-J.prototype.getData=function(a,b){var c;if(this.strideOut>1){c=[];b*=this.strideOut;for(var d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":I(c,-1);break;case "scale":I(c,1)}}else c=this.output[b];return c};O.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};O.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};
-O.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};O.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};O.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(f<0||f>1)console.log("Key.interpolate: Warning! Scale out of bounds:"+
-f),f=f<0?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))d.responseXML?(ia=c,a(d.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+
-b+")")};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:e,geometries:V,options:Q}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+$.length;$.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];Q.centerGeometry&&b.geometry&&(c=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(c.multiplySelf(b.scale)),
+b.position.subSelf(c));for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=
+[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.obj=null}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function l(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function o(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function z(){this.input={}}function u(){this.semantic="";this.offset=0;this.source="";this.set=0}function y(a){this.id=a;this.type=null}function x(){this.name=this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}
+function D(a,b){this.type=a;this.effect=b;this.material=null}function v(a){this.effect=a;this.format=this.init_from=null}function E(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function F(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function C(){this.url=""}function K(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function G(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
+this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function J(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function O(a){this.targets=[];this.time=a}function M(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function B(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=N(a).split(/\s+/),b=[],c=
+0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function L(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function I(a,b){if(Q.convertUpAxis&&Z!==Q.upAxis)switch(U){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=
+a[1],a[1]=a[2],a[2]=b*c}}function R(a,b){var c=[a[b],a[b+1],a[b+2]];I(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Q.convertUpAxis){var b=[a[0],a[4],a[8]];I(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];I(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];I(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];I(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];I(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];I(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];
+b=[a[3],a[7],a[11]];I(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var P=null,X=null,S,ia=null,Y={},ca={},W={},T={},V={},da={},ea={},ga,fa,ja,$,aa,ka=THREE.SmoothShading,Q={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Z="Y",U=null,ha=Math.PI/180;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName==
+"init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,
+"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new y).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==
+1)switch(d.nodeName){case "input":b.push((new u).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=B(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new y).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;
+default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new u).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==
+1)switch(g.nodeName){case "input":e.push((new u).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},m=0;m<e.length;m++){var l=e[m],o=c[g+l.offset];switch(l.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[l.source].data[o]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=
+this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new q).parse(c))}}return this};q.prototype.getChannelForTransform=function(a){for(var b=
+0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};q.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
+b);if(d)return d}return null};q.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};q.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};q.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=
+b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in W)for(var e=W[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
+if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Q.convertUpAxis)switch(g){case "X":switch(U){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(U){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g=
+"Z"}break;case "Z":switch(U){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],o=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&r==null;s++){var u=d[s];if(u.time===l)r=u;else if(u.time>l)break}if(!r){r=new O(l);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=l&&(s=t);l=s;d.splice(l==-1?d.length:l,0,r)}r.addTarget(f,j,g,o)}}else console.log('Could not find transform "'+
+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=i>=0?i:i+h.length;i>=0;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;o=void 0;if(k.length){o=[];for(l=0;l<k.length;++l)o[l]=k[l]+(j[l]-k[l])*h}else o=k+(j-k)*h;f.addTarget(g,i.transform,
+i.member,o)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=B(a.textContent);this.convert();return this};p.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*ha;case "translate":I(this.data,
+-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":I(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};p.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};p.prototype.update=function(a,
+b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*ha;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*
+ha}}};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new l).parse(d)),d=c.iterateNext()}}return this};
+l.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new l).parse(b)),
+b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new o(this)).parse(c)}}return this};o.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");Y[d]==void 0&&(Y[d]=(new y(d)).parse(c));break;case "vertices":this.vertices=(new z).parse(c);
+break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(c))}}this.geometry3js=new THREE.Geometry;a=Y[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(R(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();
+this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};o.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,m=0,l=3,o=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":o.push(h.set)}for(;c<f.length;){var n=[],p=[],r={},q=[];a.vcount&&(l=a.vcount[m++]);for(d=0;d<l;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Y[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":n.push(i);
+break;case "NORMAL":p.push(R(k.data,j));break;case "TEXCOORD":r[h.set]===void 0&&(r[h.set]=[]);r[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":q.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(l===3)d.push(new THREE.Face3(n[0],n[1],n[2],[p[0],p[1],p[2]],q.length?q:new THREE.Color));else if(l===4)d.push(new THREE.Face4(n[0],n[1],n[2],n[3],[p[0],p[1],p[2],p[3]],q.length?q:new THREE.Color));else if(l>4&&Q.subdivideFaces){q=q.length?q:new THREE.Color;
+for(e=1;e<l-1;)d.push(new THREE.Face3(n[0],n[e],n[e+1],[p[0],p[e++],p[e]],q))}if(d.length){n=0;for(p=d.length;n<p;n++){e=d[n];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)q=r[o[e]],q=l>4?[q[0],q[n+1],q[n+2]]:l===4?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+l+" for geometry with id: "+b.id);c+=g.length*l}};s.prototype=new t;s.prototype.constructor=s;t.prototype.setVertices=
+function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=L(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new u).parse(a.childNodes[b]));break;case "vcount":this.vcount=H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=
+function(a){this.params=[];this.source=a.getAttribute("source");this.count=L(a,"count",0);this.stride=L(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new u).parse(a.childNodes[b]);this.input[c.semantic]=
+c}return this};u.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=L(a,"set",-1);this.offset=L(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=N(c.textContent).split(/\s+/),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]==
+"1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=B(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};y.prototype.read=function(){var a=[],b=
+this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};x.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=
+(new C).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=B(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),
+this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};A.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&a.childNodes[1].nodeName==="extra"&&(a=a.childNodes[1],a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);
+break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};D.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=ca[this.effect.surface.init_from];
+if(e)e=THREE.ImageUtils.loadTexture(ja+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=
+this[c],b=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};v.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=
+c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};F.prototype.create=function(){if(this.shader==null)return null};F.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=
+null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};F.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new v(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new E(this)).parse(d);this.sampler.sid=b;break;case "extra":break;
+default:console.log(d.nodeName)}}};F.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};F.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=
+(new D(c.nodeName,this)).parse(c)}}};C.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new y).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new J(this)).parse(c));break;case "channel":this.channel.push((new G(this)).parse(c))}}return this};
+G.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};J.prototype.parse=function(a){this.id=
+a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new u).parse(c))}}return this};J.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;
+case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};J.prototype.getData=function(a,b){var c;if(this.strideOut>1){c=[];b*=this.strideOut;for(var d=0;d<this.strideOut;++d)c[d]=this.output[b+
+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":I(c,-1);break;case "scale":I(c,1)}}else c=this.output[b];return c};O.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};O.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};O.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};
+O.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};O.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(f<0||f>1)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=f<0?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,
+d.member)}};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4){if(f.status==0||f.status==200)f.responseXML?(ia=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else f.readyState==3&&d&&(e==0&&(e=f.getResponseHeader("Content-Length")),d({total:e,loaded:f.responseText.length}))};
+f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:e,geometries:V,options:Q}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){try{var h=JSON.parse(g.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
 g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
@@ -379,7 +380,7 @@ b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB
 "color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var k=new THREE.Vector3,j=h/f,q=f*0.5,p=h*0.5,m=16/h,l=new THREE.Vector2(m*j,m),n=new THREE.Vector3(1,1,0),r=new THREE.Vector2(1,1),o=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
 b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(o.occlusionMap,0);b.uniform1i(o.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var s,t,w,z,u;for(s=0;s<i;s++)if(m=16/h,l.set(m*j,m),z=a[s],k.set(z.matrixWorld.n14,z.matrixWorld.n24,z.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(k),
 g.projectionMatrix.multiplyVector3(k),n.copy(k),r.x=n.x*q+q,r.y=n.y*p+p,d.hasVertexTexture||r.x>0&&r.x<f&&r.y>0&&r.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,r.x-8,r.y-8,16,16,0);b.uniform1i(o.renderType,0);b.uniform2f(o.scale,l.x,l.y);b.uniform3f(o.screenPosition,n.x,n.y,n.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
-b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,r.x-8,r.y-8,16,16,0);b.uniform1i(o.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(n);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(o.renderType,2);b.enable(b.BLEND);t=0;for(w=z.lensFlares.length;t<w;t++)if(u=z.lensFlares[t],u.opacity>0.0010&&u.scale>0.0010)n.x=u.x,n.y=u.y,n.z=u.z,m=u.size*u.scale/
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,r.x-8,r.y-8,16,16,0);b.uniform1i(o.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(n);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(o.renderType,2);b.enable(b.BLEND);t=0;for(w=z.lensFlares.length;t<w;t++)if(u=z.lensFlares[t],u.opacity>0.001&&u.scale>0.001)n.x=u.x,n.y=u.y,n.z=u.z,m=u.size*u.scale/
 h,l.x=m*j,l.y=m,b.uniform3f(o.screenPosition,n.x,n.y,n.z),b.uniform2f(o.scale,l.x,l.y),b.uniform1f(o.rotation,u.rotation),b.uniform1f(o.opacity,u.opacity),b.uniform3f(o.color,u.color.r,u.color.g,u.color.b),c.setBlending(u.blending),c.setTexture(u.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,g=new THREE.Frustum,f=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=
 function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,k,j,q,p,m,l,n,r=0,o=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(k=o.length;i<k;i++)if(l=o[i],l.castShadow&&l instanceof THREE.SpotLight){this.shadowMap[r]||(this.shadowMap[r]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,

+ 1 - 1
build/custom/ThreeSVG.js

@@ -76,7 +76,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,l=this.w,i=l*c+g*e-h*d,k=l*d+h*c-f*e,j=l*e+f*d-g*c,c=-f*
 c-g*d-h*e;b.x=i*l+c*-f+k*-h-j*-g;b.y=k*l+c*-g+j*-f-i*-h;b.z=j*l+c*-h+i*-g-k*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};

+ 2 - 2
build/custom/ThreeWebGL.js

@@ -76,7 +76,7 @@ this.x=a.x*c;this.y=a.y*c;this.z=a.z*c;this.w=Math.cos(d);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,d=this.y,c=this.z,f=this.w,g=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+f*g+d*i-c*h;this.y=d*a+f*h+c*g-b*i;this.z=c*a+f*i+b*h-d*g;this.w=f*a-b*g-d*h-c*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var d=a.x,c=a.y,f=a.z,g=this.x,h=this.y,i=this.z,l=this.w,k=l*d+h*f-i*c,j=l*c+i*d-g*f,p=l*f+g*c-h*d,d=-g*
 d-h*c-i*f;b.x=k*l+d*-g+j*-i-p*-h;b.y=j*l+d*-h+p*-g-k*-i;b.z=p*l+d*-i+k*-h-j*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,d,c){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(d.w=-b.w,d.x=-b.x,d.y=-b.y,d.z=-b.z,f=-f):d.copy(b);if(Math.abs(f)>=1)return d.w=a.w,d.x=a.x,d.y=a.y,d.z=a.z,d;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return d.w=0.5*(a.w+b.w),d.x=0.5*(a.x+b.x),d.y=0.5*(a.y+b.y),d.z=0.5*(a.z+b.z),d;b=Math.sin((1-c)*g)/f;c=Math.sin(c*g)/f;d.w=a.w*b+d.w*c;d.x=a.x*b+d.x*c;d.y=a.y*b+d.y*c;d.z=a.z*b+d.z*c;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,d,c){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(d.w=-b.w,d.x=-b.x,d.y=-b.y,d.z=-b.z,f=-f):d.copy(b);if(Math.abs(f)>=1)return d.w=a.w,d.x=a.x,d.y=a.y,d.z=a.z,d;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return d.w=0.5*(a.w+b.w),d.x=0.5*(a.x+b.x),d.y=0.5*(a.y+b.y),d.z=0.5*(a.z+b.z),d;b=Math.sin((1-c)*g)/f;c=Math.sin(c*g)/f;d.w=a.w*b+d.w*c;d.x=a.x*b+d.x*c;d.y=a.y*b+d.y*c;d.z=a.z*b+d.z*c;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,d,c,f,g){this.a=a;this.b=b;this.c=d;this.normal=c instanceof THREE.Vector3?c:new THREE.Vector3;this.vertexNormals=c instanceof Array?c:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,d,c,f,g,h){this.a=a;this.b=b;this.c=d;this.d=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -303,7 +303,7 @@ b.bindTexture(b.TEXTURE_2D,c.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB
 "color");c.uniforms.scale=b.getUniformLocation(c.program,"scale");c.uniforms.rotation=b.getUniformLocation(c.program,"rotation");c.uniforms.screenPosition=b.getUniformLocation(c.program,"screenPosition");c.attributesEnabled=!1};this.render=function(a,g,h,i){var a=a.__webglFlares,l=a.length;if(l){var k=new THREE.Vector3,j=i/h,p=h*0.5,s=i*0.5,w=16/i,n=new THREE.Vector2(w*j,w),E=new THREE.Vector3(1,1,0),y=new THREE.Vector2(1,1),J=c.uniforms,w=c.attributes;b.useProgram(c.program);if(!c.attributesEnabled)b.enableVertexAttribArray(c.attributes.vertex),
 b.enableVertexAttribArray(c.attributes.uv),c.attributesEnabled=!0;b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,1);b.bindBuffer(b.ARRAY_BUFFER,c.vertexBuffer);b.vertexAttribPointer(w.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(w.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var P,Q,V,C,D;for(P=0;P<l;P++)if(w=16/i,n.set(w*j,w),C=a[P],k.set(C.matrixWorld.n14,C.matrixWorld.n24,C.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(k),
 g.projectionMatrix.multiplyVector3(k),E.copy(k),y.x=E.x*p+p,y.y=E.y*s+s,c.hasVertexTexture||y.x>0&&y.x<h&&y.y>0&&y.y<i){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,c.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,y.x-8,y.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,n.x,n.y);b.uniform3f(J.screenPosition,E.x,E.y,E.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,c.occlusionTexture);
-b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,y.x-8,y.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,c.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);C.positionScreen.copy(E);C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);Q=0;for(V=C.lensFlares.length;Q<V;Q++)if(D=C.lensFlares[Q],D.opacity>0.0010&&D.scale>0.0010)E.x=D.x,E.y=D.y,E.z=D.z,w=D.size*D.scale/
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,y.x-8,y.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,c.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);C.positionScreen.copy(E);C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);Q=0;for(V=C.lensFlares.length;Q<V;Q++)if(D=C.lensFlares[Q],D.opacity>0.001&&D.scale>0.001)E.x=D.x,E.y=D.y,E.z=D.z,w=D.size*D.scale/
 i,n.x=w*j,n.y=w,b.uniform3f(J.screenPosition,E.x,E.y,E.z),b.uniform2f(J.scale,n.x,n.y),b.uniform1f(J.rotation,D.rotation),b.uniform1f(J.opacity,D.opacity),b.uniform3f(J.color,D.color.r,D.color.g,D.color.b),d.setBlending(D.blending),d.setTexture(D.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,d,c,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(f){a=f.context;b=f;var f=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(f.uniforms);d=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g});c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:g,morphTargets:!0});d._shadowPass=!0;c._shadowPass=!0};this.render=
 function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i){var l,k,j,p,s,w,n,E,y=0,J=i.lights;f||(f=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));l=0;for(k=J.length;l<k;l++)if(n=J[l],n.castShadow&&n instanceof THREE.SpotLight){this.shadowMap[y]||(this.shadowMap[y]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,

+ 1 - 1
examples/webgl_loader_json_blender.html

@@ -125,7 +125,7 @@
 
 				scene.add( new THREE.AmbientLight( 0xcccccc ) );
 
-				pointLight = new THREE.PointLight( 0xff4400, 2, 60 );
+				pointLight = new THREE.PointLight( 0xff4400, 5, 30 );
 				pointLight.position.set( 5, 0, 0 );
 				scene.add( pointLight );
 

+ 12 - 14
src/extras/GeometryUtils.js

@@ -238,7 +238,7 @@ THREE.GeometryUtils = {
 	// 	(uniform distribution)
 	// 	http://www.cgafaq.info/wiki/Random_Point_In_Triangle
 
-	randomPointInTriangle: function( vectorA, vectorB, vectorC ) {
+	randomPointInTriangle: function ( vectorA, vectorB, vectorC ) {
 
 		var a, b, c,
 			point = new THREE.Vector3(),
@@ -276,7 +276,7 @@ THREE.GeometryUtils = {
 	// Get random point in face (triangle / quad)
 	// (uniform distribution)
 
-	randomPointInFace: function( face, geometry, useCachedAreas ) {
+	randomPointInFace: function ( face, geometry, useCachedAreas ) {
 
 		var vA, vB, vC, vD;
 
@@ -343,7 +343,7 @@ THREE.GeometryUtils = {
 	//  - find corresponding place in area array by binary search
 	//	- get random point in face
 
-	randomPointsInGeometry: function( geometry, n ) {
+	randomPointsInGeometry: function ( geometry, n ) {
 
 		var face, i,
 			faces = geometry.faces,
@@ -456,7 +456,7 @@ THREE.GeometryUtils = {
 	// Get triangle area (by Heron's formula)
 	// 	http://en.wikipedia.org/wiki/Heron%27s_formula
 
-	triangleArea: function( vectorA, vectorB, vectorC ) {
+	triangleArea: function ( vectorA, vectorB, vectorC ) {
 
 		var s, a, b, c,
 			tmp = THREE.GeometryUtils.__v1;
@@ -478,22 +478,20 @@ THREE.GeometryUtils = {
 
 	// Center geometry so that 0,0,0 is in center of bounding box
 
-	center: function( geometry ) {
+	center: function ( geometry ) {
 
 		geometry.computeBoundingBox();
 
-		var matrix = new THREE.Matrix4();
-
-		var dx = -0.5 * ( geometry.boundingBox.x[ 1 ] + geometry.boundingBox.x[ 0 ] );
-		var dy = -0.5 * ( geometry.boundingBox.y[ 1 ] + geometry.boundingBox.y[ 0 ] );
-		var dz = -0.5 * ( geometry.boundingBox.z[ 1 ] + geometry.boundingBox.z[ 0 ] );
-
-		matrix.setTranslation( dx, dy, dz );
-
-		geometry.applyMatrix( matrix );
+		var offset = new THREE.Vector3();
+		offset.x = - 0.5 * ( geometry.boundingBox.x[ 1 ] + geometry.boundingBox.x[ 0 ] );
+		offset.y = - 0.5 * ( geometry.boundingBox.y[ 1 ] + geometry.boundingBox.y[ 0 ] );
+		offset.z = - 0.5 * ( geometry.boundingBox.z[ 1 ] + geometry.boundingBox.z[ 0 ] );
 
+		geometry.applyMatrix( new THREE.Matrix4().setTranslation( offset.x, offset.y, offset.z ) );
 		geometry.computeBoundingBox();
 
+		return offset;
+
 	},
 
 	// Normalize UVs to be from <0,1>