瀏覽代碼

Merged @greggman's cube texture autoscaling patch.

Made it toggleable with "renderer.autoScaleCubemaps" flag (on by default).
alteredq 13 年之前
父節點
當前提交
ef5f67d1a6
共有 3 個文件被更改,包括 598 次插入553 次删除
  1. 399 399
      build/Three.js
  2. 144 143
      build/custom/ThreeWebGL.js
  3. 55 11
      src/renderers/WebGLRenderer.js

+ 399 - 399
build/Three.js

@@ -18,66 +18,66 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};
-THREE.Ray=function(a,b){function c(a,b,c){n.sub(c,a);p=n.dot(b);if(p<=0)return null;o=q.add(a,m.copy(b).multiplyScalar(p));return r=c.distanceTo(o)}function d(a,b,c,d){n.sub(d,b);q.sub(c,b);m.sub(a,b);s=n.dot(n);u=n.dot(q);t=n.dot(m);A=q.dot(q);B=q.dot(m);z=1/(s*A-u*u);E=(A*t-u*B)*z;H=(s*B-u*t)*z;return E>=0&&H>=0&&E+H<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
-c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(m){for(var o,p=[],n=0,q=m.children.length;n<q;n++)Array.prototype.push.apply(p,this.intersectObject(m.children[n]));if(m instanceof THREE.Particle){n=
-c(this.origin,this.direction,m.matrixWorld.getPosition());if(n===null||n>m.scale.x)return[];o={distance:n,point:m.position,face:null,object:m};p.push(o)}else if(m instanceof THREE.Mesh){n=c(this.origin,this.direction,m.matrixWorld.getPosition());if(n===null||n>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return p;var r,s=m.geometry,u=s.vertices,t;m.matrixRotationWorld.extractRotation(m.matrixWorld);n=0;for(q=s.faces.length;n<q;n++)if(o=s.faces[n],a.copy(this.origin),
-b.copy(this.direction),t=m.matrixWorld,i=t.multiplyVector3(i.copy(o.centroid)).subSelf(a),r=i.dot(b),!(r<=0)&&(e=t.multiplyVector3(e.copy(u[o.a].position)),f=t.multiplyVector3(f.copy(u[o.b].position)),g=t.multiplyVector3(g.copy(u[o.c].position)),o instanceof THREE.Face4&&(h=t.multiplyVector3(h.copy(u[o.d].position))),k=m.matrixRotationWorld.multiplyVector3(k.copy(o.normal)),r=b.dot(k),m.doubleSided||(m.flipSided?r>0:r<0)))if(r=k.dot(i.sub(e,a))/r,j.add(a,b.multiplyScalar(r)),o instanceof THREE.Face3)d(j,
-e,f,g)&&(o={distance:a.distanceTo(j),point:j.clone(),face:o,object:m},p.push(o));else if(o instanceof THREE.Face4&&(d(j,e,f,h)||d(j,f,g,h)))o={distance:a.distanceTo(j),point:j.clone(),face:o,object:m},p.push(o)}return p};var n=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,p,o,r,s,u,t,A,B,z,E,H};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,n){h=!1;b=f;c=g;d=j;e=n;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
-function(f,g,j,n,q,m){h?(h=!1,b=f<j?f<q?f:q:j<q?j:q,c=g<n?g<m?g:m:n<m?n:m,d=f>j?f>q?f:q:j>q?j:q,e=g>n?g>m?g:m:n>m?n:m):(b=f<j?f<q?f<b?f:b:q<b?q:b:j<q?j<b?j:b:q<b?q:b,c=g<n?g<m?g<c?g:c:m<c?m:c:n<m?n<c?n:c:m<c?m:c,d=f>j?f>q?f>d?f:d:q>d?q:d:j>q?j>d?j:d:q>d?q:d,e=g>n?g>m?g>e?g:e:m>e?m:e:n>m?n>e?n:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
+THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);p=o.dot(b);if(p<=0)return null;m=s.add(a,n.copy(b).multiplyScalar(p));return q=c.distanceTo(m)}function d(a,b,c,d){o.sub(d,b);s.sub(c,b);n.sub(a,b);r=o.dot(o);t=o.dot(s);x=o.dot(n);v=s.dot(s);D=s.dot(n);y=1/(r*v-t*t);F=(v*x-t*D)*y;E=(r*D-t*x)*y;return F>=0&&E>=0&&F+E<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
+c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(n){for(var m,p=[],o=0,s=n.children.length;o<s;o++)Array.prototype.push.apply(p,this.intersectObject(n.children[o]));if(n instanceof THREE.Particle){o=
+c(this.origin,this.direction,n.matrixWorld.getPosition());if(o===null||o>n.scale.x)return[];m={distance:o,point:n.position,face:null,object:n};p.push(m)}else if(n instanceof THREE.Mesh){o=c(this.origin,this.direction,n.matrixWorld.getPosition());if(o===null||o>n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)))return p;var q,r=n.geometry,t=r.vertices,x;n.matrixRotationWorld.extractRotation(n.matrixWorld);o=0;for(s=r.faces.length;o<s;o++)if(m=r.faces[o],a.copy(this.origin),
+b.copy(this.direction),x=n.matrixWorld,i=x.multiplyVector3(i.copy(m.centroid)).subSelf(a),q=i.dot(b),!(q<=0)&&(e=x.multiplyVector3(e.copy(t[m.a].position)),f=x.multiplyVector3(f.copy(t[m.b].position)),g=x.multiplyVector3(g.copy(t[m.c].position)),m instanceof THREE.Face4&&(h=x.multiplyVector3(h.copy(t[m.d].position))),j=n.matrixRotationWorld.multiplyVector3(j.copy(m.normal)),q=b.dot(j),n.doubleSided||(n.flipSided?q>0:q<0)))if(q=j.dot(i.sub(e,a))/q,k.add(a,b.multiplyScalar(q)),m instanceof THREE.Face3)d(k,
+e,f,g)&&(m={distance:a.distanceTo(k),point:k.clone(),face:m,object:n},p.push(m));else if(m instanceof THREE.Face4&&(d(k,e,f,h)||d(k,f,g,h)))m={distance:a.distanceTo(k),point:k.clone(),face:m,object:n},p.push(m)}return p};var o=new THREE.Vector3,s=new THREE.Vector3,n=new THREE.Vector3,p,m,q,r,t,x,v,D,y,F,E};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,k,o){h=!1;b=f;c=g;d=k;e=o;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
+function(f,g,k,o,s,n){h?(h=!1,b=f<k?f<s?f:s:k<s?k:s,c=g<o?g<n?g:n:o<n?o:n,d=f>k?f>s?f:s:k>s?k:s,e=g>o?g>n?g:n:o>n?o:n):(b=f<k?f<s?f<b?f:b:s<b?s:b:k<s?k<b?k:b:s<b?s:b,c=g<o?g<n?g<c?g:c:n<c?n:c:o<n?o<c?o:c:n<c?n:c,d=f>k?f>s?f>d?f:d:s>d?s:d:k>s?k>d?k:d:s>d?s:d,e=g>o?g>n?g>e?g:e:n>e?n:e:o>n?o>e?o:e:n>e?n:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
 f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){if(d<a.getLeft())return!1;if(b>a.getRight())return!1;if(e<a.getTop())return!1;if(c>a.getBottom())return!1;return!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,k,j,n,q,m,p,o){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,i||0,k||0,j!==void 0?j:1,n||0,q||0,m||0,p||0,o!==void 0?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,k,j,n,q,m,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=k;this.n33=j;this.n34=n;this.n41=q;this.n42=m;this.n43=p;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();d.length()===0&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,k=a.n24,j=a.n31,n=a.n32,q=a.n33,m=a.n34,p=a.n41,o=a.n42,r=a.n43,
-s=a.n44,u=b.n11,t=b.n12,A=b.n13,B=b.n14,z=b.n21,E=b.n22,H=b.n23,w=b.n24,G=b.n31,y=b.n32,K=b.n33,Z=b.n34,Q=b.n41,X=b.n42,T=b.n43,R=b.n44;this.n11=c*u+d*z+e*G+f*Q;this.n12=c*t+d*E+e*y+f*X;this.n13=c*A+d*H+e*K+f*T;this.n14=c*B+d*w+e*Z+f*R;this.n21=g*u+h*z+i*G+k*Q;this.n22=g*t+h*E+i*y+k*X;this.n23=g*A+h*H+i*K+k*T;this.n24=g*B+h*w+i*Z+k*R;this.n31=j*u+n*z+q*G+m*Q;this.n32=j*t+n*E+q*y+m*X;this.n33=j*A+n*H+q*K+m*T;this.n34=j*B+n*w+q*Z+m*R;this.n41=p*u+o*z+r*G+s*Q;this.n42=p*t+o*E+r*y+s*X;this.n43=p*A+o*
-H+r*K+s*T;this.n44=p*B+o*w+r*Z+s*R;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,j,k,o,s,n,p,m){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,j||0,k!==void 0?k:1,o||0,s||0,n||0,p||0,m!==void 0?m: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,j,k,o,s,n,p,m){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=j;this.n33=k;this.n34=o;this.n41=s;this.n42=n;this.n43=p;this.n44=m;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,j=a.n24,k=a.n31,o=a.n32,s=a.n33,n=a.n34,p=a.n41,m=a.n42,q=a.n43,
+r=a.n44,t=b.n11,x=b.n12,v=b.n13,D=b.n14,y=b.n21,F=b.n22,E=b.n23,u=b.n24,I=b.n31,w=b.n32,R=b.n33,V=b.n34,J=b.n41,T=b.n42,Y=b.n43,O=b.n44;this.n11=c*t+d*y+e*I+f*J;this.n12=c*x+d*F+e*w+f*T;this.n13=c*v+d*E+e*R+f*Y;this.n14=c*D+d*u+e*V+f*O;this.n21=g*t+h*y+i*I+j*J;this.n22=g*x+h*F+i*w+j*T;this.n23=g*v+h*E+i*R+j*Y;this.n24=g*D+h*u+i*V+j*O;this.n31=k*t+o*y+s*I+n*J;this.n32=k*x+o*F+s*w+n*T;this.n33=k*v+o*E+s*R+n*Y;this.n34=k*D+o*u+s*V+n*O;this.n41=p*t+m*y+q*I+r*J;this.n42=p*x+m*F+q*w+r*T;this.n43=p*v+m*
+E+q*R+r*Y;this.n44=p*D+m*u+q*V+r*O;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
-a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,i=this.n31,k=this.n32,j=this.n33,n=this.n34,q=this.n41,m=this.n42,p=this.n43,o=this.n44;return d*g*k*q-c*h*k*q-d*f*j*q+b*h*j*q+c*f*n*q-b*g*n*q-d*g*i*m+c*h*i*m+d*e*j*m-a*h*j*m-c*e*n*m+a*g*n*m+d*f*i*p-b*h*i*p-d*e*k*p+a*h*k*p+b*e*n*p-a*f*n*p-c*f*i*o+b*g*i*o+c*e*k*o-a*g*k*o-b*e*j*o+a*f*j*o},transpose:function(){var a;
+a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,i=this.n31,j=this.n32,k=this.n33,o=this.n34,s=this.n41,n=this.n42,p=this.n43,m=this.n44;return d*g*j*s-c*h*j*s-d*f*k*s+b*h*k*s+c*f*o*s-b*g*o*s-d*g*i*n+c*h*i*n+d*e*k*n-a*h*k*n-c*e*o*n+a*g*o*n+d*f*i*p-b*h*i*p-d*e*j*p+a*h*j*p+b*e*o*p-a*f*o*p-c*f*i*m+b*g*i*m+c*e*j*m-a*g*j*m-b*e*k*m+a*f*k*m},transpose:function(){var a;
 a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
 a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
 a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},
 setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},
-setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,i=a.n24,k=a.n31,j=a.n32,n=a.n33,q=a.n34,m=a.n41,p=a.n42,o=a.n43,r=a.n44;this.n11=h*q*p-i*n*p+i*j*o-g*q*o-h*j*r+g*n*r;this.n12=e*n*p-d*q*p-e*j*o+c*q*o+d*j*r-c*n*r;this.n13=d*i*p-e*h*p+e*g*o-c*i*o-d*g*r+c*h*r;this.n14=e*h*j-d*i*j-e*g*n+c*i*n+d*g*q-c*h*q;this.n21=i*n*m-h*q*m-i*k*o+f*q*o+h*k*r-f*n*r;this.n22=d*q*m-e*n*m+
-e*k*o-b*q*o-d*k*r+b*n*r;this.n23=e*h*m-d*i*m-e*f*o+b*i*o+d*f*r-b*h*r;this.n24=d*i*k-e*h*k+e*f*n-b*i*n-d*f*q+b*h*q;this.n31=g*q*m-i*j*m+i*k*p-f*q*p-g*k*r+f*j*r;this.n32=e*j*m-c*q*m-e*k*p+b*q*p+c*k*r-b*j*r;this.n33=c*i*m-e*g*m+e*f*p-b*i*p-c*f*r+b*g*r;this.n34=e*g*k-c*i*k-e*f*j+b*i*j+c*f*q-b*g*q;this.n41=h*j*m-g*n*m-h*k*p+f*n*p+g*k*o-f*j*o;this.n42=c*n*m-d*j*m+d*k*p-b*n*p-c*k*o+b*j*o;this.n43=d*g*m-c*h*m-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*k-d*g*k+d*f*j-b*h*j-c*f*n+b*g*n;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=g*h,k=g*e,j=d*h,n=d*e;this.n11=i+n*c;this.n12=j*c-k;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=k*c-j;this.n32=n+i*c;this.n33=f*g;break;case "ZXY":i=g*h;k=g*e;j=d*h;n=d*e;this.n11=i-n*c;this.n12=-f*e;this.n13=j+k*c;this.n21=k+j*c;this.n22=f*h;this.n23=n-i*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":i=
-f*h;k=f*e;j=c*h;n=c*e;this.n11=g*h;this.n12=j*d-k;this.n13=i*d+n;this.n21=g*e;this.n22=n*d+i;this.n23=k*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":i=f*g;k=f*d;j=c*g;n=c*d;this.n11=g*h;this.n12=n-i*e;this.n13=j*e+k;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=k*e+j;this.n33=i-n*e;break;case "XZY":i=f*g;k=f*d;j=c*g;n=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=i*e+n;this.n22=f*h;this.n23=k*e-j;this.n31=j*e-k;this.n32=c*h;this.n33=n*e+i;break;default:i=f*h,k=f*
-e,j=c*h,n=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=k+j*d,this.n22=i-n*d,this.n23=-c*g,this.n31=n-i*d,this.n32=j+k*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,i=b*g;b*=h;var k=c*g;c*=h;d*=h;f*=e;g*=e;e*=h;this.n11=1-(k+d);this.n12=i-e;this.n13=b+g;this.n21=i+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,i=a.n24,j=a.n31,k=a.n32,o=a.n33,s=a.n34,n=a.n41,p=a.n42,m=a.n43,q=a.n44;this.n11=h*s*p-i*o*p+i*k*m-g*s*m-h*k*q+g*o*q;this.n12=e*o*p-d*s*p-e*k*m+c*s*m+d*k*q-c*o*q;this.n13=d*i*p-e*h*p+e*g*m-c*i*m-d*g*q+c*h*q;this.n14=e*h*k-d*i*k-e*g*o+c*i*o+d*g*s-c*h*s;this.n21=i*o*n-h*s*n-i*j*m+f*s*m+h*j*q-f*o*q;this.n22=d*s*n-e*o*n+
+e*j*m-b*s*m-d*j*q+b*o*q;this.n23=e*h*n-d*i*n-e*f*m+b*i*m+d*f*q-b*h*q;this.n24=d*i*j-e*h*j+e*f*o-b*i*o-d*f*s+b*h*s;this.n31=g*s*n-i*k*n+i*j*p-f*s*p-g*j*q+f*k*q;this.n32=e*k*n-c*s*n-e*j*p+b*s*p+c*j*q-b*k*q;this.n33=c*i*n-e*g*n+e*f*p-b*i*p-c*f*q+b*g*q;this.n34=e*g*j-c*i*j-e*f*k+b*i*k+c*f*s-b*g*s;this.n41=h*k*n-g*o*n-h*j*p+f*o*p+g*j*m-f*k*m;this.n42=c*o*n-d*k*n+d*j*p-b*o*p-c*j*m+b*k*m;this.n43=d*g*n-c*h*n-d*f*p+b*h*p+c*f*m-b*g*m;this.n44=c*h*j-d*g*j+d*f*k-b*h*k-c*f*o+b*g*o;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=g*h,j=g*e,k=d*h,o=d*e;this.n11=i+o*c;this.n12=k*c-j;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=j*c-k;this.n32=o+i*c;this.n33=f*g;break;case "ZXY":i=g*h;j=g*e;k=d*h;o=d*e;this.n11=i-o*c;this.n12=-f*e;this.n13=k+j*c;this.n21=j+k*c;this.n22=f*h;this.n23=o-i*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":i=
+f*h;j=f*e;k=c*h;o=c*e;this.n11=g*h;this.n12=k*d-j;this.n13=i*d+o;this.n21=g*e;this.n22=o*d+i;this.n23=j*d-k;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":i=f*g;j=f*d;k=c*g;o=c*d;this.n11=g*h;this.n12=o-i*e;this.n13=k*e+j;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*e+k;this.n33=i-o*e;break;case "XZY":i=f*g;j=f*d;k=c*g;o=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=i*e+o;this.n22=f*h;this.n23=j*e-k;this.n31=k*e-j;this.n32=c*h;this.n33=o*e+i;break;default:i=f*h,j=f*
+e,k=c*h,o=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=j+k*d,this.n22=i-o*d,this.n23=-c*g,this.n31=o-i*d,this.n32=k+j*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,i=b*g;b*=h;var j=c*g;c*=h;d*=h;f*=e;g*=e;e*=h;this.n11=1-(j+d);this.n12=i-e;this.n13=b+g;this.n21=i+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);else if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);else if(a.x===0&&a.y===
-0&&a.z===1)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e);c/=f;d/=f;e/=f;var f=c*c,g=d*d,h=e*e,i=Math.cos(b),k=Math.sin(b),j=1-i,n=c*d*j,q=c*e*j;j*=d*e;c*=k;var m=d*k;k*=e;e=f+(1-f)*i;f=n+k;d=q-m;n-=k;g+=(1-g)*i;k=j+c;q+=m;j-=c;h+=(1-h)*i;var i=this.n11,c=this.n21,m=this.n31,p=this.n41,o=this.n12,r=this.n22,s=this.n32,u=this.n42,t=this.n13,A=this.n23,B=this.n33,z=this.n43;this.n11=e*i+f*o+d*t;this.n21=e*c+f*r+d*A;this.n31=e*m+f*s+d*B;this.n41=e*p+f*u+d*z;this.n12=n*i+g*o+k*
-t;this.n22=n*c+g*r+k*A;this.n32=n*m+g*s+k*B;this.n42=n*p+g*u+k*z;this.n13=q*i+j*o+h*t;this.n23=q*c+j*r+h*A;this.n33=q*m+j*s+h*B;this.n43=q*p+j*u+h*z;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n12=k*b+a*f;this.n22=k*c+a*g;this.n32=k*d+a*h;this.n42=k*e+a*i;this.n13=k*f-a*b;this.n23=k*g-a*c;this.n33=k*h-a*d;this.n43=k*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,
-e=this.n41,f=this.n13,g=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n11=k*b-a*f;this.n21=k*c-a*g;this.n31=k*d-a*h;this.n41=k*e-a*i;this.n13=k*f+a*b;this.n23=k*g+a*c;this.n33=k*h+a*d;this.n43=k*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,i=this.n42,k=Math.cos(a),a=Math.sin(a);this.n11=k*b+a*f;this.n21=k*c+a*g;this.n31=k*d+a*h;this.n41=k*e+a*i;this.n12=k*f-a*b;this.n22=k*g-a*c;this.n32=k*h-a*d;this.n42=k*
+0&&a.z===1)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e);c/=f;d/=f;e/=f;var f=c*c,g=d*d,h=e*e,i=Math.cos(b),j=Math.sin(b),k=1-i,o=c*d*k,s=c*e*k;k*=d*e;c*=j;var n=d*j;j*=e;e=f+(1-f)*i;f=o+j;d=s-n;o-=j;g+=(1-g)*i;j=k+c;s+=n;k-=c;h+=(1-h)*i;var i=this.n11,c=this.n21,n=this.n31,p=this.n41,m=this.n12,q=this.n22,r=this.n32,t=this.n42,x=this.n13,v=this.n23,D=this.n33,y=this.n43;this.n11=e*i+f*m+d*x;this.n21=e*c+f*q+d*v;this.n31=e*n+f*r+d*D;this.n41=e*p+f*t+d*y;this.n12=o*i+g*m+j*
+x;this.n22=o*c+g*q+j*v;this.n32=o*n+g*r+j*D;this.n42=o*p+g*t+j*y;this.n13=s*i+k*m+h*x;this.n23=s*c+k*q+h*v;this.n33=s*n+k*r+h*D;this.n43=s*p+k*t+h*y;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*f;this.n22=j*c+a*g;this.n32=j*d+a*h;this.n42=j*e+a*i;this.n13=j*f-a*b;this.n23=j*g-a*c;this.n33=j*h-a*d;this.n43=j*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,
+e=this.n41,f=this.n13,g=this.n23,h=this.n33,i=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*f;this.n21=j*c-a*g;this.n31=j*d-a*h;this.n41=j*e-a*i;this.n13=j*f+a*b;this.n23=j*g+a*c;this.n33=j*h+a*d;this.n43=j*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,i=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*f;this.n21=j*c+a*g;this.n31=j*d+a*h;this.n41=j*e+a*i;this.n12=j*f-a*b;this.n22=j*g-a*c;this.n32=j*h-a*d;this.n42=j*
 i-a*e;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;if(a===0)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*i;c[6]=a*k;c[7]=a*j;c[8]=a*n;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*j;if(a===0)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*i;c[6]=a*j;c[7]=a*k;c[8]=a*o;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,i,k;g=new THREE.Matrix4;h=b-a;i=c-d;k=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/i;g.n23=0;g.n24=-((c+d)/i);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((f+e)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,i,j;g=new THREE.Matrix4;h=b-a;i=c-d;j=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/i;g.n23=0;g.n24=-((c+d)/i);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;
 if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[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,n,q=[],m,p=[],o,r,s=[],u,t,A=[],B={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,E=new THREE.Vector4,H=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);H.multiply(b.projectionMatrix,b.matrixWorldInverse);H.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);H.multiply(b.matrixWorld,
-b.projectionMatrixInverse);H.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;B.objects.length=0;B.sprites.length=0;B.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))?(H.multiplyVector3(z.copy(b.position)),e=a(),e.object=
-b,e.z=z.z,B.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(H.multiplyVector3(z.copy(b.position)),e=a(),e.object=b,e.z=z.z,B.sprites.push(e)):b instanceof THREE.Light&&B.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&B.objects.sort(c);return B};this.projectScene=function(a,e,f){var g=e.near,R=e.far,l,z,v,W,M,Y,ca,$,ea,U,L,V,ba,ga,va,fa;t=r=m=n=0;B.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);H.multiply(e.projectionMatrix,e.matrixWorldInverse);G.setFromMatrix(H);B=this.projectGraph(a,!1);a=0;for(l=B.objects.length;a<l;a++)if(ea=B.objects[a].object,U=ea.matrixWorld,V=ea.material,i=0,ea instanceof THREE.Mesh){L=ea.geometry;ba=ea.geometry.materials;W=L.vertices;ga=L.faces;va=L.faceVertexUvs;L=ea.matrixRotationWorld.extractRotation(U);z=0;for(v=W.length;z<v;z++)h=b(),h.positionWorld.copy(W[z].position),U.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),H.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<R;W=0;for(z=ga.length;W<z;W++){v=ga[W];if(v instanceof THREE.Face3)if(M=k[v.a],Y=k[v.b],ca=k[v.c],M.visible&&Y.visible&&ca.visible&&(ea.doubleSided||ea.flipSided!=(ca.positionScreen.x-M.positionScreen.x)*(Y.positionScreen.y-M.positionScreen.y)-(ca.positionScreen.y-M.positionScreen.y)*(Y.positionScreen.x-
-M.positionScreen.x)<0))$=q[n]=q[n]||new THREE.RenderableFace3,n++,j=$,j.v1.copy(M),j.v2.copy(Y),j.v3.copy(ca);else continue;else if(v instanceof THREE.Face4)if(M=k[v.a],Y=k[v.b],ca=k[v.c],$=k[v.d],M.visible&&Y.visible&&ca.visible&&$.visible&&(ea.doubleSided||ea.flipSided!=(($.positionScreen.x-M.positionScreen.x)*(Y.positionScreen.y-M.positionScreen.y)-($.positionScreen.y-M.positionScreen.y)*(Y.positionScreen.x-M.positionScreen.x)<0||(Y.positionScreen.x-ca.positionScreen.x)*($.positionScreen.y-ca.positionScreen.y)-
-(Y.positionScreen.y-ca.positionScreen.y)*($.positionScreen.x-ca.positionScreen.x)<0)))fa=p[m]=p[m]||new THREE.RenderableFace4,m++,j=fa,j.v1.copy(M),j.v2.copy(Y),j.v3.copy(ca),j.v4.copy($);else continue;j.normalWorld.copy(v.normal);L.multiplyVector3(j.normalWorld);j.centroidWorld.copy(v.centroid);U.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);H.multiplyVector3(j.centroidScreen);ca=v.vertexNormals;M=0;for(Y=ca.length;M<Y;M++)$=j.vertexNormalsWorld[M],$.copy(ca[M]),L.multiplyVector3($);
-M=0;for(Y=va.length;M<Y;M++)if(fa=va[M][W]){ca=0;for($=fa.length;ca<$;ca++)j.uvs[M][ca]=fa[ca]}j.material=V;j.faceMaterial=v.materialIndex!==null?ba[v.materialIndex]:null;j.z=j.centroidScreen.z;B.elements.push(j)}}else if(ea instanceof THREE.Line){w.multiply(H,U);W=ea.geometry.vertices;M=b();M.positionScreen.copy(W[0].position);w.multiplyVector4(M.positionScreen);z=1;for(v=W.length;z<v;z++)if(M=b(),M.positionScreen.copy(W[z].position),w.multiplyVector4(M.positionScreen),Y=k[i-2],y.copy(M.positionScreen),
-K.copy(Y.positionScreen),d(y,K))y.multiplyScalar(1/y.w),K.multiplyScalar(1/K.w),ea=s[r]=s[r]||new THREE.RenderableLine,r++,o=ea,o.v1.positionScreen.copy(y),o.v2.positionScreen.copy(K),o.z=Math.max(y.z,K.z),o.material=V,B.elements.push(o)}a=0;for(l=B.sprites.length;a<l;a++)if(ea=B.sprites[a].object,U=ea.matrixWorld,ea instanceof THREE.Particle&&(E.set(U.n14,U.n24,U.n34,1),H.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))g=A[t]=A[t]||new THREE.RenderableParticle,t++,u=g,u.x=E.x/E.w,u.y=E.y/E.w,u.z=E.z,u.rotation=
-ea.rotation.z,u.scale.x=ea.scale.x*Math.abs(u.x-(E.x+e.projectionMatrix.n11)/(E.w+e.projectionMatrix.n14)),u.scale.y=ea.scale.y*Math.abs(u.y-(E.y+e.projectionMatrix.n22)/(E.w+e.projectionMatrix.n24)),u.material=ea.material,B.elements.push(u);f&&B.elements.sort(c);return B}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=j[i]=j[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,j=[],
+k,o,s=[],n,p=[],m,q,r=[],t,x,v=[],D={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,F=new THREE.Vector4,E=new THREE.Matrix4,u=new THREE.Matrix4,I=new THREE.Frustum,w=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);E.multiply(b.projectionMatrix,b.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);E.multiply(b.matrixWorld,
+b.projectionMatrixInverse);E.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var g=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||I.contains(b))?(E.multiplyVector3(y.copy(b.position)),e=a(),e.object=
+b,e.z=y.z,D.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.multiplyVector3(y.copy(b.position)),e=a(),e.object=b,e.z=y.z,D.sprites.push(e)):b instanceof THREE.Light&&D.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&D.objects.sort(c);return D};this.projectScene=function(a,e,f){var g=e.near,O=e.far,l,y,A,X,N,W,aa,ea,Z,S,$,U,Q,ba,wa,ca;x=q=n=o=0;D.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);E.multiply(e.projectionMatrix,e.matrixWorldInverse);I.setFromMatrix(E);D=this.projectGraph(a,!1);a=0;for(l=D.objects.length;a<l;a++)if(Z=D.objects[a].object,S=Z.matrixWorld,U=Z.material,i=0,Z instanceof THREE.Mesh){$=Z.geometry;Q=Z.geometry.materials;X=$.vertices;ba=$.faces;wa=$.faceVertexUvs;$=Z.matrixRotationWorld.extractRotation(S);y=0;for(A=X.length;y<A;y++)h=b(),h.positionWorld.copy(X[y].position),S.multiplyVector3(h.positionWorld),
+h.positionScreen.copy(h.positionWorld),E.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<O;X=0;for(y=ba.length;X<y;X++){A=ba[X];if(A instanceof THREE.Face3)if(N=j[A.a],W=j[A.b],aa=j[A.c],N.visible&&W.visible&&aa.visible&&(Z.doubleSided||Z.flipSided!=(aa.positionScreen.x-N.positionScreen.x)*(W.positionScreen.y-N.positionScreen.y)-(aa.positionScreen.y-N.positionScreen.y)*(W.positionScreen.x-
+N.positionScreen.x)<0))ea=s[o]=s[o]||new THREE.RenderableFace3,o++,k=ea,k.v1.copy(N),k.v2.copy(W),k.v3.copy(aa);else continue;else if(A instanceof THREE.Face4)if(N=j[A.a],W=j[A.b],aa=j[A.c],ea=j[A.d],N.visible&&W.visible&&aa.visible&&ea.visible&&(Z.doubleSided||Z.flipSided!=((ea.positionScreen.x-N.positionScreen.x)*(W.positionScreen.y-N.positionScreen.y)-(ea.positionScreen.y-N.positionScreen.y)*(W.positionScreen.x-N.positionScreen.x)<0||(W.positionScreen.x-aa.positionScreen.x)*(ea.positionScreen.y-
+aa.positionScreen.y)-(W.positionScreen.y-aa.positionScreen.y)*(ea.positionScreen.x-aa.positionScreen.x)<0)))ca=p[n]=p[n]||new THREE.RenderableFace4,n++,k=ca,k.v1.copy(N),k.v2.copy(W),k.v3.copy(aa),k.v4.copy(ea);else continue;k.normalWorld.copy(A.normal);$.multiplyVector3(k.normalWorld);k.centroidWorld.copy(A.centroid);S.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);E.multiplyVector3(k.centroidScreen);aa=A.vertexNormals;N=0;for(W=aa.length;N<W;N++)ea=k.vertexNormalsWorld[N],
+ea.copy(aa[N]),$.multiplyVector3(ea);N=0;for(W=wa.length;N<W;N++)if(ca=wa[N][X]){aa=0;for(ea=ca.length;aa<ea;aa++)k.uvs[N][aa]=ca[aa]}k.material=U;k.faceMaterial=A.materialIndex!==null?Q[A.materialIndex]:null;k.z=k.centroidScreen.z;D.elements.push(k)}}else if(Z instanceof THREE.Line){u.multiply(E,S);X=Z.geometry.vertices;N=b();N.positionScreen.copy(X[0].position);u.multiplyVector4(N.positionScreen);y=1;for(A=X.length;y<A;y++)if(N=b(),N.positionScreen.copy(X[y].position),u.multiplyVector4(N.positionScreen),
+W=j[i-2],w.copy(N.positionScreen),R.copy(W.positionScreen),d(w,R))w.multiplyScalar(1/w.w),R.multiplyScalar(1/R.w),Z=r[q]=r[q]||new THREE.RenderableLine,q++,m=Z,m.v1.positionScreen.copy(w),m.v2.positionScreen.copy(R),m.z=Math.max(w.z,R.z),m.material=U,D.elements.push(m)}a=0;for(l=D.sprites.length;a<l;a++)if(Z=D.sprites[a].object,S=Z.matrixWorld,Z instanceof THREE.Particle&&(F.set(S.n14,S.n24,S.n34,1),E.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))g=v[x]=v[x]||new THREE.RenderableParticle,x++,t=g,t.x=
+F.x/F.w,t.y=F.y/F.w,t.z=F.z,t.rotation=Z.rotation.z,t.scale.x=Z.scale.x*Math.abs(t.x-(F.x+e.projectionMatrix.n11)/(F.w+e.projectionMatrix.n14)),t.scale.y=Z.scale.y*Math.abs(t.y-(F.y+e.projectionMatrix.n22)/(F.w+e.projectionMatrix.n24)),t.material=Z.material,D.elements.push(t);f&&D.elements.sort(c);return D}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
-this.x,c=this.y,d=this.z,e=this.w,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,n=i*e+f*d-g*c,c=-f*
-c-g*d-h*e;b.x=k*i+c*-f+j*-h-n*-g;b.y=j*i+c*-g+n*-f-k*-h;b.z=n*i+c*-h+k*-g-j*-f;return 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,j=i*c+g*e-h*d,k=i*d+h*c-f*e,o=i*e+f*d-g*c,c=-f*
+c-g*d-h*e;b.x=j*i+c*-f+k*-h-o*-g;b.y=k*i+c*-g+o*-f-j*-h;b.z=o*i+c*-h+j*-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.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};
@@ -88,14 +88,14 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f.position,e.position),h.sub(d.position,e.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=
 this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
 d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
-b,c,d,e,f,H){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;j=g[e];n=g[f];q=g[H];m=i.x-h.x;p=k.x-h.x;o=i.y-h.y;r=k.y-h.y;s=i.z-h.z;u=k.z-h.z;t=n.u-j.u;A=q.u-j.u;B=n.v-j.v;z=q.v-j.v;E=1/(t*z-A*B);y.set((z*m-B*p)*E,(z*o-B*r)*E,(z*s-B*u)*E);K.set((t*p-A*m)*E,(t*r-A*o)*E,(t*u-A*s)*E);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,n,q,m,p,o,r,s,u,t,A,B,z,E,H,w=[],G=[],y=new THREE.Vector3,K=new THREE.Vector3,
-Z=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 T=["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[T[d]],
-H=w[e],Z.copy(H),Z.subSelf(X.multiplyScalar(X.dot(H))).normalize(),Q.cross(f.vertexNormals[d],H),e=Q.dot(G[e]),e=e<0?-1:1,f.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(this.vertices.length>0){var a;a=this.vertices[0].position;this.boundingBox?(this.boundingBox.min.copy(a),this.boundingBox.max.copy(a)):this.boundingBox={min:a.clone(),max:a.clone()};for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=
+b,c,d,e,f,E){h=a.vertices[b].position;i=a.vertices[c].position;j=a.vertices[d].position;k=g[e];o=g[f];s=g[E];n=i.x-h.x;p=j.x-h.x;m=i.y-h.y;q=j.y-h.y;r=i.z-h.z;t=j.z-h.z;x=o.u-k.u;v=s.u-k.u;D=o.v-k.v;y=s.v-k.v;F=1/(x*y-v*D);w.set((y*n-D*p)*F,(y*m-D*q)*F,(y*r-D*t)*F);R.set((x*p-v*n)*F,(x*q-v*m)*F,(x*t-v*r)*F);u[b].addSelf(w);u[c].addSelf(w);u[d].addSelf(w);I[b].addSelf(R);I[c].addSelf(R);I[d].addSelf(R)}var b,c,d,e,f,g,h,i,j,k,o,s,n,p,m,q,r,t,x,v,D,y,F,E,u=[],I=[],w=new THREE.Vector3,R=new THREE.Vector3,
+V=new THREE.Vector3,J=new THREE.Vector3,T=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,I[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 Y=["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++)T.copy(f.vertexNormals[d]),e=f[Y[d]],
+E=u[e],V.copy(E),V.subSelf(T.multiplyScalar(T.dot(E))).normalize(),J.cross(f.vertexNormals[d],E),e=J.dot(I[e]),e=e<0?-1:1,f.vertexTangents[d]=new THREE.Vector4(V.x,V.y,V.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(this.vertices.length>0){var a;a=this.vertices[0].position;this.boundingBox?(this.boundingBox.min.copy(a),this.boundingBox.max.copy(a)):this.boundingBox={min:a.clone(),max:a.clone()};for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=
 this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere={radius:b}},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;
-THREE.Spline=function(a){function b(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}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,k,j,n,q;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;k=this.points[c[0]];j=this.points[c[1]];
-n=this.points[c[2]];q=this.points[c[3]];h=g*g;i=g*h;d.x=b(k.x,j.x,n.x,q.x,g,h,i);d.y=b(k.y,j.y,n.y,q.y,g,h,i);d.z=b(k.z,j.z,n.z,q.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),
-f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
+THREE.Spline=function(a){function b(a,b,c,d,e,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}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,k,o,s;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;j=this.points[c[0]];k=this.points[c[1]];
+o=this.points[c[2]];s=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,k.x,o.x,s.x,g,h,i);d.y=b(j.y,k.y,o.y,s.y,g,h,i);d.z=b(j.z,k.z,o.z,s.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),
+f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];g=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
 h}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
 THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
@@ -126,7 +126,7 @@ void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.ve
 THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.format=g!==void 0?g:THREE.RGBAFormat;this.type=h!==void 0?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=
 !1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
 THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;
-THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,k){THREE.Texture.call(this,null,f,g,h,i,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,j){THREE.Texture.call(this,null,f,g,h,i,j,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1;if(this.geometry)this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius;this.frustumCulled=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
@@ -153,47 +153,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,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,n,q,m,p,o;a=b.projectScene(c,d);i=0;for(k=a.length;i<k;i++)if(q=a[i],q instanceof THREE.RenderableParticle){p=q.x*e+e;o=q.y*f+f;j=0;for(n=q.material.length;j<n;j++)if(m=q.material[j],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=p+"px",m.style.top=o+"px"}}};
-THREE.CanvasRenderer=function(a){function b(a){if(u!=a)o.globalAlpha=u=a}function c(a){if(t!=a){switch(a){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}t=a}}function d(a){if(A!=a)o.strokeStyle=A=a}function e(a){if(B!=a)o.fillStyle=B=a}var f=this,g,h,i,k=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-n,q,m,p,o=j.getContext("2d"),r=new THREE.Color(0),s=0,u=1,t=0,A=null,B=null,z=null,E=null,H=null,w,G,y,K,Z=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,X,T,R,l,S,v,W,M,Y,ca,$,ea,U=new THREE.Color,L=new THREE.Color,V=new THREE.Color,ba=new THREE.Color,ga=new THREE.Color,va=[],fa=[],na,ja,sa,ra,Ba,wa,xa,ya,za,Aa,la=new THREE.Rectangle,ta=new THREE.Rectangle,pa=new THREE.Rectangle,Ia=!1,da=new THREE.Color,aa=new THREE.Color,C=new THREE.Color,qa=new THREE.Vector3,Ka,La,Oa,Ca,Ma,D,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;D=Ma.getContext("2d");D.translate(-a/2,-a/2);D.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){n=a;q=b;m=Math.floor(n/2);p=Math.floor(q/2);j.width=n;j.height=q;la.set(-m,-p,m,p);ta.set(-m,-p,m,p);u=1;t=0;H=
-E=z=B=A=null};this.setClearColor=function(a,b){r.copy(a);s=b;ta.set(-m,-p,m,p)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;ta.set(-m,-p,m,p)};this.clear=function(){o.setTransform(1,0,0,-1,m,p);ta.isEmpty()||(ta.minSelf(la),ta.inflate(2),s<1&&o.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight())),s>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+s+")"),o.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 n(a){var b,c,d,e;da.setRGB(0,0,0);aa.setRGB(0,0,0);C.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(da.r+=e.r,da.g+=e.g,da.b+=e.b):d instanceof THREE.DirectionalLight?(aa.r+=e.r,aa.g+=e.g,aa.b+=e.b):d instanceof THREE.PointLight&&(C.r+=e.r,C.g+=e.g,C.b+=e.b)}function q(a,b,c,d){var e,f,g,da,h,l;e=0;for(f=a.length;e<f;e++)g=a[e],da=
-g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),l=c.dot(h),l<=0||(l*=g.intensity,d.r+=da.r*l,d.g+=da.g*l,d.b+=da.b*l)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),l=c.dot(qa.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+=da.r*l,d.g+=da.g*l,d.b+=da.b*l)))}function r(a,f,g){b(g.opacity);c(g.blending);var da,h,l,i,j,C;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=g.map.image,j=
-i.width>>1,C=i.height>>1,g=f.scale.x*m,l=f.scale.y*p,da=g*j,h=l*C,pa.set(a.x-da,a.y-h,a.x+da,a.y+h),la.intersects(pa)&&(o.save(),o.translate(a.x,a.y),o.rotate(-f.rotation),o.scale(g,-l),o.translate(-j,-C),o.drawImage(i,0,0),o.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(da=f.scale.x*m,h=f.scale.y*p,pa.set(a.x-da,a.y-h,a.x+da,a.y+h),la.intersects(pa)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),o.save(),o.translate(a.x,a.y),o.rotate(-f.rotation),o.scale(da,h),g.program(o),
-o.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);o.beginPath();o.moveTo(a.positionScreen.x,a.positionScreen.y);o.lineTo(e.positionScreen.x,e.positionScreen.y);o.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(z!=a)o.lineWidth=z=a;a=g.linecap;if(E!=a)o.lineCap=E=a;a=g.linejoin;if(H!=a)o.lineJoin=H=a;d(g.color.getContextStyle());o.stroke();pa.inflate(g.linewidth*2)}}function u(a,d,e,g,h,C,aa,k){f.info.render.vertices+=3;f.info.render.faces++;b(k.opacity);c(k.blending);
-X=a.positionScreen.x;T=a.positionScreen.y;R=d.positionScreen.x;l=d.positionScreen.y;S=e.positionScreen.x;v=e.positionScreen.y;A(X,T,R,l,S,v);if(k instanceof THREE.MeshBasicMaterial)if(k.map)k.map.mapping instanceof THREE.UVMapping&&(ra=aa.uvs[0],Pa(X,T,R,l,S,v,ra[g].u,ra[g].v,ra[h].u,ra[h].v,ra[C].u,ra[C].v,k.map));else if(k.envMap){if(k.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,qa.copy(aa.vertexNormalsWorld[g]),Ba=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,
-wa=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,qa.copy(aa.vertexNormalsWorld[h]),xa=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,ya=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,qa.copy(aa.vertexNormalsWorld[C]),za=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,Aa=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,Pa(X,T,R,l,S,v,Ba,wa,xa,ya,za,Aa,k.envMap)}else k.wireframe?J(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(k.color);else if(k instanceof THREE.MeshLambertMaterial)k.map&&!k.wireframe&&
-(k.map.mapping instanceof THREE.UVMapping&&(ra=aa.uvs[0],Pa(X,T,R,l,S,v,ra[g].u,ra[g].v,ra[h].u,ra[h].v,ra[C].u,ra[C].v,k.map)),c(THREE.SubtractiveBlending)),Ia?!k.wireframe&&k.shading==THREE.SmoothShading&&aa.vertexNormalsWorld.length==3?(L.r=V.r=ba.r=da.r,L.g=V.g=ba.g=da.g,L.b=V.b=ba.b=da.b,q(i,aa.v1.positionWorld,aa.vertexNormalsWorld[0],L),q(i,aa.v2.positionWorld,aa.vertexNormalsWorld[1],V),q(i,aa.v3.positionWorld,aa.vertexNormalsWorld[2],ba),L.r=Math.max(0,Math.min(k.color.r*L.r,1)),L.g=Math.max(0,
-Math.min(k.color.g*L.g,1)),L.b=Math.max(0,Math.min(k.color.b*L.b,1)),V.r=Math.max(0,Math.min(k.color.r*V.r,1)),V.g=Math.max(0,Math.min(k.color.g*V.g,1)),V.b=Math.max(0,Math.min(k.color.b*V.b,1)),ba.r=Math.max(0,Math.min(k.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(k.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(k.color.b*ba.b,1)),ga.r=(V.r+ba.r)*0.5,ga.g=(V.g+ba.g)*0.5,ga.b=(V.b+ba.b)*0.5,sa=P(L,V,ba,ga),Ja(X,T,R,l,S,v,0,0,1,0,0,1,sa)):(U.r=da.r,U.g=da.g,U.b=da.b,q(i,aa.centroidWorld,aa.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)),k.wireframe?J(U,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(U)):k.wireframe?J(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(k.color);else if(k instanceof THREE.MeshDepthMaterial)na=j.near,ja=j.far,L.r=L.g=L.b=1-N(a.positionScreen.z,na,ja),V.r=V.g=V.b=1-N(d.positionScreen.z,na,ja),ba.r=ba.g=ba.b=1-N(e.positionScreen.z,na,ja),ga.r=
-(V.r+ba.r)*0.5,ga.g=(V.g+ba.g)*0.5,ga.b=(V.b+ba.b)*0.5,sa=P(L,V,ba,ga),Ja(X,T,R,l,S,v,0,0,1,0,0,1,sa);else if(k instanceof THREE.MeshNormalMaterial)U.r=O(aa.normalWorld.x),U.g=O(aa.normalWorld.y),U.b=O(aa.normalWorld.z),k.wireframe?J(U,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Ea(U)}function t(a,d,e,g,h,k,aa,C,o){f.info.render.vertices+=4;f.info.render.faces++;b(C.opacity);c(C.blending);if(C.map||C.envMap)u(a,d,g,0,1,3,aa,C,o),u(h,e,k,1,2,3,aa,C,o);else if(X=a.positionScreen.x,
-T=a.positionScreen.y,R=d.positionScreen.x,l=d.positionScreen.y,S=e.positionScreen.x,v=e.positionScreen.y,W=g.positionScreen.x,M=g.positionScreen.y,Y=h.positionScreen.x,ca=h.positionScreen.y,$=k.positionScreen.x,ea=k.positionScreen.y,C instanceof THREE.MeshBasicMaterial)B(X,T,R,l,S,v,W,M),C.wireframe?J(C.color,C.wireframeLinewidth,C.wireframeLinecap,C.wireframeLinejoin):Ea(C.color);else if(C instanceof THREE.MeshLambertMaterial)Ia?!C.wireframe&&C.shading==THREE.SmoothShading&&aa.vertexNormalsWorld.length==
-4?(L.r=V.r=ba.r=ga.r=da.r,L.g=V.g=ba.g=ga.g=da.g,L.b=V.b=ba.b=ga.b=da.b,q(i,aa.v1.positionWorld,aa.vertexNormalsWorld[0],L),q(i,aa.v2.positionWorld,aa.vertexNormalsWorld[1],V),q(i,aa.v4.positionWorld,aa.vertexNormalsWorld[3],ba),q(i,aa.v3.positionWorld,aa.vertexNormalsWorld[2],ga),L.r=Math.max(0,Math.min(C.color.r*L.r,1)),L.g=Math.max(0,Math.min(C.color.g*L.g,1)),L.b=Math.max(0,Math.min(C.color.b*L.b,1)),V.r=Math.max(0,Math.min(C.color.r*V.r,1)),V.g=Math.max(0,Math.min(C.color.g*V.g,1)),V.b=Math.max(0,
-Math.min(C.color.b*V.b,1)),ba.r=Math.max(0,Math.min(C.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(C.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(C.color.b*ba.b,1)),ga.r=Math.max(0,Math.min(C.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(C.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(C.color.b*ga.b,1)),sa=P(L,V,ba,ga),A(X,T,R,l,W,M),Ja(X,T,R,l,W,M,0,0,1,0,0,1,sa),A(Y,ca,S,v,$,ea),Ja(Y,ca,S,v,$,ea,1,0,1,1,0,1,sa)):(U.r=da.r,U.g=da.g,U.b=da.b,q(i,aa.centroidWorld,aa.normalWorld,U),U.r=Math.max(0,Math.min(C.color.r*
-U.r,1)),U.g=Math.max(0,Math.min(C.color.g*U.g,1)),U.b=Math.max(0,Math.min(C.color.b*U.b,1)),B(X,T,R,l,S,v,W,M),C.wireframe?J(U,C.wireframeLinewidth,C.wireframeLinecap,C.wireframeLinejoin):Ea(U)):(B(X,T,R,l,S,v,W,M),C.wireframe?J(C.color,C.wireframeLinewidth,C.wireframeLinecap,C.wireframeLinejoin):Ea(C.color));else if(C instanceof THREE.MeshNormalMaterial)U.r=O(aa.normalWorld.x),U.g=O(aa.normalWorld.y),U.b=O(aa.normalWorld.z),B(X,T,R,l,S,v,W,M),C.wireframe?J(U,C.wireframeLinewidth,C.wireframeLinecap,
-C.wireframeLinejoin):Ea(U);else if(C instanceof THREE.MeshDepthMaterial)na=j.near,ja=j.far,L.r=L.g=L.b=1-N(a.positionScreen.z,na,ja),V.r=V.g=V.b=1-N(d.positionScreen.z,na,ja),ba.r=ba.g=ba.b=1-N(g.positionScreen.z,na,ja),ga.r=ga.g=ga.b=1-N(e.positionScreen.z,na,ja),sa=P(L,V,ba,ga),A(X,T,R,l,W,M),Ja(X,T,R,l,W,M,0,0,1,0,0,1,sa),A(Y,ca,S,v,$,ea),Ja(Y,ca,S,v,$,ea,1,0,1,1,0,1,sa)}function A(a,b,c,d,e,f){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(e,f);o.lineTo(a,b);o.closePath()}function B(a,b,c,
-d,e,f,g,da){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(e,f);o.lineTo(g,da);o.lineTo(a,b);o.closePath()}function J(a,b,c,e){if(z!=b)o.lineWidth=z=b;if(E!=c)o.lineCap=E=c;if(H!=e)o.lineJoin=H=e;d(a.getContextStyle());o.stroke();pa.inflate(b*2)}function Ea(a){e(a.getContextStyle());o.fill()}function Pa(a,b,c,d,f,g,da,h,l,i,C,k,aa){if(aa.image.width!=0){if(aa.needsUpdate==!0||va[aa.id]==void 0){var j=aa.wrapS==THREE.RepeatWrapping,m=aa.wrapT==THREE.RepeatWrapping;va[aa.id]=o.createPattern(aa.image,
-j&&m?"repeat":j&&!m?"repeat-x":!j&&m?"repeat-y":"no-repeat");aa.needsUpdate=!1}e(va[aa.id]);var j=aa.offset.x/aa.repeat.x,m=aa.offset.y/aa.repeat.y,n=aa.image.width*aa.repeat.x,qa=aa.image.height*aa.repeat.y,da=(da+j)*n,h=(h+m)*qa,l=(l+j)*n,i=(i+m)*qa,C=(C+j)*n,k=(k+m)*qa;c-=a;d-=b;f-=a;g-=b;l-=da;i-=h;C-=da;k-=h;j=l*k-C*i;if(j==0){if(fa[aa.id]==void 0)b=document.createElement("canvas"),b.width=aa.image.width,b.height=aa.image.height,a=b.getContext("2d"),a.drawImage(aa.image,0,0),fa[aa.id]=a.getImageData(0,
-0,aa.image.width,aa.image.height).data,delete b;b=fa[aa.id];da=(Math.floor(da)+Math.floor(h)*aa.image.width)*4;U.setRGB(b[da]/255,b[da+1]/255,b[da+2]/255);Ea(U)}else j=1/j,aa=(k*c-i*f)*j,i=(k*d-i*g)*j,c=(l*f-C*c)*j,d=(l*g-C*d)*j,a=a-aa*da-c*h,da=b-i*da-d*h,o.save(),o.transform(aa,i,c,d,a,da),o.fill(),o.restore()}}function Ja(a,b,c,d,e,f,g,da,h,l,i,C,aa){var j,k;j=aa.width-1;k=aa.height-1;g*=j;da*=k;h*=j;l*=k;i*=j;C*=k;c-=a;d-=b;e-=a;f-=b;h-=g;l-=da;i-=g;C-=da;k=1/(h*C-i*l);j=(C*c-l*e)*k;l=(C*d-l*
-f)*k;c=(h*e-i*c)*k;d=(h*f-i*d)*k;a=a-j*g-c*da;b=b-l*g-d*da;o.save();o.transform(j,l,c,d,a,b);o.clip();o.drawImage(aa,0,0);o.restore()}function P(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),da=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),l=~~(c.g*255),c=~~(c.b*255),i=~~(d.r*255),C=~~(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]=da<0?0:da>255?255:da;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]=C<0?0:C>255?255:C;Ca[14]=d<0?0:d>255?255:d;La.putImageData(Oa,0,0);D.drawImage(Ka,0,0);return Ma}function N(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function O(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():o.setTransform(1,0,0,-1,m,p);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)&&n(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*=p,r(w,ua,Da,a);else if(ua instanceof THREE.RenderableLine)w=ua.v1,G=ua.v2,w.positionScreen.x*=m,w.positionScreen.y*=p,G.positionScreen.x*=m,G.positionScreen.y*=p,pa.addPoint(w.positionScreen.x,w.positionScreen.y),
-pa.addPoint(G.positionScreen.x,G.positionScreen.y),la.intersects(pa)&&s(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*=p,G.positionScreen.x*=m,G.positionScreen.y*=p,y.positionScreen.x*=m,y.positionScreen.y*=p,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*=p,G.positionScreen.x*=m,G.positionScreen.y*=p,y.positionScreen.x*=m,y.positionScreen.y*=p,K.positionScreen.x*=m,K.positionScreen.y*=p,Z.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,Z.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,Z,Q,ua,Da,a);ta.addRectangle(pa)}o.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,n,q,m,p,o,r,s=new THREE.Rectangle,u=new THREE.Rectangle,t=!1,A=new THREE.Color,B=new THREE.Color,z=new THREE.Color,E=new THREE.Color,H,w=new THREE.Vector3,G=[],y=[],K,Z,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;n=k/2;q=j/2;i.setAttribute("viewBox",-n+" "+-q+" "+k+" "+j);i.setAttribute("width",k);i.setAttribute("height",j);s.set(-n,-q,n,q)};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=Z=0;if(t=g.length>0){B.setRGB(0,0,0);z.setRGB(0,0,0);E.setRGB(0,0,0);l=0;for(G=g.length;l<G;l++)w=g[l],v=w.color,w instanceof THREE.AmbientLight?(B.r+=v.r,B.g+=v.g,B.b+=v.b):w instanceof THREE.DirectionalLight?(z.r+=v.r,z.g+=v.g,z.b+=v.b):w instanceof THREE.PointLight&&(E.r+=v.r,E.g+=v.g,E.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*=
-n,m.y*=-q;else if(v instanceof THREE.RenderableLine){if(m=v.v1,p=v.v2,m.positionScreen.x*=n,m.positionScreen.y*=-q,p.positionScreen.x*=n,p.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),s.intersects(u)){v=m;var M=p,Y=Q++;y[Y]==null&&(y[Y]=document.createElementNS("http://www.w3.org/2000/svg","line"),X==0&&y[Y].setAttribute("shape-rendering","crispEdges"));K=y[Y];K.setAttribute("x1",v.positionScreen.x);K.setAttribute("y1",v.positionScreen.y);
-K.setAttribute("x2",M.positionScreen.x);K.setAttribute("y2",M.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,p=v.v2,o=v.v3,m.positionScreen.x*=n,m.positionScreen.y*=-q,p.positionScreen.x*=n,p.positionScreen.y*=-q,o.positionScreen.x*=
-n,o.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),s.intersects(u)){var M=m,Y=p,ca=o;d.info.render.vertices+=3;d.info.render.faces++;K=b(Z++);K.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");w instanceof THREE.MeshBasicMaterial?A.copy(w.color):w instanceof THREE.MeshLambertMaterial?
-t?(A.r=B.r,A.g=B.g,A.b=B.b,a(g,v.centroidWorld,v.normalWorld,A),A.r=Math.max(0,Math.min(w.color.r*A.r,1)),A.g=Math.max(0,Math.min(w.color.g*A.g,1)),A.b=Math.max(0,Math.min(w.color.b*A.b,1))):A.copy(w.color):w instanceof THREE.MeshDepthMaterial?(H=1-w.__2near/(w.__farPlusNear-v.z*w.__farMinusNear),A.setRGB(H,H,H)):w instanceof THREE.MeshNormalMaterial&&A.setRGB(c(v.normalWorld.x),c(v.normalWorld.y),c(v.normalWorld.z));w.wireframe?K.setAttribute("style","fill: none; stroke: "+A.getContextStyle()+"; stroke-width: "+
-w.wireframeLinewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.wireframeLinecap+"; stroke-linejoin: "+w.wireframeLinejoin):K.setAttribute("style","fill: "+A.getContextStyle()+"; fill-opacity: "+w.opacity);i.appendChild(K)}}else if(v instanceof THREE.RenderableFace4&&(m=v.v1,p=v.v2,o=v.v3,r=v.v4,m.positionScreen.x*=n,m.positionScreen.y*=-q,p.positionScreen.x*=n,p.positionScreen.y*=-q,o.positionScreen.x*=n,o.positionScreen.y*=-q,r.positionScreen.x*=n,r.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,
-m.positionScreen.y),u.addPoint(p.positionScreen.x,p.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(u))){var M=m,Y=p,ca=o,$=r;d.info.render.vertices+=4;d.info.render.faces++;K=b(Z++);K.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+" L "+$.positionScreen.x+","+$.positionScreen.y+"z");w instanceof THREE.MeshBasicMaterial?
-A.copy(w.color):w instanceof THREE.MeshLambertMaterial?t?(A.r=B.r,A.g=B.g,A.b=B.b,a(g,v.centroidWorld,v.normalWorld,A),A.r=Math.max(0,Math.min(w.color.r*A.r,1)),A.g=Math.max(0,Math.min(w.color.g*A.g,1)),A.b=Math.max(0,Math.min(w.color.b*A.b,1))):A.copy(w.color):w instanceof THREE.MeshDepthMaterial?(H=1-w.__2near/(w.__farPlusNear-v.z*w.__farMinusNear),A.setRGB(H,H,H)):w instanceof THREE.MeshNormalMaterial&&A.setRGB(c(v.normalWorld.x),c(v.normalWorld.y),c(v.normalWorld.z));w.wireframe?K.setAttribute("style",
-"fill: none; stroke: "+A.getContextStyle()+"; stroke-width: "+w.wireframeLinewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.wireframeLinecap+"; stroke-linejoin: "+w.wireframeLinejoin):K.setAttribute("style","fill: "+A.getContextStyle()+"; fill-opacity: "+w.opacity);i.appendChild(K)}}};
+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,j,k,o,s,n,p,m;a=b.projectScene(c,d);i=0;for(j=a.length;i<j;i++)if(s=a[i],s instanceof THREE.RenderableParticle){p=s.x*e+e;m=s.y*f+f;k=0;for(o=s.material.length;k<o;k++)if(n=s.material[k],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=p+"px",n.style.top=m+"px"}}};
+THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(x!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}x=a}}function d(a){if(v!=a)m.strokeStyle=v=a}function e(a){if(D!=a)m.fillStyle=D=a}var f=this,g,h,i,j=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+o,s,n,p,m=k.getContext("2d"),q=new THREE.Color(0),r=0,t=1,x=0,v=null,D=null,y=null,F=null,E=null,u,I,w,R,V=new THREE.RenderableVertex,J=new THREE.RenderableVertex,T,Y,O,l,P,A,X,N,W,aa,ea,Z,S=new THREE.Color,$=new THREE.Color,U=new THREE.Color,Q=new THREE.Color,ba=new THREE.Color,wa=[],ca=[],oa,ta,va,sa,ya,za,Aa,Ba,xa,Ca,ha=new THREE.Rectangle,ja=new THREE.Rectangle,qa=new THREE.Rectangle,Ha=!1,fa=new THREE.Color,da=new THREE.Color,ma=new THREE.Color,ra=new THREE.Vector3,Ja,Ka,Pa,Da,La,Ma,a=16;Ja=
+document.createElement("canvas");Ja.width=Ja.height=2;Ka=Ja.getContext("2d");Ka.fillStyle="rgba(0,0,0,1)";Ka.fillRect(0,0,2,2);Pa=Ka.getImageData(0,0,2,2);Da=Pa.data;La=document.createElement("canvas");La.width=La.height=a;Ma=La.getContext("2d");Ma.translate(-a/2,-a/2);Ma.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;s=b;n=Math.floor(o/2);p=Math.floor(s/2);k.width=o;k.height=s;ha.set(-n,
+-p,n,p);ja.set(-n,-p,n,p);t=1;x=0;E=F=y=D=v=null};this.setClearColor=function(a,b){q.copy(a);r=b;ja.set(-n,-p,n,p)};this.setClearColorHex=function(a,b){q.setHex(a);r=b;ja.set(-n,-p,n,p)};this.clear=function(){m.setTransform(1,0,0,-1,n,p);ja.isEmpty()||(ja.minSelf(ha),ja.inflate(2),r<1&&m.clearRect(Math.floor(ja.getX()),Math.floor(ja.getY()),Math.floor(ja.getWidth()),Math.floor(ja.getHeight())),r>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*
+255)+","+r+")"),m.fillRect(Math.floor(ja.getX()),Math.floor(ja.getY()),Math.floor(ja.getWidth()),Math.floor(ja.getHeight()))),ja.empty())};this.render=function(a,k){function o(a){var b,c,d,e;fa.setRGB(0,0,0);da.setRGB(0,0,0);ma.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(fa.r+=e.r,fa.g+=e.g,fa.b+=e.b):d instanceof THREE.DirectionalLight?(da.r+=e.r,da.g+=e.g,da.b+=e.b):d instanceof THREE.PointLight&&(ma.r+=e.r,ma.g+=e.g,ma.b+=e.b)}function s(a,b,c,d){var e,
+f,g,h,fa,da;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(fa=g.matrixWorld.getPosition(),da=c.dot(fa),da<=0||(da*=g.intensity,d.r+=h.r*da,d.g+=h.g*da,d.b+=h.b*da)):g instanceof THREE.PointLight&&(fa=g.matrixWorld.getPosition(),da=c.dot(ra.sub(fa,b).normalize()),da<=0||(da*=g.distance==0?1:1-Math.min(b.distanceTo(fa)/g.distance,1),da!=0&&(da*=g.intensity,d.r+=h.r*da,d.g+=h.g*da,d.b+=h.b*da)))}function q(a,f,g){b(g.opacity);c(g.blending);var h,fa,da,l,i,k;if(g instanceof
+THREE.ParticleBasicMaterial){if(g.map)l=g.map.image,i=l.width>>1,k=l.height>>1,g=f.scale.x*n,da=f.scale.y*p,h=g*i,fa=da*k,qa.set(a.x-h,a.y-fa,a.x+h,a.y+fa),ha.intersects(qa)&&(m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(g,-da),m.translate(-i,-k),m.drawImage(l,0,0),m.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*n,fa=f.scale.y*p,qa.set(a.x-h,a.y-fa,a.x+h,a.y+fa),ha.intersects(qa)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),m.save(),m.translate(a.x,
+a.y),m.rotate(-f.rotation),m.scale(h,fa),g.program(m),m.restore()))}function r(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(y!=a)m.lineWidth=y=a;a=g.linecap;if(F!=a)m.lineCap=F=a;a=g.linejoin;if(E!=a)m.lineJoin=E=a;d(g.color.getContextStyle());m.stroke();qa.inflate(g.linewidth*2)}}function t(a,d,e,g,h,da,j,m){f.info.render.vertices+=
+3;f.info.render.faces++;b(m.opacity);c(m.blending);T=a.positionScreen.x;Y=a.positionScreen.y;O=d.positionScreen.x;l=d.positionScreen.y;P=e.positionScreen.x;A=e.positionScreen.y;v(T,Y,O,l,P,A);if(m instanceof THREE.MeshBasicMaterial)if(m.map)m.map.mapping instanceof THREE.UVMapping&&(sa=j.uvs[0],Qa(T,Y,O,l,P,A,sa[g].u,sa[g].v,sa[h].u,sa[h].v,sa[da].u,sa[da].v,m.map));else if(m.envMap){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,ra.copy(j.vertexNormalsWorld[g]),
+ya=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,za=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,ra.copy(j.vertexNormalsWorld[h]),Aa=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,Ba=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,ra.copy(j.vertexNormalsWorld[da]),xa=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,Ca=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,Qa(T,Y,O,l,P,A,ya,za,Aa,Ba,xa,Ca,m.envMap)}else m.wireframe?Fa(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):H(m.color);else if(m instanceof
+THREE.MeshLambertMaterial)m.map&&!m.wireframe&&(m.map.mapping instanceof THREE.UVMapping&&(sa=j.uvs[0],Qa(T,Y,O,l,P,A,sa[g].u,sa[g].v,sa[h].u,sa[h].v,sa[da].u,sa[da].v,m.map)),c(THREE.SubtractiveBlending)),Ha?!m.wireframe&&m.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3?($.r=U.r=Q.r=fa.r,$.g=U.g=Q.g=fa.g,$.b=U.b=Q.b=fa.b,s(i,j.v1.positionWorld,j.vertexNormalsWorld[0],$),s(i,j.v2.positionWorld,j.vertexNormalsWorld[1],U),s(i,j.v3.positionWorld,j.vertexNormalsWorld[2],Q),$.r=Math.max(0,
+Math.min(m.color.r*$.r,1)),$.g=Math.max(0,Math.min(m.color.g*$.g,1)),$.b=Math.max(0,Math.min(m.color.b*$.b,1)),U.r=Math.max(0,Math.min(m.color.r*U.r,1)),U.g=Math.max(0,Math.min(m.color.g*U.g,1)),U.b=Math.max(0,Math.min(m.color.b*U.b,1)),Q.r=Math.max(0,Math.min(m.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(m.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(m.color.b*Q.b,1)),ba.r=(U.r+Q.r)*0.5,ba.g=(U.g+Q.g)*0.5,ba.b=(U.b+Q.b)*0.5,va=Na($,U,Q,ba),Ia(T,Y,O,l,P,A,0,0,1,0,0,1,va)):(S.r=fa.r,S.g=fa.g,S.b=fa.b,s(i,j.centroidWorld,
+j.normalWorld,S),S.r=Math.max(0,Math.min(m.color.r*S.r,1)),S.g=Math.max(0,Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),m.wireframe?Fa(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):H(S)):m.wireframe?Fa(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):H(m.color);else if(m instanceof THREE.MeshDepthMaterial)oa=k.near,ta=k.far,$.r=$.g=$.b=1-L(a.positionScreen.z,oa,ta),U.r=U.g=U.b=1-L(d.positionScreen.z,oa,ta),Q.r=Q.g=Q.b=1-L(e.positionScreen.z,
+oa,ta),ba.r=(U.r+Q.r)*0.5,ba.g=(U.g+Q.g)*0.5,ba.b=(U.b+Q.b)*0.5,va=Na($,U,Q,ba),Ia(T,Y,O,l,P,A,0,0,1,0,0,1,va);else if(m instanceof THREE.MeshNormalMaterial)S.r=M(j.normalWorld.x),S.g=M(j.normalWorld.y),S.b=M(j.normalWorld.z),m.wireframe?Fa(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):H(S)}function x(a,d,e,g,h,da,m,j,ma){f.info.render.vertices+=4;f.info.render.faces++;b(j.opacity);c(j.blending);if(j.map||j.envMap)t(a,d,g,0,1,3,m,j,ma),t(h,e,da,1,2,3,m,j,ma);else if(T=a.positionScreen.x,
+Y=a.positionScreen.y,O=d.positionScreen.x,l=d.positionScreen.y,P=e.positionScreen.x,A=e.positionScreen.y,X=g.positionScreen.x,N=g.positionScreen.y,W=h.positionScreen.x,aa=h.positionScreen.y,ea=da.positionScreen.x,Z=da.positionScreen.y,j instanceof THREE.MeshBasicMaterial)D(T,Y,O,l,P,A,X,N),j.wireframe?Fa(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):H(j.color);else if(j instanceof THREE.MeshLambertMaterial)Ha?!j.wireframe&&j.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==
+4?($.r=U.r=Q.r=ba.r=fa.r,$.g=U.g=Q.g=ba.g=fa.g,$.b=U.b=Q.b=ba.b=fa.b,s(i,m.v1.positionWorld,m.vertexNormalsWorld[0],$),s(i,m.v2.positionWorld,m.vertexNormalsWorld[1],U),s(i,m.v4.positionWorld,m.vertexNormalsWorld[3],Q),s(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ba),$.r=Math.max(0,Math.min(j.color.r*$.r,1)),$.g=Math.max(0,Math.min(j.color.g*$.g,1)),$.b=Math.max(0,Math.min(j.color.b*$.b,1)),U.r=Math.max(0,Math.min(j.color.r*U.r,1)),U.g=Math.max(0,Math.min(j.color.g*U.g,1)),U.b=Math.max(0,Math.min(j.color.b*
+U.b,1)),Q.r=Math.max(0,Math.min(j.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(j.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(j.color.b*Q.b,1)),ba.r=Math.max(0,Math.min(j.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(j.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(j.color.b*ba.b,1)),va=Na($,U,Q,ba),v(T,Y,O,l,X,N),Ia(T,Y,O,l,X,N,0,0,1,0,0,1,va),v(W,aa,P,A,ea,Z),Ia(W,aa,P,A,ea,Z,1,0,1,1,0,1,va)):(S.r=fa.r,S.g=fa.g,S.b=fa.b,s(i,m.centroidWorld,m.normalWorld,S),S.r=Math.max(0,Math.min(j.color.r*S.r,1)),S.g=Math.max(0,
+Math.min(j.color.g*S.g,1)),S.b=Math.max(0,Math.min(j.color.b*S.b,1)),D(T,Y,O,l,P,A,X,N),j.wireframe?Fa(S,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):H(S)):(D(T,Y,O,l,P,A,X,N),j.wireframe?Fa(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):H(j.color));else if(j instanceof THREE.MeshNormalMaterial)S.r=M(m.normalWorld.x),S.g=M(m.normalWorld.y),S.b=M(m.normalWorld.z),D(T,Y,O,l,P,A,X,N),j.wireframe?Fa(S,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):H(S);
+else if(j instanceof THREE.MeshDepthMaterial)oa=k.near,ta=k.far,$.r=$.g=$.b=1-L(a.positionScreen.z,oa,ta),U.r=U.g=U.b=1-L(d.positionScreen.z,oa,ta),Q.r=Q.g=Q.b=1-L(g.positionScreen.z,oa,ta),ba.r=ba.g=ba.b=1-L(e.positionScreen.z,oa,ta),va=Na($,U,Q,ba),v(T,Y,O,l,X,N),Ia(T,Y,O,l,X,N,0,0,1,0,0,1,va),v(W,aa,P,A,ea,Z),Ia(W,aa,P,A,ea,Z,1,0,1,1,0,1,va)}function v(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function D(a,b,c,d,e,f,g,h){m.beginPath();m.moveTo(a,
+b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,h);m.lineTo(a,b);m.closePath()}function Fa(a,b,c,e){if(y!=b)m.lineWidth=y=b;if(F!=c)m.lineCap=F=c;if(E!=e)m.lineJoin=E=e;d(a.getContextStyle());m.stroke();qa.inflate(b*2)}function H(a){e(a.getContextStyle());m.fill()}function Qa(a,b,c,d,f,g,h,fa,da,l,i,j,k){if(k.image.width!=0){if(k.needsUpdate==!0||wa[k.id]==void 0){var ma=k.wrapS==THREE.RepeatWrapping,n=k.wrapT==THREE.RepeatWrapping;wa[k.id]=m.createPattern(k.image,ma&&n?"repeat":ma&&!n?"repeat-x":!ma&&
+n?"repeat-y":"no-repeat");k.needsUpdate=!1}e(wa[k.id]);var ma=k.offset.x/k.repeat.x,n=k.offset.y/k.repeat.y,ra=k.image.width*k.repeat.x,o=k.image.height*k.repeat.y,h=(h+ma)*ra,fa=(fa+n)*o,da=(da+ma)*ra,l=(l+n)*o,i=(i+ma)*ra,j=(j+n)*o;c-=a;d-=b;f-=a;g-=b;da-=h;l-=fa;i-=h;j-=fa;ma=da*j-i*l;if(ma==0){if(ca[k.id]==void 0)b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,a=b.getContext("2d"),a.drawImage(k.image,0,0),ca[k.id]=a.getImageData(0,0,k.image.width,k.image.height).data,
+delete b;b=ca[k.id];h=(Math.floor(h)+Math.floor(fa)*k.image.width)*4;S.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);H(S)}else ma=1/ma,k=(j*c-l*f)*ma,l=(j*d-l*g)*ma,c=(da*f-i*c)*ma,d=(da*g-i*d)*ma,a=a-k*h-c*fa,h=b-l*h-d*fa,m.save(),m.transform(k,l,c,d,a,h),m.fill(),m.restore()}}function Ia(a,b,c,d,e,f,g,h,fa,da,l,i,k){var j,ma;j=k.width-1;ma=k.height-1;g*=j;h*=ma;fa*=j;da*=ma;l*=j;i*=ma;c-=a;d-=b;e-=a;f-=b;fa-=g;da-=h;l-=g;i-=h;ma=1/(fa*i-l*da);j=(i*c-da*e)*ma;da=(i*d-da*f)*ma;c=(fa*e-l*c)*ma;d=(fa*f-l*
+d)*ma;a=a-j*g-c*h;b=b-da*g-d*h;m.save();m.transform(j,da,c,d,a,b);m.clip();m.drawImage(k,0,0);m.restore()}function Na(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),fa=~~(c.r*255),da=~~(c.g*255),c=~~(c.b*255),l=~~(d.r*255),i=~~(d.g*255),d=~~(d.b*255);Da[0]=e<0?0:e>255?255:e;Da[1]=f<0?0:f>255?255:f;Da[2]=a<0?0:a>255?255:a;Da[4]=g<0?0:g>255?255:g;Da[5]=h<0?0:h>255?255:h;Da[6]=b<0?0:b>255?255:b;Da[8]=fa<0?0:fa>255?255:fa;Da[9]=da<0?0:da>255?255:da;Da[10]=
+c<0?0:c>255?255:c;Da[12]=l<0?0:l>255?255:l;Da[13]=i<0?0:i>255?255:i;Da[14]=d<0?0:d>255?255:d;Ka.putImageData(Pa,0,0);Ma.drawImage(Ja,0,0);return La}function L(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function M(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function K(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 Oa,Ra,ua,Ea;this.autoClear?this.clear():m.setTransform(1,0,0,-1,n,p);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,k,this.sortElements);
+h=g.elements;i=g.lights;(Ha=i.length>0)&&o(i);Oa=0;for(Ra=h.length;Oa<Ra;Oa++)if(ua=h[Oa],Ea=ua.material,Ea=Ea instanceof THREE.MeshFaceMaterial?ua.faceMaterial:Ea,!(Ea==null||Ea.opacity==0)){qa.empty();if(ua instanceof THREE.RenderableParticle)u=ua,u.x*=n,u.y*=p,q(u,ua,Ea,a);else if(ua instanceof THREE.RenderableLine)u=ua.v1,I=ua.v2,u.positionScreen.x*=n,u.positionScreen.y*=p,I.positionScreen.x*=n,I.positionScreen.y*=p,qa.addPoint(u.positionScreen.x,u.positionScreen.y),qa.addPoint(I.positionScreen.x,
+I.positionScreen.y),ha.intersects(qa)&&r(u,I,ua,Ea,a);else if(ua instanceof THREE.RenderableFace3)u=ua.v1,I=ua.v2,w=ua.v3,u.positionScreen.x*=n,u.positionScreen.y*=p,I.positionScreen.x*=n,I.positionScreen.y*=p,w.positionScreen.x*=n,w.positionScreen.y*=p,Ea.overdraw&&(K(u.positionScreen,I.positionScreen),K(I.positionScreen,w.positionScreen),K(w.positionScreen,u.positionScreen)),qa.add3Points(u.positionScreen.x,u.positionScreen.y,I.positionScreen.x,I.positionScreen.y,w.positionScreen.x,w.positionScreen.y),
+ha.intersects(qa)&&t(u,I,w,0,1,2,ua,Ea,a);else if(ua instanceof THREE.RenderableFace4)u=ua.v1,I=ua.v2,w=ua.v3,R=ua.v4,u.positionScreen.x*=n,u.positionScreen.y*=p,I.positionScreen.x*=n,I.positionScreen.y*=p,w.positionScreen.x*=n,w.positionScreen.y*=p,R.positionScreen.x*=n,R.positionScreen.y*=p,V.positionScreen.copy(I.positionScreen),J.positionScreen.copy(R.positionScreen),Ea.overdraw&&(K(u.positionScreen,I.positionScreen),K(I.positionScreen,R.positionScreen),K(R.positionScreen,u.positionScreen),K(w.positionScreen,
+V.positionScreen),K(w.positionScreen,J.positionScreen)),qa.addPoint(u.positionScreen.x,u.positionScreen.y),qa.addPoint(I.positionScreen.x,I.positionScreen.y),qa.addPoint(w.positionScreen.x,w.positionScreen.y),qa.addPoint(R.positionScreen.x,R.positionScreen.y),ha.intersects(qa)&&x(u,I,w,R,V,J,ua,Ea,a);ja.addRectangle(qa)}m.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(u.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){I[a]==null&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),T==0&&I[a].setAttribute("shape-rendering","crispEdges"));return I[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"),j,k,o,s,n,p,m,q,r=new THREE.Rectangle,t=new THREE.Rectangle,x=!1,v=new THREE.Color,D=new THREE.Color,y=new THREE.Color,F=new THREE.Color,E,u=new THREE.Vector3,I=[],w=[],R,V,J,T=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":T=1;break;case "low":T=0}};this.setSize=function(a,b){j=a;k=b;o=j/2;s=k/2;i.setAttribute("viewBox",-o+" "+-s+" "+j+" "+k);i.setAttribute("width",j);i.setAttribute("height",k);r.set(-o,-s,o,s)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,j){var l,I,A,u;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;J=V=0;if(x=g.length>0){D.setRGB(0,0,0);y.setRGB(0,0,0);F.setRGB(0,0,0);l=0;for(I=g.length;l<I;l++)u=g[l],A=u.color,u instanceof THREE.AmbientLight?(D.r+=A.r,D.g+=A.g,D.b+=A.b):u instanceof THREE.DirectionalLight?(y.r+=A.r,y.g+=A.g,y.b+=A.b):u instanceof THREE.PointLight&&(F.r+=A.r,F.g+=A.g,F.b+=A.b)}l=0;for(I=f.length;l<I;l++)if(A=f[l],u=A.material,u=u instanceof THREE.MeshFaceMaterial?A.faceMaterial:u,!(u==null||u.opacity==0))if(t.empty(),A instanceof THREE.RenderableParticle)n=A,n.x*=
+o,n.y*=-s;else if(A instanceof THREE.RenderableLine){if(n=A.v1,p=A.v2,n.positionScreen.x*=o,n.positionScreen.y*=-s,p.positionScreen.x*=o,p.positionScreen.y*=-s,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),r.intersects(t)){A=n;var N=p,W=J++;w[W]==null&&(w[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),T==0&&w[W].setAttribute("shape-rendering","crispEdges"));R=w[W];R.setAttribute("x1",A.positionScreen.x);R.setAttribute("y1",A.positionScreen.y);
+R.setAttribute("x2",N.positionScreen.x);R.setAttribute("y2",N.positionScreen.y);u instanceof THREE.LineBasicMaterial&&(R.setAttribute("style","fill: none; stroke: "+u.color.getContextStyle()+"; stroke-width: "+u.linewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.linecap+"; stroke-linejoin: "+u.linejoin),i.appendChild(R))}}else if(A instanceof THREE.RenderableFace3){if(n=A.v1,p=A.v2,m=A.v3,n.positionScreen.x*=o,n.positionScreen.y*=-s,p.positionScreen.x*=o,p.positionScreen.y*=-s,m.positionScreen.x*=
+o,m.positionScreen.y*=-s,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),r.intersects(t)){var N=n,W=p,aa=m;d.info.render.vertices+=3;d.info.render.faces++;R=b(V++);R.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?v.copy(u.color):u instanceof THREE.MeshLambertMaterial?
+x?(v.r=D.r,v.g=D.g,v.b=D.b,a(g,A.centroidWorld,A.normalWorld,v),v.r=Math.max(0,Math.min(u.color.r*v.r,1)),v.g=Math.max(0,Math.min(u.color.g*v.g,1)),v.b=Math.max(0,Math.min(u.color.b*v.b,1))):v.copy(u.color):u instanceof THREE.MeshDepthMaterial?(E=1-u.__2near/(u.__farPlusNear-A.z*u.__farMinusNear),v.setRGB(E,E,E)):u instanceof THREE.MeshNormalMaterial&&v.setRGB(c(A.normalWorld.x),c(A.normalWorld.y),c(A.normalWorld.z));u.wireframe?R.setAttribute("style","fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+
+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):R.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+u.opacity);i.appendChild(R)}}else if(A instanceof THREE.RenderableFace4&&(n=A.v1,p=A.v2,m=A.v3,q=A.v4,n.positionScreen.x*=o,n.positionScreen.y*=-s,p.positionScreen.x*=o,p.positionScreen.y*=-s,m.positionScreen.x*=o,m.positionScreen.y*=-s,q.positionScreen.x*=o,q.positionScreen.y*=-s,t.addPoint(n.positionScreen.x,
+n.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),r.intersects(t))){var N=n,W=p,aa=m,ea=q;d.info.render.vertices+=4;d.info.render.faces++;R=b(V++);R.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+" L "+ea.positionScreen.x+","+ea.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?
+v.copy(u.color):u instanceof THREE.MeshLambertMaterial?x?(v.r=D.r,v.g=D.g,v.b=D.b,a(g,A.centroidWorld,A.normalWorld,v),v.r=Math.max(0,Math.min(u.color.r*v.r,1)),v.g=Math.max(0,Math.min(u.color.g*v.g,1)),v.b=Math.max(0,Math.min(u.color.b*v.b,1))):v.copy(u.color):u instanceof THREE.MeshDepthMaterial?(E=1-u.__2near/(u.__farPlusNear-A.z*u.__farMinusNear),v.setRGB(E,E,E)):u instanceof THREE.MeshNormalMaterial&&v.setRGB(c(A.normalWorld.x),c(A.normalWorld.y),c(A.normalWorld.z));u.wireframe?R.setAttribute("style",
+"fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):R.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+u.opacity);i.appendChild(R)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -228,117 +228,117 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragme
 THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=l.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){if(a.vertexColors)return a.vertexColors;return!1}function f(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
-return!1}function g(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,k=i.length,j=a.__vertexArray,m=a.__colorArray,o=a.__sortArray,n=a.__dirtyVertices,q=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){ya.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,za.copy(e),ya.multiplyVector3(za),o[d]=[za.z,d];o.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[o[d][1]].position,f=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;for(d=0;d<k;d++)f=d*3,e=i[o[d][1]],m[f]=e.r,m[f+
-1]=e.g,m[f+2]=e.b;if(p){i=0;for(k=p.length;i<k;i++)if(h=p[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=o[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=o[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=o[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=o[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,
-f+=3;else if(h.size===4)for(d=0;d<e;d++)g=o[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(n)for(d=0;d<g;d++)e=h[d].position,f=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;if(q)for(d=0;d<k;d++)e=i[d],f=d*3,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(p){i=0;for(k=p.length;i<k;i++)if(h=p[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(e=h.value.length,f=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)g=h.value[d],
-h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}if(n||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,j,b);if(q||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,
-a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,m,b);if(p){i=0;for(k=p.length;i<k;i++)if(h=p[i],h.needsUpdate||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,h.buffer),l.bufferData(l.ARRAY_BUFFER,h.array,b)}}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)v=null,M=Y=V=L=U=-1,a[d].render(b,c,Ba,wa),v=null,M=Y=V=L=U=-1}function k(a,b,c,d,e,f,g,h){var l,i,k,j;b?(i=a.length-1,j=b=-1):(i=0,b=a.length,j=1);for(var o=i;o!==b;o+=j)if(l=a[o],l.render){i=l.object;
-k=l.buffer;if(h)l=h;else{l=l[c];if(!l)continue;g&&R.setBlending(l.blending);R.setDepthTest(l.depthTest);u(l.depthWrite);t(l.polygonOffset,l.polygonOffsetFactor,l.polygonOffsetUnits)}R.setObjectFaces(i);k instanceof THREE.BufferGeometry?R.renderBufferDirect(d,e,f,l,k,i):R.renderBuffer(d,e,f,l,k,i)}}function j(a,b,c,d,e,f,g){for(var h,l,i=0,k=a.length;i<k;i++)if(h=a[i],l=h.object,l.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&R.setBlending(h.blending);R.setDepthTest(h.depthTest);u(h.depthWrite);
-t(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}R.renderImmediateObject(c,d,e,h,l)}}function n(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function r(a,b,c,d,e){d.program||
-R.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(R.maxMorphTargets);for(var f=0,g=R.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==v&&(l.useProgram(f),v=f,h=!0);if(d.id!==M)M=d.id,h=!0;if(h){l.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;
-else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,j,o=0,m=0,n=0,p,q,r=Aa,s=r.directional.colors,y=r.directional.positions,u=r.point.colors,t=r.point.positions,K=r.point.distances,A=0,G=0,z=q=0,c=0,h=b.length;c<h;c++)if(k=b[c],j=k.color,p=k.intensity,q=k.distance,k instanceof THREE.AmbientLight)R.gammaInput?(o+=j.r*j.r,m+=j.g*j.g,n+=j.b*j.b):(o+=j.r,m+=j.g,n+=j.b);else if(k instanceof
-THREE.DirectionalLight)q=A*3,R.gammaInput?(s[q]=j.r*j.r*p*p,s[q+1]=j.g*j.g*p*p,s[q+2]=j.b*j.b*p*p):(s[q]=j.r*p,s[q+1]=j.g*p,s[q+2]=j.b*p),k=k.matrixWorld.getPosition(),j=1/k.length(),y[q]=k.x*j,y[q+1]=k.y*j,y[q+2]=k.z*j,A+=1;else if(k instanceof THREE.SpotLight&&!k.onlyShadow)q=A*3,R.gammaInput?(s[q]=j.r*j.r*p*p,s[q+1]=j.g*j.g*p*p,s[q+2]=j.b*j.b*p*p):(s[q]=j.r*p,s[q+1]=j.g*p,s[q+2]=j.b*p),k=k.matrixWorld.getPosition(),j=1/k.length(),y[q]=k.x*j,y[q+1]=k.y*j,y[q+2]=k.z*j,A+=1;else if(k instanceof THREE.PointLight)z=
-G*3,R.gammaInput?(u[z]=j.r*j.r*p*p,u[z+1]=j.g*j.g*p*p,u[z+2]=j.b*j.b*p*p):(u[z]=j.r*p,u[z+1]=j.g*p,u[z+2]=j.b*p),k=k.matrixWorld.getPosition(),t[z]=k.x,t[z+1]=k.y,t[z+2]=k.z,K[G]=q,G+=1;c=A*3;for(h=s.length;c<h;c++)s[c]=0;c=G*3;for(h=u.length;c<h;c++)u[c]=0;r.point.length=G;r.directional.length=A;r.ambient[0]=o;r.ambient[1]=m;r.ambient[2]=n;b=Aa;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=
-b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,R.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=
-d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=w.height/2,i.map.texture=d.map;else if(d instanceof
-THREE.MeshPhongMaterial)i.shininess.value=d.shininess,R.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)R.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,
-i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<R.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=R.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=R.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=R.shadowMapDarkness;i.shadowBias.value=R.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(m=f.uniforms[b[i][1]])if(o=b[i][0],n=o.type,
-h=o.value,n==="i")l.uniform1i(m,h);else if(n==="f")l.uniform1f(m,h);else if(n==="v2")l.uniform2f(m,h.x,h.y);else if(n==="v3")l.uniform3f(m,h.x,h.y,h.z);else if(n==="v4")l.uniform4f(m,h.x,h.y,h.z,h.w);else if(n==="c")l.uniform3f(m,h.r,h.g,h.b);else if(n==="fv1")l.uniform1fv(m,h);else if(n==="fv")l.uniform3fv(m,h);else if(n==="v3v"){if(!o._array)o._array=new Float32Array(3*h.length);n=0;for(r=h.length;n<r;n++)s=n*3,o._array[s]=h[n].x,o._array[s+1]=h[n].y,o._array[s+2]=h[n].z;l.uniform3fv(m,o._array)}else if(n===
-"m4"){if(!o._array)o._array=new Float32Array(16);h.flattenToArray(o._array);l.uniformMatrix4fv(m,!1,o._array)}else if(n==="m4v"){if(!o._array)o._array=new Float32Array(16*h.length);n=0;for(r=h.length;n<r;n++)h[n].flattenToArrayOffset(o._array,n*16);l.uniformMatrix4fv(m,!1,o._array)}else if(n==="t"){if(l.uniform1i(m,h),m=o.texture)if(m.image instanceof Array&&m.image.length===6){if(o=m,o.image.length===6)if(o.needsUpdate){if(!o.image.__webglTextureCube)o.image.__webglTextureCube=l.createTexture();
-l.activeTexture(l.TEXTURE0+h);l.bindTexture(l.TEXTURE_CUBE_MAP,o.image.__webglTextureCube);h=B(l.TEXTURE_CUBE_MAP,o,o.image[0]);m=H(o.format);n=H(o.type);for(r=0;r<6;r++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,m,m,n,o.image[r]);h&&l.generateMipmap(l.TEXTURE_CUBE_MAP);o.needsUpdate=!1}else l.activeTexture(l.TEXTURE0+h),l.bindTexture(l.TEXTURE_CUBE_MAP,o.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(o=m,l.activeTexture(l.TEXTURE0+h),l.bindTexture(l.TEXTURE_CUBE_MAP,
-o.__webglTexture)):R.setTexture(m,h)}else if(n==="tv"){if(!o._array){o._array=[];n=0;for(r=o.texture.length;n<r;n++)o._array[n]=h+n}l.uniform1iv(m,o._array);n=0;for(r=o.texture.length;n<r;n++)(m=o.texture[n])&&R.setTexture(m,o._array[n])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&l.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof
-THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&l.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(l.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),l.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}l.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&l.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&l.uniformMatrix4fv(g.objectMatrix,
-!1,e._objectMatrixArray);return f}function s(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function u(a){V!==a&&(l.depthMask(a),V=a)}function t(a,b,c){ba!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),ba=a);if(a&&(ga!==b||va!==c))l.polygonOffset(b,c),ga=b,va=c}function A(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):
-a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);if(!l.getShaderParameter(c,l.COMPILE_STATUS))return console.error(l.getShaderInfoLog(c)),console.error(b),null;return c}function B(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(l.texParameteri(a,l.TEXTURE_WRAP_S,H(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,H(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,H(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,H(b.minFilter)),!0):(l.texParameteri(a,
-l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,E(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,E(b.minFilter)),!1)}function z(a,b){l.bindRenderbuffer(l.RENDERBUFFER,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 E(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;default:return l.LINEAR}}function H(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:"mediump",y=a.antialias!==void 0?a.antialias:!1,K=a.stencil!==
-void 0?a.stencil:!0,Z=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,T=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,S=[],v=null,W=null,M=-1,Y=null,ca=0,$=null,ea=null,U=null,L=null,V=null,ba=null,ga=null,va=null,fa=null,na=0,ja=0,sa=0,
-ra=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:Z})))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 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;ra=d;l.viewport(na,ja,sa,ra)};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)};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=function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),R.info.memory.textures--};this.updateShadowMap=function(a,b){v=null;M=Y=V=L=U=-1;this.shadowMapPlugin.update(a,b)};
-this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=l.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=l.createBuffer();a.hasPos&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),l.enableVertexAttribArray(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormal){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,
-e,f,g,h,i,k,j,o,m,n=a.count*3;for(m=0;m<n;m+=9)c=a.normalArray,d=c[m],e=c[m+1],f=c[m+2],g=c[m+3],i=c[m+4],j=c[m+5],h=c[m+6],k=c[m+7],o=c[m+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+j+o)/3,c[m]=d,c[m+1]=e,c[m+2]=f,c[m+3]=d,c[m+4]=e,c[m+5]=f,c[m+6]=d,c[m+7]=e,c[m+8]=f}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,
-b,c,d,e,f){if(d.opacity!==0&&(c=r(a,b,c,d,f),a=c.attributes,b=!1,d=e.id*16777215+c.id*2+(d.wireframe?1:0),d!==Y&&(Y=d,b=!0),f instanceof THREE.Mesh)){d=e.offsets;for(f=0;f<d.length;++f)b&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexPositionBuffer),l.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,l.FLOAT,!1,0,d[f].index*12),a.normal>=0&&e.vertexNormalBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexNormalBuffer),l.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,l.FLOAT,!1,0,d[f].index*
-12)),a.uv>=0&&e.vertexUvBuffer&&(e.vertexUvBuffer?(l.bindBuffer(l.ARRAY_BUFFER,e.vertexUvBuffer),l.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,l.FLOAT,!1,0,d[f].index*8),l.enableVertexAttribArray(a.uv)):l.disableVertexAttribArray(a.uv)),a.color>=0&&e.vertexColorBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexColorBuffer),l.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,l.FLOAT,!1,0,d[f].index*16)),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),l.drawElements(l.TRIANGLES,d[f].count,
-l.UNSIGNED_SHORT,d[f].start*2),R.info.render.calls++,R.info.render.vertices+=d[f].count,R.info.render.faces+=d[f].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=r(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==Y&&(Y=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(l.bindBuffer(l.ARRAY_BUFFER,
-e.__webglMorphTargetsBuffers[f.morphTargetBase]),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):c.position>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=
-h[i[g]],g++}else{var i=[],k=-1,j=0;h=f.morphTargetInfluences;var o,m=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(o=0;o<m;o++)!i[o]&&h[o]>k&&(j=o,k=h[j]);l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]);l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[j]=1;k=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
-0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0))}b.color>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0));b.normal>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));b.tangent>=0&&(l.bindBuffer(l.ARRAY_BUFFER,
-e.__webglTangentBuffer),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv)):l.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv2)):l.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
-0&&b.skinIndex>=0&&b.skinWeight>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexABuffer),l.vertexAttribPointer(b.skinVertexA,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),l.vertexAttribPointer(b.skinVertexB,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
-(d=d.wireframeLinewidth,d!==fa&&(l.lineWidth(d),fa=d),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,l.UNSIGNED_SHORT,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,l.UNSIGNED_SHORT,0)),R.info.render.calls++,R.info.render.vertices+=e.__webglFaceCount,R.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,d=d.linewidth,d!==
-fa&&(l.lineWidth(d),fa=d),l.drawArrays(f,0,e.__webglLineCount),R.info.render.calls++):f instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,e.__webglParticleCount),R.info.render.calls++,R.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,0,e.__webglVertexCount),R.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,g,o,m=a.lights,n=a.fog;M=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();i(this.renderPluginsPre,a,b);R.info.render.calls=0;R.info.render.vertices=0;R.info.render.faces=0;R.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ya.multiply(b.projectionMatrix,
-b.matrixWorldInverse);xa.setFromMatrix(ya);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);o=a.__webglObjects;d=0;for(e=o.length;d<e;d++)if(f=o[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||xa.contains(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);s(g,b);var p=f,q=p.object,r=p.buffer,y=void 0,y=y=void 0,y=q.material;if(y instanceof THREE.MeshFaceMaterial){if(y=
-r.materialIndex,y>=0)y=q.geometry.materials[y],y.transparent?(p.transparent=y,p.opaque=null):(p.opaque=y,p.transparent=null)}else if(y)y.transparent?(p.transparent=y,p.opaque=null):(p.opaque=y,p.transparent=null);f.render=!0;if(this.sortObjects)g.renderDepth?f.z=g.renderDepth:(za.copy(g.position),ya.multiplyVector3(za),f.z=za.z)}this.sortObjects&&o.sort(h);o=a.__webglObjectsImmediate;d=0;for(e=o.length;d<e;d++)if(f=o[d],g=f.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray),
-s(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),u(a.overrideMaterial.depthWrite),t(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,m,n,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,m,n,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),
-k(a.__webglObjects,!0,"opaque",b,m,n,!1),j(a.__webglObjectsImmediate,"opaque",b,m,n,!1),k(a.__webglObjects,!1,"transparent",b,m,n,!0),j(a.__webglObjectsImmediate,"transparent",b,m,n,!0));i(this.renderPluginsPost,a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,c.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,c.__webglTexture),
-l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,e){var f=r(a,b,c,d,e);Y=-1;R.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,l,xa):e.render(function(a){R.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,k=void 0,j=void 0,
-C=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){if(j=h.geometry,j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var C=j,r=void 0,s=void 0,y=void 0,u=void 0,t=void 0,w=void 0,D=void 0,v={},A=C.morphTargets.length;C.geometryGroups={};r=0;for(s=C.faces.length;r<
-s;r++)y=C.faces[r],u=y.materialIndex,w=u!==void 0?u:-1,v[w]===void 0&&(v[w]={hash:w,counter:0}),D=v[w].hash+"_"+v[w].counter,C.geometryGroups[D]===void 0&&(C.geometryGroups[D]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:A}),t=y instanceof THREE.Face3?3:4,C.geometryGroups[D].vertices+t>65535&&(v[w].counter+=1,D=v[w].hash+"_"+v[w].counter,C.geometryGroups[D]===void 0&&(C.geometryGroups[D]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:A})),y instanceof THREE.Face3?
-C.geometryGroups[D].faces3.push(r):C.geometryGroups[D].faces4.push(r),C.geometryGroups[D].vertices+=t;C.geometryGroupsList=[];r=void 0;for(r in C.geometryGroups)C.geometryGroups[r].id=ca++,C.geometryGroupsList.push(C.geometryGroups[r])}for(k in j.geometryGroups)if(C=j.geometryGroups[k],!C.__webglVertexBuffer){r=C;r.__webglVertexBuffer=l.createBuffer();r.__webglNormalBuffer=l.createBuffer();r.__webglTangentBuffer=l.createBuffer();r.__webglColorBuffer=l.createBuffer();r.__webglUVBuffer=l.createBuffer();
-r.__webglUV2Buffer=l.createBuffer();r.__webglSkinVertexABuffer=l.createBuffer();r.__webglSkinVertexBBuffer=l.createBuffer();r.__webglSkinIndicesBuffer=l.createBuffer();r.__webglSkinWeightsBuffer=l.createBuffer();r.__webglFaceBuffer=l.createBuffer();r.__webglLineBuffer=l.createBuffer();if(r.numMorphTargets){y=s=void 0;r.__webglMorphTargetsBuffers=[];s=0;for(y=r.numMorphTargets;s<y;s++)r.__webglMorphTargetsBuffers.push(l.createBuffer())}R.info.memory.geometries++;u=h;t=u.geometry;s=C.faces3;w=C.faces4;
-r=s.length*3+w.length*4;y=s.length*1+w.length*2;w=s.length*3+w.length*4;s=c(u,C);D=f(s);v=d(s);A=e(s);C.__vertexArray=new Float32Array(r*3);if(v)C.__normalArray=new Float32Array(r*3);if(t.hasTangents)C.__tangentArray=new Float32Array(r*4);if(A)C.__colorArray=new Float32Array(r*3);if(D){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)C.__uvArray=new Float32Array(r*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)C.__uv2Array=new Float32Array(r*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length)C.__skinVertexAArray=
-new Float32Array(r*4),C.__skinVertexBArray=new Float32Array(r*4),C.__skinIndexArray=new Float32Array(r*4),C.__skinWeightArray=new Float32Array(r*4);C.__faceArray=new Uint16Array(y*3);C.__lineArray=new Uint16Array(w*2);if(C.numMorphTargets){C.__morphTargetsArrays=[];u=0;for(t=C.numMorphTargets;u<t;u++)C.__morphTargetsArrays.push(new Float32Array(r*3))}C.__webglFaceCount=y*3;C.__webglLineCount=w*2;if(s.attributes){if(C.__webglCustomAttributesList===void 0)C.__webglCustomAttributesList=[];y=void 0;for(y in s.attributes){var u=
-s.attributes[y],t={},K;for(K in u)t[K]=u[K];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,w=1,t.type==="v2"?w=2:t.type==="v3"?w=3:t.type==="v4"?w=4:t.type==="c"&&(w=3),t.size=w,t.array=new Float32Array(r*w),t.buffer=l.createBuffer(),t.buffer.belongsToAttribute=y,u.needsUpdate=!0,t.__original=u;C.__webglCustomAttributesList.push(t)}}C.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=
-!0;j.__dirtyColors=!0}}}else if(h instanceof THREE.Ribbon){if(j=h.geometry,!j.__webglVertexBuffer)C=j,C.__webglVertexBuffer=l.createBuffer(),C.__webglColorBuffer=l.createBuffer(),R.info.memory.geometries++,C=j,r=C.vertices.length,C.__vertexArray=new Float32Array(r*3),C.__colorArray=new Float32Array(r*3),C.__webglVertexCount=r,j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(h instanceof THREE.Line){if(j=h.geometry,!j.__webglVertexBuffer)C=j,C.__webglVertexBuffer=l.createBuffer(),C.__webglColorBuffer=
-l.createBuffer(),R.info.memory.geometries++,C=j,r=h,s=C.vertices.length,C.__vertexArray=new Float32Array(s*3),C.__colorArray=new Float32Array(s*3),C.__webglLineCount=s,b(C,r),j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(j=h.geometry,!j.__webglVertexBuffer))C=j,C.__webglVertexBuffer=l.createBuffer(),C.__webglColorBuffer=l.createBuffer(),R.info.geometries++,C=j,r=h,s=C.vertices.length,C.__vertexArray=new Float32Array(s*3),C.__colorArray=new Float32Array(s*3),C.__sortArray=
-[],C.__webglParticleCount=s,b(C,r),j.__dirtyVertices=!0,j.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)if(j=h.geometry,j instanceof THREE.BufferGeometry)n(i.__webglObjects,j,h);else for(k in j.geometryGroups)C=j.geometryGroups[k],n(i.__webglObjects,C,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(j=h.geometry,n(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?p(i.__webglObjects,h):h instanceof THREE.Sprite?o(i.__webglSprites,h):h instanceof THREE.LensFlare?o(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||
-h.immediateRenderCallback)&&p(i.__webglObjectsImmediate,h),h.__webglActive=!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(K=a.__webglObjects[h].object,k=K.geometry,j=y=s=void 0,K instanceof THREE.Mesh)if(k instanceof THREE.BufferGeometry)k.__dirtyVertices=!1,k.__dirtyElements=!1,k.__dirtyUvs=!1,k.__dirtyNormals=!1,k.__dirtyColors=!1;else{C=0;for(r=k.geometryGroupsList.length;C<r;C++)if(s=k.geometryGroupsList[C],j=c(K,s),y=j.attributes&&q(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,D=j;if(s.__inittedArrays){var t=d(D),w=e(D),z=f(D),H=t===THREE.SmoothShading,B=v=D=void 0,I=void 0,M=void 0,Q=void 0,J=void 0,E=void 0,Z=void 0,Y=B=void 0,P=void 0,N=void 0,O=void 0,T=I=void 0,U=void 0,X=void 0,W=I=Z=void 0,V=void 0,ea=O=N=P=J=void 0,L=I=O=N=P=ea=O=N=P=ea=O=N=P=void 0,S=void 0,ba=Q=void 0,ga=void 0,$=void 0,va=void 0,fa=void 0,na=Y=$=S=0,la=0,ja=L=B=0,ha=
-J=T=0,F=0,ma=void 0,ha=s.__vertexArray,ga=s.__uvArray,F=s.__uv2Array,ba=s.__normalArray,M=s.__tangentArray,U=s.__colorArray,W=s.__skinVertexAArray,V=s.__skinVertexBArray,E=s.__skinIndexArray,oa=s.__skinWeightArray,ea=s.__morphTargetsArrays,A=s.__webglCustomAttributesList,x=void 0,x=s.__faceArray,ma=s.__lineArray,X=G.geometry,ra=X.__dirtyElements,sa=X.__dirtyUvs,Q=X.__dirtyNormals,Z=X.__dirtyTangents,za=X.__dirtyColors,va=X.__dirtyMorphTargets,fa=X.vertices,G=s.faces3,ia=s.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){D=0;for(v=G.length;D<v;D++)I=ka[G[D]],P=fa[I.a].position,N=fa[I.b].position,O=fa[I.c].position,ha[$]=P.x,ha[$+1]=P.y,ha[$+2]=P.z,ha[$+3]=N.x,ha[$+4]=N.y,ha[$+5]=N.z,ha[$+6]=O.x,ha[$+7]=O.y,ha[$+8]=O.z,$+=9;D=0;for(v=ia.length;D<v;D++)I=ka[ia[D]],P=fa[I.a].position,N=fa[I.b].position,O=fa[I.c].position,I=fa[I.d].position,ha[$]=P.x,ha[$+1]=P.y,ha[$+2]=P.z,ha[$+3]=N.x,
-ha[$+4]=N.y,ha[$+5]=N.z,ha[$+6]=O.x,ha[$+7]=O.y,ha[$+8]=O.z,ha[$+9]=I.x,ha[$+10]=I.y,ha[$+11]=I.z,$+=12;l.bindBuffer(l.ARRAY_BUFFER,s.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,ha,y)}if(va){$=0;for(va=Ha.length;$<va;$++){D=ha=0;for(v=G.length;D<v;D++)I=ka[G[D]],P=Ha[$].vertices[I.a].position,N=Ha[$].vertices[I.b].position,O=Ha[$].vertices[I.c].position,fa=ea[$],fa[ha]=P.x,fa[ha+1]=P.y,fa[ha+2]=P.z,fa[ha+3]=N.x,fa[ha+4]=N.y,fa[ha+5]=N.z,fa[ha+6]=O.x,fa[ha+7]=O.y,fa[ha+8]=O.z,ha+=9;D=0;for(v=
-ia.length;D<v;D++)I=ka[ia[D]],P=Ha[$].vertices[I.a].position,N=Ha[$].vertices[I.b].position,O=Ha[$].vertices[I.c].position,I=Ha[$].vertices[I.d].position,fa=ea[$],fa[ha]=P.x,fa[ha+1]=P.y,fa[ha+2]=P.z,fa[ha+3]=N.x,fa[ha+4]=N.y,fa[ha+5]=N.z,fa[ha+6]=O.x,fa[ha+7]=O.y,fa[ha+8]=O.z,fa[ha+9]=I.x,fa[ha+10]=I.y,fa[ha+11]=I.z,ha+=12;l.bindBuffer(l.ARRAY_BUFFER,s.__webglMorphTargetsBuffers[$]);l.bufferData(l.ARRAY_BUFFER,ea[$],y)}}if(Ga.length){D=0;for(v=G.length;D<v;D++)I=ka[G[D]],P=Ga[I.a],N=Ga[I.b],O=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]=N.x,oa[J+5]=N.y,oa[J+6]=N.z,oa[J+7]=N.w,oa[J+8]=O.x,oa[J+9]=O.y,oa[J+10]=O.z,oa[J+11]=O.w,P=Aa[I.a],N=Aa[I.b],O=Aa[I.c],E[J]=P.x,E[J+1]=P.y,E[J+2]=P.z,E[J+3]=P.w,E[J+4]=N.x,E[J+5]=N.y,E[J+6]=N.z,E[J+7]=N.w,E[J+8]=O.x,E[J+9]=O.y,E[J+10]=O.z,E[J+11]=O.w,P=wa[I.a],N=wa[I.b],O=wa[I.c],W[J]=P.x,W[J+1]=P.y,W[J+2]=P.z,W[J+3]=1,W[J+4]=N.x,W[J+5]=N.y,W[J+6]=N.z,W[J+7]=1,W[J+8]=O.x,W[J+9]=O.y,W[J+10]=O.z,W[J+11]=1,P=xa[I.a],N=xa[I.b],O=xa[I.c],V[J]=P.x,
-V[J+1]=P.y,V[J+2]=P.z,V[J+3]=1,V[J+4]=N.x,V[J+5]=N.y,V[J+6]=N.z,V[J+7]=1,V[J+8]=O.x,V[J+9]=O.y,V[J+10]=O.z,V[J+11]=1,J+=12;D=0;for(v=ia.length;D<v;D++)I=ka[ia[D]],P=Ga[I.a],N=Ga[I.b],O=Ga[I.c],ea=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]=N.x,oa[J+5]=N.y,oa[J+6]=N.z,oa[J+7]=N.w,oa[J+8]=O.x,oa[J+9]=O.y,oa[J+10]=O.z,oa[J+11]=O.w,oa[J+12]=ea.x,oa[J+13]=ea.y,oa[J+14]=ea.z,oa[J+15]=ea.w,P=Aa[I.a],N=Aa[I.b],O=Aa[I.c],ea=Aa[I.d],E[J]=P.x,E[J+1]=P.y,E[J+2]=P.z,E[J+3]=P.w,E[J+4]=N.x,E[J+
-5]=N.y,E[J+6]=N.z,E[J+7]=N.w,E[J+8]=O.x,E[J+9]=O.y,E[J+10]=O.z,E[J+11]=O.w,E[J+12]=ea.x,E[J+13]=ea.y,E[J+14]=ea.z,E[J+15]=ea.w,P=wa[I.a],N=wa[I.b],O=wa[I.c],ea=wa[I.d],W[J]=P.x,W[J+1]=P.y,W[J+2]=P.z,W[J+3]=1,W[J+4]=N.x,W[J+5]=N.y,W[J+6]=N.z,W[J+7]=1,W[J+8]=O.x,W[J+9]=O.y,W[J+10]=O.z,W[J+11]=1,W[J+12]=ea.x,W[J+13]=ea.y,W[J+14]=ea.z,W[J+15]=1,P=xa[I.a],N=xa[I.b],O=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]=N.x,V[J+5]=N.y,V[J+6]=N.z,V[J+7]=1,V[J+8]=O.x,V[J+9]=O.y,V[J+10]=O.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,s.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,W,y),l.bindBuffer(l.ARRAY_BUFFER,s.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,V,y),l.bindBuffer(l.ARRAY_BUFFER,s.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,E,y),l.bindBuffer(l.ARRAY_BUFFER,s.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,oa,y))}if(za&&w){D=0;for(v=G.length;D<v;D++)I=ka[G[D]],J=I.vertexColors,E=I.color,J.length===
-3&&w===THREE.VertexColors?(I=J[0],W=J[1],V=J[2]):V=W=I=E,U[T]=I.r,U[T+1]=I.g,U[T+2]=I.b,U[T+3]=W.r,U[T+4]=W.g,U[T+5]=W.b,U[T+6]=V.r,U[T+7]=V.g,U[T+8]=V.b,T+=9;D=0;for(v=ia.length;D<v;D++)I=ka[ia[D]],J=I.vertexColors,E=I.color,J.length===4&&w===THREE.VertexColors?(I=J[0],W=J[1],V=J[2],J=J[3]):J=V=W=I=E,U[T]=I.r,U[T+1]=I.g,U[T+2]=I.b,U[T+3]=W.r,U[T+4]=W.g,U[T+5]=W.b,U[T+6]=V.r,U[T+7]=V.g,U[T+8]=V.b,U[T+9]=J.r,U[T+10]=J.g,U[T+11]=J.b,T+=12;T>0&&(l.bindBuffer(l.ARRAY_BUFFER,s.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,
-U,y))}if(Z&&X.hasTangents){D=0;for(v=G.length;D<v;D++)I=ka[G[D]],Z=I.vertexTangents,T=Z[0],U=Z[1],X=Z[2],M[L]=T.x,M[L+1]=T.y,M[L+2]=T.z,M[L+3]=T.w,M[L+4]=U.x,M[L+5]=U.y,M[L+6]=U.z,M[L+7]=U.w,M[L+8]=X.x,M[L+9]=X.y,M[L+10]=X.z,M[L+11]=X.w,L+=12;D=0;for(v=ia.length;D<v;D++)I=ka[ia[D]],Z=I.vertexTangents,T=Z[0],U=Z[1],X=Z[2],Z=Z[3],M[L]=T.x,M[L+1]=T.y,M[L+2]=T.z,M[L+3]=T.w,M[L+4]=U.x,M[L+5]=U.y,M[L+6]=U.z,M[L+7]=U.w,M[L+8]=X.x,M[L+9]=X.y,M[L+10]=X.z,M[L+11]=X.w,M[L+12]=Z.x,M[L+13]=Z.y,M[L+14]=Z.z,M[L+
-15]=Z.w,L+=16;l.bindBuffer(l.ARRAY_BUFFER,s.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,M,y)}if(Q&&t){D=0;for(v=G.length;D<v;D++)if(I=ka[G[D]],M=I.vertexNormals,Q=I.normal,M.length===3&&H)for(L=0;L<3;L++)Q=M[L],ba[B]=Q.x,ba[B+1]=Q.y,ba[B+2]=Q.z,B+=3;else for(L=0;L<3;L++)ba[B]=Q.x,ba[B+1]=Q.y,ba[B+2]=Q.z,B+=3;D=0;for(v=ia.length;D<v;D++)if(I=ka[ia[D]],M=I.vertexNormals,Q=I.normal,M.length===4&&H)for(L=0;L<4;L++)Q=M[L],ba[B]=Q.x,ba[B+1]=Q.y,ba[B+2]=Q.z,B+=3;else for(L=0;L<4;L++)ba[B]=Q.x,ba[B+
-1]=Q.y,ba[B+2]=Q.z,B+=3;l.bindBuffer(l.ARRAY_BUFFER,s.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,ba,y)}if(sa&&ya&&z){D=0;for(v=G.length;D<v;D++)if(B=G[D],B=ya[B],B!==void 0)for(L=0;L<3;L++)ba=B[L],ga[Y]=ba.u,ga[Y+1]=ba.v,Y+=2;D=0;for(v=ia.length;D<v;D++)if(B=ia[D],B=ya[B],B!==void 0)for(L=0;L<4;L++)ba=B[L],ga[Y]=ba.u,ga[Y+1]=ba.v,Y+=2;Y>0&&(l.bindBuffer(l.ARRAY_BUFFER,s.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,ga,y))}if(sa&&Ba&&z){D=0;for(v=G.length;D<v;D++)if(B=G[D],Y=Ba[B],Y!==void 0)for(L=
-0;L<3;L++)ga=Y[L],F[na]=ga.u,F[na+1]=ga.v,na+=2;D=0;for(v=ia.length;D<v;D++)if(B=ia[D],Y=Ba[B],Y!==void 0)for(L=0;L<4;L++)ga=Y[L],F[na]=ga.u,F[na+1]=ga.v,na+=2;na>0&&(l.bindBuffer(l.ARRAY_BUFFER,s.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,F,y))}if(ra){D=0;for(v=G.length;D<v;D++)x[la]=S,x[la+1]=S+1,x[la+2]=S+2,la+=3,ma[ja]=S,ma[ja+1]=S+1,ma[ja+2]=S,ma[ja+3]=S+2,ma[ja+4]=S+1,ma[ja+5]=S+2,ja+=6,S+=3;D=0;for(v=ia.length;D<v;D++)x[la]=S,x[la+1]=S+1,x[la+2]=S+3,x[la+3]=S+1,x[la+4]=S+2,x[la+5]=S+3,la+=
-6,ma[ja]=S,ma[ja+1]=S+1,ma[ja+2]=S,ma[ja+3]=S+3,ma[ja+4]=S+1,ma[ja+5]=S+2,ma[ja+6]=S+2,ma[ja+7]=S+3,ja+=8,S+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,s.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,x,y);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,s.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,ma,y)}if(A){L=0;for(S=A.length;L<S;L++)if(x=A[L],x.__original.needsUpdate){F=0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){D=0;for(v=G.length;D<v;D++)I=ka[G[D]],x.array[F]=x.value[I.a],
-x.array[F+1]=x.value[I.b],x.array[F+2]=x.value[I.c],F+=3;D=0;for(v=ia.length;D<v;D++)I=ka[ia[D]],x.array[F]=x.value[I.a],x.array[F+1]=x.value[I.b],x.array[F+2]=x.value[I.c],x.array[F+3]=x.value[I.d],F+=4}else{if(x.boundTo==="faces"){D=0;for(v=G.length;D<v;D++)ma=x.value[G[D]],x.array[F]=ma,x.array[F+1]=ma,x.array[F+2]=ma,F+=3;D=0;for(v=ia.length;D<v;D++)ma=x.value[ia[D]],x.array[F]=ma,x.array[F+1]=ma,x.array[F+2]=ma,x.array[F+3]=ma,F+=4}}else if(x.size===2)if(x.boundTo===void 0||x.boundTo==="vertices"){D=
-0;for(v=G.length;D<v;D++)I=ka[G[D]],P=x.value[I.a],N=x.value[I.b],O=x.value[I.c],x.array[F]=P.x,x.array[F+1]=P.y,x.array[F+2]=N.x,x.array[F+3]=N.y,x.array[F+4]=O.x,x.array[F+5]=O.y,F+=6;D=0;for(v=ia.length;D<v;D++)I=ka[ia[D]],P=x.value[I.a],N=x.value[I.b],O=x.value[I.c],I=x.value[I.d],x.array[F]=P.x,x.array[F+1]=P.y,x.array[F+2]=N.x,x.array[F+3]=N.y,x.array[F+4]=O.x,x.array[F+5]=O.y,x.array[F+6]=I.x,x.array[F+7]=I.y,F+=8}else{if(x.boundTo==="faces"){D=0;for(v=G.length;D<v;D++)O=N=P=ma=x.value[G[D]],
-x.array[F]=P.x,x.array[F+1]=P.y,x.array[F+2]=N.x,x.array[F+3]=N.y,x.array[F+4]=O.x,x.array[F+5]=O.y,F+=6;D=0;for(v=ia.length;D<v;D++)I=O=N=P=ma=x.value[ia[D]],x.array[F]=P.x,x.array[F+1]=P.y,x.array[F+2]=N.x,x.array[F+3]=N.y,x.array[F+4]=O.x,x.array[F+5]=O.y,x.array[F+6]=I.x,x.array[F+7]=I.y,F+=8}}else if(x.size===3)if(t=x.type==="c"?["r","g","b"]:["x","y","z"],x.boundTo===void 0||x.boundTo==="vertices"){D=0;for(v=G.length;D<v;D++)I=ka[G[D]],P=x.value[I.a],N=x.value[I.b],O=x.value[I.c],x.array[F]=
-P[t[0]],x.array[F+1]=P[t[1]],x.array[F+2]=P[t[2]],x.array[F+3]=N[t[0]],x.array[F+4]=N[t[1]],x.array[F+5]=N[t[2]],x.array[F+6]=O[t[0]],x.array[F+7]=O[t[1]],x.array[F+8]=O[t[2]],F+=9;D=0;for(v=ia.length;D<v;D++)I=ka[ia[D]],P=x.value[I.a],N=x.value[I.b],O=x.value[I.c],I=x.value[I.d],x.array[F]=P[t[0]],x.array[F+1]=P[t[1]],x.array[F+2]=P[t[2]],x.array[F+3]=N[t[0]],x.array[F+4]=N[t[1]],x.array[F+5]=N[t[2]],x.array[F+6]=O[t[0]],x.array[F+7]=O[t[1]],x.array[F+8]=O[t[2]],x.array[F+9]=I[t[0]],x.array[F+10]=
-I[t[1]],x.array[F+11]=I[t[2]],F+=12}else{if(x.boundTo==="faces"){D=0;for(v=G.length;D<v;D++)O=N=P=ma=x.value[G[D]],x.array[F]=P[t[0]],x.array[F+1]=P[t[1]],x.array[F+2]=P[t[2]],x.array[F+3]=N[t[0]],x.array[F+4]=N[t[1]],x.array[F+5]=N[t[2]],x.array[F+6]=O[t[0]],x.array[F+7]=O[t[1]],x.array[F+8]=O[t[2]],F+=9;D=0;for(v=ia.length;D<v;D++)I=O=N=P=ma=x.value[ia[D]],x.array[F]=P[t[0]],x.array[F+1]=P[t[1]],x.array[F+2]=P[t[2]],x.array[F+3]=N[t[0]],x.array[F+4]=N[t[1]],x.array[F+5]=N[t[2]],x.array[F+6]=O[t[0]],
-x.array[F+7]=O[t[1]],x.array[F+8]=O[t[2]],x.array[F+9]=I[t[0]],x.array[F+10]=I[t[1]],x.array[F+11]=I[t[2]],F+=12}}else if(x.size===4)if(x.boundTo===void 0||x.boundTo==="vertices"){D=0;for(v=G.length;D<v;D++)I=ka[G[D]],P=x.value[I.a],N=x.value[I.b],O=x.value[I.c],x.array[F]=P.x,x.array[F+1]=P.y,x.array[F+2]=P.z,x.array[F+3]=P.w,x.array[F+4]=N.x,x.array[F+5]=N.y,x.array[F+6]=N.z,x.array[F+7]=N.w,x.array[F+8]=O.x,x.array[F+9]=O.y,x.array[F+10]=O.z,x.array[F+11]=O.w,F+=12;D=0;for(v=ia.length;D<v;D++)I=
-ka[ia[D]],P=x.value[I.a],N=x.value[I.b],O=x.value[I.c],I=x.value[I.d],x.array[F]=P.x,x.array[F+1]=P.y,x.array[F+2]=P.z,x.array[F+3]=P.w,x.array[F+4]=N.x,x.array[F+5]=N.y,x.array[F+6]=N.z,x.array[F+7]=N.w,x.array[F+8]=O.x,x.array[F+9]=O.y,x.array[F+10]=O.z,x.array[F+11]=O.w,x.array[F+12]=I.x,x.array[F+13]=I.y,x.array[F+14]=I.z,x.array[F+15]=I.w,F+=16}else if(x.boundTo==="faces"){D=0;for(v=G.length;D<v;D++)O=N=P=ma=x.value[G[D]],x.array[F]=P.x,x.array[F+1]=P.y,x.array[F+2]=P.z,x.array[F+3]=P.w,x.array[F+
-4]=N.x,x.array[F+5]=N.y,x.array[F+6]=N.z,x.array[F+7]=N.w,x.array[F+8]=O.x,x.array[F+9]=O.y,x.array[F+10]=O.z,x.array[F+11]=O.w,F+=12;D=0;for(v=ia.length;D<v;D++)I=O=N=P=ma=x.value[ia[D]],x.array[F]=P.x,x.array[F+1]=P.y,x.array[F+2]=P.z,x.array[F+3]=P.w,x.array[F+4]=N.x,x.array[F+5]=N.y,x.array[F+6]=N.z,x.array[F+7]=N.w,x.array[F+8]=O.x,x.array[F+9]=O.y,x.array[F+10]=O.z,x.array[F+11]=O.w,x.array[F+12]=I.x,x.array[F+13]=I.y,x.array[F+14]=I.z,x.array[F+15]=I.w,F+=16}l.bindBuffer(l.ARRAY_BUFFER,x.buffer);
-l.bufferData(l.ARRAY_BUFFER,x.array,y)}}u&&(delete s.__inittedArrays,delete s.__colorArray,delete s.__normalArray,delete s.__tangentArray,delete s.__uvArray,delete s.__uv2Array,delete s.__faceArray,delete s.__vertexArray,delete s.__lineArray,delete s.__skinVertexAArray,delete s.__skinVertexBArray,delete s.__skinIndexArray,delete s.__skinWeightArray)}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;j.attributes&&
-m(j)}else if(K instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){j=k;K=l.DYNAMIC_DRAW;t=C=t=u=u=void 0;w=j.vertices;r=j.colors;D=w.length;s=r.length;v=j.__vertexArray;y=j.__colorArray;A=j.__dirtyColors;if(j.__dirtyVertices){for(u=0;u<D;u++)t=w[u].position,C=u*3,v[C]=t.x,v[C+1]=t.y,v[C+2]=t.z;l.bindBuffer(l.ARRAY_BUFFER,j.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,v,K)}if(A){for(u=0;u<s;u++)t=r[u],C=u*3,y[C]=t.r,y[C+1]=t.g,y[C+2]=t.b;l.bindBuffer(l.ARRAY_BUFFER,j.__webglColorBuffer);
-l.bufferData(l.ARRAY_BUFFER,y,K)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(K instanceof THREE.Line){j=c(K,s);y=j.attributes&&q(j);if(k.__dirtyVertices||k.__dirtyColors||y){K=k;C=l.DYNAMIC_DRAW;D=r=H=w=z=void 0;w=K.vertices;s=K.colors;D=w.length;y=s.length;v=K.__vertexArray;u=K.__colorArray;A=K.__dirtyColors;t=K.__webglCustomAttributesList;S=ka=ia=G=H=z=void 0;if(K.__dirtyVertices){for(z=0;z<D;z++)H=w[z].position,r=z*3,v[r]=H.x,v[r+1]=H.y,v[r+2]=H.z;l.bindBuffer(l.ARRAY_BUFFER,K.__webglVertexBuffer);
-l.bufferData(l.ARRAY_BUFFER,v,C)}if(A){for(w=0;w<y;w++)D=s[w],r=w*3,u[r]=D.r,u[r+1]=D.g,u[r+2]=D.b;l.bindBuffer(l.ARRAY_BUFFER,K.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,u,C)}if(t){z=0;for(H=t.length;z<H;z++)if(S=t[z],S.needsUpdate&&(S.boundTo===void 0||S.boundTo==="vertices")){r=0;ia=S.value.length;if(S.size===1)for(G=0;G<ia;G++)S.array[G]=S.value[G];else if(S.size===2)for(G=0;G<ia;G++)ka=S.value[G],S.array[r]=ka.x,S.array[r+1]=ka.y,r+=2;else if(S.size===3)if(S.type==="c")for(G=0;G<ia;G++)ka=
-S.value[G],S.array[r]=ka.r,S.array[r+1]=ka.g,S.array[r+2]=ka.b,r+=3;else for(G=0;G<ia;G++)ka=S.value[G],S.array[r]=ka.x,S.array[r+1]=ka.y,S.array[r+2]=ka.z,r+=3;else if(S.size===4)for(G=0;G<ia;G++)ka=S.value[G],S.array[r]=ka.x,S.array[r+1]=ka.y,S.array[r+2]=ka.z,S.array[r+3]=ka.w,r+=4;l.bindBuffer(l.ARRAY_BUFFER,S.buffer);l.bufferData(l.ARRAY_BUFFER,S.array,C)}}}k.__dirtyVertices=!1;k.__dirtyColors=!1;j.attributes&&m(j)}else if(K instanceof THREE.ParticleSystem)j=c(K,s),y=j.attributes&&q(j),(k.__dirtyVertices||
-k.__dirtyColors||K.sortParticles||y)&&g(k,l.DYNAMIC_DRAW,K),k.__dirtyVertices=!1,k.__dirtyColors=!1,j.attributes&&m(j)};this.initMaterial=function(a,b,c,d){var e,f,g,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h=
-"particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,k,o;j=o=i=0;for(k=b.length;j<k;j++)g=b[j],g instanceof THREE.SpotLight&&!g.onlyShadow&&o++,g instanceof THREE.DirectionalLight&&o++,g instanceof THREE.PointLight&&i++;i+o<=T?j=o:(j=Math.ceil(T*o/(i+o)),i=T-j);g={directional:j,point:i};i=o=0;for(j=b.length;i<j;i++)k=b[i],k instanceof THREE.SpotLight&&k.castShadow&&o++;var m=50;if(d!==
-void 0&&d instanceof THREE.SkinnedMesh)m=d.bones.length;var n;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:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,
-shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},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=S.length;p<d;p++)if(S[p].code===h){n=S[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.wrapAround?"#define WRAP_AROUND":"",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=["precision "+G+" float;","#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.wrapAround?"#define WRAP_AROUND":"",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,A("fragment",
-g+j));l.attachShader(p,A("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(n in b)d.push(n);n=d;q=0;for(b=n.length;q<b;q++)c=n[q],p.attributes[c]=l.getAttribLocation(p,c);p.id=S.length;S.push({program:p,code:h});R.info.memory.programs=S.length;n=p}a.program=n;n=a.program.attributes;n.position>=0&&l.enableVertexAttribArray(n.position);n.color>=0&&l.enableVertexAttribArray(n.color);n.normal>=
-0&&l.enableVertexAttribArray(n.normal);n.tangent>=0&&l.enableVertexAttribArray(n.tangent);a.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(l.enableVertexAttribArray(n.skinVertexA),l.enableVertexAttribArray(n.skinVertexB),l.enableVertexAttribArray(n.skinIndex),l.enableVertexAttribArray(n.skinWeight));if(a.attributes)for(f in a.attributes)n[f]!==void 0&&n[f]>=0&&l.enableVertexAttribArray(n[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)q=
-"morphTarget"+f,n[q]>=0&&(l.enableVertexAttribArray(n[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($!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),
-$=a.doubleSided;if(ea!==a.flipSided)a.flipSided?l.frontFace(l.CW):l.frontFace(l.CCW),ea=a.flipSided};this.setDepthTest=function(a){L!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),L=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,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)}U=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=l.createTexture(),R.info.memory.textures++;l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);var c=B(l.TEXTURE_2D,a,a.image),d=H(a.format),e=H(a.type);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,d,a.image.width,
-a.image.height,0,d,e,a.image.data):l.texImage2D(l.TEXTURE_2D,0,d,d,e,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();var c=H(a.format),d=H(a.type);
-if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);B(l.TEXTURE_CUBE_MAP,a,a);for(var e=0;e<6;e++){a.__webglFramebuffer[e]=l.createFramebuffer();a.__webglRenderbuffer[e]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,c,a.width,a.height,0,c,d,null);var f=a,g=l.TEXTURE_CUBE_MAP_POSITIVE_X+e;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[e]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,g,f.__webglTexture,0);
-z(a.__webglRenderbuffer[e],a)}}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),B(l.TEXTURE_2D,a,a),l.texImage2D(l.TEXTURE_2D,0,c,a.width,a.height,0,c,d,null),c=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,c,a.__webglTexture,0),z(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=ra,d=na,e=ja);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)};
+return!1}function g(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,k=i.length,j=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.__dirtyVertices,s=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){Ba.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,xa.copy(e),Ba.multiplyVector3(xa),n[d]=[xa.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[n[d][1]].position,f=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;for(d=0;d<k;d++)f=d*3,e=i[n[d][1]],m[f]=e.r,m[f+
+1]=e.g,m[f+2]=e.b;if(p){i=0;for(k=p.length;i<k;i++)if(h=p[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,
+f+=3;else if(h.size===4)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;if(s)for(d=0;d<k;d++)e=i[d],f=d*3,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(p){i=0;for(k=p.length;i<k;i++)if(h=p[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(e=h.value.length,f=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)g=h.value[d],
+h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}if(o||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,j,b);if(s||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,
+a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,m,b);if(p){i=0;for(k=p.length;i<k;i++)if(h=p[i],h.needsUpdate||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,h.buffer),l.bufferData(l.ARRAY_BUFFER,h.array,b)}}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)A=null,N=W=U=$=S=-1,a[d].render(b,c,ya,za),A=null,N=W=U=$=S=-1}function j(a,b,c,d,e,f,g,h){var l,i,k,j;b?(i=a.length-1,j=b=-1):(i=0,b=a.length,j=1);for(var m=i;m!==b;m+=j)if(l=a[m],l.render){i=l.object;
+k=l.buffer;if(h)l=h;else{l=l[c];if(!l)continue;g&&O.setBlending(l.blending);O.setDepthTest(l.depthTest);t(l.depthWrite);x(l.polygonOffset,l.polygonOffsetFactor,l.polygonOffsetUnits)}O.setObjectFaces(i);k instanceof THREE.BufferGeometry?O.renderBufferDirect(d,e,f,l,k,i):O.renderBuffer(d,e,f,l,k,i)}}function k(a,b,c,d,e,f,g){for(var h,l,i=0,k=a.length;i<k;i++)if(h=a[i],l=h.object,l.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&O.setBlending(h.blending);O.setDepthTest(h.depthTest);t(h.depthWrite);
+x(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}O.renderImmediateObject(c,d,e,h,l)}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function s(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function m(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){d.program||
+O.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets);for(var f=0,g=O.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==A&&(l.useProgram(f),A=f,h=!0);if(d.id!==N)N=d.id,h=!0;if(h){l.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;
+else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,j,m=0,n=0,o=0,p,s,q=Ca,r=q.directional.colors,w=q.directional.positions,t=q.point.colors,x=q.point.positions,R=q.point.distances,v=0,I=0,y=s=0,c=0,h=b.length;c<h;c++)if(k=b[c],j=k.color,p=k.intensity,s=k.distance,k instanceof THREE.AmbientLight)O.gammaInput?(m+=j.r*j.r,n+=j.g*j.g,o+=j.b*j.b):(m+=j.r,n+=j.g,o+=j.b);else if(k instanceof
+THREE.DirectionalLight)s=v*3,O.gammaInput?(r[s]=j.r*j.r*p*p,r[s+1]=j.g*j.g*p*p,r[s+2]=j.b*j.b*p*p):(r[s]=j.r*p,r[s+1]=j.g*p,r[s+2]=j.b*p),k=k.matrixWorld.getPosition(),j=1/k.length(),w[s]=k.x*j,w[s+1]=k.y*j,w[s+2]=k.z*j,v+=1;else if(k instanceof THREE.SpotLight&&!k.onlyShadow)s=v*3,O.gammaInput?(r[s]=j.r*j.r*p*p,r[s+1]=j.g*j.g*p*p,r[s+2]=j.b*j.b*p*p):(r[s]=j.r*p,r[s+1]=j.g*p,r[s+2]=j.b*p),k=k.matrixWorld.getPosition(),j=1/k.length(),w[s]=k.x*j,w[s+1]=k.y*j,w[s+2]=k.z*j,v+=1;else if(k instanceof THREE.PointLight)y=
+I*3,O.gammaInput?(t[y]=j.r*j.r*p*p,t[y+1]=j.g*j.g*p*p,t[y+2]=j.b*j.b*p*p):(t[y]=j.r*p,t[y+1]=j.g*p,t[y+2]=j.b*p),k=k.matrixWorld.getPosition(),x[y]=k.x,x[y+1]=k.y,x[y+2]=k.z,R[I]=s,I+=1;c=v*3;for(h=r.length;c<h;c++)r[c]=0;c=I*3;for(h=t.length;c<h;c++)t[c]=0;q.point.length=I;q.directional.length=v;q.ambient[0]=m;q.ambient[1]=n;q.ambient[2]=o;b=Ca;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=
+b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,O.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=
+d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=u.height/2,i.map.texture=d.map;else if(d instanceof
+THREE.MeshPhongMaterial)i.shininess.value=d.shininess,O.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)O.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,
+i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<O.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=O.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=O.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=O.shadowMapDarkness;i.shadowBias.value=O.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(h=b[i][0],o=h.type,
+m=h.value,o==="i")l.uniform1i(n,m);else if(o==="f")l.uniform1f(n,m);else if(o==="v2")l.uniform2f(n,m.x,m.y);else if(o==="v3")l.uniform3f(n,m.x,m.y,m.z);else if(o==="v4")l.uniform4f(n,m.x,m.y,m.z,m.w);else if(o==="c")l.uniform3f(n,m.r,m.g,m.b);else if(o==="fv1")l.uniform1fv(n,m);else if(o==="fv")l.uniform3fv(n,m);else if(o==="v3v"){if(!h._array)h._array=new Float32Array(3*m.length);o=0;for(q=m.length;o<q;o++)r=o*3,h._array[r]=m[o].x,h._array[r+1]=m[o].y,h._array[r+2]=m[o].z;l.uniform3fv(n,h._array)}else if(o===
+"m4"){if(!h._array)h._array=new Float32Array(16);m.flattenToArray(h._array);l.uniformMatrix4fv(n,!1,h._array)}else if(o==="m4v"){if(!h._array)h._array=new Float32Array(16*m.length);o=0;for(q=m.length;o<q;o++)m[o].flattenToArrayOffset(h._array,o*16);l.uniformMatrix4fv(n,!1,h._array)}else if(o==="t"){if(l.uniform1i(n,m),n=h.texture)if(n.image instanceof Array&&n.image.length===6){if(h=n,h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=l.createTexture();
+l.activeTexture(l.TEXTURE0+m);l.bindTexture(l.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);m=[];for(n=0;n<6;n++){o=m;q=n;if(O.autoScaleCubemaps){if(r=h.image[n],!(r.width<=ja&&r.height<=ja))t=Math.max(r.width,r.height),w=Math.floor(r.width*ja/t),t=Math.floor(r.height*ja/t),x=document.createElement("canvas"),x.width=w,x.height=t,x.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,w,t),r=x}else r=h.image[n];o[q]=r}o=D(l.TEXTURE_CUBE_MAP,h,m[0]);q=E(h.format);r=E(h.type);for(n=0;n<6;n++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
+n,0,q,q,r,m[n]);o&&l.generateMipmap(l.TEXTURE_CUBE_MAP);h.needsUpdate=!1}else l.activeTexture(l.TEXTURE0+m),l.bindTexture(l.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,l.activeTexture(l.TEXTURE0+m),l.bindTexture(l.TEXTURE_CUBE_MAP,h.__webglTexture)):O.setTexture(n,m)}else if(o==="tv"){if(!h._array){h._array=[];o=0;for(q=h.texture.length;o<q;o++)h._array[o]=m+o}l.uniform1iv(n,h._array);o=0;for(q=h.texture.length;o<q;o++)(n=h.texture[o])&&O.setTexture(n,
+h._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&l.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&l.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(l.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),l.uniformMatrix4fv(g.boneGlobalMatrices,
+!1,e.boneMatrices))}l.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&l.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&l.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}
+function t(a){U!==a&&(l.depthMask(a),U=a)}function x(a,b,c){Q!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),Q=a);if(a&&(ba!==b||wa!==c))l.polygonOffset(b,c),ba=b,wa=c}function v(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);if(!l.getShaderParameter(c,l.COMPILE_STATUS))return console.error(l.getShaderInfoLog(c)),console.error(b),null;return c}function D(a,b,c){return(c.width&
+c.width-1)===0&&(c.height&c.height-1)===0?(l.texParameteri(a,l.TEXTURE_WRAP_S,E(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,E(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,E(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,E(b.minFilter)),!0):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,F(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,F(b.minFilter)),!1)}function y(a,b){l.bindRenderbuffer(l.RENDERBUFFER,
+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 F(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;
+default:return l.LINEAR}}function E(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||{},u=a.canvas!==void 0?a.canvas:document.createElement("canvas"),I=a.precision!==void 0?a.precision:"mediump",w=a.antialias!==void 0?a.antialias:!1,R=a.stencil!==void 0?a.stencil:!0,V=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,J=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),T=a.clearAlpha!==void 0?a.clearAlpha:0,Y=a.maxLights!==void 0?a.maxLights:4;this.domElement=u;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
+this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,
+textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var O=this,l,P=[],A=null,X=null,N=-1,W=null,aa=0,ea=null,Z=null,S=null,$=null,U=null,Q=null,ba=null,wa=null,ca=null,oa=0,ta=0,va=0,sa=0,ya=0,za=0,Aa=new THREE.Frustum,Ba=new THREE.Matrix4,xa=new THREE.Vector4,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};l=function(){var a;try{if(!(a=u.getContext("experimental-webgl",{antialias:w,stencil:R,preserveDrawingBuffer:V})))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(J.r,J.g,J.b,T);this.context=
+l;var ha=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS);l.getParameter(l.TEXTURE_SIZE);var ja=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return l};this.supportsVertexTextures=function(){return ha>0};this.setSize=function(a,b){u.width=a;u.height=b;this.setViewport(0,0,u.width,u.height)};this.setViewport=function(a,b,c,d){oa=a;ta=b;va=c;sa=d;l.viewport(oa,ta,va,sa)};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){J.setHex(a);T=b;l.clearColor(J.r,J.g,J.b,T)};this.setClearColor=function(a,b){J.copy(a);T=b;l.clearColor(J.r,J.g,J.b,T)};this.getClearColor=function(){return J};this.getClearAlpha=function(){return T};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);O.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),O.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),O.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),
+l.deleteBuffer(a.__webglColorBuffer),O.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),O.info.memory.textures--};this.updateShadowMap=function(a,b){A=null;N=W=U=$=S=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=l.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=l.createBuffer();a.hasPos&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),
+l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),l.enableVertexAttribArray(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormal){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,k,j,m,n,o=a.count*3;for(n=0;n<o;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],i=c[n+4],j=c[n+5],h=c[n+6],k=c[n+7],m=c[n+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+j+m)/3,c[n]=d,c[n+1]=e,c[n+2]=f,c[n+3]=d,c[n+4]=e,c[n+5]=f,
+c[n+6]=d,c[n+7]=e,c[n+8]=f}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.opacity!==0&&(c=q(a,b,c,d,f),a=c.attributes,b=!1,d=e.id*16777215+c.id*2+(d.wireframe?1:0),d!==W&&(W=d,b=!0),f instanceof THREE.Mesh)){d=e.offsets;for(f=0;f<d.length;++f)b&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexPositionBuffer),
+l.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,l.FLOAT,!1,0,d[f].index*12),a.normal>=0&&e.vertexNormalBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexNormalBuffer),l.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,l.FLOAT,!1,0,d[f].index*12)),a.uv>=0&&e.vertexUvBuffer&&(e.vertexUvBuffer?(l.bindBuffer(l.ARRAY_BUFFER,e.vertexUvBuffer),l.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,l.FLOAT,!1,0,d[f].index*8),l.enableVertexAttribArray(a.uv)):l.disableVertexAttribArray(a.uv)),
+a.color>=0&&e.vertexColorBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexColorBuffer),l.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,l.FLOAT,!1,0,d[f].index*16)),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),l.drawElements(l.TRIANGLES,d[f].count,l.UNSIGNED_SHORT,d[f].start*2),O.info.render.calls++,O.info.render.vertices+=d[f].count,O.info.render.faces+=d[f].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=q(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+
+c.id*2+(d.wireframe?1:0);c!==W&&(W=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):c.position>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,
+0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],k=-1,j=0;h=f.morphTargetInfluences;var m,n=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(m=0;m<n;m++)!i[m]&&h[m]>k&&
+(j=m,k=h[j]);l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]);l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[j]=1;k=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(l.bindBuffer(l.ARRAY_BUFFER,
+c.buffer),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0))}b.color>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0));b.normal>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));b.tangent>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),
+l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv)):l.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv2)):l.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexABuffer),l.vertexAttribPointer(b.skinVertexA,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,
+e.__webglSkinVertexBBuffer),l.vertexAttribPointer(b.skinVertexB,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ca&&(l.lineWidth(d),ca=d),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,l.UNSIGNED_SHORT,
+0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,l.UNSIGNED_SHORT,0)),O.info.render.calls++,O.info.render.vertices+=e.__webglFaceCount,O.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,d=d.linewidth,d!==ca&&(l.lineWidth(d),ca=d),l.drawArrays(f,0,e.__webglLineCount),O.info.render.calls++):f instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,e.__webglParticleCount),O.info.render.calls++,
+O.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,0,e.__webglVertexCount),O.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,g,m,n=a.lights,o=a.fog;N=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();i(this.renderPluginsPre,a,b);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=
+0;O.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Ba.multiply(b.projectionMatrix,b.matrixWorldInverse);Aa.setFromMatrix(Ba);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
+m=a.__webglObjects;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||Aa.contains(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);r(g,b);var p=f,s=p.object,q=p.buffer,w=void 0,w=w=void 0,w=s.material;if(w instanceof THREE.MeshFaceMaterial){if(w=q.materialIndex,w>=0)w=s.geometry.materials[w],w.transparent?(p.transparent=w,p.opaque=null):(p.opaque=w,p.transparent=null)}else if(w)w.transparent?
+(p.transparent=w,p.opaque=null):(p.opaque=w,p.transparent=null);f.render=!0;if(this.sortObjects)g.renderDepth?f.z=g.renderDepth:(xa.copy(g.position),Ba.multiplyVector3(xa),f.z=xa.z)}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray),r(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),
+this.setDepthTest(a.overrideMaterial.depthTest),t(a.overrideMaterial.depthWrite),x(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),j(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),j(a.__webglObjects,!0,"opaque",b,n,o,!1),k(a.__webglObjectsImmediate,"opaque",b,n,o,!1),j(a.__webglObjects,!1,"transparent",b,n,o,!0),k(a.__webglObjectsImmediate,
+"transparent",b,n,o,!0));i(this.renderPluginsPost,a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,c.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,c.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);W=-1;O.setObjectFaces(e);
+e.immediateRenderCallback?e.immediateRenderCallback(f,l,Aa):e.render(function(a){O.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,k=void 0,j=void 0,q=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),
+h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){if(j=h.geometry,j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var q=j,r=void 0,w=void 0,t=void 0,x=void 0,u=void 0,A=void 0,C=void 0,v={},R=q.morphTargets.length;q.geometryGroups={};r=0;for(w=q.faces.length;r<w;r++)t=q.faces[r],x=t.materialIndex,A=x!==void 0?x:-1,v[A]===void 0&&(v[A]={hash:A,counter:0}),C=v[A].hash+"_"+v[A].counter,q.geometryGroups[C]===void 0&&(q.geometryGroups[C]=
+{faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:R}),u=t instanceof THREE.Face3?3:4,q.geometryGroups[C].vertices+u>65535&&(v[A].counter+=1,C=v[A].hash+"_"+v[A].counter,q.geometryGroups[C]===void 0&&(q.geometryGroups[C]={faces3:[],faces4:[],materialIndex:x,vertices:0,numMorphTargets:R})),t instanceof THREE.Face3?q.geometryGroups[C].faces3.push(r):q.geometryGroups[C].faces4.push(r),q.geometryGroups[C].vertices+=u;q.geometryGroupsList=[];r=void 0;for(r in q.geometryGroups)q.geometryGroups[r].id=
+aa++,q.geometryGroupsList.push(q.geometryGroups[r])}for(k in j.geometryGroups)if(q=j.geometryGroups[k],!q.__webglVertexBuffer){r=q;r.__webglVertexBuffer=l.createBuffer();r.__webglNormalBuffer=l.createBuffer();r.__webglTangentBuffer=l.createBuffer();r.__webglColorBuffer=l.createBuffer();r.__webglUVBuffer=l.createBuffer();r.__webglUV2Buffer=l.createBuffer();r.__webglSkinVertexABuffer=l.createBuffer();r.__webglSkinVertexBBuffer=l.createBuffer();r.__webglSkinIndicesBuffer=l.createBuffer();r.__webglSkinWeightsBuffer=
+l.createBuffer();r.__webglFaceBuffer=l.createBuffer();r.__webglLineBuffer=l.createBuffer();if(r.numMorphTargets){t=w=void 0;r.__webglMorphTargetsBuffers=[];w=0;for(t=r.numMorphTargets;w<t;w++)r.__webglMorphTargetsBuffers.push(l.createBuffer())}O.info.memory.geometries++;x=h;u=x.geometry;w=q.faces3;A=q.faces4;r=w.length*3+A.length*4;t=w.length*1+A.length*2;A=w.length*3+A.length*4;w=c(x,q);C=f(w);v=d(w);R=e(w);q.__vertexArray=new Float32Array(r*3);if(v)q.__normalArray=new Float32Array(r*3);if(u.hasTangents)q.__tangentArray=
+new Float32Array(r*4);if(R)q.__colorArray=new Float32Array(r*3);if(C){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)q.__uv2Array=new Float32Array(r*2)}if(x.geometry.skinWeights.length&&x.geometry.skinIndices.length)q.__skinVertexAArray=new Float32Array(r*4),q.__skinVertexBArray=new Float32Array(r*4),q.__skinIndexArray=new Float32Array(r*4),q.__skinWeightArray=new Float32Array(r*4);q.__faceArray=new Uint16Array(t*3);
+q.__lineArray=new Uint16Array(A*2);if(q.numMorphTargets){q.__morphTargetsArrays=[];x=0;for(u=q.numMorphTargets;x<u;x++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__webglFaceCount=t*3;q.__webglLineCount=A*2;if(w.attributes){if(q.__webglCustomAttributesList===void 0)q.__webglCustomAttributesList=[];t=void 0;for(t in w.attributes){var x=w.attributes[t],u={},I;for(I in x)u[I]=x[I];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,A=1,u.type==="v2"?A=2:u.type==="v3"?A=3:
+u.type==="v4"?A=4:u.type==="c"&&(A=3),u.size=A,u.array=new Float32Array(r*A),u.buffer=l.createBuffer(),u.buffer.belongsToAttribute=t,x.needsUpdate=!0,u.__original=x;q.__webglCustomAttributesList.push(u)}}q.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}}}else if(h instanceof THREE.Ribbon){if(j=h.geometry,!j.__webglVertexBuffer)q=j,q.__webglVertexBuffer=l.createBuffer(),q.__webglColorBuffer=
+l.createBuffer(),O.info.memory.geometries++,q=j,r=q.vertices.length,q.__vertexArray=new Float32Array(r*3),q.__colorArray=new Float32Array(r*3),q.__webglVertexCount=r,j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(h instanceof THREE.Line){if(j=h.geometry,!j.__webglVertexBuffer)q=j,q.__webglVertexBuffer=l.createBuffer(),q.__webglColorBuffer=l.createBuffer(),O.info.memory.geometries++,q=j,r=h,w=q.vertices.length,q.__vertexArray=new Float32Array(w*3),q.__colorArray=new Float32Array(w*3),q.__webglLineCount=
+w,b(q,r),j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(j=h.geometry,!j.__webglVertexBuffer))q=j,q.__webglVertexBuffer=l.createBuffer(),q.__webglColorBuffer=l.createBuffer(),O.info.geometries++,q=j,r=h,w=q.vertices.length,q.__vertexArray=new Float32Array(w*3),q.__colorArray=new Float32Array(w*3),q.__sortArray=[],q.__webglParticleCount=w,b(q,r),j.__dirtyVertices=!0,j.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)if(j=h.geometry,j instanceof THREE.BufferGeometry)o(i.__webglObjects,
+j,h);else for(k in j.geometryGroups)q=j.geometryGroups[k],o(i.__webglObjects,q,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?p(i.__webglObjects,h):h instanceof THREE.Sprite?m(i.__webglSprites,h):h instanceof THREE.LensFlare?m(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&p(i.__webglObjectsImmediate,h),h.__webglActive=!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(I=a.__webglObjects[h].object,
+k=I.geometry,j=t=w=void 0,I instanceof THREE.Mesh)if(k instanceof THREE.BufferGeometry)k.__dirtyVertices=!1,k.__dirtyElements=!1,k.__dirtyUvs=!1,k.__dirtyNormals=!1,k.__dirtyColors=!1;else{q=0;for(r=k.geometryGroupsList.length;q<r;q++)if(w=k.geometryGroupsList[q],j=c(I,w),t=j.attributes&&s(j),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||t){var y=I,t=l.DYNAMIC_DRAW,x=!k.dynamic,C=j;if(w.__inittedArrays){var u=d(C),
+A=e(C),E=f(C),D=u===THREE.SmoothShading,N=v=C=void 0,G=void 0,J=void 0,F=void 0,H=void 0,V=void 0,W=void 0,Y=N=void 0,L=void 0,M=void 0,K=void 0,S=G=void 0,T=void 0,X=void 0,U=G=W=void 0,Z=void 0,$=K=M=L=H=void 0,P=G=K=M=L=$=K=M=L=$=K=M=L=void 0,Q=void 0,ba=F=void 0,ea=void 0,ka=void 0,wa=void 0,ca=void 0,oa=Y=ka=Q=0,ja=0,ha=P=N=0,ga=H=S=0,B=0,na=void 0,ga=w.__vertexArray,ea=w.__uvArray,B=w.__uv2Array,ba=w.__normalArray,J=w.__tangentArray,T=w.__colorArray,U=w.__skinVertexAArray,Z=w.__skinVertexBArray,
+V=w.__skinIndexArray,pa=w.__skinWeightArray,$=w.__morphTargetsArrays,R=w.__webglCustomAttributesList,z=void 0,z=w.__faceArray,na=w.__lineArray,X=y.geometry,ta=X.__dirtyElements,sa=X.__dirtyUvs,F=X.__dirtyNormals,W=X.__dirtyTangents,va=X.__dirtyColors,wa=X.__dirtyMorphTargets,ca=X.vertices,y=w.faces3,ia=w.faces4,la=X.faces,xa=X.faceVertexUvs[0],Ba=X.faceVertexUvs[1],ya=X.skinVerticesA,za=X.skinVerticesB,Aa=X.skinIndices,Ca=X.skinWeights,Ga=X.morphTargets;if(X.__dirtyVertices){C=0;for(v=y.length;C<
+v;C++)G=la[y[C]],L=ca[G.a].position,M=ca[G.b].position,K=ca[G.c].position,ga[ka]=L.x,ga[ka+1]=L.y,ga[ka+2]=L.z,ga[ka+3]=M.x,ga[ka+4]=M.y,ga[ka+5]=M.z,ga[ka+6]=K.x,ga[ka+7]=K.y,ga[ka+8]=K.z,ka+=9;C=0;for(v=ia.length;C<v;C++)G=la[ia[C]],L=ca[G.a].position,M=ca[G.b].position,K=ca[G.c].position,G=ca[G.d].position,ga[ka]=L.x,ga[ka+1]=L.y,ga[ka+2]=L.z,ga[ka+3]=M.x,ga[ka+4]=M.y,ga[ka+5]=M.z,ga[ka+6]=K.x,ga[ka+7]=K.y,ga[ka+8]=K.z,ga[ka+9]=G.x,ga[ka+10]=G.y,ga[ka+11]=G.z,ka+=12;l.bindBuffer(l.ARRAY_BUFFER,
+w.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,ga,t)}if(wa){ka=0;for(wa=Ga.length;ka<wa;ka++){C=ga=0;for(v=y.length;C<v;C++)G=la[y[C]],L=Ga[ka].vertices[G.a].position,M=Ga[ka].vertices[G.b].position,K=Ga[ka].vertices[G.c].position,ca=$[ka],ca[ga]=L.x,ca[ga+1]=L.y,ca[ga+2]=L.z,ca[ga+3]=M.x,ca[ga+4]=M.y,ca[ga+5]=M.z,ca[ga+6]=K.x,ca[ga+7]=K.y,ca[ga+8]=K.z,ga+=9;C=0;for(v=ia.length;C<v;C++)G=la[ia[C]],L=Ga[ka].vertices[G.a].position,M=Ga[ka].vertices[G.b].position,K=Ga[ka].vertices[G.c].position,
+G=Ga[ka].vertices[G.d].position,ca=$[ka],ca[ga]=L.x,ca[ga+1]=L.y,ca[ga+2]=L.z,ca[ga+3]=M.x,ca[ga+4]=M.y,ca[ga+5]=M.z,ca[ga+6]=K.x,ca[ga+7]=K.y,ca[ga+8]=K.z,ca[ga+9]=G.x,ca[ga+10]=G.y,ca[ga+11]=G.z,ga+=12;l.bindBuffer(l.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[ka]);l.bufferData(l.ARRAY_BUFFER,$[ka],t)}}if(Ca.length){C=0;for(v=y.length;C<v;C++)G=la[y[C]],L=Ca[G.a],M=Ca[G.b],K=Ca[G.c],pa[H]=L.x,pa[H+1]=L.y,pa[H+2]=L.z,pa[H+3]=L.w,pa[H+4]=M.x,pa[H+5]=M.y,pa[H+6]=M.z,pa[H+7]=M.w,pa[H+8]=K.x,pa[H+9]=K.y,
+pa[H+10]=K.z,pa[H+11]=K.w,L=Aa[G.a],M=Aa[G.b],K=Aa[G.c],V[H]=L.x,V[H+1]=L.y,V[H+2]=L.z,V[H+3]=L.w,V[H+4]=M.x,V[H+5]=M.y,V[H+6]=M.z,V[H+7]=M.w,V[H+8]=K.x,V[H+9]=K.y,V[H+10]=K.z,V[H+11]=K.w,L=ya[G.a],M=ya[G.b],K=ya[G.c],U[H]=L.x,U[H+1]=L.y,U[H+2]=L.z,U[H+3]=1,U[H+4]=M.x,U[H+5]=M.y,U[H+6]=M.z,U[H+7]=1,U[H+8]=K.x,U[H+9]=K.y,U[H+10]=K.z,U[H+11]=1,L=za[G.a],M=za[G.b],K=za[G.c],Z[H]=L.x,Z[H+1]=L.y,Z[H+2]=L.z,Z[H+3]=1,Z[H+4]=M.x,Z[H+5]=M.y,Z[H+6]=M.z,Z[H+7]=1,Z[H+8]=K.x,Z[H+9]=K.y,Z[H+10]=K.z,Z[H+11]=1,H+=
+12;C=0;for(v=ia.length;C<v;C++)G=la[ia[C]],L=Ca[G.a],M=Ca[G.b],K=Ca[G.c],$=Ca[G.d],pa[H]=L.x,pa[H+1]=L.y,pa[H+2]=L.z,pa[H+3]=L.w,pa[H+4]=M.x,pa[H+5]=M.y,pa[H+6]=M.z,pa[H+7]=M.w,pa[H+8]=K.x,pa[H+9]=K.y,pa[H+10]=K.z,pa[H+11]=K.w,pa[H+12]=$.x,pa[H+13]=$.y,pa[H+14]=$.z,pa[H+15]=$.w,L=Aa[G.a],M=Aa[G.b],K=Aa[G.c],$=Aa[G.d],V[H]=L.x,V[H+1]=L.y,V[H+2]=L.z,V[H+3]=L.w,V[H+4]=M.x,V[H+5]=M.y,V[H+6]=M.z,V[H+7]=M.w,V[H+8]=K.x,V[H+9]=K.y,V[H+10]=K.z,V[H+11]=K.w,V[H+12]=$.x,V[H+13]=$.y,V[H+14]=$.z,V[H+15]=$.w,L=
+ya[G.a],M=ya[G.b],K=ya[G.c],$=ya[G.d],U[H]=L.x,U[H+1]=L.y,U[H+2]=L.z,U[H+3]=1,U[H+4]=M.x,U[H+5]=M.y,U[H+6]=M.z,U[H+7]=1,U[H+8]=K.x,U[H+9]=K.y,U[H+10]=K.z,U[H+11]=1,U[H+12]=$.x,U[H+13]=$.y,U[H+14]=$.z,U[H+15]=1,L=za[G.a],M=za[G.b],K=za[G.c],G=za[G.d],Z[H]=L.x,Z[H+1]=L.y,Z[H+2]=L.z,Z[H+3]=1,Z[H+4]=M.x,Z[H+5]=M.y,Z[H+6]=M.z,Z[H+7]=1,Z[H+8]=K.x,Z[H+9]=K.y,Z[H+10]=K.z,Z[H+11]=1,Z[H+12]=G.x,Z[H+13]=G.y,Z[H+14]=G.z,Z[H+15]=1,H+=16;H>0&&(l.bindBuffer(l.ARRAY_BUFFER,w.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,
+U,t),l.bindBuffer(l.ARRAY_BUFFER,w.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,Z,t),l.bindBuffer(l.ARRAY_BUFFER,w.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,V,t),l.bindBuffer(l.ARRAY_BUFFER,w.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,pa,t))}if(va&&A){C=0;for(v=y.length;C<v;C++)G=la[y[C]],H=G.vertexColors,V=G.color,H.length===3&&A===THREE.VertexColors?(G=H[0],U=H[1],Z=H[2]):Z=U=G=V,T[S]=G.r,T[S+1]=G.g,T[S+2]=G.b,T[S+3]=U.r,T[S+4]=U.g,T[S+5]=U.b,T[S+6]=Z.r,T[S+7]=Z.g,
+T[S+8]=Z.b,S+=9;C=0;for(v=ia.length;C<v;C++)G=la[ia[C]],H=G.vertexColors,V=G.color,H.length===4&&A===THREE.VertexColors?(G=H[0],U=H[1],Z=H[2],H=H[3]):H=Z=U=G=V,T[S]=G.r,T[S+1]=G.g,T[S+2]=G.b,T[S+3]=U.r,T[S+4]=U.g,T[S+5]=U.b,T[S+6]=Z.r,T[S+7]=Z.g,T[S+8]=Z.b,T[S+9]=H.r,T[S+10]=H.g,T[S+11]=H.b,S+=12;S>0&&(l.bindBuffer(l.ARRAY_BUFFER,w.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,T,t))}if(W&&X.hasTangents){C=0;for(v=y.length;C<v;C++)G=la[y[C]],W=G.vertexTangents,S=W[0],T=W[1],X=W[2],J[P]=S.x,J[P+1]=
+S.y,J[P+2]=S.z,J[P+3]=S.w,J[P+4]=T.x,J[P+5]=T.y,J[P+6]=T.z,J[P+7]=T.w,J[P+8]=X.x,J[P+9]=X.y,J[P+10]=X.z,J[P+11]=X.w,P+=12;C=0;for(v=ia.length;C<v;C++)G=la[ia[C]],W=G.vertexTangents,S=W[0],T=W[1],X=W[2],W=W[3],J[P]=S.x,J[P+1]=S.y,J[P+2]=S.z,J[P+3]=S.w,J[P+4]=T.x,J[P+5]=T.y,J[P+6]=T.z,J[P+7]=T.w,J[P+8]=X.x,J[P+9]=X.y,J[P+10]=X.z,J[P+11]=X.w,J[P+12]=W.x,J[P+13]=W.y,J[P+14]=W.z,J[P+15]=W.w,P+=16;l.bindBuffer(l.ARRAY_BUFFER,w.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,J,t)}if(F&&u){C=0;for(v=y.length;C<
+v;C++)if(G=la[y[C]],J=G.vertexNormals,F=G.normal,J.length===3&&D)for(P=0;P<3;P++)F=J[P],ba[N]=F.x,ba[N+1]=F.y,ba[N+2]=F.z,N+=3;else for(P=0;P<3;P++)ba[N]=F.x,ba[N+1]=F.y,ba[N+2]=F.z,N+=3;C=0;for(v=ia.length;C<v;C++)if(G=la[ia[C]],J=G.vertexNormals,F=G.normal,J.length===4&&D)for(P=0;P<4;P++)F=J[P],ba[N]=F.x,ba[N+1]=F.y,ba[N+2]=F.z,N+=3;else for(P=0;P<4;P++)ba[N]=F.x,ba[N+1]=F.y,ba[N+2]=F.z,N+=3;l.bindBuffer(l.ARRAY_BUFFER,w.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,ba,t)}if(sa&&xa&&E){C=0;for(v=
+y.length;C<v;C++)if(N=y[C],N=xa[N],N!==void 0)for(P=0;P<3;P++)ba=N[P],ea[Y]=ba.u,ea[Y+1]=ba.v,Y+=2;C=0;for(v=ia.length;C<v;C++)if(N=ia[C],N=xa[N],N!==void 0)for(P=0;P<4;P++)ba=N[P],ea[Y]=ba.u,ea[Y+1]=ba.v,Y+=2;Y>0&&(l.bindBuffer(l.ARRAY_BUFFER,w.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,ea,t))}if(sa&&Ba&&E){C=0;for(v=y.length;C<v;C++)if(N=y[C],Y=Ba[N],Y!==void 0)for(P=0;P<3;P++)ea=Y[P],B[oa]=ea.u,B[oa+1]=ea.v,oa+=2;C=0;for(v=ia.length;C<v;C++)if(N=ia[C],Y=Ba[N],Y!==void 0)for(P=0;P<4;P++)ea=Y[P],
+B[oa]=ea.u,B[oa+1]=ea.v,oa+=2;oa>0&&(l.bindBuffer(l.ARRAY_BUFFER,w.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,B,t))}if(ta){C=0;for(v=y.length;C<v;C++)z[ja]=Q,z[ja+1]=Q+1,z[ja+2]=Q+2,ja+=3,na[ha]=Q,na[ha+1]=Q+1,na[ha+2]=Q,na[ha+3]=Q+2,na[ha+4]=Q+1,na[ha+5]=Q+2,ha+=6,Q+=3;C=0;for(v=ia.length;C<v;C++)z[ja]=Q,z[ja+1]=Q+1,z[ja+2]=Q+3,z[ja+3]=Q+1,z[ja+4]=Q+2,z[ja+5]=Q+3,ja+=6,na[ha]=Q,na[ha+1]=Q+1,na[ha+2]=Q,na[ha+3]=Q+3,na[ha+4]=Q+1,na[ha+5]=Q+2,na[ha+6]=Q+2,na[ha+7]=Q+3,ha+=8,Q+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,
+w.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,z,t);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,na,t)}if(R){P=0;for(Q=R.length;P<Q;P++)if(z=R[P],z.__original.needsUpdate){B=0;if(z.size===1)if(z.boundTo===void 0||z.boundTo==="vertices"){C=0;for(v=y.length;C<v;C++)G=la[y[C]],z.array[B]=z.value[G.a],z.array[B+1]=z.value[G.b],z.array[B+2]=z.value[G.c],B+=3;C=0;for(v=ia.length;C<v;C++)G=la[ia[C]],z.array[B]=z.value[G.a],z.array[B+1]=z.value[G.b],
+z.array[B+2]=z.value[G.c],z.array[B+3]=z.value[G.d],B+=4}else{if(z.boundTo==="faces"){C=0;for(v=y.length;C<v;C++)na=z.value[y[C]],z.array[B]=na,z.array[B+1]=na,z.array[B+2]=na,B+=3;C=0;for(v=ia.length;C<v;C++)na=z.value[ia[C]],z.array[B]=na,z.array[B+1]=na,z.array[B+2]=na,z.array[B+3]=na,B+=4}}else if(z.size===2)if(z.boundTo===void 0||z.boundTo==="vertices"){C=0;for(v=y.length;C<v;C++)G=la[y[C]],L=z.value[G.a],M=z.value[G.b],K=z.value[G.c],z.array[B]=L.x,z.array[B+1]=L.y,z.array[B+2]=M.x,z.array[B+
+3]=M.y,z.array[B+4]=K.x,z.array[B+5]=K.y,B+=6;C=0;for(v=ia.length;C<v;C++)G=la[ia[C]],L=z.value[G.a],M=z.value[G.b],K=z.value[G.c],G=z.value[G.d],z.array[B]=L.x,z.array[B+1]=L.y,z.array[B+2]=M.x,z.array[B+3]=M.y,z.array[B+4]=K.x,z.array[B+5]=K.y,z.array[B+6]=G.x,z.array[B+7]=G.y,B+=8}else{if(z.boundTo==="faces"){C=0;for(v=y.length;C<v;C++)K=M=L=na=z.value[y[C]],z.array[B]=L.x,z.array[B+1]=L.y,z.array[B+2]=M.x,z.array[B+3]=M.y,z.array[B+4]=K.x,z.array[B+5]=K.y,B+=6;C=0;for(v=ia.length;C<v;C++)G=K=
+M=L=na=z.value[ia[C]],z.array[B]=L.x,z.array[B+1]=L.y,z.array[B+2]=M.x,z.array[B+3]=M.y,z.array[B+4]=K.x,z.array[B+5]=K.y,z.array[B+6]=G.x,z.array[B+7]=G.y,B+=8}}else if(z.size===3)if(u=z.type==="c"?["r","g","b"]:["x","y","z"],z.boundTo===void 0||z.boundTo==="vertices"){C=0;for(v=y.length;C<v;C++)G=la[y[C]],L=z.value[G.a],M=z.value[G.b],K=z.value[G.c],z.array[B]=L[u[0]],z.array[B+1]=L[u[1]],z.array[B+2]=L[u[2]],z.array[B+3]=M[u[0]],z.array[B+4]=M[u[1]],z.array[B+5]=M[u[2]],z.array[B+6]=K[u[0]],z.array[B+
+7]=K[u[1]],z.array[B+8]=K[u[2]],B+=9;C=0;for(v=ia.length;C<v;C++)G=la[ia[C]],L=z.value[G.a],M=z.value[G.b],K=z.value[G.c],G=z.value[G.d],z.array[B]=L[u[0]],z.array[B+1]=L[u[1]],z.array[B+2]=L[u[2]],z.array[B+3]=M[u[0]],z.array[B+4]=M[u[1]],z.array[B+5]=M[u[2]],z.array[B+6]=K[u[0]],z.array[B+7]=K[u[1]],z.array[B+8]=K[u[2]],z.array[B+9]=G[u[0]],z.array[B+10]=G[u[1]],z.array[B+11]=G[u[2]],B+=12}else{if(z.boundTo==="faces"){C=0;for(v=y.length;C<v;C++)K=M=L=na=z.value[y[C]],z.array[B]=L[u[0]],z.array[B+
+1]=L[u[1]],z.array[B+2]=L[u[2]],z.array[B+3]=M[u[0]],z.array[B+4]=M[u[1]],z.array[B+5]=M[u[2]],z.array[B+6]=K[u[0]],z.array[B+7]=K[u[1]],z.array[B+8]=K[u[2]],B+=9;C=0;for(v=ia.length;C<v;C++)G=K=M=L=na=z.value[ia[C]],z.array[B]=L[u[0]],z.array[B+1]=L[u[1]],z.array[B+2]=L[u[2]],z.array[B+3]=M[u[0]],z.array[B+4]=M[u[1]],z.array[B+5]=M[u[2]],z.array[B+6]=K[u[0]],z.array[B+7]=K[u[1]],z.array[B+8]=K[u[2]],z.array[B+9]=G[u[0]],z.array[B+10]=G[u[1]],z.array[B+11]=G[u[2]],B+=12}}else if(z.size===4)if(z.boundTo===
+void 0||z.boundTo==="vertices"){C=0;for(v=y.length;C<v;C++)G=la[y[C]],L=z.value[G.a],M=z.value[G.b],K=z.value[G.c],z.array[B]=L.x,z.array[B+1]=L.y,z.array[B+2]=L.z,z.array[B+3]=L.w,z.array[B+4]=M.x,z.array[B+5]=M.y,z.array[B+6]=M.z,z.array[B+7]=M.w,z.array[B+8]=K.x,z.array[B+9]=K.y,z.array[B+10]=K.z,z.array[B+11]=K.w,B+=12;C=0;for(v=ia.length;C<v;C++)G=la[ia[C]],L=z.value[G.a],M=z.value[G.b],K=z.value[G.c],G=z.value[G.d],z.array[B]=L.x,z.array[B+1]=L.y,z.array[B+2]=L.z,z.array[B+3]=L.w,z.array[B+
+4]=M.x,z.array[B+5]=M.y,z.array[B+6]=M.z,z.array[B+7]=M.w,z.array[B+8]=K.x,z.array[B+9]=K.y,z.array[B+10]=K.z,z.array[B+11]=K.w,z.array[B+12]=G.x,z.array[B+13]=G.y,z.array[B+14]=G.z,z.array[B+15]=G.w,B+=16}else if(z.boundTo==="faces"){C=0;for(v=y.length;C<v;C++)K=M=L=na=z.value[y[C]],z.array[B]=L.x,z.array[B+1]=L.y,z.array[B+2]=L.z,z.array[B+3]=L.w,z.array[B+4]=M.x,z.array[B+5]=M.y,z.array[B+6]=M.z,z.array[B+7]=M.w,z.array[B+8]=K.x,z.array[B+9]=K.y,z.array[B+10]=K.z,z.array[B+11]=K.w,B+=12;C=0;for(v=
+ia.length;C<v;C++)G=K=M=L=na=z.value[ia[C]],z.array[B]=L.x,z.array[B+1]=L.y,z.array[B+2]=L.z,z.array[B+3]=L.w,z.array[B+4]=M.x,z.array[B+5]=M.y,z.array[B+6]=M.z,z.array[B+7]=M.w,z.array[B+8]=K.x,z.array[B+9]=K.y,z.array[B+10]=K.z,z.array[B+11]=K.w,z.array[B+12]=G.x,z.array[B+13]=G.y,z.array[B+14]=G.z,z.array[B+15]=G.w,B+=16}l.bindBuffer(l.ARRAY_BUFFER,z.buffer);l.bufferData(l.ARRAY_BUFFER,z.array,t)}}x&&(delete w.__inittedArrays,delete w.__colorArray,delete w.__normalArray,delete w.__tangentArray,
+delete w.__uvArray,delete w.__uv2Array,delete w.__faceArray,delete w.__vertexArray,delete w.__lineArray,delete w.__skinVertexAArray,delete w.__skinVertexBArray,delete w.__skinIndexArray,delete w.__skinWeightArray)}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;j.attributes&&n(j)}else if(I instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){j=k;I=l.DYNAMIC_DRAW;u=q=u=x=x=void 0;A=j.vertices;
+r=j.colors;C=A.length;w=r.length;v=j.__vertexArray;t=j.__colorArray;R=j.__dirtyColors;if(j.__dirtyVertices){for(x=0;x<C;x++)u=A[x].position,q=x*3,v[q]=u.x,v[q+1]=u.y,v[q+2]=u.z;l.bindBuffer(l.ARRAY_BUFFER,j.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,v,I)}if(R){for(x=0;x<w;x++)u=r[x],q=x*3,t[q]=u.r,t[q+1]=u.g,t[q+2]=u.b;l.bindBuffer(l.ARRAY_BUFFER,j.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,t,I)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(I instanceof THREE.Line){j=c(I,w);t=j.attributes&&
+s(j);if(k.__dirtyVertices||k.__dirtyColors||t){I=k;q=l.DYNAMIC_DRAW;C=r=D=A=E=void 0;A=I.vertices;w=I.colors;C=A.length;t=w.length;v=I.__vertexArray;x=I.__colorArray;R=I.__dirtyColors;u=I.__webglCustomAttributesList;Q=la=ia=y=D=E=void 0;if(I.__dirtyVertices){for(E=0;E<C;E++)D=A[E].position,r=E*3,v[r]=D.x,v[r+1]=D.y,v[r+2]=D.z;l.bindBuffer(l.ARRAY_BUFFER,I.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,v,q)}if(R){for(A=0;A<t;A++)C=w[A],r=A*3,x[r]=C.r,x[r+1]=C.g,x[r+2]=C.b;l.bindBuffer(l.ARRAY_BUFFER,
+I.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,x,q)}if(u){E=0;for(D=u.length;E<D;E++)if(Q=u[E],Q.needsUpdate&&(Q.boundTo===void 0||Q.boundTo==="vertices")){r=0;ia=Q.value.length;if(Q.size===1)for(y=0;y<ia;y++)Q.array[y]=Q.value[y];else if(Q.size===2)for(y=0;y<ia;y++)la=Q.value[y],Q.array[r]=la.x,Q.array[r+1]=la.y,r+=2;else if(Q.size===3)if(Q.type==="c")for(y=0;y<ia;y++)la=Q.value[y],Q.array[r]=la.r,Q.array[r+1]=la.g,Q.array[r+2]=la.b,r+=3;else for(y=0;y<ia;y++)la=Q.value[y],Q.array[r]=la.x,Q.array[r+
+1]=la.y,Q.array[r+2]=la.z,r+=3;else if(Q.size===4)for(y=0;y<ia;y++)la=Q.value[y],Q.array[r]=la.x,Q.array[r+1]=la.y,Q.array[r+2]=la.z,Q.array[r+3]=la.w,r+=4;l.bindBuffer(l.ARRAY_BUFFER,Q.buffer);l.bufferData(l.ARRAY_BUFFER,Q.array,q)}}}k.__dirtyVertices=!1;k.__dirtyColors=!1;j.attributes&&n(j)}else if(I instanceof THREE.ParticleSystem)j=c(I,w),t=j.attributes&&s(j),(k.__dirtyVertices||k.__dirtyColors||I.sortParticles||t)&&g(k,l.DYNAMIC_DRAW,I),k.__dirtyVertices=!1,k.__dirtyColors=!1,j.attributes&&n(j)};
+this.initMaterial=function(a,b,c,d){var e,f,g,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;
+a.fragmentShader=i.fragmentShader}var j,k,m;j=m=i=0;for(k=b.length;j<k;j++)g=b[j],g instanceof THREE.SpotLight&&!g.onlyShadow&&m++,g instanceof THREE.DirectionalLight&&m++,g instanceof THREE.PointLight&&i++;i+m<=Y?j=m:(j=Math.ceil(Y*m/(i+m)),i=Y-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,
+wrapAround:a.wrapAround},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=P.length;p<d;p++)if(P[p].code===h){o=P[p].program;break a}p=l.createProgram();d=[ha>0?"#define VERTEX_TEXTURES":"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.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.wrapAround?"#define WRAP_AROUND":"",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=["precision "+I+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.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.wrapAround?"#define WRAP_AROUND":"",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,v("fragment",
+g+j));l.attachShader(p,v("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=P.length;P.push({program:p,code:h});O.info.memory.programs=P.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(ea!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),
+ea=a.doubleSided;if(Z!==a.flipSided)a.flipSided?l.frontFace(l.CW):l.frontFace(l.CCW),Z=a.flipSided};this.setDepthTest=function(a){$!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),$=a)};this.setBlending=function(a){if(a!==S){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,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)}S=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=l.createTexture(),O.info.memory.textures++;l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);var c=D(l.TEXTURE_2D,a,a.image),d=E(a.format),e=E(a.type);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,d,a.image.width,
+a.image.height,0,d,e,a.image.data):l.texImage2D(l.TEXTURE_2D,0,d,d,e,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();var c=E(a.format),d=E(a.type);
+if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);D(l.TEXTURE_CUBE_MAP,a,a);for(var e=0;e<6;e++){a.__webglFramebuffer[e]=l.createFramebuffer();a.__webglRenderbuffer[e]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,c,a.width,a.height,0,c,d,null);var f=a,g=l.TEXTURE_CUBE_MAP_POSITIVE_X+e;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[e]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,g,f.__webglTexture,0);
+y(a.__webglRenderbuffer[e],a)}}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),D(l.TEXTURE_2D,a,a),l.texImage2D(l.TEXTURE_2D,0,c,a.width,a.height,0,c,d,null),c=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,c,a.__webglTexture,0),y(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=va,a=sa,d=oa,e=ta);b!==X&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),X=b);ya=c;za=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};
@@ -348,20 +348,20 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],n=f.faceVertexUvs[0],q={},m=0;m<a.materials.length;m++)q[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,p=h.length;m<p;m++){var o=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(o.position);g.push(o)}m=
-0;for(p=k.length;m<p;m++){var g=k[m],r,s,u=g.vertexNormals,t=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(o=u.length;h<o;h++)s=u[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(o=t.length;h<o;h++)s=t[h],r.vertexColors.push(s.clone());if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];
-o=h.id;t=q[o];if(t===void 0)t=a.materials.length,q[o]=t,a.materials.push(h);r.materialIndex=t}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}m=0;for(p=n.length;m<p;m++){c=n[m];d=[];h=0;for(o=c.length;h<o;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var g=new THREE.Vertex(d[a].position.clone());b.vertices.push(g)}a=
-0;for(c=e.length;a<c;a++){var h=e[a],i,k,j=h.vertexNormals,n=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(g=j.length;d<g;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(g=n.length;d<g;d++)k=n[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=f.length;a<c;a++){e=f[a];i=[];d=0;for(g=e.length;d<
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,j=f.faces,k=a.faceVertexUvs[0],o=f.faceVertexUvs[0],s={},n=0;n<a.materials.length;n++)s[a.materials[n].id]=n;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var n=0,p=h.length;n<p;n++){var m=new THREE.Vertex(h[n].position.clone());c&&c.multiplyVector3(m.position);g.push(m)}n=
+0;for(p=j.length;n<p;n++){var g=j[n],q,r,t=g.vertexNormals,x=g.vertexColors;g instanceof THREE.Face3?q=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(q=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));q.normal.copy(g.normal);d&&d.multiplyVector3(q.normal);h=0;for(m=t.length;h<m;h++)r=t[h].clone(),d&&d.multiplyVector3(r),q.vertexNormals.push(r);q.color.copy(g.color);h=0;for(m=x.length;h<m;h++)r=x[h],q.vertexColors.push(r.clone());if(g.materialIndex!==void 0){h=f.materials[g.materialIndex];
+m=h.id;x=s[m];if(x===void 0)x=a.materials.length,s[m]=x,a.materials.push(h);q.materialIndex=x}q.centroid.copy(g.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}n=0;for(p=o.length;n<p;n++){c=o[n];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var g=new THREE.Vertex(d[a].position.clone());b.vertices.push(g)}a=
+0;for(c=e.length;a<c;a++){var h=e[a],i,j,k=h.vertexNormals,o=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(g=k.length;d<g;d++)j=k[d],i.vertexNormals.push(j.clone());i.color.copy(h.color);d=0;for(g=o.length;d<g;d++)j=o[d],i.vertexColors.push(j.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=f.length;a<c;a++){e=f[a];i=[];d=0;for(g=e.length;d<
 g;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
 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,n,q,m;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)j=g[d.a].position,n=g[d.b].position,q=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,n,q);else if(d instanceof
-THREE.Face4)j=g[d.a].position,n=g[d.b].position,q=g[d.c].position,m=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,n,m),d._area2=THREE.GeometryUtils.triangleArea(n,q,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();
+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 j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],k,o,s,n;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)k=g[d.a].position,o=g[d.b].position,s=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,o,s);else if(d instanceof
+THREE.Face4)k=g[d.a].position,o=g[d.b].position,s=g[d.c].position,n=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,o,n),d._area2=THREE.GeometryUtils.triangleArea(o,s,n),d._area=d._area1+d._area2;i+=d._area;j[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=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},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 n=1;n<e;n++){var q=n-1<0?e-1:n-1,m=(n+1)%e,p=j-1<0?d-1:j-1,o=(j+1)%d,r=[],s=[0,0,h[(n*d+j)*4]/255*b];r.push([-1,0,h[(n*d+p)*4]/255*b]);r.push([-1,-1,h[(q*d+p)*4]/255*b]);r.push([0,-1,h[(q*d+j)*4]/255*b]);r.push([1,
--1,h[(q*d+o)*4]/255*b]);r.push([1,0,h[(n*d+o)*4]/255*b]);r.push([1,1,h[(m*d+o)*4]/255*b]);r.push([0,1,h[(m*d+j)*4]/255*b]);r.push([-1,1,h[(m*d+p)*4]/255*b]);q=[];p=r.length;for(m=0;m<p;m++){var o=r[m],u=r[(m+1)%p],o=[o[0]-s[0],o[1]-s[1],o[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];q.push(c([o[1]*u[2]-o[2]*u[1],o[2]*u[0]-o[0]*u[2],o[0]*u[1]-o[1]*u[0]]))}r=[0,0,0];for(m=0;m<q.length;m++)r[0]+=q[m][0],r[1]+=q[m][1],r[2]+=q[m][2];r[0]/=q.length;r[1]/=q.length;r[2]/=q.length;s=(n*d+j)*4;k[s]=(r[0]+1)/
-2*255|0;k[s+1]=(r[1]+0.5)*255|0;k[s+2]=r[2]*255|0;k[s+3]=255}g.putImageData(i,0,0);return f}};
+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),j=i.data,k=0;k<d;k++)for(var o=1;o<e;o++){var s=o-1<0?e-1:o-1,n=(o+1)%e,p=k-1<0?d-1:k-1,m=(k+1)%d,q=[],r=[0,0,h[(o*d+k)*4]/255*b];q.push([-1,0,h[(o*d+p)*4]/255*b]);q.push([-1,-1,h[(s*d+p)*4]/255*b]);q.push([0,-1,h[(s*d+k)*4]/255*b]);q.push([1,
+-1,h[(s*d+m)*4]/255*b]);q.push([1,0,h[(o*d+m)*4]/255*b]);q.push([1,1,h[(n*d+m)*4]/255*b]);q.push([0,1,h[(n*d+k)*4]/255*b]);q.push([-1,1,h[(n*d+p)*4]/255*b]);s=[];p=q.length;for(n=0;n<p;n++){var m=q[n],t=q[(n+1)%p],m=[m[0]-r[0],m[1]-r[1],m[2]-r[2]],t=[t[0]-r[0],t[1]-r[1],t[2]-r[2]];s.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}q=[0,0,0];for(n=0;n<s.length;n++)q[0]+=s[n][0],q[1]+=s[n][1],q[2]+=s[n][2];q[0]/=s.length;q[1]/=s.length;q[2]/=s.length;r=(o*d+k)*4;j[r]=(q[0]+1)/
+2*255|0;j[r+1]=(q[1]+0.5)*255|0;j[r+2]=q[2]*255|0;j[r+3]=255}g.putImageData(i,0,0);return f}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
@@ -407,37 +407,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,f));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,f,g,h,i,k,j,n,q,m,p,o;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];n=f[0];q=f[1];c.length>0?(g=c[c.length-1],m=g.x,p=g.y):(g=this.actions[d-1].args,m=g[g.length-2],p=g[g.length-1]);for(g=1;g<=a;g++)o=g/a,f=THREE.Shape.Utils.b2(o,m,n,h),o=THREE.Shape.Utils.b2(o,p,q,
-i),c.push(new THREE.Vector2(f,o));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];q=f[1];k=f[2];j=f[3];c.length>0?(g=c[c.length-1],m=g.x,p=g.y):(g=this.actions[d-1].args,m=g[g.length-2],p=g[g.length-1]);for(g=1;g<=a;g++)o=g/a,f=THREE.Shape.Utils.b3(o,m,n,k,h),o=THREE.Shape.Utils.b3(o,p,q,j,i),c.push(new THREE.Vector2(f,o));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];o=a*f[0].length;g=g.concat(f[0]);f=new THREE.SplineCurve(g);
-for(g=1;g<=o;g++)c.push(f.getPointAt(g/o));break;case THREE.PathActions.ARC:g=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];n=f[3];o=f[4];q=!!f[5];j=g[g.length-2];m=g[g.length-1];g.length==0&&(j=m=0);p=o-n;var r=a*2;for(g=1;g<=r;g++)o=g/r,q||(o=1-o),o=n+o*p,f=j+h+k*Math.cos(o),o=m+i+k*Math.sin(o),c.push(new THREE.Vector2(f,o))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
-THREE.Path.prototype.nltransform=function(a,b,c,d,e,f){var g=this.getPoints(),h,i,k,j,n;h=0;for(i=g.length;h<i;h++)k=g[h],j=k.x,n=k.y,k.x=a*j+b*n+c,k.y=d*n+e*j+f;return g};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,f,g,h,i,j,k,o,s,n,p,m;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];o=f[0];s=f[1];c.length>0?(g=c[c.length-1],n=g.x,p=g.y):(g=this.actions[d-1].args,n=g[g.length-2],p=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b2(m,n,o,h),m=THREE.Shape.Utils.b2(m,p,s,
+i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];o=f[0];s=f[1];j=f[2];k=f[3];c.length>0?(g=c[c.length-1],n=g.x,p=g.y):(g=this.actions[d-1].args,n=g[g.length-2],p=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b3(m,n,o,j,h),m=THREE.Shape.Utils.b3(m,p,s,k,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];m=a*f[0].length;g=g.concat(f[0]);f=new THREE.SplineCurve(g);
+for(g=1;g<=m;g++)c.push(f.getPointAt(g/m));break;case THREE.PathActions.ARC:g=this.actions[d-1].args;h=f[0];i=f[1];j=f[2];o=f[3];m=f[4];s=!!f[5];k=g[g.length-2];n=g[g.length-1];g.length==0&&(k=n=0);p=m-o;var q=a*2;for(g=1;g<=q;g++)m=g/q,s||(m=1-m),m=o+m*p,f=k+h+j*Math.cos(m),m=n+i+j*Math.sin(m),c.push(new THREE.Vector2(f,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
+THREE.Path.prototype.nltransform=function(a,b,c,d,e,f){var g=this.getPoints(),h,i,j,k,o;h=0;for(i=g.length;h<i;h++)j=g[h],k=j.x,o=j.y,j.x=a*k+b*o+c,j.y=d*o+e*k+f;return g};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&f.actions.length!=0&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);f.actions.length!=0&&e.push(f);if(e.length==0)return[];var g,f=[];if(THREE.Shape.Utils.isClockWise(e[0].getPoints())){a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(g&&f.push(g),g=new THREE.Shape,g.actions=d.actions,g.curves=
 d.curves):g.holes.push(d);f.push(g)}else{g=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(g.actions=d.actions,g.curves=d.curves,f.push(g),g=new THREE.Shape):g.holes.push(d)}return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,k,j,n,q,m,p=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){q=k[e];m=[];for(n=0;n<c.length;n++)j=c[n],j=q.distanceToSquared(j),m.push(j),j<f&&(f=j,g=e,h=n)}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;var o=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(o);var r=[k[g],k[f],c[h]];q=THREE.FontUtils.Triangulate.area(r);m=h;j=g;h+=1;g+=-1;h<
-0&&(h+=c.length);h%=c.length;g<0&&(g+=k.length);g%=k.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:k.length-1;o=[k[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(o);r=[k[g],k[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);n+q>o+r&&(h=m,g=j,h<0&&(h+=c.length),h%=c.length,g<0&&(g+=k.length),g%=k.length,e=h-1>=0?h-1:c.length-1,f=g-1>=0?g-1:k.length-1);n=c.slice(0,h);q=c.slice(h);m=k.slice(g);j=k.slice(0,g);f=[k[g],k[f],c[h]];p.push([k[g],c[h],c[e]]);p.push(f);c=n.concat(m).concat(j).concat(q)}return{shape:c,
-isolatedPts:p,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,k={};f=0;for(g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=f;f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,j,k,o,s,n,p=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){s=j[e];n=[];for(o=0;o<c.length;o++)k=c[o],k=s.distanceToSquared(k),n.push(k),k<f&&(f=k,g=e,h=o)}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var m=[j[g],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(m);var q=[j[g],j[f],c[h]];s=THREE.FontUtils.Triangulate.area(q);n=h;k=g;h+=1;g+=-1;h<
+0&&(h+=c.length);h%=c.length;g<0&&(g+=j.length);g%=j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;m=[j[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);o+s>m+q&&(h=n,g=k,h<0&&(h+=c.length),h%=c.length,g<0&&(g+=j.length),g%=j.length,e=h-1>=0?h-1:c.length-1,f=g-1>=0?g-1:j.length-1);o=c.slice(0,h);s=c.slice(h);n=j.slice(g);k=j.slice(0,g);f=[j[g],j[f],c[h]];p.push([j[g],c[h],c[e]]);p.push(f);c=o.concat(n).concat(k).concat(s)}return{shape:c,
+isolatedPts:p,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,j={};f=0;for(g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=f;f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",f=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
-0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=
-h;for(d=0;d<a.hierarchy[c].keys.length;d++){var j={};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
+0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=
+h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k={};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
 d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
 THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,k,j=this.data.JIT.hierarchy,n,q;this.currentTime+=a*this.timeScale;q=this.currentTime;n=this.currentTime%=this.data.length;k=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,p=this.hierarchy.length;m<p;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&j[m][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=j[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var o=0;o<3;o++){c=b[o];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=q){if(n<q)if(this.loop){g=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<n;)g=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<
-n)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",m,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
-"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(m=0;m<this.hierarchy.length;m++)j[m][k]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
-THREE.Animation.prototype.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.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,k=this.data.JIT.hierarchy,o,s;this.currentTime+=a*this.timeScale;s=this.currentTime;o=this.currentTime%=this.data.length;j=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,p=this.hierarchy.length;n<p;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&k[n][j]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=s){if(o<s)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<o;)g=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<
+o)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-g.time)/(h.time-g.time);e=g[c];f=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",n,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
+"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(n=0;n<this.hierarchy.length;n++)k[n][j]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;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]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[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();
@@ -445,9 +445,9 @@ 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};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++){var b=this.hierarchy[a];if(b.animationCache!==void 0){var c=b.animationCache.originalMatrix;b instanceof THREE.Bone?(c.copy(b.skinMatrix),b.skinMatrix=c):(c.copy(b.matrix),b.matrix=c);delete b.animationCache}}};
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;this.currentTime+=a*this.timeScale;h=this.currentTime;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var j=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=j.length-1;e=this.hierarchy[a];
-if(j.length){for(j=0;j<f.length;j++)g=f[j],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var j=b.keys,n=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(j.length){if(this.JITCompile&&
-n)d instanceof THREE.Bone?d.skinMatrix=n.originalMatrix:d.matrix=n.originalMatrix;b=n.prevKey;c=n.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=j[0];for(c=j[1];c.time<g;)b=c,c=j[b.index+1]}else if(!i)for(var q=j.length-1;c.time<g&&c.index!==q;)b=c,c=j[b.index+1];n.prevKey=b;n.nextKey=c}b.interpolate(c,g)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;this.currentTime+=a*this.timeScale;h=this.currentTime;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];
+if(k.length){for(k=0;k<f.length;k++)g=f[k],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,o=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&
+o)d instanceof THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var s=k.length-1;c.time<g&&c.index!==s;)b=c,c=k[b.index+1];o.prevKey=b;o.nextKey=c}b.interpolate(c,g)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
 this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
@@ -468,14 +468,14 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
 1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,s=0;f=r-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<r-1;f++)s=d*h.chunks[f]/h.total,b.keys[f]={time:s,pos:g[f]};e.hierarchy[0]=
+THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,r=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++)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=
 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),
+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}),n=0;n<b.points.length;n++)c=new THREE.Mesh(g,h),c.position.copy(b.points[n]),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,
 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=
@@ -486,42 +486,42 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,i=0,k=0,j=0,n=0,q=0,m=window.innerWidth/2,p=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*n);this.rotateVertically(b*q)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);g&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,i=0,j=0,k=0,o=0,s=0,n=window.innerWidth/2,p=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*o);this.rotateVertically(b*s)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);g&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){n=(a.clientX-m)/window.innerWidth;q=(a.clientY-p)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-n)/window.innerWidth;s=(a.clientY-p)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
 THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
-this.target=new THREE.Vector3(0,0,0);var e=!1,f=d.NONE,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,n=new THREE.Vector2,q=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
+this.target=new THREE.Vector3(0,0,0);var e=!1,f=d.NONE,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2,s=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
 c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
--a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*c.zoomSpeed;a!==1&&a>0&&(g.multiplyScalar(a),c.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=q.clone().subSelf(n);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
-c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?n=q:n.addSelf(a.sub(q,n).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
-c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=c.getMouseOnScreen(a.clientX,a.clientY),n=q=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),f!==d.NONE&&(f===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&
-!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):f===d.PAN&&!c.noPan&&(q=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(n=q=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
+-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;a!==1&&a>0&&(g.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=s.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
+c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=s:o.addSelf(a.sub(s,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
+c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),o=s=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),f!==d.NONE&&(f===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&
+!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):f===d.PAN&&!c.noPan&&(s=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=s=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
 function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),f=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&f===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)f=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)f=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)f=d.PAN;f!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&f!==d.NONE)f=d.NONE},!1)};
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,j,o){var m,n=d||1,p=e||1,q=h/2,r=i/2,s=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",p=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",n=f||1;var l=n+1,t=p+1,v=h/n,u=i/p,M=new THREE.Vector3;M[m]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<l;i++){var Y=new THREE.Vector3;Y[a]=(i*v-q)*c;Y[b]=(h*u-r)*g;Y[m]=j;k.vertices.push(new THREE.Vertex(Y))}for(h=0;h<p;h++)for(i=0;i<n;i++)a=
-new THREE.Face4(i+l*h+s,i+l*(h+1)+s,i+1+l*(h+1)+s,i+1+l*h+s),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=o,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/n,h/p),new THREE.UV(i/n,(h+1)/p),new THREE.UV((i+1)/n,(h+1)/p),new THREE.UV((i+1)/n,h/p)])}THREE.Geometry.call(this);var k=this,j=a/2,n=b/2,q=c/2,m,p,o,r,s,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(g)}m=0;r=1;p=2;s=
-3;o=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,m);this.sides.nx&&i("z","y",1,-1,c,b,-j,r);this.sides.py&&i("x","z",1,1,a,c,n,p);this.sides.ny&&i("x","z",1,-1,a,c,-n,s);this.sides.pz&&i("x","y",1,-1,a,b,q,o);this.sides.nz&&i("x","y",-1,-1,a,b,-q,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,m){var n,o=d||1,p=e||1,q=h/2,s=i/2,r=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",p=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=f||1;var l=o+1,t=p+1,x=h/o,X=i/p,N=new THREE.Vector3;N[n]=k>0?1:-1;for(h=0;h<t;h++)for(i=0;i<l;i++){var W=new THREE.Vector3;W[a]=(i*x-q)*c;W[b]=(h*X-s)*g;W[n]=k;j.vertices.push(new THREE.Vertex(W))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+l*h+r,i+l*(h+1)+r,i+1+l*(h+1)+r,i+1+l*h+r),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=m,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var j=this,k=a/2,o=b/2,s=c/2,n,p,m,q,r,t;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(g)}n=0;q=1;p=2;r=
+3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var x in h)this.sides[x]!==void 0&&(this.sides[x]=h[x]);this.sides.px&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,q);this.sides.py&&i("x","z",1,1,a,c,o,p);this.sides.ny&&i("x","z",1,-1,a,c,-o,r);this.sides.pz&&i("x","y",1,-1,a,b,s,m);this.sides.nz&&i("x","y",-1,-1,a,b,-s,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,g=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var n=[],q=[],m=i/e,p=m*(b-a)+a;for(h=0;h<=d;h++){var o=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(p*Math.sin(o*Math.PI*2),-m*c+g,p*Math.cos(o*Math.PI*2))));n.push(this.vertices.length-1);q.push(new THREE.UV(o,m))}k.push(n);j.push(q)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],n=k[i+1][h],q=k[i+1][h+1],m=k[i][h+1],p=
-this.vertices[c].position.clone().setY(0).normalize(),o=this.vertices[n].position.clone().setY(0).normalize(),r=this.vertices[q].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),u=j[i][h].clone(),t=j[i+1][h].clone(),A=j[i+1][h+1].clone(),B=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,n,q,m,[p,o,r,s]));this.faceVertexUvs[0].push([u,t,A,B])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=0;h<d;h++)c=k[0][h],n=k[0][h+
-1],q=this.vertices.length-1,p=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),u=j[0][h].clone(),t=j[0][h+1].clone(),A=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,n,q,[p,o,r])),this.faceVertexUvs[0].push([u,t,A])}if(!f&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=k[i][h+1],n=k[i][h],q=this.vertices.length-1,p=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),u=j[i][h+1].clone(),t=j[i][h].clone(),
-A=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,n,q,[p,o,r])),this.faceVertexUvs[0].push([u,t,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,g=c/2,d=d||8,e=e||1,h,i,j=[],k=[];for(i=0;i<=e;i++){var o=[],s=[],n=i/e,p=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(p*Math.sin(m*Math.PI*2),-n*c+g,p*Math.cos(m*Math.PI*2))));o.push(this.vertices.length-1);s.push(new THREE.UV(m,n))}j.push(o);k.push(s)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=j[i][h],o=j[i+1][h],s=j[i+1][h+1],n=j[i][h+1],p=
+this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[o].position.clone().setY(0).normalize(),q=this.vertices[s].position.clone().setY(0).normalize(),r=this.vertices[n].position.clone().setY(0).normalize(),t=k[i][h].clone(),x=k[i+1][h].clone(),v=k[i+1][h+1].clone(),D=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,s,n,[p,m,q,r]));this.faceVertexUvs[0].push([t,x,v,D])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=0;h<d;h++)c=j[0][h],o=j[0][h+
+1],s=this.vertices.length-1,p=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),t=k[0][h].clone(),x=k[0][h+1].clone(),v=new THREE.UV(x.u,0),this.faces.push(new THREE.Face3(c,o,s,[p,m,q])),this.faceVertexUvs[0].push([t,x,v])}if(!f&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=j[i][h+1],o=j[i][h],s=this.vertices.length-1,p=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),t=k[i][h+1].clone(),x=k[i][h].clone(),
+v=new THREE.UV(x.u,1),this.faces.push(new THREE.Face3(c,o,s,[p,m,q])),this.faceVertexUvs[0].push([t,x,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(y=a.length;--y>=0;){Y=y;ca=y-1;ca<0&&(ca=a.length-1);for(var b=
-0,c=m+j*2,b=0;b<c;b++){var d=R*b,e=R*(b+1),f=$+Y+d,g=$+Y+e,l=f,d=$+ca+d,e=$+ca+e,k=g;l+=G;d+=G;e+=G;k+=G;w.faces.push(new THREE.Face4(l,d,e,k,null,null,A));A!==void 0&&(l=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,l),new THREE.UV(g,l),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!==void 0){var d=B.minX,e=B.minY,f=B.maxY,g=B.maxX,h=w.vertices[b].position.x-d,b=w.vertices[b].position.y-e,i=w.vertices[c].position.x-d,c=w.vertices[c].position.y-e;w.faceVertexUvs[0].push([new THREE.UV((w.vertices[a].position.x-d)/g,(w.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(i/g,c/f)])}}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,n=b.bevelEnabled!==void 0?b.bevelEnabled:!0,q=b.curveSegments!==void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,p=b.bendPath,o=b.extrudePath,r,s=!1,u=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,A=b.extrudeMaterial,B=this.shapebb;if(o)r=o.getPoints(q),m=r.length,s=!0,n=!1;n||(k=i=j=0);var z,E,H,w=this,G=this.vertices.length;p&&a.addWrapPath(p);q=u?a.extractAllSpacedPoints(q):a.extractAllPoints(q);p=q.shape;q=q.holes;if(o=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();E=
-0;for(H=q.length;E<H;E++)z=q[E],THREE.Shape.Utils.isClockWise(z)&&(q[E]=z.reverse());o=!1}o=THREE.Shape.Utils.triangulateShape(p,q);u=p;E=0;for(H=q.length;E<H;E++)z=q[E],p=p.concat(z);var y,K,Z,Q,X,T,R=p.length,l=o.length,S=[];y=0;K=u.length;Y=K-1;for(ca=y+1;y<K;y++,Y++,ca++)Y===K&&(Y=0),ca===K&&(ca=0),S[y]=d(u[y],u[Y],u[ca]);var v=[],W,M=S.concat();E=0;for(H=q.length;E<H;E++){z=q[E];W=[];y=0;K=z.length;Y=K-1;for(ca=y+1;y<K;y++,Y++,ca++)Y===K&&(Y=0),ca===K&&(ca=0),W[y]=d(z[y],z[Y],z[ca]);v.push(W);
-M=M.concat(W)}for(Z=0;Z<j;Z++){Q=Z/j;X=i*(1-Q);Q=k*Math.sin(Q*Math.PI/2);y=0;for(K=u.length;y<K;y++)T=c(u[y],S[y],Q),f(T.x,T.y,-X);E=0;for(H=q.length;E<H;E++){z=q[E];W=v[E];y=0;for(K=z.length;y<K;y++)T=c(z[y],W[y],Q),f(T.x,T.y,-X)}}Q=k;for(y=0;y<R;y++)T=n?c(p[y],M[y],Q):p[y],s?f(T.x,T.y+r[0].y,r[0].x):f(T.x,T.y,0);for(Z=1;Z<=m;Z++)for(y=0;y<R;y++)T=n?c(p[y],M[y],Q):p[y],s?f(T.x,T.y+r[Z-1].y,r[Z-1].x):f(T.x,T.y,h/m*Z);for(Z=j-1;Z>=0;Z--){Q=Z/j;X=i*(1-Q);Q=k*Math.sin(Q*Math.PI/2);y=0;for(K=u.length;y<
-K;y++)T=c(u[y],S[y],Q),f(T.x,T.y,h+X);E=0;for(H=q.length;E<H;E++){z=q[E];W=v[E];y=0;for(K=z.length;y<K;y++)T=c(z[y],W[y],Q),s?f(T.x,T.y+r[m-1].y,r[m-1].x+X):f(T.x,T.y,h+X)}}if(n){n=R*0;for(y=0;y<l;y++)k=o[y],g(k[2]+n,k[1]+n,k[0]+n);n=R*(m+j*2);for(y=0;y<l;y++)k=o[y],g(k[0]+n,k[1]+n,k[2]+n)}else{for(y=0;y<l;y++)k=o[y],g(k[2],k[1],k[0]);for(y=0;y<l;y++)k=o[y],g(k[0]+R*m,k[1]+R*m,k[2]+R*m)}var Y,ca,$=0;e(u);$+=u.length;E=0;for(H=q.length;E<H;E++)z=q[E],e(z),$+=z.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
-THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(w=a.length;--w>=0;){W=w;aa=w-1;aa<0&&(aa=a.length-1);for(var b=
+0,c=n+k*2,b=0;b<c;b++){var d=O*b,e=O*(b+1),f=ea+W+d,g=ea+W+e,j=f,d=ea+aa+d,e=ea+aa+e,l=g;j+=I;d+=I;e+=I;l+=I;u.faces.push(new THREE.Face4(j,d,e,l,null,null,v));v!==void 0&&(j=b/c,d=(b+1)/c,e=h+i*2,f=(u.vertices[f].position.z+i)/e,g=(u.vertices[g].position.z+i)/e,u.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){u.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=I;b+=I;c+=I;u.faces.push(new THREE.Face3(a,
+b,c,null,null,x));if(x!==void 0){var d=D.minX,e=D.minY,f=D.maxY,g=D.maxX,h=u.vertices[b].position.x-d,b=u.vertices[b].position.y-e,i=u.vertices[c].position.x-d,c=u.vertices[c].position.y-e;u.faceVertexUvs[0].push([new THREE.UV((u.vertices[a].position.x-d)/g,(u.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(i/g,c/f)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:
+3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,s=b.curveSegments!==void 0?b.curveSegments:12,n=b.steps!==void 0?b.steps:1,p=b.bendPath,m=b.extrudePath,q,r=!1,t=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,x=b.material,v=b.extrudeMaterial,D=this.shapebb;if(m)q=m.getPoints(s),n=q.length,r=!0,o=!1;o||(j=i=k=0);var y,F,E,u=this,I=this.vertices.length;p&&a.addWrapPath(p);s=t?a.extractAllSpacedPoints(s):a.extractAllPoints(s);p=s.shape;s=s.holes;if(m=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();F=
+0;for(E=s.length;F<E;F++)y=s[F],THREE.Shape.Utils.isClockWise(y)&&(s[F]=y.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(p,s);t=p;F=0;for(E=s.length;F<E;F++)y=s[F],p=p.concat(y);var w,R,V,J,T,Y,O=p.length,l=m.length,P=[];w=0;R=t.length;W=R-1;for(aa=w+1;w<R;w++,W++,aa++)W===R&&(W=0),aa===R&&(aa=0),P[w]=d(t[w],t[W],t[aa]);var A=[],X,N=P.concat();F=0;for(E=s.length;F<E;F++){y=s[F];X=[];w=0;R=y.length;W=R-1;for(aa=w+1;w<R;w++,W++,aa++)W===R&&(W=0),aa===R&&(aa=0),X[w]=d(y[w],y[W],y[aa]);A.push(X);
+N=N.concat(X)}for(V=0;V<k;V++){J=V/k;T=i*(1-J);J=j*Math.sin(J*Math.PI/2);w=0;for(R=t.length;w<R;w++)Y=c(t[w],P[w],J),f(Y.x,Y.y,-T);F=0;for(E=s.length;F<E;F++){y=s[F];X=A[F];w=0;for(R=y.length;w<R;w++)Y=c(y[w],X[w],J),f(Y.x,Y.y,-T)}}J=j;for(w=0;w<O;w++)Y=o?c(p[w],N[w],J):p[w],r?f(Y.x,Y.y+q[0].y,q[0].x):f(Y.x,Y.y,0);for(V=1;V<=n;V++)for(w=0;w<O;w++)Y=o?c(p[w],N[w],J):p[w],r?f(Y.x,Y.y+q[V-1].y,q[V-1].x):f(Y.x,Y.y,h/n*V);for(V=k-1;V>=0;V--){J=V/k;T=i*(1-J);J=j*Math.sin(J*Math.PI/2);w=0;for(R=t.length;w<
+R;w++)Y=c(t[w],P[w],J),f(Y.x,Y.y,h+T);F=0;for(E=s.length;F<E;F++){y=s[F];X=A[F];w=0;for(R=y.length;w<R;w++)Y=c(y[w],X[w],J),r?f(Y.x,Y.y+q[n-1].y,q[n-1].x+T):f(Y.x,Y.y,h+T)}}if(o){o=O*0;for(w=0;w<l;w++)j=m[w],g(j[2]+o,j[1]+o,j[0]+o);o=O*(n+k*2);for(w=0;w<l;w++)j=m[w],g(j[0]+o,j[1]+o,j[2]+o)}else{for(w=0;w<l;w++)j=m[w],g(j[2],j[1],j[0]);for(w=0;w<l;w++)j=m[w],g(j[0]+O*n,j[1]+O*n,j[2]+O*n)}var W,aa,ea=0;e(t);ea+=t.length;F=0;for(E=s.length;F<E;F++)y=s[F],e(y),ea+=y.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=
+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),j=d(f.faces[h].b,f.faces[h].c),k=d(f.faces[h].c,f.faces[h].a);c(f.faces[h].a,i,k,a);c(f.faces[h].b,j,i,a);c(f.faces[h].c,k,j,a);c(i,j,k,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);
 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;
@@ -529,171 +529,171 @@ THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.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===
 1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=b||0,g=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],b);d(i[0],i[4],i[3],b);d(i[0],i[3],i[5],b);d(i[0],i[5],i[2],b);d(i[1],i[2],i[5],b);d(i[1],i[5],i[3],b);d(i[1],i[3],i[4],b);d(i[1],i[4],i[2],b);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,k=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*k-f),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(j),e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*j-f),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,f=f!=void 0?f:0,g=g!=void 0?g:Math.PI,h,i,k=[],j=[];for(i=0;i<=c;i++){var n=[],q=[];for(h=0;h<=b;h++){var m=h/b,p=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(f+p*g),a*Math.cos(f+p*g),a*Math.sin(d+m*e)*Math.sin(f+p*g))));n.push(this.vertices.length-1);q.push(new THREE.UV(m,p))}k.push(n);
-j.push(q)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],f=k[i+1][h],g=k[i+1][h+1],n=this.vertices[d].position.clone().normalize(),q=this.vertices[e].position.clone().normalize(),m=this.vertices[f].position.clone().normalize(),p=this.vertices[g].position.clone().normalize(),o=j[i][h+1].clone(),r=j[i][h].clone(),s=j[i+1][h].clone(),u=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[n,m,p])),this.faceVertexUvs[0].push([o,s,u])):Math.abs(this.vertices[f].position.y)==
-a?(this.faces.push(new THREE.Face3(d,e,f,[n,q,m])),this.faceVertexUvs[0].push([o,r,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[n,q,m,p])),this.faceVertexUvs[0].push([o,r,s,u]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,f=f!=void 0?f:0,g=g!=void 0?g:Math.PI,h,i,j=[],k=[];for(i=0;i<=c;i++){var o=[],s=[];for(h=0;h<=b;h++){var n=h/b,p=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+n*e)*Math.sin(f+p*g),a*Math.cos(f+p*g),a*Math.sin(d+n*e)*Math.sin(f+p*g))));o.push(this.vertices.length-1);s.push(new THREE.UV(n,p))}j.push(o);
+k.push(s)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],e=j[i][h],f=j[i+1][h],g=j[i+1][h+1],o=this.vertices[d].position.clone().normalize(),s=this.vertices[e].position.clone().normalize(),n=this.vertices[f].position.clone().normalize(),p=this.vertices[g].position.clone().normalize(),m=k[i][h+1].clone(),q=k[i][h].clone(),r=k[i+1][h].clone(),t=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[o,n,p])),this.faceVertexUvs[0].push([m,r,t])):Math.abs(this.vertices[f].position.y)==
+a?(this.faces.push(new THREE.Face3(d,e,f,[o,s,n])),this.faceVertexUvs[0].push([m,q,r])):(this.faces.push(new THREE.Face4(d,e,f,g,[o,s,n,p])),this.faceVertexUvs[0].push([m,q,r,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,j,n,q,m,p,o,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;f.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;f.push(new THREE.Vector2(i,
-j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;m=b[a++]*c+d;p=b[a++]*c;e.quadraticCurveTo(m,p,i,j);if(g=f[f.length-1]){n=g.x;q=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h,t=THREE.Shape.Utils.b2(u,n,m,i),u=THREE.Shape.Utils.b2(u,q,p,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,p=b[a++]*-c,o=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,j,m,p,o,r),g=f[f.length-1]){n=g.x;q=g.y;g=1;for(h=this.divisions;g<=h;g++)u=g/h,t=THREE.Shape.Utils.b3(u,n,m,
-o,i),u=THREE.Shape.Utils.b3(u,q,p,r,j),f.push(new THREE.Vector2(t,u))}}}return{offset:s.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 n=2*e;for(k=e-1;e>2;){if(n--<=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 q;a:{q=a;var m=i,p=k,o=j,r=e,s=g,u=void 0,t=void 0,A=void 0,
-B=void 0,z=void 0,E=void 0,H=void 0,w=void 0,G=void 0,t=q[s[m]].x,A=q[s[m]].y,B=q[s[p]].x,z=q[s[p]].y,E=q[s[o]].x,H=q[s[o]].y;if(1.0E-10>(B-t)*(H-A)-(z-A)*(E-t))q=!1;else{for(u=0;u<r;u++)if(!(u==m||u==p||u==o)){var w=q[s[u]].x,G=q[s[u]].y,y=void 0,K=void 0,Z=void 0,Q=void 0,X=void 0,T=void 0,R=void 0,l=void 0,S=void 0,v=void 0,W=void 0,M=void 0,y=Z=X=void 0,y=E-B,K=H-z,Z=t-E,Q=A-H,X=B-t,T=z-A,R=w-t,l=G-A,S=w-B,v=G-z,W=w-E,M=G-H,y=y*v-K*S,X=X*l-T*R,Z=Z*M-Q*W;if(y>=0&&Z>=0&&X>=0){q=!1;break a}}q=!0}}if(q){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--;n=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};
+0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,k,o,s,n,p,m,q,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,
+k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;p=b[a++]*c;e.quadraticCurveTo(n,p,i,k);if(g=f[f.length-1]){o=g.x;s=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h,x=THREE.Shape.Utils.b2(t,o,n,i),t=THREE.Shape.Utils.b2(t,s,p,k);f.push(new THREE.Vector2(x,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,n=b[a++]*c+d,p=b[a++]*-c,m=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,k,n,p,m,q),g=f[f.length-1]){o=g.x;s=g.y;g=1;for(h=this.divisions;g<=h;g++)t=g/h,x=THREE.Shape.Utils.b3(t,o,n,
+m,i),t=THREE.Shape.Utils.b3(t,s,p,q,k),f.push(new THREE.Vector2(x,t))}}}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,j,k;if(b(a)>0)for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var o=2*e;for(j=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var s;a:{s=a;var n=i,p=j,m=k,q=e,r=g,t=void 0,x=void 0,v=void 0,
+D=void 0,y=void 0,F=void 0,E=void 0,u=void 0,I=void 0,x=s[r[n]].x,v=s[r[n]].y,D=s[r[p]].x,y=s[r[p]].y,F=s[r[m]].x,E=s[r[m]].y;if(1.0E-10>(D-x)*(E-v)-(y-v)*(F-x))s=!1;else{for(t=0;t<q;t++)if(!(t==n||t==p||t==m)){var u=s[r[t]].x,I=s[r[t]].y,w=void 0,R=void 0,V=void 0,J=void 0,T=void 0,Y=void 0,O=void 0,l=void 0,P=void 0,A=void 0,X=void 0,N=void 0,w=V=T=void 0,w=F-D,R=E-y,V=x-F,J=v-E,T=D-x,Y=y-v,O=u-x,l=I-v,P=u-D,A=I-y,X=u-F,N=I-E,w=w*A-R*P,T=T*l-Y*O,V=V*N-J*X;if(w>=0&&V>=0&&T>=0){s=!1;break a}}s=!0}}if(s){f.push([a[g[i]],
+a[g[j]],a[g[k]]]);h.push([g[i],g[j],g[k]]);i=j;for(k=j+1;k<e;i++,k++)g[i]=g[k];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);
 this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
 this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,e=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x+=i*d.x+g*f.x;e.y+=i*d.y+g*f.y;e.z+=i*d.z+g*f.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
-e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,f));this.faceVertexUvs[0].push([g,i,k,j])}this.computeCentroids();
+e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,f));this.faceVertexUvs[0].push([g,i,j,k])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){j.vertexColors=[];for(var k,o,m,n=0;n<4;n++){m=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<m.length;p++)o=h.vertexColors[m[p]-1],k.r+=o.r,k.g+=o.g,k.b+=o.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[n]=k}}e.push(j);(!g.supportUVs||q.length!=0)&&f.push([q[a],q[b],q[c],q[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},n={},q=[],m,p,o,r,s,u=a.faceVertexUvs[0];m=0;for(p=u.length;m<p;m++){o=0;for(r=u[m].length;o<r;o++)s=d[m]["abcd".charAt(o)],q[s]||(q[s]=u[m][o])}var t;m=0;for(p=d.length;m<p;m++)if(s=d[m],k.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&q.length!=0){t=new THREE.UV;if(s instanceof THREE.Face3)t.u=q[s.a].u+q[s.b].u+q[s.c].u,t.v=q[s.a].v+q[s.b].v+q[s.c].v,t.u/=3,t.v/=3;else if(s instanceof THREE.Face4)t.u=
-q[s.a].u+q[s.b].u+q[s.c].u+q[s.d].u,t.v=q[s.a].v+q[s.b].v+q[s.c].v+q[s.d].v,t.u/=4,t.v/=4;q.push(t)}p=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var A=0,u=h.length,B,z,E={},H={},w=function(a,
-b){E[a]===void 0&&(E[a]=[]);E[a].push(b)},G=function(a,b){H[a]===void 0&&(H[a]={});H[a][b]=null};for(m in p){t=p[m];B=m.split("_");z=B[0];B=B[1];w(z,[z,B]);w(B,[z,B]);o=0;for(r=t.length;o<r;o++)s=t[o],G(z,s,m),G(B,s,m);t.length<2&&(n[m]=!0)}for(m in p)if(t=p[m],s=t[0],t=t[1],B=m.split("_"),z=B[0],B=B[1],r=new THREE.Vector3,n[m]?(r.addSelf(h[z].position),r.addSelf(h[B].position),r.multiplyScalar(0.5)):(r.addSelf(k[s]),r.addSelf(k[t]),r.addSelf(h[z].position),r.addSelf(h[B].position),r.multiplyScalar(0.25)),
-j[m]=u+d.length+A,i.push(new THREE.Vertex(r)),A++,g.supportUVs&&q.length!=0)t=new THREE.UV,t.u=q[z].u+q[B].u,t.v=q[z].v+q[B].v,t.u/=2,t.v/=2,q.push(t);var y,K;B=["123","12","2","23"];r=["123","23","3","31"];var w=["123","31","1","12"],G=["1234","12","2","23"],Z=["1234","23","3","34"],Q=["1234","34","4","41"],X=["1234","41","1","12"];m=0;for(p=k.length;m<p;m++)s=d[m],t=u+m,s instanceof THREE.Face3?(A=c(s.a,s.b),z=c(s.b,s.c),y=c(s.c,s.a),b(t,j[A],s.b,j[z],s,B),b(t,j[z],s.c,j[y],s,r),b(t,j[y],s.a,j[A],
-s,w)):s instanceof THREE.Face4?(A=c(s.a,s.b),z=c(s.b,s.c),y=c(s.c,s.d),K=c(s.d,s.a),b(t,j[A],s.b,j[z],s,G),b(t,j[z],s.c,j[y],s,Z),b(t,j[y],s.d,j[K],s,Q),b(t,j[K],s.a,j[A],s,X)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(p=h.length;m<p;m++)if(E[m]!==void 0){i.set(0,0,0);j.set(0,0,0);s=new THREE.Vector3(0,0,0);t=0;for(o in H[m])i.addSelf(k[o]),t++;A=0;u=E[m].length;for(o=0;o<u;o++)n[c(E[m][o][0],E[m][o][1])]&&A++;if(A!=2){i.divideScalar(t);for(o=0;o<
-u;o++)t=E[m][o],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(u);s.addSelf(h[m].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(j.multiplyScalar(2));s.divideScalar(u);d[m].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){j.vertexColors=[];for(var k,m,n,o=0;o<4;o++){n=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<n.length;p++)m=h.vertexColors[n[p]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=n.length;k.g/=n.length;k.b/=n.length;j.vertexColors[o]=k}}e.push(j);(!g.supportUVs||s.length!=0)&&f.push([s[a],s[b],s[c],s[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},o={},s=[],n,p,m,q,r,t=a.faceVertexUvs[0];n=0;for(p=t.length;n<p;n++){m=0;for(q=t[n].length;m<q;m++)r=d[n]["abcd".charAt(m)],s[r]||(s[r]=t[n][m])}var x;n=0;for(p=d.length;n<p;n++)if(r=d[n],j.push(r.centroid),i.push(new THREE.Vertex(r.centroid)),g.supportUVs&&s.length!=0){x=new THREE.UV;if(r instanceof THREE.Face3)x.u=s[r.a].u+s[r.b].u+s[r.c].u,x.v=s[r.a].v+s[r.b].v+s[r.c].v,x.u/=3,x.v/=3;else if(r instanceof THREE.Face4)x.u=
+s[r.a].u+s[r.b].u+s[r.c].u+s[r.d].u,x.v=s[r.a].v+s[r.b].v+s[r.c].v+s[r.d].v,x.u/=4,x.v/=4;s.push(x)}p=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var v=0,t=h.length,D,y,F={},E={},u=function(a,
+b){F[a]===void 0&&(F[a]=[]);F[a].push(b)},I=function(a,b){E[a]===void 0&&(E[a]={});E[a][b]=null};for(n in p){x=p[n];D=n.split("_");y=D[0];D=D[1];u(y,[y,D]);u(D,[y,D]);m=0;for(q=x.length;m<q;m++)r=x[m],I(y,r,n),I(D,r,n);x.length<2&&(o[n]=!0)}for(n in p)if(x=p[n],r=x[0],x=x[1],D=n.split("_"),y=D[0],D=D[1],q=new THREE.Vector3,o[n]?(q.addSelf(h[y].position),q.addSelf(h[D].position),q.multiplyScalar(0.5)):(q.addSelf(j[r]),q.addSelf(j[x]),q.addSelf(h[y].position),q.addSelf(h[D].position),q.multiplyScalar(0.25)),
+k[n]=t+d.length+v,i.push(new THREE.Vertex(q)),v++,g.supportUVs&&s.length!=0)x=new THREE.UV,x.u=s[y].u+s[D].u,x.v=s[y].v+s[D].v,x.u/=2,x.v/=2,s.push(x);var w,R;D=["123","12","2","23"];q=["123","23","3","31"];var u=["123","31","1","12"],I=["1234","12","2","23"],V=["1234","23","3","34"],J=["1234","34","4","41"],T=["1234","41","1","12"];n=0;for(p=j.length;n<p;n++)r=d[n],x=t+n,r instanceof THREE.Face3?(v=c(r.a,r.b),y=c(r.b,r.c),w=c(r.c,r.a),b(x,k[v],r.b,k[y],r,D),b(x,k[y],r.c,k[w],r,q),b(x,k[w],r.a,k[v],
+r,u)):r instanceof THREE.Face4?(v=c(r.a,r.b),y=c(r.b,r.c),w=c(r.c,r.d),R=c(r.d,r.a),b(x,k[v],r.b,k[y],r,I),b(x,k[y],r.c,k[w],r,V),b(x,k[w],r.d,k[R],r,J),b(x,k[R],r.a,k[v],r,T)):console.log("face should be a face!",r);d=i;i=new THREE.Vector3;k=new THREE.Vector3;n=0;for(p=h.length;n<p;n++)if(F[n]!==void 0){i.set(0,0,0);k.set(0,0,0);r=new THREE.Vector3(0,0,0);x=0;for(m in E[n])i.addSelf(j[m]),x++;v=0;t=F[n].length;for(m=0;m<t;m++)o[c(F[n][m][0],F[n][m][1])]&&v++;if(v!=2){i.divideScalar(x);for(m=0;m<
+t;m++)x=F[n][m],x=h[x[0]].position.clone().addSelf(h[x[1]].position).divideScalar(2),k.addSelf(x);k.divideScalar(t);r.addSelf(h[n].position);r.multiplyScalar(t-3);r.addSelf(i);r.addSelf(k.multiplyScalar(2));r.divideScalar(t);d[n].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)+
 "%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
 a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,b,d)}else a.image=this;a.needsUpdate=!0};d.crossOrigin=g.crossOrigin;d.src=b}function e(a,c,e,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=e;if(f){a[c].repeat.set(f[0],f[1]);
-if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}d(a[c],b+"/"+e)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var g=this,h,i,k;i="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?
+if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}d(a[c],b+"/"+e)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var g=this,h,i,j;i="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?
 i="MeshPhongMaterial":a.shading=="Basic"&&(i="MeshBasicMaterial"));if(a.blending)if(a.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)h.transparent=a.transparent;if(a.depthTest!==void 0)h.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(a.vertexColors)h.vertexColors=
 THREE.VertexColors;if(a.colorDiffuse)h.color=f(a.colorDiffuse);else if(a.DbgColor)h.color=a.DbgColor;if(a.colorSpecular)h.specular=f(a.colorSpecular);if(a.colorAmbient)h.ambient=f(a.colorAmbient);if(a.transparency)h.opacity=a.transparency;if(a.specularCoef)h.shininess=a.specularCoef;a.mapDiffuse&&b&&e(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(h,"normalMap",
-a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(j.uniforms),q=h.color;i=h.specular;k=h.ambient;var m=h.shininess;n.tNormal.texture=h.normalMap;if(a.mapNormalFactor)n.uNormalScale.value=a.mapNormalFactor;if(h.map)n.tDiffuse.texture=h.map,n.enableDiffuse.value=!0;if(h.specularMap)n.tSpecular.texture=
-h.specularMap,n.enableSpecular.value=!0;if(h.lightMap)n.tAO.texture=h.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(q);n.uSpecularColor.value.setHex(i);n.uAmbientColor.value.setHex(k);n.uShininess.value=m;if(h.opacity)n.uOpacity.value=h.opacity;h=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:n,lights:!0,fog:!0})}else h=new THREE[i](h);if(a.DbgName!==void 0)h.name=a.DbgName;return h}};
+a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(k.uniforms),s=h.color;i=h.specular;j=h.ambient;var n=h.shininess;o.tNormal.texture=h.normalMap;if(a.mapNormalFactor)o.uNormalScale.value=a.mapNormalFactor;if(h.map)o.tDiffuse.texture=h.map,o.enableDiffuse.value=!0;if(h.specularMap)o.tSpecular.texture=
+h.specularMap,o.enableSpecular.value=!0;if(h.lightMap)o.tAO.texture=h.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(s);o.uSpecularColor.value.setHex(i);o.uAmbientColor.value.setHex(j);o.uShininess.value=n;if(h.opacity)o.uOpacity.value=h.opacity;h=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:o,lights:!0,fog:!0})}else h=new THREE[i](h);if(a.DbgName!==void 0)h.name=a.DbgName;return h}};
 THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
 g.status+"]")};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("Couldn't load ["+g+"] ["+f.status+"]"):f.readyState==3?e&&(h==0&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);
 f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,f,g,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=o.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));n.push(new THREE.UV(f,k));g.push(n)}}
-function j(b,c){var d,e,f,g,h,i,j,k,m,n,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];m=t[f*2+1];k=t[g*2];n=t[g*2+1];g=t[h*2];f=t[h*2+1];h=o.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(j,m));q.push(new THREE.UV(k,n));q.push(new THREE.UV(g,f));h.push(q)}}function n(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],o.faces.push(new THREE.Face3(e,
-f,g,null,null,h))}function q(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],o.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,j,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];m=d[e*3+2];i=n[e];var p=u[k*3],q=u[k*3+1];k=u[k*3+2];var r=u[m*3],s=u[m*3+1];m=u[m*3+2];o.faces.push(new THREE.Face3(f,
-g,h,[new THREE.Vector3(u[j*3],u[j*3+1],u[j*3+2]),new THREE.Vector3(p,q,k),new THREE.Vector3(r,s,m)],null,i))}}function p(b,c,d,e){for(var f,g,h,i,j,k,m,n,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];m=d[e*4+1];n=d[e*4+2];p=d[e*4+3];j=q[e];var r=u[m*3],s=u[m*3+1];m=u[m*3+2];var t=u[n*3],w=u[n*3+1];n=u[n*3+2];var z=u[p*3],A=u[p*3+1];p=u[p*3+2];o.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(u[k*
-3],u[k*3+1],u[k*3+2]),new THREE.Vector3(r,s,m),new THREE.Vector3(t,w,n),new THREE.Vector3(z,A,p)],null,j))}}var o=this,r=0,s,u=[],t=[],A,B,z,E,H,w;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(o,d,b);s={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,r,12),header_bytes:e(a,r+12),vertex_coordinate_bytes:e(a,r+13),normal_coordinate_bytes:e(a,r+14),uv_coordinate_bytes:e(a,r+15),vertex_index_bytes:e(a,r+16),normal_index_bytes:e(a,
-r+17),uv_index_bytes:e(a,r+18),material_index_bytes:e(a,r+19),nvertices:i(a,r+20),nnormals:i(a,r+20+4),nuvs:i(a,r+20+8),ntri_flat:i(a,r+20+12),ntri_smooth:i(a,r+20+16),ntri_flat_uv:i(a,r+20+20),ntri_smooth_uv:i(a,r+20+24),nquad_flat:i(a,r+20+28),nquad_smooth:i(a,r+20+32),nquad_flat_uv:i(a,r+20+36),nquad_smooth_uv:i(a,r+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");r+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;w=s.vertex_index_bytes*
-4+s.material_index_bytes;A=s.ntri_flat*b;B=s.ntri_smooth*(b+s.normal_index_bytes*3);z=s.ntri_flat_uv*(b+s.uv_index_bytes*3);E=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);H=s.nquad_flat*w;b=s.nquad_smooth*(w+s.normal_index_bytes*4);w=s.nquad_flat_uv*(w+s.uv_index_bytes*4);r+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],o.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(r);
-r+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],u.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(r);r+=c(s.nnormals*3);r+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(r);A=r+A+c(s.ntri_flat*2);B=A+B+c(s.ntri_smooth*2);z=B+z+c(s.ntri_flat_uv*2);E=z+E+c(s.ntri_smooth_uv*2);H=E+H+c(s.nquad_flat*2);
-b=H+b+c(s.nquad_smooth*2);w=b+w+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(B);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(z);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
-c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(w);(function(a){var b=s.ntri_flat;b&&n(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(r);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(A);(function(a){var b=s.nquad_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(E);(function(a){var b=
-s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(H);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||ba;e!==void 0&&(a=e.split("/"),a.pop(),xa=a.length<1?"":a.join("/")+"/");if((a=U.evaluate("//dae:asset",U,S,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",H,"material");ra=b("//dae:library_effects/dae:effect",Z,"effect");ja=b("//dae:library_geometries/dae:geometry",r,"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,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),V=wa[a]):V=null;L=new THREE.Object3D;for(a=0;a<V.nodes.length;a++)L.add(f(V.nodes[a]));Ba=[];c(L);a={scene:L,morphs:ya,skins:za,animations:Ba,dae:{images:va,materials:sa,effects:ra,geometries:ja,controllers:na,animations:fa,visualScenes:wa,scene:V}};d&&d(a);return a}function b(a,b,c){for(var a=U.evaluate(a,U,
-S,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=V.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=V.getChildById(b.skeleton[0],!0)||V.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,o,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],o=-1,l.type=="JOINT"){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){o=n;break}if(o>=0){n=k.invBindMatrices[o];l.invBindMatrix=n;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,n);l.weights=[];for(n=0;n<k.weights.length;n++)for(var p=0;p<k.weights[n].length;p++){var q=k.weights[n][p];q.joint==o&&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,o=a.vertices[m],m=i[m],g.x=o.position.x,g.y=o.position.y,g.z=o.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 o;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 o,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 o,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=[],n=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=ra[sa[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=n;l.push(q.material);p=q.material;n++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(n>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(n=ja[k.targets[l]],n.mesh&&n.mesh.primitives&&n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,
-n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.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 n(){this.sid=this.name=this.id="";this.nodes=
-[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function q(){this.type=this.sid="";this.data=[];this.obj=null}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function o(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function s(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 A(){this.source="";this.stride=this.count=0;this.params=[]}function B(){this.input={}}function z(){this.semantic="";this.offset=0;this.source="";this.set=0}function E(a){this.id=a;this.type=null}function H(){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 Z(){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 T(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 S(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function v(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function W(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],
-10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function Y(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ca(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 $(a,b){var c=[a[b],a[b+1],a[b+2]];ca(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ea(a){if(la.convertUpAxis){var b=[a[0],a[4],a[8]];ca(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];ca(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];ca(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];ca(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];ca(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];ca(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],
-a[11]];ca(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,L=null,V,ba=null,ga={},va={},fa={},na={},ja={},sa={},ra={},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 E).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==
-1)switch(d.nodeName){case "input":b.push((new z).parse(d))}}return b};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=ea(f);break;case "source":f=(new E).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 z).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};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 z).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 n).parse(c))}}return this};n.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};n.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};n.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};n.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};n.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 n).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 o).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,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new q).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in 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 p=i[b],r=h.getData(j.type,b),s;s=null;for(var t=0,u=d.length;t<u&&s==null;t++){var v=d[t];if(v.time===p)s=v;else if(v.time>p)break}if(!s){s=new l(p);t=-1;u=0;for(v=d.length;u<v&&t==-1;u++)d[u].time>=p&&(t=u);p=t;d.splice(p==-1?d.length:p,0,s)}s.addTarget(f,j,g,r)}}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(s=d[b],!s.hasTarget(e)){h=d;f=s;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;r=void 0;if(k.length){r=[];for(p=0;p<k.length;++p)r[p]=k[p]+(j[p]-k[p])*h}else r=k+(j-k)*h;f.addTarget(g,i.transform,
-i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};q.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=v(a.textContent);this.convert();return this};q.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ea(this.data);break;case "rotate":this.angle=this.data[3]*Ia;case "translate":ca(this.data,
--1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":ca(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)}};q.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)}};q.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,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new p).parse(d)),d=c.iterateNext()}}return this};
-p.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};o.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,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new p).parse(b)),
-b=a.iterateNext();break}}return this};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 s(this)).parse(c)}}return this};s.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 E(d)).parse(c));break;case "vertices":this.vertices=(new B).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($(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};s.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($(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=Y(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new z).parse(a.childNodes[b]));break;case "vcount":this.vcount=W(c.textContent);break;case "p":this.p=W(c.textContent)}}return this};A.prototype.parse=
-function(a){this.params=[];this.source=a.getAttribute("source");this.count=Y(a,"count",0);this.stride=Y(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new z).parse(a.childNodes[b]);this.input[c.semantic]=
-c}return this};z.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=Y(a,"set",-1);this.offset=Y(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=M(c.textContent),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=M(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 A).parse(c.childNodes[d]);break}}}return this};E.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=ea(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};H.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,S,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};Z.prototype.create=function(){if(this.shader==null)return null};Z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=
-0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};Z.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new 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)}}};Z.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};Z.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "constant":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 E).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 T(this)).parse(c))}}return this};
-T.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 z).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":ca(c,-1);break;case "scale":ca(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?(ba=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.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function j(b,c){var d,e,f,g,h,i,j,k,n=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=n[d*3];f=n[d*3+1];g=n[d*3+2];h=x[e*2];e=x[e*2+1];i=x[f*2];j=x[f*2+1];f=x[g*2];k=x[g*2+1];g=m.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,j));o.push(new THREE.UV(f,k));g.push(o)}}
+function k(b,c){var d,e,f,g,h,i,j,k,n,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=x[e*2];e=x[e*2+1];j=x[f*2];n=x[f*2+1];k=x[g*2];o=x[g*2+1];g=x[h*2];f=x[h*2+1];h=m.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(j,n));q.push(new THREE.UV(k,o));q.push(new THREE.UV(g,f));h.push(q)}}function o(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],m.faces.push(new THREE.Face3(e,
+f,g,null,null,h))}function s(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],m.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function n(b,c,d,e){for(var f,g,h,i,j,k,n,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];n=d[e*3+2];i=o[e];var p=t[k*3],q=t[k*3+1];k=t[k*3+2];var r=t[n*3],s=t[n*3+1];n=t[n*3+2];m.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(t[j*3],t[j*3+1],t[j*3+2]),new THREE.Vector3(p,q,k),new THREE.Vector3(r,s,n)],null,i))}}function p(b,c,d,e){for(var f,g,h,i,j,k,n,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];n=d[e*4+1];o=d[e*4+2];p=d[e*4+3];j=q[e];var r=t[n*3],s=t[n*3+1];n=t[n*3+2];var u=t[o*3],v=t[o*3+1];o=t[o*3+2];var x=t[p*3],y=t[p*3+1];p=t[p*3+2];m.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(t[k*
+3],t[k*3+1],t[k*3+2]),new THREE.Vector3(r,s,n),new THREE.Vector3(u,v,o),new THREE.Vector3(x,y,p)],null,j))}}var m=this,q=0,r,t=[],x=[],v,D,y,F,E,u;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(m,d,b);r={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
+q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};r.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=r.header_bytes;b=r.vertex_index_bytes*3+r.material_index_bytes;u=r.vertex_index_bytes*
+4+r.material_index_bytes;v=r.ntri_flat*b;D=r.ntri_smooth*(b+r.normal_index_bytes*3);y=r.ntri_flat_uv*(b+r.uv_index_bytes*3);F=r.ntri_smooth_uv*(b+r.normal_index_bytes*3+r.uv_index_bytes*3);E=r.nquad_flat*u;b=r.nquad_smooth*(u+r.normal_index_bytes*4);u=r.nquad_flat_uv*(u+r.uv_index_bytes*4);q+=function(b){var c=r.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],m.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
+q+=function(b){var c=r.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],t.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(r.nnormals*3);q+=function(b){var c=r.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],x.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);v=q+v+c(r.ntri_flat*2);D=v+D+c(r.ntri_smooth*2);y=D+y+c(r.ntri_flat_uv*2);F=y+F+c(r.ntri_smooth_uv*2);E=F+E+c(r.nquad_flat*2);
+b=E+b+c(r.nquad_smooth*2);u=b+u+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);j(b,c)}})(D);(function(a){var b=r.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);j(b,d)}})(y);(function(a){var b=r.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(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;p(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(u);(function(a){var b=r.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=r.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(v);(function(a){var b=r.nquad_flat;b&&s(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(F);(function(a){var b=
+r.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(E);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
+THREE.ColladaLoader=function(){function a(a,d,e){S=a;d=d||Q;e!==void 0&&(a=e.split("/"),a.pop(),Aa=a.length<1?"":a.join("/")+"/");if((a=S.evaluate("//dae:asset",S,P,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":ja=i.textContent.charAt(0)}}if(!ha.convertUpAxis||ja===ha.upAxis)qa=null;else switch(ja){case "X":qa=ha.upAxis===
+"Y"?"XtoY":"XtoZ";break;case "Y":qa=ha.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":qa=ha.upAxis==="X"?"ZtoX":"ZtoY"}wa=b("//dae:library_images/dae:image",g,"image");va=b("//dae:library_materials/dae:material",E,"material");sa=b("//dae:library_effects/dae:effect",V,"effect");ta=b("//dae:library_geometries/dae:geometry",q,"geometry");oa=b("//dae:library_controllers/dae:controller",h,"controller");ca=b("//dae:library_animations/dae:animation",T,"animation");za=b(".//dae:library_visual_scenes/dae:visual_scene",
+k,"visual_scene");Ba=[];xa=[];(a=S.evaluate(".//dae:scene/dae:instance_visual_scene",S,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),U=za[a]):U=null;$=new THREE.Object3D;for(a=0;a<U.nodes.length;a++)$.add(f(U.nodes[a]));ya=[];c($);a={scene:$,morphs:Ba,skins:xa,animations:ya,dae:{images:wa,materials:va,effects:sa,geometries:ta,controllers:oa,animations:ca,visualScenes:za,scene:U}};d&&d(a);return a}function b(a,b,c){for(var a=S.evaluate(a,S,
+P,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=U.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};ya.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=oa[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 ca)for(var i=ca[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=U.getChildById(b.skeleton[0],!0)||U.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=oa[a.controllers[g].url];switch(i.type){case "skin":if(ta[i.skin.source]){var j=
+new m;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(oa[i.skin.source]&&(d=i=oa[i.skin.source],i.morph&&ta[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(ta[i.morph.source])j=new m,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=ta[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=sa[va[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=oa[c.url],j.skinInstanceController=c,j.name="skin_"+xa.length,xa.push(j);else if(d!==void 0){h=i;k=d instanceof n?oa[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=ta[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_"+Ba.length;Ba.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];ha.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 j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=
+[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function s(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function r(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function x(){this.material="";this.count=
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input={}}function y(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function u(){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 I(a,b){this.type=a;this.effect=b;this.material=null}function w(a){this.effect=a;this.format=this.init_from=null}function R(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function V(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function J(){this.url=""}function T(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function Y(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
+this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function O(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 P(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function A(a){for(var a=N(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function X(a){for(var a=N(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],
+10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function W(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function aa(a,b){if(ha.convertUpAxis&&ja!==ha.upAxis)switch(qa){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 ea(a,b){var c=[a[b],a[b+1],a[b+2]];aa(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function Z(a){if(ha.convertUpAxis){var b=[a[0],a[4],a[8]];aa(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];aa(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];aa(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];aa(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];aa(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];aa(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],
+a[11]];aa(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 S=null,$=null,U,Q=null,ba={},wa={},ca={},oa={},ta={},va={},sa={},ya,za,Aa,Ba,xa,Ca=THREE.SmoothShading,ha={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},ja="Y",qa=null,Ha=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 j).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 F).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new y).parse(d))}}return b};
+j.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=A(f.textContent);this.bindShapeMatrix=Z(f);break;case "source":f=(new F).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};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new y).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new y).parse(g));break;
+case "v":c=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],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};
+k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],
+d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};o.prototype.getChildBySid=
+function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:
+"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,
+"");(b=S.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",S,P,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 s).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in ca)for(var e=ca[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(ha.convertUpAxis)switch(g){case "X":switch(qa){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(qa){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(qa){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 p=i[b],q=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===p)r=v;else if(v.time>p)break}if(!r){r=new l(p);t=-1;u=0;for(v=d.length;u<v&&t==-1;u++)d[u].time>=p&&(t=u);p=t;d.splice(p==-1?d.length:p,0,r)}r.addTarget(f,j,g,q)}}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;q=void 0;if(k.length){q=[];for(p=0;p<k.length;++p)q[p]=k[p]+(j[p]-k[p])*h}else q=k+(j-k)*h;f.addTarget(g,i.transform,i.member,q)}}}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)};s.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=A(a.textContent);this.convert();return this};s.prototype.convert=function(){switch(this.type){case "matrix":this.obj=Z(this.data);break;case "rotate":this.angle=this.data[3]*Ha;case "translate":aa(this.data,-1);this.obj=new THREE.Vector3(this.data[0],
+this.data[1],this.data[2]);break;case "scale":aa(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)}};s.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)}};s.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}}};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=
+[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=S.evaluate(".//dae:instance_material",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new p).parse(d)),d=c.iterateNext()}}return this};p.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,
+"");return this};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=S.evaluate(".//dae:instance_material",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new p).parse(b)),b=a.iterateNext();break}}return this};q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<
+a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new 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");ba[d]==void 0&&(ba[d]=(new F(d)).parse(c));break;case "vertices":this.vertices=(new D).parse(c);break;case "triangles":this.primitives.push((new x).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");
+case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=ba[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ea(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,n=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":n.push(h.set)}for(;c<f.length;){var o=[],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=ba[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":o.push(i);break;case "NORMAL":p.push(ea(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(o[0],o[1],o[2],[p[0],p[1],p[2]],r.length?r:new THREE.Color));else if(m===4)d.push(new THREE.Face4(o[0],o[1],o[2],o[3],[p[0],p[1],p[2],p[3]],r.length?r:new THREE.Color));else if(m>4&&ha.subdivideFaces){r=r.length?r:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(o[0],o[e],o[e+1],[p[0],p[e++],p[e]],r))}if(d.length){o=
+0;for(p=d.length;o<p;o++){e=d[o];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<n.length;e++)r=q[n[e]],r=m>4?[r[0],r[o+1],r[o+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}};t.prototype=new x;t.prototype.constructor=t;x.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};x.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=W(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new y).parse(a.childNodes[b]));break;case "vcount":this.vcount=X(c.textContent);break;case "p":this.p=X(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=W(a,"count",0);this.stride=
+W(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new y).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};y.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
+"");this.set=W(a,"set",-1);this.offset=W(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.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),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=A(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=N(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};F.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=Z(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new J).parse(a.childNodes[b]);break}return this};u.prototype.isColor=function(){return this.texture==null};u.prototype.isTexture=function(){return this.texture!=
+null};u.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=A(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};u.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};I.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 u).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=S.evaluate(".//dae:float",c,P,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};I.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 u)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=wa[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(Aa+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=Ca;return this.material=new THREE.MeshLambertMaterial(a)};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 "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};R.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "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};V.prototype.create=function(){if(this.shader==null)return null};V.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};
+V.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 w(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new R(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};V.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};V.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 "constant":case "lambert":case "blinn":case "phong":this.shader=(new I(c.nodeName,this)).parse(c)}}};J.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};T.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 F).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new O(this)).parse(c));break;case "channel":this.channel.push((new Y(this)).parse(c))}}return this};Y.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");
+b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;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};O.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new y).parse(c))}}return this};
+O.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}};O.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":aa(c,-1);break;case "scale":aa(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?(Q=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){Ca=a},applySkin:e,geometries:ta,options:ha}};
+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)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,k,j,n,q,m,p,o,r,s,u,t,A=a.faces;n=a.vertices;var B=a.normals,z=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=n.length;k<
-j;)q=new THREE.Vertex,q.position.x=n[k++]*b,q.position.y=n[k++]*b,q.position.z=n[k++]*b,d.vertices.push(q);k=0;for(j=A.length;k<j;){b=A[k++];n=b&1;i=b&2;c=b&4;e=b&8;m=b&16;q=b&32;o=b&64;b&=128;n?(r=new THREE.Face4,r.a=A[k++],r.b=A[k++],r.c=A[k++],r.d=A[k++],n=4):(r=new THREE.Face3,r.a=A[k++],r.b=A[k++],r.c=A[k++],n=3);if(i)i=A[k++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<E;c++)s=a.uvs[c],p=A[k++],t=s[p*2],p=s[p*2+1],d.faceUvs[c][i]=new THREE.UV(t,p);if(e)for(c=0;c<E;c++){s=a.uvs[c];u=[];
-for(e=0;e<n;e++)p=A[k++],t=s[p*2],p=s[p*2+1],u[e]=new THREE.UV(t,p);d.faceVertexUvs[c][i]=u}if(m)m=A[k++]*3,e=new THREE.Vector3,e.x=B[m++],e.y=B[m++],e.z=B[m],r.normal=e;if(q)for(c=0;c<n;c++)m=A[k++]*3,e=new THREE.Vector3,e.x=B[m++],e.y=B[m++],e.z=B[m],r.vertexNormals.push(e);if(o)q=A[k++],q=new THREE.Color(z[q]),r.color=q;if(b)for(c=0;c<n;c++)q=A[k++],q=new THREE.Color(z[q]),r.vertexColors.push(q);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,j,n,q,m,p;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
-p=a.morphTargets[c].vertices;i=0;for(k=p.length;i<k;i+=3)j=p[i]*b,n=p[i+1]*b,q=p[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(j,n,q)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)n=new THREE.Color(16755200),n.setRGB(j[b],j[b+1],j[b+2]),k.push(n)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,j,k,o,s,n,p,m,q,r,t,x,v=a.faces;o=a.vertices;var D=a.normals,y=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=o.length;j<
+k;)s=new THREE.Vertex,s.position.x=o[j++]*b,s.position.y=o[j++]*b,s.position.z=o[j++]*b,d.vertices.push(s);j=0;for(k=v.length;j<k;){b=v[j++];o=b&1;i=b&2;c=b&4;e=b&8;n=b&16;s=b&32;m=b&64;b&=128;o?(q=new THREE.Face4,q.a=v[j++],q.b=v[j++],q.c=v[j++],q.d=v[j++],o=4):(q=new THREE.Face3,q.a=v[j++],q.b=v[j++],q.c=v[j++],o=3);if(i)i=v[j++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<F;c++)r=a.uvs[c],p=v[j++],x=r[p*2],p=r[p*2+1],d.faceUvs[c][i]=new THREE.UV(x,p);if(e)for(c=0;c<F;c++){r=a.uvs[c];t=[];
+for(e=0;e<o;e++)p=v[j++],x=r[p*2],p=r[p*2+1],t[e]=new THREE.UV(x,p);d.faceVertexUvs[c][i]=t}if(n)n=v[j++]*3,e=new THREE.Vector3,e.x=D[n++],e.y=D[n++],e.z=D[n],q.normal=e;if(s)for(c=0;c<o;c++)n=v[j++]*3,e=new THREE.Vector3,e.x=D[n++],e.y=D[n++],e.z=D[n],q.vertexNormals.push(e);if(m)s=v[j++],s=new THREE.Color(y[s]),q.color=s;if(b)for(c=0;c<o;c++)s=v[j++],s=new THREE.Color(y[s]),q.vertexColors.push(s);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,j,k,o,s,n,p;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
+p=a.morphTargets[c].vertices;i=0;for(j=p.length;i<j;i+=3)k=p[i]*b,o=p[i+1]*b,s=p[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,o,s)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(k[b],k[b+1],k[b+2]),j.push(o)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(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(q in Q.objects)if(!v.objects[q])if(s=Q.objects[q],s.geometry!==void 0){if(G=v.geometries[s.geometry]){a=!1;for(W=0;W<s.materials.length;W++)Z=v.materials[s.materials[W]],a=Z instanceof THREE.ShaderMaterial;a&&G.computeTangents();A=s.position;B=s.rotation;z=s.quaternion;E=s.scale;z=0;Z.length==0&&(Z=new THREE.MeshFaceMaterial);Z.length>1&&(Z=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(G,Z);a.name=q;a.position.set(A[0],A[1],A[2]);z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(B[0],B[1],B[2]);a.scale.set(E[0],E[1],E[2]);a.visible=s.visible;v.scene.add(a);v.objects[q]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);v.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(G),v.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b=
-{type:s.trigger,object:s},v.triggers[a.name]=b)}}else A=s.position,B=s.rotation,z=s.quaternion,E=s.scale,z=0,a=new THREE.Object3D,a.name=q,a.position.set(A[0],A[1],A[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(B[0],B[1],B[2]),a.scale.set(E[0],E[1],E[2]),a.visible=s.visible!==void 0?s.visible:!1,v.scene.add(a),v.objects[q]=a,v.empties[q]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},v.triggers[a.name]=b)}function f(a){return function(b){v.geometries[a]=
-b;e();T-=1;i.onLoadComplete();h()}}function g(a){return function(b){v.geometries[a]=b}}function h(){i.callbackProgress({totalModels:l,totalTextures:S,loadedModels:l-T,loadedTextures:S-R},v);i.onLoadProgress();T==0&&R==0&&b(v)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,n,q,m,p,o,r,s,u,t,A,B,z,E,H,w,G,y,K,Z,Q,X,T,R,l,S,v;Q=a;c=new THREE.BinaryLoader;X=new THREE.JSONLoader;R=T=0;v={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(q in Q.objects)if(s=Q.objects[q],s.meshCollider){a=!0;break}if(a)v.scene.collisions=new THREE.CollisionSystem;if(Q.transform)a=Q.transform.position,u=Q.transform.rotation,H=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]),H&&v.scene.scale.set(H[0],H[1],H[2]),(a||u||H)&&v.scene.updateMatrix();a=function(){R-=1;h();i.onLoadComplete()};for(p in Q.cameras)H=Q.cameras[p],H.type=="perspective"?y=new THREE.PerspectiveCamera(H.fov,H.aspect,
-H.near,H.far):H.type=="ortho"&&(y=new THREE.OrthographicCamera(H.left,H.right,H.top,H.bottom,H.near,H.far)),A=H.position,u=H.target,H=H.up,y.position.set(A[0],A[1],A[2]),y.target=new THREE.Vector3(u[0],u[1],u[2]),H&&y.up.set(H[0],H[1],H[2]),v.cameras[p]=y;for(m in Q.lights)u=Q.lights[m],p=u.color!==void 0?u.color:16777215,y=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(A=u.direction,t=new THREE.DirectionalLight(p,y),t.position.set(A[0],A[1],A[2]),t.position.normalize()):u.type=="point"?
-(A=u.position,t=u.distance,t=new THREE.PointLight(p,y,t),t.position.set(A[0],A[1],A[2])):u.type=="ambient"&&(t=new THREE.AmbientLight(p)),v.scene.add(t),v.lights[m]=t;for(o in Q.fogs)m=Q.fogs[o],m.type=="linear"?K=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(K=new THREE.FogExp2(0,m.density)),H=m.color,K.color.setRGB(H[0],H[1],H[2]),v.fogs[o]=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];H=Q.defaults.bgcolor;
-v.bgColor=new THREE.Color;v.bgColor.setRGB(H[0],H[1],H[2]);v.bgColorAlpha=Q.defaults.bgalpha;for(j in Q.geometries)if(o=Q.geometries[j],o.type=="bin_mesh"||o.type=="ascii_mesh")T+=1,i.onLoadStart();l=T;for(j in Q.geometries)o=Q.geometries[j],o.type=="cube"?(G=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides),v.geometries[j]=G):o.type=="plane"?(G=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight),v.geometries[j]=
-G):o.type=="sphere"?(G=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight),v.geometries[j]=G):o.type=="cylinder"?(G=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs),v.geometries[j]=G):o.type=="torus"?(G=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT),v.geometries[j]=G):o.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(o.subdivisions),v.geometries[j]=G):o.type=="bin_mesh"?c.load(d(o.url,Q.urlBaseType),f(j)):o.type=="ascii_mesh"?X.load(d(o.url,
-Q.urlBaseType),f(j)):o.type=="embedded_mesh"&&(o=Q.embeds[o.id])&&X.createModel(o,g(j),"");for(r in Q.textures)if(j=Q.textures[r],j.url instanceof Array){R+=j.url.length;for(o=0;o<j.url.length;o++)i.onLoadStart()}else R+=1,i.onLoadStart();S=R;for(r in Q.textures){j=Q.textures[r];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){o=[];for(var W=0;W<j.url.length;W++)o[W]=d(j.url[W],Q.urlBaseType);o=THREE.ImageUtils.loadTextureCube(o,j.mapping,a)}else{o=
-THREE.ImageUtils.loadTexture(d(j.url,Q.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)o.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)o.magFilter=THREE[j.magFilter];if(j.repeat){o.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)o.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)o.wrapT=THREE.RepeatWrapping}j.offset&&o.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)o.wrapS=K[j.wrap[0]];
-if(K[j.wrap[1]]!==void 0)o.wrapT=K[j.wrap[1]]}}v.textures[r]=o}for(n in Q.materials){r=Q.materials[n];for(w in r.parameters)if(w=="envMap"||w=="map"||w=="lightMap")r.parameters[w]=v.textures[r.parameters[w]];else if(w=="shading")r.parameters[w]=r.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w=="blending")r.parameters[w]=THREE[r.parameters[w]]?THREE[r.parameters[w]]:THREE.NormalBlending;else if(w=="combine")r.parameters[w]=r.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;
-else if(w=="vertexColors")if(r.parameters[w]=="face")r.parameters[w]=THREE.FaceColors;else if(r.parameters[w])r.parameters[w]=THREE.VertexColors;if(r.parameters.opacity!==void 0&&r.parameters.opacity<1)r.parameters.transparent=!0;if(r.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);o=r.parameters.color;K=r.parameters.specular;c=r.parameters.ambient;X=r.parameters.shininess;a.tNormal.texture=v.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=
-r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=v.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(o);a.uSpecularColor.value.setHex(K);a.uAmbientColor.value.setHex(c);a.uShininess.value=X;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;r=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
-vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else r=new THREE[r.type](r.parameters);v.materials[n]=r}e();i.callbackSync(v);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(s in J.objects)if(!A.objects[s])if(r=J.objects[s],r.geometry!==void 0){if(I=A.geometries[r.geometry]){a=!1;for(X=0;X<r.materials.length;X++)V=A.materials[r.materials[X]],a=V instanceof THREE.ShaderMaterial;a&&I.computeTangents();v=r.position;D=r.rotation;y=r.quaternion;F=r.scale;y=0;V.length==0&&(V=new THREE.MeshFaceMaterial);V.length>1&&(V=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(I,V);a.name=s;a.position.set(v[0],v[1],v[2]);y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(D[0],D[1],D[2]);a.scale.set(F[0],F[1],F[2]);a.visible=r.visible;A.scene.add(a);A.objects[s]=a;if(r.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);A.scene.collisions.colliders.push(b)}if(r.castsShadow)b=new THREE.ShadowVolume(I),A.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},A.triggers[a.name]=b)}}else v=r.position,D=r.rotation,y=r.quaternion,F=r.scale,y=0,a=new THREE.Object3D,a.name=s,a.position.set(v[0],v[1],v[2]),y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(D[0],D[1],D[2]),a.scale.set(F[0],F[1],F[2]),a.visible=r.visible!==void 0?r.visible:!1,A.scene.add(a),A.objects[s]=a,A.empties[s]=a,r.trigger&&r.trigger.toLowerCase()!="none"&&(b={type:r.trigger,object:r},A.triggers[a.name]=b)}function f(a){return function(b){A.geometries[a]=
+b;e();Y-=1;i.onLoadComplete();h()}}function g(a){return function(b){A.geometries[a]=b}}function h(){i.callbackProgress({totalModels:l,totalTextures:P,loadedModels:l-Y,loadedTextures:P-O},A);i.onLoadProgress();Y==0&&O==0&&b(A)}var i=this,j=THREE.Loader.prototype.extractUrlbase(c),k,o,s,n,p,m,q,r,t,x,v,D,y,F,E,u,I,w,R,V,J,T,Y,O,l,P,A;J=a;c=new THREE.BinaryLoader;T=new THREE.JSONLoader;O=Y=0;A={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(s in J.objects)if(r=J.objects[s],r.meshCollider){a=!0;break}if(a)A.scene.collisions=new THREE.CollisionSystem;if(J.transform)a=J.transform.position,t=J.transform.rotation,E=J.transform.scale,a&&A.scene.position.set(a[0],a[1],a[2]),t&&A.scene.rotation.set(t[0],t[1],t[2]),E&&A.scene.scale.set(E[0],E[1],E[2]),(a||t||E)&&A.scene.updateMatrix();a=function(){O-=1;h();i.onLoadComplete()};for(p in J.cameras)E=J.cameras[p],E.type=="perspective"?w=new THREE.PerspectiveCamera(E.fov,E.aspect,
+E.near,E.far):E.type=="ortho"&&(w=new THREE.OrthographicCamera(E.left,E.right,E.top,E.bottom,E.near,E.far)),v=E.position,t=E.target,E=E.up,w.position.set(v[0],v[1],v[2]),w.target=new THREE.Vector3(t[0],t[1],t[2]),E&&w.up.set(E[0],E[1],E[2]),A.cameras[p]=w;for(n in J.lights)t=J.lights[n],p=t.color!==void 0?t.color:16777215,w=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(v=t.direction,x=new THREE.DirectionalLight(p,w),x.position.set(v[0],v[1],v[2]),x.position.normalize()):t.type=="point"?
+(v=t.position,x=t.distance,x=new THREE.PointLight(p,w,x),x.position.set(v[0],v[1],v[2])):t.type=="ambient"&&(x=new THREE.AmbientLight(p)),A.scene.add(x),A.lights[n]=x;for(m in J.fogs)n=J.fogs[m],n.type=="linear"?R=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(R=new THREE.FogExp2(0,n.density)),E=n.color,R.color.setRGB(E[0],E[1],E[2]),A.fogs[m]=R;if(A.cameras&&J.defaults.camera)A.currentCamera=A.cameras[J.defaults.camera];if(A.fogs&&J.defaults.fog)A.scene.fog=A.fogs[J.defaults.fog];E=J.defaults.bgcolor;
+A.bgColor=new THREE.Color;A.bgColor.setRGB(E[0],E[1],E[2]);A.bgColorAlpha=J.defaults.bgalpha;for(k in J.geometries)if(m=J.geometries[k],m.type=="bin_mesh"||m.type=="ascii_mesh")Y+=1,i.onLoadStart();l=Y;for(k in J.geometries)m=J.geometries[k],m.type=="cube"?(I=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),A.geometries[k]=I):m.type=="plane"?(I=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),A.geometries[k]=
+I):m.type=="sphere"?(I=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),A.geometries[k]=I):m.type=="cylinder"?(I=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),A.geometries[k]=I):m.type=="torus"?(I=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),A.geometries[k]=I):m.type=="icosahedron"?(I=new THREE.IcosahedronGeometry(m.subdivisions),A.geometries[k]=I):m.type=="bin_mesh"?c.load(d(m.url,J.urlBaseType),f(k)):m.type=="ascii_mesh"?T.load(d(m.url,
+J.urlBaseType),f(k)):m.type=="embedded_mesh"&&(m=J.embeds[m.id])&&T.createModel(m,g(k),"");for(q in J.textures)if(k=J.textures[q],k.url instanceof Array){O+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else O+=1,i.onLoadStart();P=O;for(q in J.textures){k=J.textures[q];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(var X=0;X<k.url.length;X++)m[X]=d(k.url[X],J.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=
+THREE.ImageUtils.loadTexture(d(k.url,J.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)m.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(R[k.wrap[0]]!==void 0)m.wrapS=R[k.wrap[0]];
+if(R[k.wrap[1]]!==void 0)m.wrapT=R[k.wrap[1]]}}A.textures[q]=m}for(o in J.materials){q=J.materials[o];for(u in q.parameters)if(u=="envMap"||u=="map"||u=="lightMap")q.parameters[u]=A.textures[q.parameters[u]];else if(u=="shading")q.parameters[u]=q.parameters[u]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(u=="blending")q.parameters[u]=THREE[q.parameters[u]]?THREE[q.parameters[u]]:THREE.NormalBlending;else if(u=="combine")q.parameters[u]=q.parameters[u]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;
+else if(u=="vertexColors")if(q.parameters[u]=="face")q.parameters[u]=THREE.FaceColors;else if(q.parameters[u])q.parameters[u]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);m=q.parameters.color;R=q.parameters.specular;c=q.parameters.ambient;T=q.parameters.shininess;a.tNormal.texture=A.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
+q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=A.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(R);a.uAmbientColor.value.setHex(c);a.uShininess.value=T;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
+vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);A.materials[o]=q}e();i.callbackSync(A);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]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,g,i){for(var j,k,r,s=a.length;i<s;i+=g)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*c,k=k/16383*c,r=r/16383*c,j+=d,k+=e,r+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(g[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,u,t,A,B=a.length;for(c=0;c<B;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;A=e;i=f;u=d;var z=e,E=f,H=k[z*3],w=k[z*3+1],z=k[z*3+2],G=k[E*3],y=k[E*3+1],E=k[E*3+2];u=new THREE.Vector3(k[u*3],k[u*3+1],k[u*3+2]);z=new THREE.Vector3(H,w,z);E=new THREE.Vector3(G,y,E);g.faces.push(new THREE.Face3(t,A,i,[u,z,E],null,0));g=j[d*2];d=j[d*2+1];i=j[e*2];u=j[e*
-2+1];t=j[f*2];A=j[f*2+1];f=b.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(t,A));f.push(u)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,g,i){for(var j,k,q,r=a.length;i<r;i+=g)j=a[i],k=a[i+1],q=a[i+2],j=j/16383*c,k=k/16383*c,q=q/16383*c,j+=d,k+=e,q+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,q)))})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(g[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,t,x,v,D=a.length;for(c=0;c<D;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;x=d;v=e;i=f;t=d;var y=e,F=f,E=j[y*3],u=j[y*3+1],y=j[y*3+2],I=j[F*3],w=j[F*3+1],F=j[F*3+2];t=new THREE.Vector3(j[t*3],j[t*3+1],j[t*3+2]);y=new THREE.Vector3(E,u,y);F=new THREE.Vector3(I,w,F);g.faces.push(new THREE.Face3(x,v,i,[t,y,F],null,0));g=k[d*2];d=k[d*2+1];i=k[e*2];t=k[e*
+2+1];x=k[f*2];v=k[f*2+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(x,v));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
-this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,f,g,h,i,k,j,n){g=(g-j)/(n-j);j=this.normal_cache;b[f]=h+g*this.delta;b[f+1]=i;b[f+2]=k;e[f]=this.lerp(j[a],j[a+3],g);e[f+1]=this.lerp(j[a+1],j[a+4],g);e[f+2]=this.lerp(j[a+2],j[a+5],g)};this.VIntY=function(a,b,e,f,g,h,i,k,j,n){g=(g-j)/(n-j);j=this.normal_cache;b[f]=h;b[f+1]=i+g*this.delta;b[f+2]=k;b=a+this.yd*
-3;e[f]=this.lerp(j[a],j[b],g);e[f+1]=this.lerp(j[a+1],j[b+1],g);e[f+2]=this.lerp(j[a+2],j[b+2],g)};this.VIntZ=function(a,b,e,f,g,h,i,k,j,n){g=(g-j)/(n-j);j=this.normal_cache;b[f]=h;b[f+1]=i;b[f+2]=k+g*this.delta;b=a+this.zd*3;e[f]=this.lerp(j[a],j[b],g);e[f+1]=this.lerp(j[a+1],j[b+1],g);e[f+2]=this.lerp(j[a+2],j[b+2],g)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,f,g,h){var i=f+1,k=f+this.yd,j=f+this.zd,n=i+this.yd,q=i+this.zd,m=f+this.yd+this.zd,p=i+this.yd+this.zd,o=0,r=this.field[f],s=this.field[i],u=this.field[k],t=this.field[n],A=this.field[j],B=this.field[q],z=this.field[m],E=this.field[p];r<g&&(o|=1);s<g&&(o|=2);u<g&&(o|=8);t<g&&(o|=4);A<g&&(o|=16);B<g&&(o|=32);z<g&&(o|=128);E<g&&(o|=64);var H=THREE.edgeTable[o];if(H===0)return 0;var w=this.delta,G=a+
-w,y=b+w,w=e+w;H&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,g,a,b,e,r,s));H&2&&(this.compNorm(i),this.compNorm(n),this.VIntY(i*3,this.vlist,this.nlist,3,g,G,b,e,s,t));H&4&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,6,g,a,y,e,u,t));H&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,g,a,b,e,r,u));H&16&&(this.compNorm(j),this.compNorm(q),this.VIntX(j*3,this.vlist,this.nlist,12,g,a,b,w,A,B));H&32&&(this.compNorm(q),
-this.compNorm(p),this.VIntY(q*3,this.vlist,this.nlist,15,g,G,b,w,B,E));H&64&&(this.compNorm(m),this.compNorm(p),this.VIntX(m*3,this.vlist,this.nlist,18,g,a,y,w,z,E));H&128&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,21,g,a,b,w,A,z));H&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(f*3,this.vlist,this.nlist,24,g,a,b,e,r,A));H&512&&(this.compNorm(i),this.compNorm(q),this.VIntZ(i*3,this.vlist,this.nlist,27,g,G,b,e,s,B));H&1024&&(this.compNorm(n),this.compNorm(p),this.VIntZ(n*
-3,this.vlist,this.nlist,30,g,G,y,e,t,E));H&2048&&(this.compNorm(k),this.compNorm(m),this.VIntZ(k*3,this.vlist,this.nlist,33,g,a,y,e,u,z));o<<=4;for(g=f=0;THREE.triTable[o+g]!=-1;)a=o+g,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),g+=3,f++;return f};this.posnormtriv=function(a,b,e,f,g,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[f];this.positionArray[i+
+this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,f,g,h,i,j,k,o){g=(g-k)/(o-k);k=this.normal_cache;b[f]=h+g*this.delta;b[f+1]=i;b[f+2]=j;e[f]=this.lerp(k[a],k[a+3],g);e[f+1]=this.lerp(k[a+1],k[a+4],g);e[f+2]=this.lerp(k[a+2],k[a+5],g)};this.VIntY=function(a,b,e,f,g,h,i,j,k,o){g=(g-k)/(o-k);k=this.normal_cache;b[f]=h;b[f+1]=i+g*this.delta;b[f+2]=j;b=a+this.yd*
+3;e[f]=this.lerp(k[a],k[b],g);e[f+1]=this.lerp(k[a+1],k[b+1],g);e[f+2]=this.lerp(k[a+2],k[b+2],g)};this.VIntZ=function(a,b,e,f,g,h,i,j,k,o){g=(g-k)/(o-k);k=this.normal_cache;b[f]=h;b[f+1]=i;b[f+2]=j+g*this.delta;b=a+this.zd*3;e[f]=this.lerp(k[a],k[b],g);e[f+1]=this.lerp(k[a+1],k[b+1],g);e[f+2]=this.lerp(k[a+2],k[b+2],g)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,f,g,h){var i=f+1,j=f+this.yd,k=f+this.zd,o=i+this.yd,s=i+this.zd,n=f+this.yd+this.zd,p=i+this.yd+this.zd,m=0,q=this.field[f],r=this.field[i],t=this.field[j],x=this.field[o],v=this.field[k],D=this.field[s],y=this.field[n],F=this.field[p];q<g&&(m|=1);r<g&&(m|=2);t<g&&(m|=8);x<g&&(m|=4);v<g&&(m|=16);D<g&&(m|=32);y<g&&(m|=128);F<g&&(m|=64);var E=THREE.edgeTable[m];if(E===0)return 0;var u=this.delta,I=a+
+u,w=b+u,u=e+u;E&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,g,a,b,e,q,r));E&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,g,I,b,e,r,x));E&4&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,6,g,a,w,e,t,x));E&8&&(this.compNorm(f),this.compNorm(j),this.VIntY(f*3,this.vlist,this.nlist,9,g,a,b,e,q,t));E&16&&(this.compNorm(k),this.compNorm(s),this.VIntX(k*3,this.vlist,this.nlist,12,g,a,b,u,v,D));E&32&&(this.compNorm(s),
+this.compNorm(p),this.VIntY(s*3,this.vlist,this.nlist,15,g,I,b,u,D,F));E&64&&(this.compNorm(n),this.compNorm(p),this.VIntX(n*3,this.vlist,this.nlist,18,g,a,w,u,y,F));E&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,21,g,a,b,u,v,y));E&256&&(this.compNorm(f),this.compNorm(k),this.VIntZ(f*3,this.vlist,this.nlist,24,g,a,b,e,q,v));E&512&&(this.compNorm(i),this.compNorm(s),this.VIntZ(i*3,this.vlist,this.nlist,27,g,I,b,e,r,D));E&1024&&(this.compNorm(o),this.compNorm(p),this.VIntZ(o*
+3,this.vlist,this.nlist,30,g,I,w,e,x,F));E&2048&&(this.compNorm(j),this.compNorm(n),this.VIntZ(j*3,this.vlist,this.nlist,33,g,a,w,e,t,y));m<<=4;for(g=f=0;THREE.triTable[m+g]!=-1;)a=m+g,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),g+=3,f++;return f};this.posnormtriv=function(a,b,e,f,g,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[f];this.positionArray[i+
 4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[g];this.positionArray[i+7]=a[g+1];this.positionArray[i+8]=a[g+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[f];this.normalArray[i+4]=b[f+1];this.normalArray[i+5]=b[f+2];this.normalArray[i+6]=b[g];this.normalArray[i+7]=b[g+1];this.normalArray[i+8]=b[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var h=this.size*Math.sqrt(f/g),i=e*this.size,k=b*this.size,j=a*this.size,n=Math.floor(i-h);n<1&&(n=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var q=Math.floor(k-h);q<1&&(q=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var m=Math.floor(j-h);m<1&&(m=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
-1);for(var p,o,r,s,u,t;n<i;n++){j=this.size2*n;o=n/this.size-e;u=o*o;for(o=q;o<k;o++){r=j+this.size*o;p=o/this.size-b;t=p*p;for(p=m;p<h;p++)s=p/this.size-a,s=f/(1.0E-6+s*s+t+u)-g,s>0&&(this.field[r+p]+=s)}}};this.addPlaneX=function(a,b){var e,f,g,h,i,k=this.size,j=this.yd,n=this.zd,q=this.field,m=k*Math.sqrt(a/b);m>k&&(m=k);for(e=0;e<m;e++)if(f=e/k,f*=f,h=a/(1.0E-4+f)-b,h>0)for(f=0;f<k;f++){i=e+f*j;for(g=0;g<k;g++)q[n*g+i]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,i,k,j=this.size,n=this.yd,q=
-this.zd,m=this.field,p=j*Math.sqrt(a/b);p>j&&(p=j);for(f=0;f<p;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=f*n;for(e=0;e<j;e++){k=i+e;for(g=0;g<j;g++)m[q*g+k]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,i,k,j=this.size,n=this.yd,q=this.zd,m=this.field,p=j*Math.sqrt(a/b);p>j&&(p=j);for(g=0;g<p;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=q*g;for(f=0;f<j;f++){k=i+f*n;for(e=0;e<j;e++)m[k+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=
-function(a){this.begin();var b,e,f,g,h,i,k,j,n,q=this.size-2;for(g=1;g<q;g++){n=this.size2*g;k=(g-this.halfsize)/this.halfsize;for(f=1;f<q;f++){j=n+this.size*f;i=(f-this.halfsize)/this.halfsize;for(e=1;e<q;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(f){var g,h,i,k,j,n,q,m;for(g=0;g<f.count;g++)q=g*3,j=q+1,m=q+2,h=f.positionArray[q],i=f.positionArray[j],k=
-f.positionArray[m],n=new THREE.Vector3(h,i,k),h=f.normalArray[q],i=f.normalArray[j],k=f.normalArray[m],q=new THREE.Vector3(h,i,k),q.normalize(),j=new THREE.Vertex(n),b.vertices.push(j),e.push(q);n=f.count/3;for(g=0;g<n;g++)q=(a+g)*3,j=q+1,m=q+2,h=e[q],i=e[j],k=e[m],q=new THREE.Face3(q,j,m,[h,i,k]),b.faces.push(q);a+=n;f.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var h=this.size*Math.sqrt(f/g),i=e*this.size,j=b*this.size,k=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var s=Math.floor(j-h);s<1&&(s=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var n=Math.floor(k-h);n<1&&(n=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
+1);for(var p,m,q,r,t,x;o<i;o++){k=this.size2*o;m=o/this.size-e;t=m*m;for(m=s;m<j;m++){q=k+this.size*m;p=m/this.size-b;x=p*p;for(p=n;p<h;p++)r=p/this.size-a,r=f/(1.0E-6+r*r+x+t)-g,r>0&&(this.field[q+p]+=r)}}};this.addPlaneX=function(a,b){var e,f,g,h,i,j=this.size,k=this.yd,o=this.zd,s=this.field,n=j*Math.sqrt(a/b);n>j&&(n=j);for(e=0;e<n;e++)if(f=e/j,f*=f,h=a/(1.0E-4+f)-b,h>0)for(f=0;f<j;f++){i=e+f*k;for(g=0;g<j;g++)s[o*g+i]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,i,j,k=this.size,o=this.yd,s=
+this.zd,n=this.field,p=k*Math.sqrt(a/b);p>k&&(p=k);for(f=0;f<p;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,h>0){i=f*o;for(e=0;e<k;e++){j=i+e;for(g=0;g<k;g++)n[s*g+j]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,i,j,k=this.size,o=this.yd,s=this.zd,n=this.field,p=k*Math.sqrt(a/b);p>k&&(p=k);for(g=0;g<p;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,h>0){i=s*g;for(f=0;f<k;f++){j=i+f*o;for(e=0;e<k;e++)n[j+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=
+function(a){this.begin();var b,e,f,g,h,i,j,k,o,s=this.size-2;for(g=1;g<s;g++){o=this.size2*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<s;f++){k=o+this.size*f;i=(f-this.halfsize)/this.halfsize;for(e=1;e<s;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,j,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(f){var g,h,i,j,k,o,s,n;for(g=0;g<f.count;g++)s=g*3,k=s+1,n=s+2,h=f.positionArray[s],i=f.positionArray[k],j=
+f.positionArray[n],o=new THREE.Vector3(h,i,j),h=f.normalArray[s],i=f.normalArray[k],j=f.normalArray[n],s=new THREE.Vector3(h,i,j),s.normalize(),k=new THREE.Vertex(o),b.vertices.push(k),e.push(s);o=f.count/3;for(g=0;g<o;g++)s=(a+g)*3,k=s+1,n=s+2,h=e[s],i=e[k],j=e[n],s=new THREE.Face3(s,k,n,[h,i,j]),b.faces.push(s);a+=o;f.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -725,29 +725,29 @@ d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.verti
 d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
 b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
 !0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
-"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,f,g,h){var a=a.__webglFlares,i=a.length;if(i){var k=new THREE.Vector3,j=h/g,n=g*0.5,q=h*0.5,m=16/h,p=new THREE.Vector2(m*j,m),o=new THREE.Vector3(1,1,0),r=new THREE.Vector2(1,1),s=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
-b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(s.occlusionMap,0);b.uniform1i(s.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var u,t,A,B,z;for(u=0;u<i;u++)if(m=16/h,p.set(m*j,m),B=a[u],k.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34),f.matrixWorldInverse.multiplyVector3(k),
-f.projectionMatrix.multiplyVector3(k),o.copy(k),r.x=o.x*n+n,r.y=o.y*q+q,d.hasVertexTexture||r.x>0&&r.x<g&&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(s.renderType,0);b.uniform2f(s.scale,p.x,p.y);b.uniform3f(s.screenPosition,o.x,o.y,o.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(s.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(o);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(s.renderType,2);b.enable(b.BLEND);t=0;for(A=B.lensFlares.length;t<A;t++)if(z=B.lensFlares[t],z.opacity>0.0010&&z.scale>0.0010)o.x=z.x,o.y=z.y,o.z=z.z,m=z.size*z.scale/
-h,p.x=m*j,p.y=m,b.uniform3f(s.screenPosition,o.x,o.y,o.z),b.uniform2f(s.scale,p.x,p.y),b.uniform1f(s.rotation,z.rotation),b.uniform1f(s.opacity,z.opacity),b.uniform3f(s.color,z.color.r,z.color.g,z.color.b),c.setBlending(z.blending),c.setTexture(z.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,f,g,h){var a=a.__webglFlares,i=a.length;if(i){var j=new THREE.Vector3,k=h/g,o=g*0.5,s=h*0.5,n=16/h,p=new THREE.Vector2(n*k,n),m=new THREE.Vector3(1,1,0),q=new THREE.Vector2(1,1),r=d.uniforms,n=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(r.occlusionMap,0);b.uniform1i(r.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(n.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(n.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var t,x,v,D,y;for(t=0;t<i;t++)if(n=16/h,p.set(n*k,n),D=a[t],j.set(D.matrixWorld.n14,D.matrixWorld.n24,D.matrixWorld.n34),f.matrixWorldInverse.multiplyVector3(j),
+f.projectionMatrix.multiplyVector3(j),m.copy(j),q.x=m.x*o+o,q.y=m.y*s+s,d.hasVertexTexture||q.x>0&&q.x<g&&q.y>0&&q.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,q.x-8,q.y-8,16,16,0);b.uniform1i(r.renderType,0);b.uniform2f(r.scale,p.x,p.y);b.uniform3f(r.screenPosition,m.x,m.y,m.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,q.x-8,q.y-8,16,16,0);b.uniform1i(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);D.positionScreen.copy(m);D.customUpdateCallback?D.customUpdateCallback(D):D.updateLensFlares();b.uniform1i(r.renderType,2);b.enable(b.BLEND);x=0;for(v=D.lensFlares.length;x<v;x++)if(y=D.lensFlares[x],y.opacity>0.0010&&y.scale>0.0010)m.x=y.x,m.y=y.y,m.z=y.z,n=y.size*y.scale/
+h,p.x=n*k,p.y=n,b.uniform3f(r.screenPosition,m.x,m.y,m.z),b.uniform2f(r.scale,p.x,p.y),b.uniform1f(r.rotation,y.rotation),b.uniform1f(r.opacity,y.opacity),b.uniform3f(r.color,y.color.r,y.color.g,y.color.b),c.setBlending(y.blending),c.setTexture(y.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 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,n,q,m,p,o,r=0,s=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(k=s.length;i<k;i++)if(p=s[i],p.castShadow&&p instanceof THREE.SpotLight){this.shadowMap[r]||(this.shadowMap[r]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
-format:THREE.RGBAFormat}),this.shadowMatrix[r]=new THREE.Matrix4);j=this.shadowMap[r];n=this.shadowMatrix[r];e.position.copy(p.position);e.lookAt(p.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(e.projectionMatrix);n.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
-new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);g.multiply(e.projectionMatrix,e.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();n=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,n);o=h.__webglObjects;j=0;for(n=o.length;j<n;j++)if(q=o[j],p=q.object,q.render=!1,p.visible&&p.castShadow&&
-(!(p instanceof THREE.Mesh)||!p.frustumCulled||f.contains(p)))p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),q.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(n=o.length;j<n;j++)if(q=o[j],q.render)p=q.object,q=q.buffer,b.setObjectFaces(p),m=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?d:c,q instanceof THREE.BufferGeometry?b.renderBufferDirect(e,
-s,null,m,q,p):b.renderBuffer(e,s,null,m,q,p);o=h.__webglObjectsImmediate;j=0;for(n=o.length;j<n;j++)q=o[j],p=q.object,p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),b.renderImmediateObject(e,s,null,c,p));r++}}};
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,j,k,o,s,n,p,m,q=0,r=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(j=r.length;i<j;i++)if(p=r[i],p.castShadow&&p instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);k=this.shadowMap[q];o=this.shadowMatrix[q];e.position.copy(p.position);e.lookAt(p.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(e.projectionMatrix);o.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
+new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);g.multiply(e.projectionMatrix,e.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(k);a.clearColor(1,0,1,1);b.clear();k=b.getClearColor();o=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,o);m=h.__webglObjects;k=0;for(o=m.length;k<o;k++)if(s=m[k],p=s.object,s.render=!1,p.visible&&p.castShadow&&
+(!(p instanceof THREE.Mesh)||!p.frustumCulled||f.contains(p)))p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),s.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);k=0;for(o=m.length;k<o;k++)if(s=m[k],s.render)p=s.object,s=s.buffer,b.setObjectFaces(p),n=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?d:c,s instanceof THREE.BufferGeometry?b.renderBufferDirect(e,
+r,null,n,s,p):b.renderBuffer(e,r,null,n,s,p);m=h.__webglObjectsImmediate;k=0;for(o=m.length;k<o;k++)s=m[k],p=s.object,p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),b.renderImmediateObject(e,r,null,c,p));q++}}};
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
 2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,f=b.createProgram(),g=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(g,a.fragmentShader);b.shaderSource(h,a.vertexShader);
 b.compileShader(g);b.compileShader(h);b.attachShader(f,g);b.attachShader(f,h);b.linkProgram(f);d.program=f;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
 b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
-"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,f,g,h){var e=e.__webglSprites,i=e.length;if(i){var k=d.attributes,j=d.uniforms,n=h/g;g*=0.5;var q=h*0.5,m=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(k.position,
-2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var p,o=[],k=0;k<i;k++)if(p=e[k],p.visible&&p.opacity!==0)p.useScreenCoordinates?p.z=-p.position.z:(p._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),p.z=-p._modelViewMatrix.n34);e.sort(a);for(k=0;k<i;k++)p=e[k],p.visible&&
-p.opacity!==0&&p.map&&p.map.image&&p.map.image.width&&(p.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(p.position.x-g)/g,(q-p.position.y)/q,Math.max(0,Math.min(1,p.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,p.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,p._modelViewMatrixArray)),f=p.map.image.width/(p.scaleByViewport?h:1),o[0]=f*n*p.scale.x,o[1]=f*p.scale.y,b.uniform2f(j.uvScale,p.uvScale.x,
-p.uvScale.y),b.uniform2f(j.uvOffset,p.uvOffset.x,p.uvOffset.y),b.uniform2f(j.alignment,p.alignment.x,p.alignment.y),b.uniform1f(j.opacity,p.opacity),b.uniform3f(j.color,p.color.r,p.color.g,p.color.b),b.uniform1f(j.rotation,p.rotation),b.uniform2fv(j.scale,o),p.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!p.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!1),c.setBlending(p.blending),c.setTexture(p.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,n;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},q=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.PerspectiveCamera(53,
-1,1,1E4);p.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:q},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-o=new THREE.Scene;o.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));o.add(p);this.setSize=function(a,d){c.call(b,a,d);q.width=a;q.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||j!==c.far||n!==c.fov){i=c.aspect;k=c.near;j=c.far;n=c.fov;var u=c.projectionMatrix.clone(),t=125/30*0.5,A=t*k/125,B=k*Math.tan(n*Math.PI/360),z;g.n14=t;h.n14=-t;t=-B*i+A;z=B*i+A;u.n11=2*k/(z-t);u.n13=(z+t)/(z-t);e.projectionMatrix.copy(u);t=-B*i-A;z=B*i-A;u.n11=
-2*k/(z-t);u.n13=(z+t)/(z-t);f.projectionMatrix.copy(u)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,q,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,m,!0);o.updateMatrixWorld();d.call(b,o,p)}};
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,f,g,h){var e=e.__webglSprites,i=e.length;if(i){var j=d.attributes,k=d.uniforms,o=h/g;g*=0.5;var s=h*0.5,n=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(j.position),b.enableVertexAttribArray(j.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(j.position,
+2,b.FLOAT,!1,16,0);b.vertexAttribPointer(j.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(k.projectionMatrix,!1,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(k.map,0);for(var p,m=[],j=0;j<i;j++)if(p=e[j],p.visible&&p.opacity!==0)p.useScreenCoordinates?p.z=-p.position.z:(p._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),p.z=-p._modelViewMatrix.n34);e.sort(a);for(j=0;j<i;j++)p=e[j],p.visible&&
+p.opacity!==0&&p.map&&p.map.image&&p.map.image.width&&(p.useScreenCoordinates?(b.uniform1i(k.useScreenCoordinates,1),b.uniform3f(k.screenPosition,(p.position.x-g)/g,(s-p.position.y)/s,Math.max(0,Math.min(1,p.position.z)))):(b.uniform1i(k.useScreenCoordinates,0),b.uniform1i(k.affectedByDistance,p.affectedByDistance?1:0),b.uniformMatrix4fv(k.modelViewMatrix,!1,p._modelViewMatrixArray)),f=p.map.image.width/(p.scaleByViewport?h:1),m[0]=f*o*p.scale.x,m[1]=f*p.scale.y,b.uniform2f(k.uvScale,p.uvScale.x,
+p.uvScale.y),b.uniform2f(k.uvOffset,p.uvOffset.x,p.uvOffset.y),b.uniform2f(k.alignment,p.alignment.x,p.alignment.y),b.uniform1f(k.opacity,p.opacity),b.uniform3f(k.color,p.color.r,p.color.g,p.color.b),b.uniform1f(k.rotation,p.rotation),b.uniform2fv(k.scale,m),p.mergeWith3D&&!n?(b.enable(b.DEPTH_TEST),n=!0):!p.mergeWith3D&&n&&(b.disable(b.DEPTH_TEST),n=!1),c.setBlending(p.blending),c.setTexture(p.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,o;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},s=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.PerspectiveCamera(53,
+1,1,1E4);p.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:s},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(p);this.setSize=function(a,d){c.call(b,a,d);s.width=a;s.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||o!==c.fov){i=c.aspect;j=c.near;k=c.far;o=c.fov;var t=c.projectionMatrix.clone(),x=125/30*0.5,v=x*j/125,D=j*Math.tan(o*Math.PI/360),y;g.n14=x;h.n14=-x;x=-D*i+v;y=D*i+v;t.n11=2*j/(y-x);t.n13=(y+x)/(y-x);e.projectionMatrix.copy(t);x=-D*i-v;y=D*i-v;t.n11=
+2*j/(y-x);t.n13=(y+x)/(y-x);f.projectionMatrix.copy(t)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,s,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,n,!0);m.updateMatrixWorld();d.call(b,m,p)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,f,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
 c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 144 - 143
build/custom/ThreeWebGL.js

@@ -16,39 +16,39 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,d,c){this.x=a;this.y=b;this.z=d;this.w=c;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};
-THREE.Ray=function(a,b){function d(a,b,d){p.sub(d,a);m=p.dot(b);if(m<=0)return null;E=r.add(a,v.copy(b).multiplyScalar(m));return y=d.distanceTo(E)}function c(a,b,d,c){p.sub(c,b);r.sub(d,b);v.sub(a,b);J=p.dot(p);O=p.dot(r);P=p.dot(v);V=r.dot(r);C=r.dot(v);D=1/(J*V-O*O);N=(V*P-O*C)*D;Q=(J*C-O*P)*D;return N>=0&&Q>=0&&N+Q<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
-d,c=[];b=0;for(d=a.length;b<d;b++)Array.prototype.push.apply(c,this.intersectObject(a[b]));c.sort(function(a,b){return a.distance-b.distance});return c};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(m){for(var v,p=[],r=0,E=m.children.length;r<E;r++)Array.prototype.push.apply(p,this.intersectObject(m.children[r]));if(m instanceof THREE.Particle){r=
-d(this.origin,this.direction,m.matrixWorld.getPosition());if(r===null||r>m.scale.x)return[];v={distance:r,point:m.position,face:null,object:m};p.push(v)}else if(m instanceof THREE.Mesh){r=d(this.origin,this.direction,m.matrixWorld.getPosition());if(r===null||r>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return p;var y,C=m.geometry,J=C.vertices,H;m.matrixRotationWorld.extractRotation(m.matrixWorld);r=0;for(E=C.faces.length;r<E;r++)if(v=C.faces[r],a.copy(this.origin),
-b.copy(this.direction),H=m.matrixWorld,l=H.multiplyVector3(l.copy(v.centroid)).subSelf(a),y=l.dot(b),!(y<=0)&&(f=H.multiplyVector3(f.copy(J[v.a].position)),g=H.multiplyVector3(g.copy(J[v.b].position)),h=H.multiplyVector3(h.copy(J[v.c].position)),v instanceof THREE.Face4&&(i=H.multiplyVector3(i.copy(J[v.d].position))),k=m.matrixRotationWorld.multiplyVector3(k.copy(v.normal)),y=b.dot(k),m.doubleSided||(m.flipSided?y>0:y<0)))if(y=k.dot(l.sub(f,a))/y,j.add(a,b.multiplyScalar(y)),v instanceof THREE.Face3)c(j,
-f,g,h)&&(v={distance:a.distanceTo(j),point:j.clone(),face:v,object:m},p.push(v));else if(v instanceof THREE.Face4&&(c(j,f,g,i)||c(j,g,h,i)))v={distance:a.distanceTo(j),point:j.clone(),face:v,object:m},p.push(v)}return p};var p=new THREE.Vector3,r=new THREE.Vector3,v=new THREE.Vector3,m,E,y,J,O,P,V,C,D,N,Q};
+THREE.Ray=function(a,b){function d(a,b,d){p.sub(d,a);n=p.dot(b);if(n<=0)return null;C=v.add(a,r.copy(b).multiplyScalar(n));return y=d.distanceTo(C)}function c(a,b,d,c){p.sub(c,b);v.sub(d,b);r.sub(a,b);J=p.dot(p);O=p.dot(v);P=p.dot(r);V=v.dot(v);D=v.dot(r);E=1/(J*V-O*O);N=(V*P-O*D)*E;Q=(J*D-O*P)*E;return N>=0&&Q>=0&&N+Q<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
+d,c=[];b=0;for(d=a.length;b<d;b++)Array.prototype.push.apply(c,this.intersectObject(a[b]));c.sort(function(a,b){return a.distance-b.distance});return c};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(n){for(var r,p=[],v=0,C=n.children.length;v<C;v++)Array.prototype.push.apply(p,this.intersectObject(n.children[v]));if(n instanceof THREE.Particle){v=
+d(this.origin,this.direction,n.matrixWorld.getPosition());if(v===null||v>n.scale.x)return[];r={distance:v,point:n.position,face:null,object:n};p.push(r)}else if(n instanceof THREE.Mesh){v=d(this.origin,this.direction,n.matrixWorld.getPosition());if(v===null||v>n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)))return p;var y,D=n.geometry,J=D.vertices,H;n.matrixRotationWorld.extractRotation(n.matrixWorld);v=0;for(C=D.faces.length;v<C;v++)if(r=D.faces[v],a.copy(this.origin),
+b.copy(this.direction),H=n.matrixWorld,l=H.multiplyVector3(l.copy(r.centroid)).subSelf(a),y=l.dot(b),!(y<=0)&&(f=H.multiplyVector3(f.copy(J[r.a].position)),g=H.multiplyVector3(g.copy(J[r.b].position)),h=H.multiplyVector3(h.copy(J[r.c].position)),r instanceof THREE.Face4&&(i=H.multiplyVector3(i.copy(J[r.d].position))),k=n.matrixRotationWorld.multiplyVector3(k.copy(r.normal)),y=b.dot(k),n.doubleSided||(n.flipSided?y>0:y<0)))if(y=k.dot(l.sub(f,a))/y,j.add(a,b.multiplyScalar(y)),r instanceof THREE.Face3)c(j,
+f,g,h)&&(r={distance:a.distanceTo(j),point:j.clone(),face:r,object:n},p.push(r));else if(r instanceof THREE.Face4&&(c(j,f,g,i)||c(j,g,h,i)))r={distance:a.distanceTo(j),point:j.clone(),face:r,object:n},p.push(r)}return p};var p=new THREE.Vector3,v=new THREE.Vector3,r=new THREE.Vector3,n,C,y,J,O,P,V,D,E,N,Q};
 THREE.Rectangle=function(){function a(){g=c-b;h=f-d}var b,d,c,f,g,h,i=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return c};this.getBottom=function(){return f};this.set=function(g,h,j,p){i=!1;b=g;d=h;c=j;f=p;a()};this.addPoint=function(g,h){i?(i=!1,b=g,d=h,c=g,f=h):(b=b<g?b:g,d=d<h?d:h,c=c>g?c:g,f=f>h?f:h);a()};this.add3Points=
-function(g,h,j,p,r,v){i?(i=!1,b=g<j?g<r?g:r:j<r?j:r,d=h<p?h<v?h:v:p<v?p:v,c=g>j?g>r?g:r:j>r?j:r,f=h>p?h>v?h:v:p>v?p:v):(b=g<j?g<r?g<b?g:b:r<b?r:b:j<r?j<b?j:b:r<b?r:b,d=h<p?h<v?h<d?h:d:v<d?v:d:p<v?p<d?p:d:v<d?v:d,c=g>j?g>r?g>c?g:c:r>c?r:c:j>r?j>c?j:c:r>c?r:c,f=h>p?h>v?h>f?h:f:v>f?v:f:p>v?p>f?p:f:v>f?v:f);a()};this.addRectangle=function(g){i?(i=!1,b=g.getLeft(),d=g.getTop(),c=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),d=d<g.getTop()?d:g.getTop(),c=c>g.getRight()?c:g.getRight(),f=f>
+function(g,h,j,p,v,r){i?(i=!1,b=g<j?g<v?g:v:j<v?j:v,d=h<p?h<r?h:r:p<r?p:r,c=g>j?g>v?g:v:j>v?j:v,f=h>p?h>r?h:r:p>r?p:r):(b=g<j?g<v?g<b?g:b:v<b?v:b:j<v?j<b?j:b:v<b?v:b,d=h<p?h<r?h<d?h:d:r<d?r:d:p<r?p<d?p:d:r<d?r:d,c=g>j?g>v?g>c?g:c:v>c?v:c:j>v?j>c?j:c:v>c?v:c,f=h>p?h>r?h>f?h:f:r>f?r:f:p>r?p>f?p:f:r>f?r:f);a()};this.addRectangle=function(g){i?(i=!1,b=g.getLeft(),d=g.getTop(),c=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),d=d<g.getTop()?d:g.getTop(),c=c>g.getRight()?c:g.getRight(),f=f>
 g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;d-=g;c+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();d=d>g.getTop()?d:g.getTop();c=c<g.getRight()?c:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){if(c<a.getLeft())return!1;if(b>a.getRight())return!1;if(f<a.getTop())return!1;if(d>a.getBottom())return!1;return!0};this.empty=function(){i=!0;f=c=d=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Math={clamp:function(a,b,d){return a<b?b:a>d?d:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,d,c,f){return c+(a-b)*(f-c)/(d-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,d,c,f,g,h,i,l,k,j,p,r,v,m,E){this.set(a!==void 0?a:1,b||0,d||0,c||0,f||0,g!==void 0?g:1,h||0,i||0,l||0,k||0,j!==void 0?j:1,p||0,r||0,v||0,m||0,E!==void 0?E:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,d,c,f,g,h,i,l,k,j,p,r,v,m,E){this.n11=a;this.n12=b;this.n13=d;this.n14=c;this.n21=f;this.n22=g;this.n23=h;this.n24=i;this.n31=l;this.n32=k;this.n33=j;this.n34=p;this.n41=r;this.n42=v;this.n43=m;this.n44=E;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,d){var c=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;c.cross(d,g).normalize();c.length()===0&&(g.x+=1.0E-4,c.cross(d,g).normalize());f.cross(g,c).normalize();this.n11=c.x;this.n12=f.x;this.n13=g.x;this.n21=c.y;this.n22=f.y;this.n23=g.y;this.n31=c.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var d=a.n11,c=a.n12,f=a.n13,g=a.n14,h=a.n21,i=a.n22,l=a.n23,k=a.n24,j=a.n31,p=a.n32,r=a.n33,v=a.n34,m=a.n41,E=a.n42,y=a.n43,
-J=a.n44,O=b.n11,P=b.n12,V=b.n13,C=b.n14,D=b.n21,N=b.n22,Q=b.n23,ma=b.n24,ua=b.n31,ha=b.n32,ca=b.n33,pa=b.n34,ja=b.n41,xa=b.n42,va=b.n43,H=b.n44;this.n11=d*O+c*D+f*ua+g*ja;this.n12=d*P+c*N+f*ha+g*xa;this.n13=d*V+c*Q+f*ca+g*va;this.n14=d*C+c*ma+f*pa+g*H;this.n21=h*O+i*D+l*ua+k*ja;this.n22=h*P+i*N+l*ha+k*xa;this.n23=h*V+i*Q+l*ca+k*va;this.n24=h*C+i*ma+l*pa+k*H;this.n31=j*O+p*D+r*ua+v*ja;this.n32=j*P+p*N+r*ha+v*xa;this.n33=j*V+p*Q+r*ca+v*va;this.n34=j*C+p*ma+r*pa+v*H;this.n41=m*O+E*D+y*ua+J*ja;this.n42=
-m*P+E*N+y*ha+J*xa;this.n43=m*V+E*Q+y*ca+J*va;this.n44=m*C+E*ma+y*pa+J*H;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=
+THREE.Matrix4=function(a,b,d,c,f,g,h,i,l,k,j,p,v,r,n,C){this.set(a!==void 0?a:1,b||0,d||0,c||0,f||0,g!==void 0?g:1,h||0,i||0,l||0,k||0,j!==void 0?j:1,p||0,v||0,r||0,n||0,C!==void 0?C:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,d,c,f,g,h,i,l,k,j,p,v,r,n,C){this.n11=a;this.n12=b;this.n13=d;this.n14=c;this.n21=f;this.n22=g;this.n23=h;this.n24=i;this.n31=l;this.n32=k;this.n33=j;this.n34=p;this.n41=v;this.n42=r;this.n43=n;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,d){var c=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;c.cross(d,g).normalize();c.length()===0&&(g.x+=1.0E-4,c.cross(d,g).normalize());f.cross(g,c).normalize();this.n11=c.x;this.n12=f.x;this.n13=g.x;this.n21=c.y;this.n22=f.y;this.n23=g.y;this.n31=c.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var d=a.n11,c=a.n12,f=a.n13,g=a.n14,h=a.n21,i=a.n22,l=a.n23,k=a.n24,j=a.n31,p=a.n32,v=a.n33,r=a.n34,n=a.n41,C=a.n42,y=a.n43,
+J=a.n44,O=b.n11,P=b.n12,V=b.n13,D=b.n14,E=b.n21,N=b.n22,Q=b.n23,ma=b.n24,ua=b.n31,ha=b.n32,ca=b.n33,pa=b.n34,ja=b.n41,xa=b.n42,va=b.n43,H=b.n44;this.n11=d*O+c*E+f*ua+g*ja;this.n12=d*P+c*N+f*ha+g*xa;this.n13=d*V+c*Q+f*ca+g*va;this.n14=d*D+c*ma+f*pa+g*H;this.n21=h*O+i*E+l*ua+k*ja;this.n22=h*P+i*N+l*ha+k*xa;this.n23=h*V+i*Q+l*ca+k*va;this.n24=h*D+i*ma+l*pa+k*H;this.n31=j*O+p*E+v*ua+r*ja;this.n32=j*P+p*N+v*ha+r*xa;this.n33=j*V+p*Q+v*ca+r*va;this.n34=j*D+p*ma+v*pa+r*H;this.n41=n*O+C*E+y*ua+J*ja;this.n42=
+n*P+C*N+y*ha+J*xa;this.n43=n*V+C*Q+y*ca+J*va;this.n44=n*D+C*ma+y*pa+J*H;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplyScalar:function(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,d=a.y,c=a.z,f=1/(this.n41*b+this.n42*d+this.n43*c+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*c+this.n14)*f;a.y=(this.n21*b+this.n22*d+this.n23*c+this.n24)*f;a.z=(this.n31*b+this.n32*d+this.n33*c+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,d=a.y,c=a.z,f=a.w;a.x=this.n11*b+this.n12*d+this.n13*
 c+this.n14*f;a.y=this.n21*b+this.n22*d+this.n23*c+this.n24*f;a.z=this.n31*b+this.n32*d+this.n33*c+this.n34*f;a.w=this.n41*b+this.n42*d+this.n43*c+this.n44*f;return a},rotateAxis:function(a){var b=a.x,d=a.y,c=a.z;a.x=b*this.n11+d*this.n12+c*this.n13;a.y=b*this.n21+d*this.n22+c*this.n23;a.z=b*this.n31+d*this.n32+c*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*
-a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,c=this.n14,f=this.n21,g=this.n22,h=this.n23,i=this.n24,l=this.n31,k=this.n32,j=this.n33,p=this.n34,r=this.n41,v=this.n42,m=this.n43,E=this.n44;return c*h*k*r-d*i*k*r-c*g*j*r+b*i*j*r+d*g*p*r-b*h*p*r-c*h*l*v+d*i*l*v+c*f*j*v-a*i*j*v-d*f*p*v+a*h*p*v+c*g*l*m-b*i*l*m-c*f*k*m+a*i*k*m+b*f*p*m-a*g*p*m-d*g*l*E+b*h*l*E+
-d*f*k*E-a*h*k*E-b*f*j*E+a*g*j*E},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
+a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,c=this.n14,f=this.n21,g=this.n22,h=this.n23,i=this.n24,l=this.n31,k=this.n32,j=this.n33,p=this.n34,v=this.n41,r=this.n42,n=this.n43,C=this.n44;return c*h*k*v-d*i*k*v-c*g*j*v+b*i*j*v+d*g*p*v-b*h*p*v-c*h*l*r+d*i*l*r+c*f*j*r-a*i*j*r-d*f*p*r+a*h*p*r+c*g*l*n-b*i*l*n-c*f*k*n+a*i*k*n+b*f*p*n-a*g*p*n-d*g*l*C+b*h*l*C+
+d*f*k*C-a*h*k*C-b*f*j*C+a*g*j*C},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
 a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=
 this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=
 this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,
 0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),c=Math.sin(b),f=1-d,g=a.x,h=a.y,i=a.z,l=f*g,k=f*h;this.set(l*g+d,l*h-c*i,l*i+c*h,0,l*h+c*i,k*h+d,k*i-c*g,0,l*i-c*h,k*i+c*g,f*i*i+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,d=a.n12,c=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,j=a.n32,p=a.n33,r=a.n34,v=a.n41,m=a.n42,E=a.n43,y=a.n44;this.n11=i*r*m-l*p*m+l*j*E-h*r*E-i*j*y+h*p*y;this.n12=f*p*m-c*r*m-f*j*E+d*r*E+c*j*y-d*p*y;this.n13=c*l*m-f*i*m+f*h*E-d*l*E-c*h*y+d*i*y;this.n14=f*i*j-c*l*j-f*h*p+d*l*p+c*h*r-d*i*r;this.n21=l*p*v-i*r*v-l*k*E+g*r*E+i*k*y-g*p*y;this.n22=c*r*v-f*p*v+
-f*k*E-b*r*E-c*k*y+b*p*y;this.n23=f*i*v-c*l*v-f*g*E+b*l*E+c*g*y-b*i*y;this.n24=c*l*k-f*i*k+f*g*p-b*l*p-c*g*r+b*i*r;this.n31=h*r*v-l*j*v+l*k*m-g*r*m-h*k*y+g*j*y;this.n32=f*j*v-d*r*v-f*k*m+b*r*m+d*k*y-b*j*y;this.n33=d*l*v-f*h*v+f*g*m-b*l*m-d*g*y+b*h*y;this.n34=f*h*k-d*l*k-f*g*j+b*l*j+d*g*r-b*h*r;this.n41=i*j*v-h*p*v-i*k*m+g*p*m+h*k*E-g*j*E;this.n42=d*p*v-c*j*v+c*k*m-b*p*m-d*k*E+b*j*E;this.n43=c*h*v-d*i*v-c*g*m+b*i*m+d*g*E-b*h*E;this.n44=d*i*k-c*h*k+c*g*j-b*i*j-d*g*p+b*h*p;this.multiplyScalar(1/a.determinant());
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,d=a.n12,c=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,j=a.n32,p=a.n33,v=a.n34,r=a.n41,n=a.n42,C=a.n43,y=a.n44;this.n11=i*v*n-l*p*n+l*j*C-h*v*C-i*j*y+h*p*y;this.n12=f*p*n-c*v*n-f*j*C+d*v*C+c*j*y-d*p*y;this.n13=c*l*n-f*i*n+f*h*C-d*l*C-c*h*y+d*i*y;this.n14=f*i*j-c*l*j-f*h*p+d*l*p+c*h*v-d*i*v;this.n21=l*p*r-i*v*r-l*k*C+g*v*C+i*k*y-g*p*y;this.n22=c*v*r-f*p*r+
+f*k*C-b*v*C-c*k*y+b*p*y;this.n23=f*i*r-c*l*r-f*g*C+b*l*C+c*g*y-b*i*y;this.n24=c*l*k-f*i*k+f*g*p-b*l*p-c*g*v+b*i*v;this.n31=h*v*r-l*j*r+l*k*n-g*v*n-h*k*y+g*j*y;this.n32=f*j*r-d*v*r-f*k*n+b*v*n+d*k*y-b*j*y;this.n33=d*l*r-f*h*r+f*g*n-b*l*n-d*g*y+b*h*y;this.n34=f*h*k-d*l*k-f*g*j+b*l*j+d*g*v-b*h*v;this.n41=i*j*r-h*p*r-i*k*n+g*p*n+h*k*C-g*j*C;this.n42=d*p*r-c*j*r+c*k*n-b*p*n-d*k*C+b*j*C;this.n43=c*h*r-d*i*r-c*g*n+b*i*n+d*g*C-b*h*C;this.n44=d*i*k-c*h*k+c*g*j-b*i*j-d*g*p+b*h*p;this.multiplyScalar(1/a.determinant());
 return this},setRotationFromEuler:function(a,b){var d=a.x,c=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(c),c=Math.sin(c),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=h*i,k=h*f,j=c*i,p=c*f;this.n11=l+p*d;this.n12=j*d-k;this.n13=g*c;this.n21=g*f;this.n22=g*i;this.n23=-d;this.n31=k*d-j;this.n32=p+l*d;this.n33=g*h;break;case "ZXY":l=h*i;k=h*f;j=c*i;p=c*f;this.n11=l-p*d;this.n12=-g*f;this.n13=j+k*d;this.n21=k+j*d;this.n22=g*i;this.n23=p-l*d;this.n31=-g*c;this.n32=d;this.n33=g*h;break;case "ZYX":l=
 g*i;k=g*f;j=d*i;p=d*f;this.n11=h*i;this.n12=j*c-k;this.n13=l*c+p;this.n21=h*f;this.n22=p*c+l;this.n23=k*c-j;this.n31=-c;this.n32=d*h;this.n33=g*h;break;case "YZX":l=g*h;k=g*c;j=d*h;p=d*c;this.n11=h*i;this.n12=p-l*f;this.n13=j*f+k;this.n21=f;this.n22=g*i;this.n23=-d*i;this.n31=-c*i;this.n32=k*f+j;this.n33=l-p*f;break;case "XZY":l=g*h;k=g*c;j=d*h;p=d*c;this.n11=h*i;this.n12=-f;this.n13=c*i;this.n21=l*f+p;this.n22=g*i;this.n23=k*f-j;this.n31=j*f-k;this.n32=d*i;this.n33=p*f+l;break;default:l=g*i,k=g*
 f,j=d*i,p=d*f,this.n11=h*i,this.n12=-h*f,this.n13=c,this.n21=k+j*c,this.n22=l-p*c,this.n23=-d*h,this.n31=p-l*c,this.n32=j+k*c,this.n33=g*h}return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,c=a.z,f=a.w,g=b+b,h=d+d,i=c+c,a=b*g,l=b*h;b*=i;var k=d*h;d*=i;c*=i;g*=f;h*=f;f*=i;this.n11=1-(k+c);this.n12=l-f;this.n13=b+h;this.n21=l+f;this.n22=1-(a+c);this.n23=d-g;this.n31=b-h;this.n32=d+g;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,d=a.y,a=a.z;this.n11*=b;this.n12*=d;this.n13*=
 a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},compose:function(a,b,d){var c=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;c.identity();c.setRotationFromQuaternion(b);f.setScale(d.x,d.y,d.z);this.multiply(c,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,d){var c=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;c.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);g.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=c.length();d.y=f.length();d.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;c=THREE.Matrix4.__m1;c.copy(this);c.n11/=d.x;c.n21/=d.x;c.n31/=d.x;c.n12/=d.y;c.n22/=d.y;c.n32/=d.y;c.n13/=d.z;c.n23/=d.z;c.n33/=d.z;b.setFromRotationMatrix(c);return[a,b,d]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,d=1/b.set(a.n11,a.n21,a.n31).length(),c=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*c;this.n22=a.n22*c;this.n32=a.n32*c;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);else if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);else if(a.x===0&&a.y===
-0&&a.z===1)return this.rotateZ(b);var d=a.x,c=a.y,f=a.z,g=Math.sqrt(d*d+c*c+f*f);d/=g;c/=g;f/=g;var g=d*d,h=c*c,i=f*f,l=Math.cos(b),k=Math.sin(b),j=1-l,p=d*c*j,r=d*f*j;j*=c*f;d*=k;var v=c*k;k*=f;f=g+(1-g)*l;g=p+k;c=r-v;p-=k;h+=(1-h)*l;k=j+d;r+=v;j-=d;i+=(1-i)*l;var l=this.n11,d=this.n21,v=this.n31,m=this.n41,E=this.n12,y=this.n22,J=this.n32,O=this.n42,P=this.n13,V=this.n23,C=this.n33,D=this.n43;this.n11=f*l+g*E+c*P;this.n21=f*d+g*y+c*V;this.n31=f*v+g*J+c*C;this.n41=f*m+g*O+c*D;this.n12=p*l+h*E+k*
-P;this.n22=p*d+h*y+k*V;this.n32=p*v+h*J+k*C;this.n42=p*m+h*O+k*D;this.n13=r*l+j*E+i*P;this.n23=r*d+j*y+i*V;this.n33=r*v+j*J+i*C;this.n43=r*m+j*O+i*D;return this},rotateX:function(a){var b=this.n12,d=this.n22,c=this.n32,f=this.n42,g=this.n13,h=this.n23,i=this.n33,l=this.n43,k=Math.cos(a),a=Math.sin(a);this.n12=k*b+a*g;this.n22=k*d+a*h;this.n32=k*c+a*i;this.n42=k*f+a*l;this.n13=k*g-a*b;this.n23=k*h-a*d;this.n33=k*i-a*c;this.n43=k*l-a*f;return this},rotateY:function(a){var b=this.n11,d=this.n21,c=this.n31,
+0&&a.z===1)return this.rotateZ(b);var d=a.x,c=a.y,f=a.z,g=Math.sqrt(d*d+c*c+f*f);d/=g;c/=g;f/=g;var g=d*d,h=c*c,i=f*f,l=Math.cos(b),k=Math.sin(b),j=1-l,p=d*c*j,v=d*f*j;j*=c*f;d*=k;var r=c*k;k*=f;f=g+(1-g)*l;g=p+k;c=v-r;p-=k;h+=(1-h)*l;k=j+d;v+=r;j-=d;i+=(1-i)*l;var l=this.n11,d=this.n21,r=this.n31,n=this.n41,C=this.n12,y=this.n22,J=this.n32,O=this.n42,P=this.n13,V=this.n23,D=this.n33,E=this.n43;this.n11=f*l+g*C+c*P;this.n21=f*d+g*y+c*V;this.n31=f*r+g*J+c*D;this.n41=f*n+g*O+c*E;this.n12=p*l+h*C+k*
+P;this.n22=p*d+h*y+k*V;this.n32=p*r+h*J+k*D;this.n42=p*n+h*O+k*E;this.n13=v*l+j*C+i*P;this.n23=v*d+j*y+i*V;this.n33=v*r+j*J+i*D;this.n43=v*n+j*O+i*E;return this},rotateX:function(a){var b=this.n12,d=this.n22,c=this.n32,f=this.n42,g=this.n13,h=this.n23,i=this.n33,l=this.n43,k=Math.cos(a),a=Math.sin(a);this.n12=k*b+a*g;this.n22=k*d+a*h;this.n32=k*c+a*i;this.n42=k*f+a*l;this.n13=k*g-a*b;this.n23=k*h-a*d;this.n33=k*i-a*c;this.n43=k*l-a*f;return this},rotateY:function(a){var b=this.n11,d=this.n21,c=this.n31,
 f=this.n41,g=this.n13,h=this.n23,i=this.n33,l=this.n43,k=Math.cos(a),a=Math.sin(a);this.n11=k*b-a*g;this.n21=k*d-a*h;this.n31=k*c-a*i;this.n41=k*f-a*l;this.n13=k*g+a*b;this.n23=k*h+a*d;this.n33=k*i+a*c;this.n43=k*l+a*f;return this},rotateZ:function(a){var b=this.n11,d=this.n21,c=this.n31,f=this.n41,g=this.n12,h=this.n22,i=this.n32,l=this.n42,k=Math.cos(a),a=Math.sin(a);this.n11=k*b+a*g;this.n21=k*d+a*h;this.n31=k*c+a*i;this.n41=k*f+a*l;this.n12=k*g-a*b;this.n22=k*h-a*d;this.n32=k*i-a*c;this.n42=k*
 l-a*f;return this},translate:function(a){var b=a.x,d=a.y,a=a.z;this.n14=this.n11*b+this.n12*d+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*d+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*d+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*d+this.n43*a+this.n44;return this}};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,c=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*c+a.n21*h+a.n31*k;if(a===0)return null;a=1/a;d[0]=a*c;d[1]=a*f;d[2]=a*g;d[3]=a*h;d[4]=a*i;d[5]=a*l;d[6]=a*k;d[7]=a*j;d[8]=a*p;return b};
@@ -61,16 +61,16 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,d=this.children.length;b<d;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=h[g]=h[g]||new THREE.RenderableObject;g++;return a}function b(){var a=k[l]=k[l]||new THREE.RenderableVertex;l++;return a}function d(a,b){return b.z-a.z}function c(a,b){var d=0,c=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?d=Math.max(d,f/(f-e)):e<0&&(c=Math.min(c,f/(f-e))),g<0?d=Math.max(d,g/(g-h)):h<0&&(c=Math.min(c,g/(g-h))),c<d?!1:(a.lerpSelf(b,d),b.lerpSelf(a,1-c),!0))}var f,g,h=[],i,l,k=[],
-j,p,r=[],v,m=[],E,y,J=[],O,P,V=[],C={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,N=new THREE.Vector4,Q=new THREE.Matrix4,ma=new THREE.Matrix4,ua=new THREE.Frustum,ha=new THREE.Vector4,ca=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);Q.multiply(b.projectionMatrix,b.matrixWorldInverse);Q.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);Q.multiply(b.matrixWorld,
-b.projectionMatrixInverse);Q.multiplyVector3(a);return a};this.pickingRay=function(a,b){var d;a.z=-1;d=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(d,b);d.subSelf(a).normalize();return new THREE.Ray(a,d)};this.projectGraph=function(b,c){g=0;C.objects.length=0;C.sprites.length=0;C.lights.length=0;var h=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||ua.contains(b))?(Q.multiplyVector3(D.copy(b.position)),f=a(),
-f.object=b,f.z=D.z,C.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(Q.multiplyVector3(D.copy(b.position)),f=a(),f.object=b,f.z=D.z,C.sprites.push(f)):b instanceof THREE.Light&&C.lights.push(b);for(var d=0,e=b.children.length;d<e;d++)h(b.children[d])}};h(b);c&&C.objects.sort(d);return C};this.projectScene=function(a,f,g){var h=f.near,H=f.far,e,D,T,qa,I,R,na,ra,Z,sa,oa,wa,Ca,za,Aa,ta;P=y=v=p=0;C.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);Q.multiply(f.projectionMatrix,f.matrixWorldInverse);ua.setFromMatrix(Q);C=this.projectGraph(a,!1);a=0;for(e=C.objects.length;a<e;a++)if(Z=C.objects[a].object,sa=Z.matrixWorld,wa=Z.material,l=0,Z instanceof THREE.Mesh){oa=Z.geometry;Ca=Z.geometry.materials;qa=oa.vertices;za=oa.faces;Aa=oa.faceVertexUvs;oa=Z.matrixRotationWorld.extractRotation(sa);D=0;for(T=qa.length;D<T;D++)i=b(),i.positionWorld.copy(qa[D].position),sa.multiplyVector3(i.positionWorld),
-i.positionScreen.copy(i.positionWorld),Q.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<H;qa=0;for(D=za.length;qa<D;qa++){T=za[qa];if(T instanceof THREE.Face3)if(I=k[T.a],R=k[T.b],na=k[T.c],I.visible&&R.visible&&na.visible&&(Z.doubleSided||Z.flipSided!=(na.positionScreen.x-I.positionScreen.x)*(R.positionScreen.y-I.positionScreen.y)-(na.positionScreen.y-I.positionScreen.y)*(R.positionScreen.x-
-I.positionScreen.x)<0))ra=r[p]=r[p]||new THREE.RenderableFace3,p++,j=ra,j.v1.copy(I),j.v2.copy(R),j.v3.copy(na);else continue;else if(T instanceof THREE.Face4)if(I=k[T.a],R=k[T.b],na=k[T.c],ra=k[T.d],I.visible&&R.visible&&na.visible&&ra.visible&&(Z.doubleSided||Z.flipSided!=((ra.positionScreen.x-I.positionScreen.x)*(R.positionScreen.y-I.positionScreen.y)-(ra.positionScreen.y-I.positionScreen.y)*(R.positionScreen.x-I.positionScreen.x)<0||(R.positionScreen.x-na.positionScreen.x)*(ra.positionScreen.y-
-na.positionScreen.y)-(R.positionScreen.y-na.positionScreen.y)*(ra.positionScreen.x-na.positionScreen.x)<0)))ta=m[v]=m[v]||new THREE.RenderableFace4,v++,j=ta,j.v1.copy(I),j.v2.copy(R),j.v3.copy(na),j.v4.copy(ra);else continue;j.normalWorld.copy(T.normal);oa.multiplyVector3(j.normalWorld);j.centroidWorld.copy(T.centroid);sa.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);Q.multiplyVector3(j.centroidScreen);na=T.vertexNormals;I=0;for(R=na.length;I<R;I++)ra=j.vertexNormalsWorld[I],
-ra.copy(na[I]),oa.multiplyVector3(ra);I=0;for(R=Aa.length;I<R;I++)if(ta=Aa[I][qa]){na=0;for(ra=ta.length;na<ra;na++)j.uvs[I][na]=ta[na]}j.material=wa;j.faceMaterial=T.materialIndex!==null?Ca[T.materialIndex]:null;j.z=j.centroidScreen.z;C.elements.push(j)}}else if(Z instanceof THREE.Line){ma.multiply(Q,sa);qa=Z.geometry.vertices;I=b();I.positionScreen.copy(qa[0].position);ma.multiplyVector4(I.positionScreen);D=1;for(T=qa.length;D<T;D++)if(I=b(),I.positionScreen.copy(qa[D].position),ma.multiplyVector4(I.positionScreen),
-R=k[l-2],ha.copy(I.positionScreen),ca.copy(R.positionScreen),c(ha,ca))ha.multiplyScalar(1/ha.w),ca.multiplyScalar(1/ca.w),Z=J[y]=J[y]||new THREE.RenderableLine,y++,E=Z,E.v1.positionScreen.copy(ha),E.v2.positionScreen.copy(ca),E.z=Math.max(ha.z,ca.z),E.material=wa,C.elements.push(E)}a=0;for(e=C.sprites.length;a<e;a++)if(Z=C.sprites[a].object,sa=Z.matrixWorld,Z instanceof THREE.Particle&&(N.set(sa.n14,sa.n24,sa.n34,1),Q.multiplyVector4(N),N.z/=N.w,N.z>0&&N.z<1))h=V[P]=V[P]||new THREE.RenderableParticle,
-P++,O=h,O.x=N.x/N.w,O.y=N.y/N.w,O.z=N.z,O.rotation=Z.rotation.z,O.scale.x=Z.scale.x*Math.abs(O.x-(N.x+f.projectionMatrix.n11)/(N.w+f.projectionMatrix.n14)),O.scale.y=Z.scale.y*Math.abs(O.y-(N.y+f.projectionMatrix.n22)/(N.w+f.projectionMatrix.n24)),O.material=Z.material,C.elements.push(O);g&&C.elements.sort(d);return C}};THREE.Quaternion=function(a,b,d,c){this.set(a||0,b||0,d||0,c!==void 0?c:1)};
+j,p,v=[],r,n=[],C,y,J=[],O,P,V=[],D={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,N=new THREE.Vector4,Q=new THREE.Matrix4,ma=new THREE.Matrix4,ua=new THREE.Frustum,ha=new THREE.Vector4,ca=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);Q.multiply(b.projectionMatrix,b.matrixWorldInverse);Q.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);Q.multiply(b.matrixWorld,
+b.projectionMatrixInverse);Q.multiplyVector3(a);return a};this.pickingRay=function(a,b){var d;a.z=-1;d=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(d,b);d.subSelf(a).normalize();return new THREE.Ray(a,d)};this.projectGraph=function(b,c){g=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var h=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||ua.contains(b))?(Q.multiplyVector3(E.copy(b.position)),f=a(),
+f.object=b,f.z=E.z,D.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(Q.multiplyVector3(E.copy(b.position)),f=a(),f.object=b,f.z=E.z,D.sprites.push(f)):b instanceof THREE.Light&&D.lights.push(b);for(var d=0,e=b.children.length;d<e;d++)h(b.children[d])}};h(b);c&&D.objects.sort(d);return D};this.projectScene=function(a,f,g){var h=f.near,H=f.far,e,E,T,qa,I,R,na,ra,Z,sa,oa,wa,Ca,za,Aa,ta;P=y=r=p=0;D.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);Q.multiply(f.projectionMatrix,f.matrixWorldInverse);ua.setFromMatrix(Q);D=this.projectGraph(a,!1);a=0;for(e=D.objects.length;a<e;a++)if(Z=D.objects[a].object,sa=Z.matrixWorld,wa=Z.material,l=0,Z instanceof THREE.Mesh){oa=Z.geometry;Ca=Z.geometry.materials;qa=oa.vertices;za=oa.faces;Aa=oa.faceVertexUvs;oa=Z.matrixRotationWorld.extractRotation(sa);E=0;for(T=qa.length;E<T;E++)i=b(),i.positionWorld.copy(qa[E].position),sa.multiplyVector3(i.positionWorld),
+i.positionScreen.copy(i.positionWorld),Q.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<H;qa=0;for(E=za.length;qa<E;qa++){T=za[qa];if(T instanceof THREE.Face3)if(I=k[T.a],R=k[T.b],na=k[T.c],I.visible&&R.visible&&na.visible&&(Z.doubleSided||Z.flipSided!=(na.positionScreen.x-I.positionScreen.x)*(R.positionScreen.y-I.positionScreen.y)-(na.positionScreen.y-I.positionScreen.y)*(R.positionScreen.x-
+I.positionScreen.x)<0))ra=v[p]=v[p]||new THREE.RenderableFace3,p++,j=ra,j.v1.copy(I),j.v2.copy(R),j.v3.copy(na);else continue;else if(T instanceof THREE.Face4)if(I=k[T.a],R=k[T.b],na=k[T.c],ra=k[T.d],I.visible&&R.visible&&na.visible&&ra.visible&&(Z.doubleSided||Z.flipSided!=((ra.positionScreen.x-I.positionScreen.x)*(R.positionScreen.y-I.positionScreen.y)-(ra.positionScreen.y-I.positionScreen.y)*(R.positionScreen.x-I.positionScreen.x)<0||(R.positionScreen.x-na.positionScreen.x)*(ra.positionScreen.y-
+na.positionScreen.y)-(R.positionScreen.y-na.positionScreen.y)*(ra.positionScreen.x-na.positionScreen.x)<0)))ta=n[r]=n[r]||new THREE.RenderableFace4,r++,j=ta,j.v1.copy(I),j.v2.copy(R),j.v3.copy(na),j.v4.copy(ra);else continue;j.normalWorld.copy(T.normal);oa.multiplyVector3(j.normalWorld);j.centroidWorld.copy(T.centroid);sa.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);Q.multiplyVector3(j.centroidScreen);na=T.vertexNormals;I=0;for(R=na.length;I<R;I++)ra=j.vertexNormalsWorld[I],
+ra.copy(na[I]),oa.multiplyVector3(ra);I=0;for(R=Aa.length;I<R;I++)if(ta=Aa[I][qa]){na=0;for(ra=ta.length;na<ra;na++)j.uvs[I][na]=ta[na]}j.material=wa;j.faceMaterial=T.materialIndex!==null?Ca[T.materialIndex]:null;j.z=j.centroidScreen.z;D.elements.push(j)}}else if(Z instanceof THREE.Line){ma.multiply(Q,sa);qa=Z.geometry.vertices;I=b();I.positionScreen.copy(qa[0].position);ma.multiplyVector4(I.positionScreen);E=1;for(T=qa.length;E<T;E++)if(I=b(),I.positionScreen.copy(qa[E].position),ma.multiplyVector4(I.positionScreen),
+R=k[l-2],ha.copy(I.positionScreen),ca.copy(R.positionScreen),c(ha,ca))ha.multiplyScalar(1/ha.w),ca.multiplyScalar(1/ca.w),Z=J[y]=J[y]||new THREE.RenderableLine,y++,C=Z,C.v1.positionScreen.copy(ha),C.v2.positionScreen.copy(ca),C.z=Math.max(ha.z,ca.z),C.material=wa,D.elements.push(C)}a=0;for(e=D.sprites.length;a<e;a++)if(Z=D.sprites[a].object,sa=Z.matrixWorld,Z instanceof THREE.Particle&&(N.set(sa.n14,sa.n24,sa.n34,1),Q.multiplyVector4(N),N.z/=N.w,N.z>0&&N.z<1))h=V[P]=V[P]||new THREE.RenderableParticle,
+P++,O=h,O.x=N.x/N.w,O.y=N.y/N.w,O.z=N.z,O.rotation=Z.rotation.z,O.scale.x=Z.scale.x*Math.abs(O.x-(N.x+f.projectionMatrix.n11)/(N.w+f.projectionMatrix.n14)),O.scale.y=Z.scale.y*Math.abs(O.y-(N.y+f.projectionMatrix.n22)/(N.w+f.projectionMatrix.n24)),O.material=Z.material,D.elements.push(O);g&&D.elements.sort(d);return D}};THREE.Quaternion=function(a,b,d,c){this.set(a||0,b||0,d||0,c!==void 0?c:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,d,c){this.x=a;this.y=b;this.z=d;this.w=c;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,d=a.x*b,c=a.y*b,f=a.z*b,a=Math.cos(c),c=Math.sin(c),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(d),d=Math.sin(d),h=a*b,i=c*f;this.w=h*g-i*d;this.x=h*d+i*g;this.y=c*b*g+a*f*d;this.z=a*f*g-c*b*d;return this},setFromAxisAngle:function(a,b){var d=b/2,c=Math.sin(d);
 this.x=a.x*c;this.y=a.y*c;this.z=a.z*c;this.w=Math.cos(d);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
@@ -86,13 +86,13 @@ b;a++)d=this.faces[a],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid
 b,d,c,f,g,h=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)d=this.faces[a],c=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],h.sub(g.position,f.position),i.sub(c.position,f.position),h.crossSelf(i),h.isZero()||h.normalize(),d.normal.copy(h)},computeVertexNormals:function(){var a,b,d,c;if(this.__tmpVertices===void 0){c=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)c[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(d=
 this.faces[a],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{c=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)c[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)d=this.faces[a],d instanceof THREE.Face3?(c[d.a].addSelf(d.normal),c[d.b].addSelf(d.normal),c[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(c[d.a].addSelf(d.normal),
 c[d.b].addSelf(d.normal),c[d.c].addSelf(d.normal),c[d.d].addSelf(d.normal));a=0;for(b=this.vertices.length;a<b;a++)c[a].normalize();a=0;for(b=this.faces.length;a<b;a++)d=this.faces[a],d instanceof THREE.Face3?(d.vertexNormals[0].copy(c[d.a]),d.vertexNormals[1].copy(c[d.b]),d.vertexNormals[2].copy(c[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(c[d.a]),d.vertexNormals[1].copy(c[d.b]),d.vertexNormals[2].copy(c[d.c]),d.vertexNormals[3].copy(c[d.d]))},computeTangents:function(){function a(a,
-b,d,c,f,g,Q){i=a.vertices[b].position;l=a.vertices[d].position;k=a.vertices[c].position;j=h[f];p=h[g];r=h[Q];v=l.x-i.x;m=k.x-i.x;E=l.y-i.y;y=k.y-i.y;J=l.z-i.z;O=k.z-i.z;P=p.u-j.u;V=r.u-j.u;C=p.v-j.v;D=r.v-j.v;N=1/(P*D-V*C);ha.set((D*v-C*m)*N,(D*E-C*y)*N,(D*J-C*O)*N);ca.set((P*m-V*v)*N,(P*y-V*E)*N,(P*O-V*J)*N);ma[b].addSelf(ha);ma[d].addSelf(ha);ma[c].addSelf(ha);ua[b].addSelf(ca);ua[d].addSelf(ca);ua[c].addSelf(ca)}var b,d,c,f,g,h,i,l,k,j,p,r,v,m,E,y,J,O,P,V,C,D,N,Q,ma=[],ua=[],ha=new THREE.Vector3,
+b,d,c,f,g,Q){i=a.vertices[b].position;l=a.vertices[d].position;k=a.vertices[c].position;j=h[f];p=h[g];v=h[Q];r=l.x-i.x;n=k.x-i.x;C=l.y-i.y;y=k.y-i.y;J=l.z-i.z;O=k.z-i.z;P=p.u-j.u;V=v.u-j.u;D=p.v-j.v;E=v.v-j.v;N=1/(P*E-V*D);ha.set((E*r-D*n)*N,(E*C-D*y)*N,(E*J-D*O)*N);ca.set((P*n-V*r)*N,(P*y-V*C)*N,(P*O-V*J)*N);ma[b].addSelf(ha);ma[d].addSelf(ha);ma[c].addSelf(ha);ua[b].addSelf(ca);ua[d].addSelf(ca);ua[c].addSelf(ca)}var b,d,c,f,g,h,i,l,k,j,p,v,r,n,C,y,J,O,P,V,D,E,N,Q,ma=[],ua=[],ha=new THREE.Vector3,
 ca=new THREE.Vector3,pa=new THREE.Vector3,ja=new THREE.Vector3,xa=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++)ma[b]=new THREE.Vector3,ua[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++)g=this.faces[b],h=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var va=["a","b","c","d"];b=0;for(d=this.faces.length;b<d;b++){g=this.faces[b];for(c=0;c<g.vertexNormals.length;c++)xa.copy(g.vertexNormals[c]),
 f=g[va[c]],Q=ma[f],pa.copy(Q),pa.subSelf(xa.multiplyScalar(xa.dot(Q))).normalize(),ja.cross(g.vertexNormals[c],Q),f=ja.dot(ua[f]),f=f<0?-1:1,g.vertexTangents[c]=new THREE.Vector4(pa.x,pa.y,pa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){if(this.vertices.length>0){var a;a=this.vertices[0].position;this.boundingBox?(this.boundingBox.min.copy(a),this.boundingBox.max.copy(a)):this.boundingBox={min:a.clone(),max:a.clone()};for(var b=this.boundingBox.min,d=this.boundingBox.max,c=1,f=this.vertices.length;c<
 f;c++){a=this.vertices[c].position;if(a.x<b.x)b.x=a.x;else if(a.x>d.x)d.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>d.y)d.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>d.z)d.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,d=0,c=this.vertices.length;d<c;d++)a=this.vertices[d].position.length(),a>b&&(b=a);this.boundingSphere={radius:b}},mergeVertices:function(){var a={},b=[],d=[],c,f=Math.pow(10,4),g,h;g=0;for(h=this.vertices.length;g<h;g++)c=this.vertices[g].position,c=[Math.round(c.x*f),Math.round(c.y*f),
 Math.round(c.z*f)].join("_"),a[c]===void 0?(a[c]=g,b.push(this.vertices[g]),d[g]=b.length-1):d[g]=d[a[c]];g=0;for(h=this.faces.length;g<h;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=d[a.a],a.b=d[a.b],a.c=d[a.c];else if(a instanceof THREE.Face4)a.a=d[a.a],a.b=d[a.b],a.c=d[a.c],a.d=d[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,d,c,f,g,h){a=(d-a)*0.5;c=(c-b)*0.5;return(2*(b-d)+a+c)*h+(-3*(b-d)-2*a-c)*g+a*f+b}this.points=a;var d=[],c={x:0,y:0,z:0},f,g,h,i,l,k,j,p,r;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;g=Math.floor(f);h=f-g;d[0]=g===0?g:g-1;d[1]=g;d[2]=g>this.points.length-2?g:g+1;d[3]=g>this.points.length-3?g:g+2;k=this.points[d[0]];j=this.points[d[1]];
-p=this.points[d[2]];r=this.points[d[3]];i=h*h;l=h*i;c.x=b(k.x,j.x,p.x,r.x,h,i,l);c.y=b(k.y,j.y,p.y,r.y,h,i,l);c.z=b(k.z,j.z,p.z,r.z,h,i,l);return c};this.getControlPointsArray=function(){var a,b,d=this.points.length,c=[];for(a=0;a<d;a++)b=this.points[a],c[a]=[b.x,b.y,b.z];return c};this.getLength=function(a){var b,d,c,f=b=b=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);d=this.points.length*a;g.copy(this.points[0]);for(a=1;a<d;a++)b=a/d,c=this.getPoint(b),h.copy(c),j+=h.distanceTo(g),
+THREE.Spline=function(a){function b(a,b,d,c,f,g,h){a=(d-a)*0.5;c=(c-b)*0.5;return(2*(b-d)+a+c)*h+(-3*(b-d)-2*a-c)*g+a*f+b}this.points=a;var d=[],c={x:0,y:0,z:0},f,g,h,i,l,k,j,p,v;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;g=Math.floor(f);h=f-g;d[0]=g===0?g:g-1;d[1]=g;d[2]=g>this.points.length-2?g:g+1;d[3]=g>this.points.length-3?g:g+2;k=this.points[d[0]];j=this.points[d[1]];
+p=this.points[d[2]];v=this.points[d[3]];i=h*h;l=h*i;c.x=b(k.x,j.x,p.x,v.x,h,i,l);c.y=b(k.y,j.y,p.y,v.y,h,i,l);c.z=b(k.z,j.z,p.z,v.z,h,i,l);return c};this.getControlPointsArray=function(){var a,b,d=this.points.length,c=[];for(a=0;a<d;a++)b=this.points[a],c[a]=[b.x,b.y,b.z];return c};this.getLength=function(a){var b,d,c,f=b=b=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);d=this.points.length*a;g.copy(this.points[0]);for(a=1;a<d;a++)b=a/d,c=this.getPoint(b),h.copy(c),j+=h.distanceTo(g),
 g.copy(c),b*=this.points.length-1,b=Math.floor(b),b!=f&&(i[b]=j,f=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,d,c,f,g,h,i=[],j=new THREE.Vector3,k=this.getLength();i.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){d=k.chunks[b]-k.chunks[b-1];h=Math.ceil(a*d/k.total);f=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(d=1;d<h-1;d++)c=f+d*(1/h)*(g-f),c=this.getPoint(c),i.push(j.copy(c).clone());i.push(j.copy(this.points[b]).clone())}this.points=
 i}};THREE.Edge=function(a,b,d,c){this.vertices=[a,b];this.vertexIndices=[d,c];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,d,c,f,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=d;this.bottom=c;this.near=f!==void 0?f:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
@@ -181,105 +181,106 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragme
 THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var d=a.vertices.length,c=b.material;if(c.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in c.attributes){var g=c.attributes[f];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var h=1;g.type==="v2"?h=2:g.type==="v3"?h=3:g.type==="v4"?h=4:g.type==="c"&&(h=3);g.size=h;g.array=new Float32Array(d*h);g.buffer=e.createBuffer();g.buffer.belongsToAttribute=f;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
 function d(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function c(a){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){if(a.vertexColors)return a.vertexColors;return!1}function g(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
-return!1}function h(a,b,d){var c,f,g,h,w=a.vertices;h=w.length;var i=a.colors,j=i.length,t=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,q=a.__dirtyVertices,m=a.__dirtyColors,l=a.__webglCustomAttributesList;if(d.sortParticles){Da.multiplySelf(d.matrixWorld);for(c=0;c<h;c++)f=w[c].position,Ba.copy(f),Da.multiplyVector3(Ba),n[c]=[Ba.z,c];n.sort(function(a,b){return b[0]-a[0]});for(c=0;c<h;c++)f=w[n[c][1]].position,g=c*3,t[g]=f.x,t[g+1]=f.y,t[g+2]=f.z;for(c=0;c<j;c++)g=c*3,f=i[n[c][1]],k[g]=f.r,k[g+
-1]=f.g,k[g+2]=f.b;if(l){i=0;for(j=l.length;i<j;i++)if(w=l[i],w.boundTo===void 0||w.boundTo==="vertices")if(g=0,f=w.value.length,w.size===1)for(c=0;c<f;c++)h=n[c][1],w.array[c]=w.value[h];else if(w.size===2)for(c=0;c<f;c++)h=n[c][1],h=w.value[h],w.array[g]=h.x,w.array[g+1]=h.y,g+=2;else if(w.size===3)if(w.type==="c")for(c=0;c<f;c++)h=n[c][1],h=w.value[h],w.array[g]=h.r,w.array[g+1]=h.g,w.array[g+2]=h.b,g+=3;else for(c=0;c<f;c++)h=n[c][1],h=w.value[h],w.array[g]=h.x,w.array[g+1]=h.y,w.array[g+2]=h.z,
-g+=3;else if(w.size===4)for(c=0;c<f;c++)h=n[c][1],h=w.value[h],w.array[g]=h.x,w.array[g+1]=h.y,w.array[g+2]=h.z,w.array[g+3]=h.w,g+=4}}else{if(q)for(c=0;c<h;c++)f=w[c].position,g=c*3,t[g]=f.x,t[g+1]=f.y,t[g+2]=f.z;if(m)for(c=0;c<j;c++)f=i[c],g=c*3,k[g]=f.r,k[g+1]=f.g,k[g+2]=f.b;if(l){i=0;for(j=l.length;i<j;i++)if(w=l[i],w.needsUpdate&&(w.boundTo===void 0||w.boundTo==="vertices"))if(f=w.value.length,g=0,w.size===1)for(c=0;c<f;c++)w.array[c]=w.value[c];else if(w.size===2)for(c=0;c<f;c++)h=w.value[c],
-w.array[g]=h.x,w.array[g+1]=h.y,g+=2;else if(w.size===3)if(w.type==="c")for(c=0;c<f;c++)h=w.value[c],w.array[g]=h.r,w.array[g+1]=h.g,w.array[g+2]=h.b,g+=3;else for(c=0;c<f;c++)h=w.value[c],w.array[g]=h.x,w.array[g+1]=h.y,w.array[g+2]=h.z,g+=3;else if(w.size===4)for(c=0;c<f;c++)h=w.value[c],w.array[g]=h.x,w.array[g+1]=h.y,w.array[g+2]=h.z,w.array[g+3]=h.w,g+=4}}if(q||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,t,b);if(m||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
-a.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,k,b);if(l){i=0;for(j=l.length;i<j;i++)if(w=l[i],w.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,w.buffer),e.bufferData(e.ARRAY_BUFFER,w.array,b)}}function i(a,b){return b.z-a.z}function l(a,b,d){if(a.length)for(var c=0,e=a.length;c<e;c++)T=null,I=R=wa=oa=sa=-1,a[c].render(b,d,Ja,Ka),T=null,I=R=wa=oa=sa=-1}function k(a,b,d,c,e,f,g,h){var i,j,t,k;b?(j=a.length-1,k=b=-1):(j=0,b=a.length,k=1);for(var n=j;n!==b;n+=k)if(i=a[n],i.render){j=i.object;
-t=i.buffer;if(h)i=h;else{i=i[d];if(!i)continue;g&&H.setBlending(i.blending);H.setDepthTest(i.depthTest);O(i.depthWrite);P(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}H.setObjectFaces(j);t instanceof THREE.BufferGeometry?H.renderBufferDirect(c,e,f,i,t,j):H.renderBuffer(c,e,f,i,t,j)}}function j(a,b,d,c,e,f,g){for(var h,i,j=0,k=a.length;j<k;j++)if(h=a[j],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&H.setBlending(h.blending);H.setDepthTest(h.depthTest);O(h.depthWrite);
-P(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}H.renderImmediateObject(d,c,e,h,i)}}function p(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function r(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function v(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function m(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function E(a,b){for(var d=a.length-1;d>=0;d--)a[d]===b&&a.splice(d,1)}function y(a,b,d,c,f){c.program||
+return!1}function h(a,b,d){var c,f,g,h,w=a.vertices;h=w.length;var i=a.colors,j=i.length,u=a.__vertexArray,k=a.__colorArray,m=a.__sortArray,q=a.__dirtyVertices,n=a.__dirtyColors,l=a.__webglCustomAttributesList;if(d.sortParticles){Da.multiplySelf(d.matrixWorld);for(c=0;c<h;c++)f=w[c].position,Ba.copy(f),Da.multiplyVector3(Ba),m[c]=[Ba.z,c];m.sort(function(a,b){return b[0]-a[0]});for(c=0;c<h;c++)f=w[m[c][1]].position,g=c*3,u[g]=f.x,u[g+1]=f.y,u[g+2]=f.z;for(c=0;c<j;c++)g=c*3,f=i[m[c][1]],k[g]=f.r,k[g+
+1]=f.g,k[g+2]=f.b;if(l){i=0;for(j=l.length;i<j;i++)if(w=l[i],w.boundTo===void 0||w.boundTo==="vertices")if(g=0,f=w.value.length,w.size===1)for(c=0;c<f;c++)h=m[c][1],w.array[c]=w.value[h];else if(w.size===2)for(c=0;c<f;c++)h=m[c][1],h=w.value[h],w.array[g]=h.x,w.array[g+1]=h.y,g+=2;else if(w.size===3)if(w.type==="c")for(c=0;c<f;c++)h=m[c][1],h=w.value[h],w.array[g]=h.r,w.array[g+1]=h.g,w.array[g+2]=h.b,g+=3;else for(c=0;c<f;c++)h=m[c][1],h=w.value[h],w.array[g]=h.x,w.array[g+1]=h.y,w.array[g+2]=h.z,
+g+=3;else if(w.size===4)for(c=0;c<f;c++)h=m[c][1],h=w.value[h],w.array[g]=h.x,w.array[g+1]=h.y,w.array[g+2]=h.z,w.array[g+3]=h.w,g+=4}}else{if(q)for(c=0;c<h;c++)f=w[c].position,g=c*3,u[g]=f.x,u[g+1]=f.y,u[g+2]=f.z;if(n)for(c=0;c<j;c++)f=i[c],g=c*3,k[g]=f.r,k[g+1]=f.g,k[g+2]=f.b;if(l){i=0;for(j=l.length;i<j;i++)if(w=l[i],w.needsUpdate&&(w.boundTo===void 0||w.boundTo==="vertices"))if(f=w.value.length,g=0,w.size===1)for(c=0;c<f;c++)w.array[c]=w.value[c];else if(w.size===2)for(c=0;c<f;c++)h=w.value[c],
+w.array[g]=h.x,w.array[g+1]=h.y,g+=2;else if(w.size===3)if(w.type==="c")for(c=0;c<f;c++)h=w.value[c],w.array[g]=h.r,w.array[g+1]=h.g,w.array[g+2]=h.b,g+=3;else for(c=0;c<f;c++)h=w.value[c],w.array[g]=h.x,w.array[g+1]=h.y,w.array[g+2]=h.z,g+=3;else if(w.size===4)for(c=0;c<f;c++)h=w.value[c],w.array[g]=h.x,w.array[g+1]=h.y,w.array[g+2]=h.z,w.array[g+3]=h.w,g+=4}}if(q||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,u,b);if(n||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
+a.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,k,b);if(l){i=0;for(j=l.length;i<j;i++)if(w=l[i],w.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,w.buffer),e.bufferData(e.ARRAY_BUFFER,w.array,b)}}function i(a,b){return b.z-a.z}function l(a,b,d){if(a.length)for(var c=0,e=a.length;c<e;c++)T=null,I=R=wa=oa=sa=-1,a[c].render(b,d,Ka,La),T=null,I=R=wa=oa=sa=-1}function k(a,b,d,c,e,f,g,h){var i,j,u,k;b?(j=a.length-1,k=b=-1):(j=0,b=a.length,k=1);for(var m=j;m!==b;m+=k)if(i=a[m],i.render){j=i.object;
+u=i.buffer;if(h)i=h;else{i=i[d];if(!i)continue;g&&H.setBlending(i.blending);H.setDepthTest(i.depthTest);O(i.depthWrite);P(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}H.setObjectFaces(j);u instanceof THREE.BufferGeometry?H.renderBufferDirect(c,e,f,i,u,j):H.renderBuffer(c,e,f,i,u,j)}}function j(a,b,d,c,e,f,g){for(var h,i,j=0,k=a.length;j<k;j++)if(h=a[j],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&H.setBlending(h.blending);H.setDepthTest(h.depthTest);O(h.depthWrite);
+P(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}H.renderImmediateObject(d,c,e,h,i)}}function p(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function v(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function r(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function n(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function C(a,b){for(var d=a.length-1;d>=0;d--)a[d]===b&&a.splice(d,1)}function y(a,b,d,c,f){c.program||
 H.initMaterial(c,b,d,f);if(c.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(H.maxMorphTargets);for(var g=0,h=H.maxMorphTargets;g<h;g++)f.__webglMorphTargetInfluences[g]=0}var i=!1,g=c.program,h=g.uniforms,j=c.uniforms;g!==T&&(e.useProgram(g),T=g,i=!0);if(c.id!==I)I=c.id,i=!0;if(i){e.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray);if(d&&c.fog)if(j.fogColor.value=d.color,d instanceof THREE.Fog)j.fogNear.value=d.near,j.fogFar.value=d.far;
-else if(d instanceof THREE.FogExp2)j.fogDensity.value=d.density;if(c instanceof THREE.MeshPhongMaterial||c instanceof THREE.MeshLambertMaterial||c.lights){for(var k,t,m=0,n=0,q=0,l,p,r=La,v=r.directional.colors,E=r.directional.positions,y=r.point.colors,u=r.point.positions,D=r.point.distances,J=0,x=0,U=p=0,d=0,i=b.length;d<i;d++)if(k=b[d],t=k.color,l=k.intensity,p=k.distance,k instanceof THREE.AmbientLight)H.gammaInput?(m+=t.r*t.r,n+=t.g*t.g,q+=t.b*t.b):(m+=t.r,n+=t.g,q+=t.b);else if(k instanceof
-THREE.DirectionalLight)p=J*3,H.gammaInput?(v[p]=t.r*t.r*l*l,v[p+1]=t.g*t.g*l*l,v[p+2]=t.b*t.b*l*l):(v[p]=t.r*l,v[p+1]=t.g*l,v[p+2]=t.b*l),k=k.matrixWorld.getPosition(),t=1/k.length(),E[p]=k.x*t,E[p+1]=k.y*t,E[p+2]=k.z*t,J+=1;else if(k instanceof THREE.SpotLight&&!k.onlyShadow)p=J*3,H.gammaInput?(v[p]=t.r*t.r*l*l,v[p+1]=t.g*t.g*l*l,v[p+2]=t.b*t.b*l*l):(v[p]=t.r*l,v[p+1]=t.g*l,v[p+2]=t.b*l),k=k.matrixWorld.getPosition(),t=1/k.length(),E[p]=k.x*t,E[p+1]=k.y*t,E[p+2]=k.z*t,J+=1;else if(k instanceof THREE.PointLight)U=
-x*3,H.gammaInput?(y[U]=t.r*t.r*l*l,y[U+1]=t.g*t.g*l*l,y[U+2]=t.b*t.b*l*l):(y[U]=t.r*l,y[U+1]=t.g*l,y[U+2]=t.b*l),k=k.matrixWorld.getPosition(),u[U]=k.x,u[U+1]=k.y,u[U+2]=k.z,D[x]=p,x+=1;d=J*3;for(i=v.length;d<i;d++)v[d]=0;d=x*3;for(i=y.length;d<i;d++)y[d]=0;r.point.length=x;r.directional.length=J;r.ambient[0]=m;r.ambient[1]=n;r.ambient[2]=q;b=La;j.ambientLightColor.value=b.ambient;j.directionalLightColor.value=b.directional.colors;j.directionalLightDirection.value=b.directional.positions;j.pointLightColor.value=
+else if(d instanceof THREE.FogExp2)j.fogDensity.value=d.density;if(c instanceof THREE.MeshPhongMaterial||c instanceof THREE.MeshLambertMaterial||c.lights){for(var k,u,n=0,m=0,q=0,l,p,v=Ma,r=v.directional.colors,C=v.directional.positions,y=v.point.colors,t=v.point.positions,E=v.point.distances,J=0,x=0,U=p=0,d=0,i=b.length;d<i;d++)if(k=b[d],u=k.color,l=k.intensity,p=k.distance,k instanceof THREE.AmbientLight)H.gammaInput?(n+=u.r*u.r,m+=u.g*u.g,q+=u.b*u.b):(n+=u.r,m+=u.g,q+=u.b);else if(k instanceof
+THREE.DirectionalLight)p=J*3,H.gammaInput?(r[p]=u.r*u.r*l*l,r[p+1]=u.g*u.g*l*l,r[p+2]=u.b*u.b*l*l):(r[p]=u.r*l,r[p+1]=u.g*l,r[p+2]=u.b*l),k=k.matrixWorld.getPosition(),u=1/k.length(),C[p]=k.x*u,C[p+1]=k.y*u,C[p+2]=k.z*u,J+=1;else if(k instanceof THREE.SpotLight&&!k.onlyShadow)p=J*3,H.gammaInput?(r[p]=u.r*u.r*l*l,r[p+1]=u.g*u.g*l*l,r[p+2]=u.b*u.b*l*l):(r[p]=u.r*l,r[p+1]=u.g*l,r[p+2]=u.b*l),k=k.matrixWorld.getPosition(),u=1/k.length(),C[p]=k.x*u,C[p+1]=k.y*u,C[p+2]=k.z*u,J+=1;else if(k instanceof THREE.PointLight)U=
+x*3,H.gammaInput?(y[U]=u.r*u.r*l*l,y[U+1]=u.g*u.g*l*l,y[U+2]=u.b*u.b*l*l):(y[U]=u.r*l,y[U+1]=u.g*l,y[U+2]=u.b*l),k=k.matrixWorld.getPosition(),t[U]=k.x,t[U+1]=k.y,t[U+2]=k.z,E[x]=p,x+=1;d=J*3;for(i=r.length;d<i;d++)r[d]=0;d=x*3;for(i=y.length;d<i;d++)y[d]=0;v.point.length=x;v.directional.length=J;v.ambient[0]=n;v.ambient[1]=m;v.ambient[2]=q;b=Ma;j.ambientLightColor.value=b.ambient;j.directionalLightColor.value=b.directional.colors;j.directionalLightDirection.value=b.directional.positions;j.pointLightColor.value=
 b.point.colors;j.pointLightPosition.value=b.point.positions;j.pointLightDistance.value=b.point.distances}if(c instanceof THREE.MeshBasicMaterial||c instanceof THREE.MeshLambertMaterial||c instanceof THREE.MeshPhongMaterial)j.opacity.value=c.opacity,H.gammaInput?j.diffuse.value.copyGammaToLinear(c.color):j.diffuse.value=c.color,(j.map.texture=c.map)&&j.offsetRepeat.value.set(c.map.offset.x,c.map.offset.y,c.map.repeat.x,c.map.repeat.y),j.lightMap.texture=c.lightMap,j.envMap.texture=c.envMap,j.flipEnvMap.value=
 c.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,j.reflectivity.value=c.reflectivity,j.refractionRatio.value=c.refractionRatio,j.combine.value=c.combine,j.useRefract.value=c.envMap&&c.envMap.mapping instanceof THREE.CubeRefractionMapping;if(c instanceof THREE.LineBasicMaterial)j.diffuse.value=c.color,j.opacity.value=c.opacity;else if(c instanceof THREE.ParticleBasicMaterial)j.psColor.value=c.color,j.opacity.value=c.opacity,j.size.value=c.size,j.scale.value=ma.height/2,j.map.texture=c.map;else if(c instanceof
 THREE.MeshPhongMaterial)j.shininess.value=c.shininess,H.gammaInput?(j.ambient.value.copyGammaToLinear(c.ambient),j.specular.value.copyGammaToLinear(c.specular)):(j.ambient.value=c.ambient,j.specular.value=c.specular),c.wrapAround&&j.wrapRGB.value.copy(c.wrapRGB);else if(c instanceof THREE.MeshLambertMaterial)H.gammaInput?j.ambient.value.copyGammaToLinear(c.ambient):j.ambient.value=c.ambient,c.wrapAround&&j.wrapRGB.value.copy(c.wrapRGB);else if(c instanceof THREE.MeshDepthMaterial)j.mNear.value=a.near,
-j.mFar.value=a.far,j.opacity.value=c.opacity;else if(c instanceof THREE.MeshNormalMaterial)j.opacity.value=c.opacity;if(f.receiveShadow&&!c._shadowPass&&j.shadowMatrix){for(b=0;b<H.shadowMapPlugin.shadowMatrix.length;b++)j.shadowMatrix.value[b]=H.shadowMapPlugin.shadowMatrix[b],j.shadowMap.texture[b]=H.shadowMapPlugin.shadowMap[b];j.shadowDarkness.value=H.shadowMapDarkness;j.shadowBias.value=H.shadowMapBias}b=c.uniformsList;j=0;for(d=b.length;j<d;j++)if(n=g.uniforms[b[j][1]])if(m=b[j][0],q=m.type,
-i=m.value,q==="i")e.uniform1i(n,i);else if(q==="f")e.uniform1f(n,i);else if(q==="v2")e.uniform2f(n,i.x,i.y);else if(q==="v3")e.uniform3f(n,i.x,i.y,i.z);else if(q==="v4")e.uniform4f(n,i.x,i.y,i.z,i.w);else if(q==="c")e.uniform3f(n,i.r,i.g,i.b);else if(q==="fv1")e.uniform1fv(n,i);else if(q==="fv")e.uniform3fv(n,i);else if(q==="v3v"){if(!m._array)m._array=new Float32Array(3*i.length);q=0;for(r=i.length;q<r;q++)v=q*3,m._array[v]=i[q].x,m._array[v+1]=i[q].y,m._array[v+2]=i[q].z;e.uniform3fv(n,m._array)}else if(q===
-"m4"){if(!m._array)m._array=new Float32Array(16);i.flattenToArray(m._array);e.uniformMatrix4fv(n,!1,m._array)}else if(q==="m4v"){if(!m._array)m._array=new Float32Array(16*i.length);q=0;for(r=i.length;q<r;q++)i[q].flattenToArrayOffset(m._array,q*16);e.uniformMatrix4fv(n,!1,m._array)}else if(q==="t"){if(e.uniform1i(n,i),n=m.texture)if(n.image instanceof Array&&n.image.length===6){if(m=n,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=e.createTexture();
-e.activeTexture(e.TEXTURE0+i);e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);i=C(e.TEXTURE_CUBE_MAP,m,m.image[0]);n=Q(m.format);q=Q(m.type);for(r=0;r<6;r++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,n,n,q,m.image[r]);i&&e.generateMipmap(e.TEXTURE_CUBE_MAP);m.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(m=n,e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_CUBE_MAP,
-m.__webglTexture)):H.setTexture(n,i)}else if(q==="tv"){if(!m._array){m._array=[];q=0;for(r=m.texture.length;q<r;q++)m._array[q]=i+q}e.uniform1iv(n,m._array);q=0;for(r=m.texture.length;q<r;q++)(n=m.texture[q])&&H.setTexture(n,m._array[q])}(c instanceof THREE.ShaderMaterial||c instanceof THREE.MeshPhongMaterial||c.envMap)&&h.cameraPosition!==null&&e.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(c instanceof THREE.MeshPhongMaterial||c instanceof THREE.MeshLambertMaterial||c instanceof
-THREE.ShaderMaterial||c.skinning)&&h.viewMatrix!==null&&e.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray);c.skinning&&(e.uniformMatrix4fv(h.cameraInverseMatrix,!1,a._viewMatrixArray),e.uniformMatrix4fv(h.boneGlobalMatrices,!1,f.boneMatrices))}e.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray);h.normalMatrix&&e.uniformMatrix3fv(h.normalMatrix,!1,f._normalMatrixArray);(c instanceof THREE.ShaderMaterial||c.envMap||c.skinning||f.receiveShadow)&&h.objectMatrix!==null&&e.uniformMatrix4fv(h.objectMatrix,
-!1,f._objectMatrixArray);return g}function J(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function O(a){wa!==a&&(e.depthMask(a),wa=a)}function P(a,b,c){Ca!==a&&(a?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Ca=a);if(a&&(za!==b||Aa!==c))e.polygonOffset(b,c),za=b,Aa=c}function V(a,b){var c;a==="fragment"?c=e.createShader(e.FRAGMENT_SHADER):
-a==="vertex"&&(c=e.createShader(e.VERTEX_SHADER));e.shaderSource(c,b);e.compileShader(c);if(!e.getShaderParameter(c,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(c)),console.error(b),null;return c}function C(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(e.texParameteri(a,e.TEXTURE_WRAP_S,Q(b.wrapS)),e.texParameteri(a,e.TEXTURE_WRAP_T,Q(b.wrapT)),e.texParameteri(a,e.TEXTURE_MAG_FILTER,Q(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,Q(b.minFilter)),!0):(e.texParameteri(a,
-e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_MAG_FILTER,N(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,N(b.minFilter)),!1)}function D(a,b){e.bindRenderbuffer(e.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,
-e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,a)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height)}function N(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function Q(a){switch(a){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;
-case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;
-case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var a=a||{},ma=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ua=a.precision!==void 0?a.precision:"mediump",ha=a.antialias!==void 0?a.antialias:!1,ca=
-a.stencil!==void 0?a.stencil:!0,pa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ja=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),xa=a.clearAlpha!==void 0?a.clearAlpha:0,va=a.maxLights!==void 0?a.maxLights:4;this.domElement=ma;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 H=this,e,ya=[],T=null,qa=null,I=-1,R=null,na=0,ra=null,Z=null,sa=null,oa=null,wa=null,Ca=null,za=null,
-Aa=null,ta=null,Ea=0,Fa=0,Ga=0,Ha=0,Ja=0,Ka=0,Ia=new THREE.Frustum,Da=new THREE.Matrix4,Ba=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};e=function(){var a;try{if(!(a=ma.getContext("experimental-webgl",{antialias:ha,stencil:ca,preserveDrawingBuffer:pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+
-" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(ja.r,ja.g,ja.b,xa);this.context=e;var Ma=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return e};this.supportsVertexTextures=
-function(){return Ma};this.setSize=function(a,b){ma.width=a;ma.height=b;this.setViewport(0,0,ma.width,ma.height)};this.setViewport=function(a,b,c,d){Ea=a;Fa=b;Ga=c;Ha=d;e.viewport(Ea,Fa,Ga,Ha)};this.setScissor=function(a,b,c,d){e.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ja.setHex(a);xa=b;e.clearColor(ja.r,ja.g,ja.b,xa)};this.setClearColor=function(a,b){ja.copy(a);xa=b;e.clearColor(ja.r,ja.g,ja.b,
-xa)};this.getClearColor=function(){return ja};this.getClearAlpha=function(){return xa};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=e.COLOR_BUFFER_BIT;if(b===void 0||b)d|=e.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=e.STENCIL_BUFFER_BIT;e.clear(d)};this.clearTarget=function(a,b,c,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];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);
-e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)e.deleteBuffer(c.__webglCustomAttributesList[d].buffer);H.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=
-a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,e.deleteTexture(a.__webglTexture),
-H.info.memory.textures--};this.updateShadowMap=function(a,b){T=null;I=R=wa=oa=sa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=e.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=e.createBuffer();a.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,a.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(b.attributes.position),e.vertexAttribPointer(b.attributes.position,
-3,e.FLOAT,!1,0,0));if(a.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,g,h,i,j,m,k,l,n,q=a.count*3;for(n=0;n<q;n+=9)c=a.normalArray,d=c[n],f=c[n+1],g=c[n+2],h=c[n+3],j=c[n+4],k=c[n+5],i=c[n+6],m=c[n+7],l=c[n+8],d=(d+h+i)/3,f=(f+j+m)/3,g=(g+k+l)/3,c[n]=d,c[n+1]=f,c[n+2]=g,c[n+3]=d,c[n+4]=f,c[n+5]=g,c[n+6]=d,c[n+7]=f,c[n+8]=g}e.bufferData(e.ARRAY_BUFFER,a.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(b.attributes.normal);e.vertexAttribPointer(b.attributes.normal,
-3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,g){if(d.opacity!==0&&(c=y(a,b,c,d,g),a=c.attributes,b=!1,d=f.id*16777215+c.id*2+(d.wireframe?1:0),d!==R&&(R=d,b=!0),g instanceof THREE.Mesh)){d=f.offsets;for(g=0;g<d.length;++g)b&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexPositionBuffer),e.vertexAttribPointer(a.position,f.vertexPositionBuffer.itemSize,e.FLOAT,!1,0,d[g].index*12),a.normal>=0&&f.vertexNormalBuffer&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexNormalBuffer),
-e.vertexAttribPointer(a.normal,f.vertexNormalBuffer.itemSize,e.FLOAT,!1,0,d[g].index*12)),a.uv>=0&&f.vertexUvBuffer&&(f.vertexUvBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.vertexUvBuffer),e.vertexAttribPointer(a.uv,f.vertexUvBuffer.itemSize,e.FLOAT,!1,0,d[g].index*8),e.enableVertexAttribArray(a.uv)):e.disableVertexAttribArray(a.uv)),a.color>=0&&f.vertexColorBuffer&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexColorBuffer),e.vertexAttribPointer(a.color,f.vertexColorBuffer.itemSize,e.FLOAT,!1,0,d[g].index*16)),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
-f.vertexIndexBuffer)),e.drawElements(e.TRIANGLES,d[g].count,e.UNSIGNED_SHORT,d[g].start*2),H.info.render.calls++,H.info.render.vertices+=d[g].count,H.info.render.faces+=d[g].count/3}};this.renderBuffer=function(a,b,c,d,f,g){if(d.opacity!==0){var h,i,c=y(a,b,c,d,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(d.wireframe?1:0);c!==R&&(R=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(g.morphTargetBase){c=
-d.program.attributes;g.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){h=0;var j=g.morphTargetForcedOrder;for(i=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<j.length;)e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[j[h]]),e.vertexAttribPointer(c["morphTarget"+
-h],3,e.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[h]=i[j[h]],h++}else{var j=[],m=-1,k=0;i=g.morphTargetInfluences;var l,n=i.length;h=0;for(g.morphTargetBase!==-1&&(j[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(l=0;l<n;l++)!j[l]&&i[l]>m&&(k=l,m=i[k]);e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=m;j[k]=1;m=-1;h++}}d.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(d.program.uniforms.morphTargetInfluences,
-g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){h=0;for(i=f.__webglCustomAttributesList.length;h<i;h++)c=f.__webglCustomAttributesList[h],b[c.buffer.belongsToAttribute]>=0&&(e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,e.FLOAT,!1,0,0))}b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglNormalBuffer),e.vertexAttribPointer(b.normal,
-3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));
-d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,
-4,e.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ta&&(e.lineWidth(d),ta=d),a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),e.drawElements(e.LINES,f.__webglLineCount,e.UNSIGNED_SHORT,0)):(a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),e.drawElements(e.TRIANGLES,f.__webglFaceCount,e.UNSIGNED_SHORT,0)),H.info.render.calls++,H.info.render.vertices+=f.__webglFaceCount,H.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===
-THREE.LineStrip?e.LINE_STRIP:e.LINES,d=d.linewidth,d!==ta&&(e.lineWidth(d),ta=d),e.drawArrays(g,0,f.__webglLineCount),H.info.render.calls++):g instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,f.__webglParticleCount),H.info.render.calls++,H.info.render.points+=f.__webglParticleCount):g instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,f.__webglVertexCount),H.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,h,m,p=a.lights,r=a.fog;I=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
-b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();l(this.renderPluginsPre,a,b);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;H.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);
-b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Da.multiply(b.projectionMatrix,b.matrixWorldInverse);Ia.setFromMatrix(Da);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(f=m.length;d<f;d++)if(g=m[d],h=g.object,g.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||Ia.contains(h))){h.matrixWorld.flattenToArray(h._objectMatrixArray);J(h,b);var t=
-g,v=t.object,n=t.buffer,q=void 0,q=q=void 0,q=v.material;if(q instanceof THREE.MeshFaceMaterial){if(q=n.materialIndex,q>=0)q=v.geometry.materials[q],q.transparent?(t.transparent=q,t.opaque=null):(t.opaque=q,t.transparent=null)}else if(q)q.transparent?(t.transparent=q,t.opaque=null):(t.opaque=q,t.transparent=null);g.render=!0;if(this.sortObjects)h.renderDepth?g.z=h.renderDepth:(Ba.copy(h.position),Da.multiplyVector3(Ba),g.z=Ba.z)}this.sortObjects&&m.sort(i);m=a.__webglObjectsImmediate;d=0;for(f=m.length;d<
-f;d++)if(g=m[d],h=g.object,h.visible)h.matrixAutoUpdate&&h.matrixWorld.flattenToArray(h._objectMatrixArray),J(h,b),h=g.object.material,h.transparent?(g.transparent=h,g.opaque=null):(g.opaque=h,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),O(a.overrideMaterial.depthWrite),P(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,p,
-r,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,p,r,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,p,r,!1),j(a.__webglObjectsImmediate,"opaque",b,p,r,!1),k(a.__webglObjects,!1,"transparent",b,p,r,!0),j(a.__webglObjectsImmediate,"transparent",b,p,r,!0));l(this.renderPluginsPost,a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),
-e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,c.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,f){var g=y(a,b,c,d,f);R=-1;H.setObjectFaces(f);f.immediateRenderCallback?f.immediateRenderCallback(g,e,Ia):f.render(function(a){H.renderBufferImmediate(a,g,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=
-[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var i=a.__objectsAdded[0],j=a,k=void 0,l=void 0,F=void 0;if(!i.__webglInit)if(i.__webglInit=!0,i._modelViewMatrix=new THREE.Matrix4,i._normalMatrixArray=new Float32Array(9),i._modelViewMatrixArray=new Float32Array(16),i._objectMatrixArray=new Float32Array(16),i.matrixWorld.flattenToArray(i._objectMatrixArray),i instanceof THREE.Mesh){if(l=i.geometry,l instanceof THREE.Geometry){if(l.geometryGroups===void 0){var F=l,G=void 0,
-w=void 0,y=void 0,C=void 0,t=void 0,D=void 0,n=void 0,q={},J=F.morphTargets.length;F.geometryGroups={};G=0;for(w=F.faces.length;G<w;G++)y=F.faces[G],C=y.materialIndex,D=C!==void 0?C:-1,q[D]===void 0&&(q[D]={hash:D,counter:0}),n=q[D].hash+"_"+q[D].counter,F.geometryGroups[n]===void 0&&(F.geometryGroups[n]={faces3:[],faces4:[],materialIndex:C,vertices:0,numMorphTargets:J}),t=y instanceof THREE.Face3?3:4,F.geometryGroups[n].vertices+t>65535&&(q[D].counter+=1,n=q[D].hash+"_"+q[D].counter,F.geometryGroups[n]===
-void 0&&(F.geometryGroups[n]={faces3:[],faces4:[],materialIndex:C,vertices:0,numMorphTargets:J})),y instanceof THREE.Face3?F.geometryGroups[n].faces3.push(G):F.geometryGroups[n].faces4.push(G),F.geometryGroups[n].vertices+=t;F.geometryGroupsList=[];G=void 0;for(G in F.geometryGroups)F.geometryGroups[G].id=na++,F.geometryGroupsList.push(F.geometryGroups[G])}for(k in l.geometryGroups)if(F=l.geometryGroups[k],!F.__webglVertexBuffer){G=F;G.__webglVertexBuffer=e.createBuffer();G.__webglNormalBuffer=e.createBuffer();
-G.__webglTangentBuffer=e.createBuffer();G.__webglColorBuffer=e.createBuffer();G.__webglUVBuffer=e.createBuffer();G.__webglUV2Buffer=e.createBuffer();G.__webglSkinVertexABuffer=e.createBuffer();G.__webglSkinVertexBBuffer=e.createBuffer();G.__webglSkinIndicesBuffer=e.createBuffer();G.__webglSkinWeightsBuffer=e.createBuffer();G.__webglFaceBuffer=e.createBuffer();G.__webglLineBuffer=e.createBuffer();if(G.numMorphTargets){y=w=void 0;G.__webglMorphTargetsBuffers=[];w=0;for(y=G.numMorphTargets;w<y;w++)G.__webglMorphTargetsBuffers.push(e.createBuffer())}H.info.memory.geometries++;
-C=i;t=C.geometry;w=F.faces3;D=F.faces4;G=w.length*3+D.length*4;y=w.length*1+D.length*2;D=w.length*3+D.length*4;w=d(C,F);n=g(w);q=c(w);J=f(w);F.__vertexArray=new Float32Array(G*3);if(q)F.__normalArray=new Float32Array(G*3);if(t.hasTangents)F.__tangentArray=new Float32Array(G*4);if(J)F.__colorArray=new Float32Array(G*3);if(n){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)F.__uvArray=new Float32Array(G*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)F.__uv2Array=new Float32Array(G*2)}if(C.geometry.skinWeights.length&&
-C.geometry.skinIndices.length)F.__skinVertexAArray=new Float32Array(G*4),F.__skinVertexBArray=new Float32Array(G*4),F.__skinIndexArray=new Float32Array(G*4),F.__skinWeightArray=new Float32Array(G*4);F.__faceArray=new Uint16Array(y*3);F.__lineArray=new Uint16Array(D*2);if(F.numMorphTargets){F.__morphTargetsArrays=[];C=0;for(t=F.numMorphTargets;C<t;C++)F.__morphTargetsArrays.push(new Float32Array(G*3))}F.__webglFaceCount=y*3;F.__webglLineCount=D*2;if(w.attributes){if(F.__webglCustomAttributesList===
-void 0)F.__webglCustomAttributesList=[];y=void 0;for(y in w.attributes){var C=w.attributes[y],t={},ka;for(ka in C)t[ka]=C[ka];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,D=1,t.type==="v2"?D=2:t.type==="v3"?D=3:t.type==="v4"?D=4:t.type==="c"&&(D=3),t.size=D,t.array=new Float32Array(G*D),t.buffer=e.createBuffer(),t.buffer.belongsToAttribute=y,C.needsUpdate=!0,t.__original=C;F.__webglCustomAttributesList.push(t)}}F.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=
-!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=!0}}}else if(i instanceof THREE.Ribbon){if(l=i.geometry,!l.__webglVertexBuffer)F=l,F.__webglVertexBuffer=e.createBuffer(),F.__webglColorBuffer=e.createBuffer(),H.info.memory.geometries++,F=l,G=F.vertices.length,F.__vertexArray=new Float32Array(G*3),F.__colorArray=new Float32Array(G*3),F.__webglVertexCount=G,l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(i instanceof THREE.Line){if(l=i.geometry,!l.__webglVertexBuffer)F=
-l,F.__webglVertexBuffer=e.createBuffer(),F.__webglColorBuffer=e.createBuffer(),H.info.memory.geometries++,F=l,G=i,w=F.vertices.length,F.__vertexArray=new Float32Array(w*3),F.__colorArray=new Float32Array(w*3),F.__webglLineCount=w,b(F,G),l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(i instanceof THREE.ParticleSystem&&(l=i.geometry,!l.__webglVertexBuffer))F=l,F.__webglVertexBuffer=e.createBuffer(),F.__webglColorBuffer=e.createBuffer(),H.info.geometries++,F=l,G=i,w=F.vertices.length,F.__vertexArray=
-new Float32Array(w*3),F.__colorArray=new Float32Array(w*3),F.__sortArray=[],F.__webglParticleCount=w,b(F,G),l.__dirtyVertices=!0,l.__dirtyColors=!0;if(!i.__webglActive){if(i instanceof THREE.Mesh)if(l=i.geometry,l instanceof THREE.BufferGeometry)p(j.__webglObjects,l,i);else for(k in l.geometryGroups)F=l.geometryGroups[k],p(j.__webglObjects,F,i);else i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem?(l=i.geometry,p(j.__webglObjects,l,i)):THREE.MarchingCubes!==void 0&&
-i instanceof THREE.MarchingCubes||i.immediateRenderCallback?j.__webglObjectsImmediate.push({object:i,opaque:null,transparent:null}):i instanceof THREE.Sprite?j.__webglSprites.push(i):i instanceof THREE.LensFlare&&j.__webglFlares.push(i);i.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)i=a.__objectsRemoved[0],j=a,i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem||i instanceof THREE.Ribbon||i instanceof THREE.Line?m(j.__webglObjects,i):i instanceof THREE.Sprite?
-E(j.__webglSprites,i):i instanceof THREE.LensFlare?E(j.__webglFlares,i):(i instanceof THREE.MarchingCubes||i.immediateRenderCallback)&&m(j.__webglObjectsImmediate,i),i.__webglActive=!1,a.__objectsRemoved.splice(0,1);i=0;for(j=a.__webglObjects.length;i<j;i++)if(ka=a.__webglObjects[i].object,k=ka.geometry,l=y=w=void 0,ka instanceof THREE.Mesh)if(k instanceof THREE.BufferGeometry)k.__dirtyVertices=!1,k.__dirtyElements=!1,k.__dirtyUvs=!1,k.__dirtyNormals=!1,k.__dirtyColors=!1;else{F=0;for(G=k.geometryGroupsList.length;F<
-G;F++)if(w=k.geometryGroupsList[F],l=d(ka,w),y=l.attributes&&r(l),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||y){var M=ka,y=e.DYNAMIC_DRAW,C=!k.dynamic,n=l;if(w.__inittedArrays){var t=c(n),D=f(n),O=g(n),Q=t===THREE.SmoothShading,I=q=n=void 0,u=void 0,ba=void 0,N=void 0,x=void 0,U=void 0,P=void 0,V=I=void 0,z=void 0,A=void 0,B=void 0,da=u=void 0,ea=void 0,la=void 0,W=u=P=void 0,X=void 0,R=B=A=z=x=void 0,K=u=B=A=z=
-R=B=A=z=R=B=A=z=void 0,L=void 0,T=N=void 0,Z=void 0,$=void 0,ma=void 0,fa=void 0,ja=V=$=L=0,ha=0,ca=K=I=0,S=x=da=0,s=0,ga=void 0,S=w.__vertexArray,Z=w.__uvArray,s=w.__uv2Array,T=w.__normalArray,ba=w.__tangentArray,ea=w.__colorArray,W=w.__skinVertexAArray,X=w.__skinVertexBArray,U=w.__skinIndexArray,ia=w.__skinWeightArray,R=w.__morphTargetsArrays,J=w.__webglCustomAttributesList,o=void 0,o=w.__faceArray,ga=w.__lineArray,la=M.geometry,ra=la.__dirtyElements,ua=la.__dirtyUvs,N=la.__dirtyNormals,P=la.__dirtyTangents,
-xa=la.__dirtyColors,ma=la.__dirtyMorphTargets,fa=la.vertices,M=w.faces3,Y=w.faces4,aa=la.faces,qa=la.faceVertexUvs[0],sa=la.faceVertexUvs[1],oa=la.skinVerticesA,pa=la.skinVerticesB,va=la.skinIndices,ta=la.skinWeights,wa=la.morphTargets;if(la.__dirtyVertices){n=0;for(q=M.length;n<q;n++)u=aa[M[n]],z=fa[u.a].position,A=fa[u.b].position,B=fa[u.c].position,S[$]=z.x,S[$+1]=z.y,S[$+2]=z.z,S[$+3]=A.x,S[$+4]=A.y,S[$+5]=A.z,S[$+6]=B.x,S[$+7]=B.y,S[$+8]=B.z,$+=9;n=0;for(q=Y.length;n<q;n++)u=aa[Y[n]],z=fa[u.a].position,
-A=fa[u.b].position,B=fa[u.c].position,u=fa[u.d].position,S[$]=z.x,S[$+1]=z.y,S[$+2]=z.z,S[$+3]=A.x,S[$+4]=A.y,S[$+5]=A.z,S[$+6]=B.x,S[$+7]=B.y,S[$+8]=B.z,S[$+9]=u.x,S[$+10]=u.y,S[$+11]=u.z,$+=12;e.bindBuffer(e.ARRAY_BUFFER,w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,S,y)}if(ma){$=0;for(ma=wa.length;$<ma;$++){n=S=0;for(q=M.length;n<q;n++)u=aa[M[n]],z=wa[$].vertices[u.a].position,A=wa[$].vertices[u.b].position,B=wa[$].vertices[u.c].position,fa=R[$],fa[S]=z.x,fa[S+1]=z.y,fa[S+2]=z.z,fa[S+3]=A.x,
-fa[S+4]=A.y,fa[S+5]=A.z,fa[S+6]=B.x,fa[S+7]=B.y,fa[S+8]=B.z,S+=9;n=0;for(q=Y.length;n<q;n++)u=aa[Y[n]],z=wa[$].vertices[u.a].position,A=wa[$].vertices[u.b].position,B=wa[$].vertices[u.c].position,u=wa[$].vertices[u.d].position,fa=R[$],fa[S]=z.x,fa[S+1]=z.y,fa[S+2]=z.z,fa[S+3]=A.x,fa[S+4]=A.y,fa[S+5]=A.z,fa[S+6]=B.x,fa[S+7]=B.y,fa[S+8]=B.z,fa[S+9]=u.x,fa[S+10]=u.y,fa[S+11]=u.z,S+=12;e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[$]);e.bufferData(e.ARRAY_BUFFER,R[$],y)}}if(ta.length){n=0;
-for(q=M.length;n<q;n++)u=aa[M[n]],z=ta[u.a],A=ta[u.b],B=ta[u.c],ia[x]=z.x,ia[x+1]=z.y,ia[x+2]=z.z,ia[x+3]=z.w,ia[x+4]=A.x,ia[x+5]=A.y,ia[x+6]=A.z,ia[x+7]=A.w,ia[x+8]=B.x,ia[x+9]=B.y,ia[x+10]=B.z,ia[x+11]=B.w,z=va[u.a],A=va[u.b],B=va[u.c],U[x]=z.x,U[x+1]=z.y,U[x+2]=z.z,U[x+3]=z.w,U[x+4]=A.x,U[x+5]=A.y,U[x+6]=A.z,U[x+7]=A.w,U[x+8]=B.x,U[x+9]=B.y,U[x+10]=B.z,U[x+11]=B.w,z=oa[u.a],A=oa[u.b],B=oa[u.c],W[x]=z.x,W[x+1]=z.y,W[x+2]=z.z,W[x+3]=1,W[x+4]=A.x,W[x+5]=A.y,W[x+6]=A.z,W[x+7]=1,W[x+8]=B.x,W[x+9]=B.y,
-W[x+10]=B.z,W[x+11]=1,z=pa[u.a],A=pa[u.b],B=pa[u.c],X[x]=z.x,X[x+1]=z.y,X[x+2]=z.z,X[x+3]=1,X[x+4]=A.x,X[x+5]=A.y,X[x+6]=A.z,X[x+7]=1,X[x+8]=B.x,X[x+9]=B.y,X[x+10]=B.z,X[x+11]=1,x+=12;n=0;for(q=Y.length;n<q;n++)u=aa[Y[n]],z=ta[u.a],A=ta[u.b],B=ta[u.c],R=ta[u.d],ia[x]=z.x,ia[x+1]=z.y,ia[x+2]=z.z,ia[x+3]=z.w,ia[x+4]=A.x,ia[x+5]=A.y,ia[x+6]=A.z,ia[x+7]=A.w,ia[x+8]=B.x,ia[x+9]=B.y,ia[x+10]=B.z,ia[x+11]=B.w,ia[x+12]=R.x,ia[x+13]=R.y,ia[x+14]=R.z,ia[x+15]=R.w,z=va[u.a],A=va[u.b],B=va[u.c],R=va[u.d],U[x]=
-z.x,U[x+1]=z.y,U[x+2]=z.z,U[x+3]=z.w,U[x+4]=A.x,U[x+5]=A.y,U[x+6]=A.z,U[x+7]=A.w,U[x+8]=B.x,U[x+9]=B.y,U[x+10]=B.z,U[x+11]=B.w,U[x+12]=R.x,U[x+13]=R.y,U[x+14]=R.z,U[x+15]=R.w,z=oa[u.a],A=oa[u.b],B=oa[u.c],R=oa[u.d],W[x]=z.x,W[x+1]=z.y,W[x+2]=z.z,W[x+3]=1,W[x+4]=A.x,W[x+5]=A.y,W[x+6]=A.z,W[x+7]=1,W[x+8]=B.x,W[x+9]=B.y,W[x+10]=B.z,W[x+11]=1,W[x+12]=R.x,W[x+13]=R.y,W[x+14]=R.z,W[x+15]=1,z=pa[u.a],A=pa[u.b],B=pa[u.c],u=pa[u.d],X[x]=z.x,X[x+1]=z.y,X[x+2]=z.z,X[x+3]=1,X[x+4]=A.x,X[x+5]=A.y,X[x+6]=A.z,X[x+
-7]=1,X[x+8]=B.x,X[x+9]=B.y,X[x+10]=B.z,X[x+11]=1,X[x+12]=u.x,X[x+13]=u.y,X[x+14]=u.z,X[x+15]=1,x+=16;x>0&&(e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,W,y),e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,X,y),e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,U,y),e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ia,y))}if(xa&&D){n=0;for(q=M.length;n<q;n++)u=
-aa[M[n]],x=u.vertexColors,U=u.color,x.length===3&&D===THREE.VertexColors?(u=x[0],W=x[1],X=x[2]):X=W=u=U,ea[da]=u.r,ea[da+1]=u.g,ea[da+2]=u.b,ea[da+3]=W.r,ea[da+4]=W.g,ea[da+5]=W.b,ea[da+6]=X.r,ea[da+7]=X.g,ea[da+8]=X.b,da+=9;n=0;for(q=Y.length;n<q;n++)u=aa[Y[n]],x=u.vertexColors,U=u.color,x.length===4&&D===THREE.VertexColors?(u=x[0],W=x[1],X=x[2],x=x[3]):x=X=W=u=U,ea[da]=u.r,ea[da+1]=u.g,ea[da+2]=u.b,ea[da+3]=W.r,ea[da+4]=W.g,ea[da+5]=W.b,ea[da+6]=X.r,ea[da+7]=X.g,ea[da+8]=X.b,ea[da+9]=x.r,ea[da+
-10]=x.g,ea[da+11]=x.b,da+=12;da>0&&(e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,ea,y))}if(P&&la.hasTangents){n=0;for(q=M.length;n<q;n++)u=aa[M[n]],P=u.vertexTangents,da=P[0],ea=P[1],la=P[2],ba[K]=da.x,ba[K+1]=da.y,ba[K+2]=da.z,ba[K+3]=da.w,ba[K+4]=ea.x,ba[K+5]=ea.y,ba[K+6]=ea.z,ba[K+7]=ea.w,ba[K+8]=la.x,ba[K+9]=la.y,ba[K+10]=la.z,ba[K+11]=la.w,K+=12;n=0;for(q=Y.length;n<q;n++)u=aa[Y[n]],P=u.vertexTangents,da=P[0],ea=P[1],la=P[2],P=P[3],ba[K]=da.x,ba[K+1]=da.y,ba[K+
-2]=da.z,ba[K+3]=da.w,ba[K+4]=ea.x,ba[K+5]=ea.y,ba[K+6]=ea.z,ba[K+7]=ea.w,ba[K+8]=la.x,ba[K+9]=la.y,ba[K+10]=la.z,ba[K+11]=la.w,ba[K+12]=P.x,ba[K+13]=P.y,ba[K+14]=P.z,ba[K+15]=P.w,K+=16;e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ba,y)}if(N&&t){n=0;for(q=M.length;n<q;n++)if(u=aa[M[n]],ba=u.vertexNormals,N=u.normal,ba.length===3&&Q)for(K=0;K<3;K++)N=ba[K],T[I]=N.x,T[I+1]=N.y,T[I+2]=N.z,I+=3;else for(K=0;K<3;K++)T[I]=N.x,T[I+1]=N.y,T[I+2]=N.z,I+=3;n=0;for(q=Y.length;n<
-q;n++)if(u=aa[Y[n]],ba=u.vertexNormals,N=u.normal,ba.length===4&&Q)for(K=0;K<4;K++)N=ba[K],T[I]=N.x,T[I+1]=N.y,T[I+2]=N.z,I+=3;else for(K=0;K<4;K++)T[I]=N.x,T[I+1]=N.y,T[I+2]=N.z,I+=3;e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,T,y)}if(ua&&qa&&O){n=0;for(q=M.length;n<q;n++)if(I=M[n],I=qa[I],I!==void 0)for(K=0;K<3;K++)T=I[K],Z[V]=T.u,Z[V+1]=T.v,V+=2;n=0;for(q=Y.length;n<q;n++)if(I=Y[n],I=qa[I],I!==void 0)for(K=0;K<4;K++)T=I[K],Z[V]=T.u,Z[V+1]=T.v,V+=2;V>0&&(e.bindBuffer(e.ARRAY_BUFFER,
-w.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,Z,y))}if(ua&&sa&&O){n=0;for(q=M.length;n<q;n++)if(I=M[n],V=sa[I],V!==void 0)for(K=0;K<3;K++)Z=V[K],s[ja]=Z.u,s[ja+1]=Z.v,ja+=2;n=0;for(q=Y.length;n<q;n++)if(I=Y[n],V=sa[I],V!==void 0)for(K=0;K<4;K++)Z=V[K],s[ja]=Z.u,s[ja+1]=Z.v,ja+=2;ja>0&&(e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,s,y))}if(ra){n=0;for(q=M.length;n<q;n++)o[ha]=L,o[ha+1]=L+1,o[ha+2]=L+2,ha+=3,ga[ca]=L,ga[ca+1]=L+1,ga[ca+2]=L,ga[ca+3]=L+2,ga[ca+4]=L+1,
-ga[ca+5]=L+2,ca+=6,L+=3;n=0;for(q=Y.length;n<q;n++)o[ha]=L,o[ha+1]=L+1,o[ha+2]=L+3,o[ha+3]=L+1,o[ha+4]=L+2,o[ha+5]=L+3,ha+=6,ga[ca]=L,ga[ca+1]=L+1,ga[ca+2]=L,ga[ca+3]=L+3,ga[ca+4]=L+1,ga[ca+5]=L+2,ga[ca+6]=L+2,ga[ca+7]=L+3,ca+=8,L+=4;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,o,y);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ga,y)}if(J){K=0;for(L=J.length;K<L;K++)if(o=J[K],o.__original.needsUpdate){s=
-0;if(o.size===1)if(o.boundTo===void 0||o.boundTo==="vertices"){n=0;for(q=M.length;n<q;n++)u=aa[M[n]],o.array[s]=o.value[u.a],o.array[s+1]=o.value[u.b],o.array[s+2]=o.value[u.c],s+=3;n=0;for(q=Y.length;n<q;n++)u=aa[Y[n]],o.array[s]=o.value[u.a],o.array[s+1]=o.value[u.b],o.array[s+2]=o.value[u.c],o.array[s+3]=o.value[u.d],s+=4}else{if(o.boundTo==="faces"){n=0;for(q=M.length;n<q;n++)ga=o.value[M[n]],o.array[s]=ga,o.array[s+1]=ga,o.array[s+2]=ga,s+=3;n=0;for(q=Y.length;n<q;n++)ga=o.value[Y[n]],o.array[s]=
-ga,o.array[s+1]=ga,o.array[s+2]=ga,o.array[s+3]=ga,s+=4}}else if(o.size===2)if(o.boundTo===void 0||o.boundTo==="vertices"){n=0;for(q=M.length;n<q;n++)u=aa[M[n]],z=o.value[u.a],A=o.value[u.b],B=o.value[u.c],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=A.x,o.array[s+3]=A.y,o.array[s+4]=B.x,o.array[s+5]=B.y,s+=6;n=0;for(q=Y.length;n<q;n++)u=aa[Y[n]],z=o.value[u.a],A=o.value[u.b],B=o.value[u.c],u=o.value[u.d],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=A.x,o.array[s+3]=A.y,o.array[s+4]=B.x,o.array[s+
-5]=B.y,o.array[s+6]=u.x,o.array[s+7]=u.y,s+=8}else{if(o.boundTo==="faces"){n=0;for(q=M.length;n<q;n++)B=A=z=ga=o.value[M[n]],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=A.x,o.array[s+3]=A.y,o.array[s+4]=B.x,o.array[s+5]=B.y,s+=6;n=0;for(q=Y.length;n<q;n++)u=B=A=z=ga=o.value[Y[n]],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=A.x,o.array[s+3]=A.y,o.array[s+4]=B.x,o.array[s+5]=B.y,o.array[s+6]=u.x,o.array[s+7]=u.y,s+=8}}else if(o.size===3)if(t=o.type==="c"?["r","g","b"]:["x","y","z"],o.boundTo===void 0||
-o.boundTo==="vertices"){n=0;for(q=M.length;n<q;n++)u=aa[M[n]],z=o.value[u.a],A=o.value[u.b],B=o.value[u.c],o.array[s]=z[t[0]],o.array[s+1]=z[t[1]],o.array[s+2]=z[t[2]],o.array[s+3]=A[t[0]],o.array[s+4]=A[t[1]],o.array[s+5]=A[t[2]],o.array[s+6]=B[t[0]],o.array[s+7]=B[t[1]],o.array[s+8]=B[t[2]],s+=9;n=0;for(q=Y.length;n<q;n++)u=aa[Y[n]],z=o.value[u.a],A=o.value[u.b],B=o.value[u.c],u=o.value[u.d],o.array[s]=z[t[0]],o.array[s+1]=z[t[1]],o.array[s+2]=z[t[2]],o.array[s+3]=A[t[0]],o.array[s+4]=A[t[1]],o.array[s+
-5]=A[t[2]],o.array[s+6]=B[t[0]],o.array[s+7]=B[t[1]],o.array[s+8]=B[t[2]],o.array[s+9]=u[t[0]],o.array[s+10]=u[t[1]],o.array[s+11]=u[t[2]],s+=12}else{if(o.boundTo==="faces"){n=0;for(q=M.length;n<q;n++)B=A=z=ga=o.value[M[n]],o.array[s]=z[t[0]],o.array[s+1]=z[t[1]],o.array[s+2]=z[t[2]],o.array[s+3]=A[t[0]],o.array[s+4]=A[t[1]],o.array[s+5]=A[t[2]],o.array[s+6]=B[t[0]],o.array[s+7]=B[t[1]],o.array[s+8]=B[t[2]],s+=9;n=0;for(q=Y.length;n<q;n++)u=B=A=z=ga=o.value[Y[n]],o.array[s]=z[t[0]],o.array[s+1]=z[t[1]],
-o.array[s+2]=z[t[2]],o.array[s+3]=A[t[0]],o.array[s+4]=A[t[1]],o.array[s+5]=A[t[2]],o.array[s+6]=B[t[0]],o.array[s+7]=B[t[1]],o.array[s+8]=B[t[2]],o.array[s+9]=u[t[0]],o.array[s+10]=u[t[1]],o.array[s+11]=u[t[2]],s+=12}}else if(o.size===4)if(o.boundTo===void 0||o.boundTo==="vertices"){n=0;for(q=M.length;n<q;n++)u=aa[M[n]],z=o.value[u.a],A=o.value[u.b],B=o.value[u.c],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=z.z,o.array[s+3]=z.w,o.array[s+4]=A.x,o.array[s+5]=A.y,o.array[s+6]=A.z,o.array[s+7]=A.w,
-o.array[s+8]=B.x,o.array[s+9]=B.y,o.array[s+10]=B.z,o.array[s+11]=B.w,s+=12;n=0;for(q=Y.length;n<q;n++)u=aa[Y[n]],z=o.value[u.a],A=o.value[u.b],B=o.value[u.c],u=o.value[u.d],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=z.z,o.array[s+3]=z.w,o.array[s+4]=A.x,o.array[s+5]=A.y,o.array[s+6]=A.z,o.array[s+7]=A.w,o.array[s+8]=B.x,o.array[s+9]=B.y,o.array[s+10]=B.z,o.array[s+11]=B.w,o.array[s+12]=u.x,o.array[s+13]=u.y,o.array[s+14]=u.z,o.array[s+15]=u.w,s+=16}else if(o.boundTo==="faces"){n=0;for(q=M.length;n<
-q;n++)B=A=z=ga=o.value[M[n]],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=z.z,o.array[s+3]=z.w,o.array[s+4]=A.x,o.array[s+5]=A.y,o.array[s+6]=A.z,o.array[s+7]=A.w,o.array[s+8]=B.x,o.array[s+9]=B.y,o.array[s+10]=B.z,o.array[s+11]=B.w,s+=12;n=0;for(q=Y.length;n<q;n++)u=B=A=z=ga=o.value[Y[n]],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=z.z,o.array[s+3]=z.w,o.array[s+4]=A.x,o.array[s+5]=A.y,o.array[s+6]=A.z,o.array[s+7]=A.w,o.array[s+8]=B.x,o.array[s+9]=B.y,o.array[s+10]=B.z,o.array[s+11]=B.w,o.array[s+
-12]=u.x,o.array[s+13]=u.y,o.array[s+14]=u.z,o.array[s+15]=u.w,s+=16}e.bindBuffer(e.ARRAY_BUFFER,o.buffer);e.bufferData(e.ARRAY_BUFFER,o.array,y)}}C&&(delete w.__inittedArrays,delete w.__colorArray,delete w.__normalArray,delete w.__tangentArray,delete w.__uvArray,delete w.__uv2Array,delete w.__faceArray,delete w.__vertexArray,delete w.__lineArray,delete w.__skinVertexAArray,delete w.__skinVertexBArray,delete w.__skinIndexArray,delete w.__skinWeightArray)}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=
-!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;l.attributes&&v(l)}else if(ka instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){l=k;ka=e.DYNAMIC_DRAW;t=F=t=C=C=void 0;D=l.vertices;G=l.colors;n=D.length;w=G.length;q=l.__vertexArray;y=l.__colorArray;J=l.__dirtyColors;if(l.__dirtyVertices){for(C=0;C<n;C++)t=D[C].position,F=C*3,q[F]=t.x,q[F+1]=t.y,q[F+2]=t.z;e.bindBuffer(e.ARRAY_BUFFER,l.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
-q,ka)}if(J){for(C=0;C<w;C++)t=G[C],F=C*3,y[F]=t.r,y[F+1]=t.g,y[F+2]=t.b;e.bindBuffer(e.ARRAY_BUFFER,l.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,y,ka)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(ka instanceof THREE.Line){l=d(ka,w);y=l.attributes&&r(l);if(k.__dirtyVertices||k.__dirtyColors||y){ka=k;F=e.DYNAMIC_DRAW;n=G=Q=D=O=void 0;D=ka.vertices;w=ka.colors;n=D.length;y=w.length;q=ka.__vertexArray;C=ka.__colorArray;J=ka.__dirtyColors;t=ka.__webglCustomAttributesList;L=aa=Y=M=Q=O=void 0;if(ka.__dirtyVertices){for(O=
-0;O<n;O++)Q=D[O].position,G=O*3,q[G]=Q.x,q[G+1]=Q.y,q[G+2]=Q.z;e.bindBuffer(e.ARRAY_BUFFER,ka.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,q,F)}if(J){for(D=0;D<y;D++)n=w[D],G=D*3,C[G]=n.r,C[G+1]=n.g,C[G+2]=n.b;e.bindBuffer(e.ARRAY_BUFFER,ka.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,C,F)}if(t){O=0;for(Q=t.length;O<Q;O++)if(L=t[O],L.needsUpdate&&(L.boundTo===void 0||L.boundTo==="vertices")){G=0;Y=L.value.length;if(L.size===1)for(M=0;M<Y;M++)L.array[M]=L.value[M];else if(L.size===2)for(M=0;M<
-Y;M++)aa=L.value[M],L.array[G]=aa.x,L.array[G+1]=aa.y,G+=2;else if(L.size===3)if(L.type==="c")for(M=0;M<Y;M++)aa=L.value[M],L.array[G]=aa.r,L.array[G+1]=aa.g,L.array[G+2]=aa.b,G+=3;else for(M=0;M<Y;M++)aa=L.value[M],L.array[G]=aa.x,L.array[G+1]=aa.y,L.array[G+2]=aa.z,G+=3;else if(L.size===4)for(M=0;M<Y;M++)aa=L.value[M],L.array[G]=aa.x,L.array[G+1]=aa.y,L.array[G+2]=aa.z,L.array[G+3]=aa.w,G+=4;e.bindBuffer(e.ARRAY_BUFFER,L.buffer);e.bufferData(e.ARRAY_BUFFER,L.array,F)}}}k.__dirtyVertices=!1;k.__dirtyColors=
-!1;l.attributes&&v(l)}else if(ka instanceof THREE.ParticleSystem)l=d(ka,w),y=l.attributes&&r(l),(k.__dirtyVertices||k.__dirtyColors||ka.sortParticles||y)&&h(k,e.DYNAMIC_DRAW,ka),k.__dirtyVertices=!1,k.__dirtyColors=!1,l.attributes&&v(l)};this.initMaterial=function(a,b,c,d){var f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?
-i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var k,l,m;k=m=j=0;for(l=b.length;k<l;k++)h=b[k],h instanceof THREE.SpotLight&&!h.onlyShadow&&m++,h instanceof THREE.DirectionalLight&&m++,h instanceof THREE.PointLight&&j++;j+m<=va?k=m:(k=Math.ceil(va*m/(j+m)),j=va-k);h={directional:k,point:j};
-j=m=0;for(k=b.length;j<k;j++)l=b[j],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var q;a:{k=a.fragmentShader;l=a.vertexShader;var j=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,
-maxBones: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,wrapAround:a.wrapAround},p,d=[];i?d.push(i):(d.push(k),d.push(l));for(p in c)d.push(p),d.push(c[p]);i=d.join();p=0;for(d=ya.length;p<d;p++)if(ya[p].code===i){q=ya[p].program;break a}p=e.createProgram();d=[Ma?"#define VERTEX_TEXTURES":"",H.gammaInput?"#define GAMMA_INPUT":
-"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.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.wrapAround?"#define WRAP_AROUND":"",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");
+j.mFar.value=a.far,j.opacity.value=c.opacity;else if(c instanceof THREE.MeshNormalMaterial)j.opacity.value=c.opacity;if(f.receiveShadow&&!c._shadowPass&&j.shadowMatrix){for(b=0;b<H.shadowMapPlugin.shadowMatrix.length;b++)j.shadowMatrix.value[b]=H.shadowMapPlugin.shadowMatrix[b],j.shadowMap.texture[b]=H.shadowMapPlugin.shadowMap[b];j.shadowDarkness.value=H.shadowMapDarkness;j.shadowBias.value=H.shadowMapBias}b=c.uniformsList;j=0;for(d=b.length;j<d;j++)if(m=g.uniforms[b[j][1]])if(i=b[j][0],q=i.type,
+n=i.value,q==="i")e.uniform1i(m,n);else if(q==="f")e.uniform1f(m,n);else if(q==="v2")e.uniform2f(m,n.x,n.y);else if(q==="v3")e.uniform3f(m,n.x,n.y,n.z);else if(q==="v4")e.uniform4f(m,n.x,n.y,n.z,n.w);else if(q==="c")e.uniform3f(m,n.r,n.g,n.b);else if(q==="fv1")e.uniform1fv(m,n);else if(q==="fv")e.uniform3fv(m,n);else if(q==="v3v"){if(!i._array)i._array=new Float32Array(3*n.length);q=0;for(v=n.length;q<v;q++)r=q*3,i._array[r]=n[q].x,i._array[r+1]=n[q].y,i._array[r+2]=n[q].z;e.uniform3fv(m,i._array)}else if(q===
+"m4"){if(!i._array)i._array=new Float32Array(16);n.flattenToArray(i._array);e.uniformMatrix4fv(m,!1,i._array)}else if(q==="m4v"){if(!i._array)i._array=new Float32Array(16*n.length);q=0;for(v=n.length;q<v;q++)n[q].flattenToArrayOffset(i._array,q*16);e.uniformMatrix4fv(m,!1,i._array)}else if(q==="t"){if(e.uniform1i(m,n),m=i.texture)if(m.image instanceof Array&&m.image.length===6){if(i=m,i.image.length===6)if(i.needsUpdate){if(!i.image.__webglTextureCube)i.image.__webglTextureCube=e.createTexture();
+e.activeTexture(e.TEXTURE0+n);e.bindTexture(e.TEXTURE_CUBE_MAP,i.image.__webglTextureCube);n=[];for(m=0;m<6;m++){q=n;v=m;if(H.autoScaleCubemaps){if(r=i.image[m],!(r.width<=Ea&&r.height<=Ea))y=Math.max(r.width,r.height),C=Math.floor(r.width*Ea/y),y=Math.floor(r.height*Ea/y),t=document.createElement("canvas"),t.width=C,t.height=y,t.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,C,y),r=t}else r=i.image[m];q[v]=r}q=D(e.TEXTURE_CUBE_MAP,i,n[0]);v=Q(i.format);r=Q(i.type);for(m=0;m<6;m++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+
+m,0,v,v,r,n[m]);q&&e.generateMipmap(e.TEXTURE_CUBE_MAP);i.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_CUBE_MAP,i.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(i=m,e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_CUBE_MAP,i.__webglTexture)):H.setTexture(m,n)}else if(q==="tv"){if(!i._array){i._array=[];q=0;for(v=i.texture.length;q<v;q++)i._array[q]=n+q}e.uniform1iv(m,i._array);q=0;for(v=i.texture.length;q<v;q++)(m=i.texture[q])&&H.setTexture(m,
+i._array[q])}(c instanceof THREE.ShaderMaterial||c instanceof THREE.MeshPhongMaterial||c.envMap)&&h.cameraPosition!==null&&e.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(c instanceof THREE.MeshPhongMaterial||c instanceof THREE.MeshLambertMaterial||c instanceof THREE.ShaderMaterial||c.skinning)&&h.viewMatrix!==null&&e.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray);c.skinning&&(e.uniformMatrix4fv(h.cameraInverseMatrix,!1,a._viewMatrixArray),e.uniformMatrix4fv(h.boneGlobalMatrices,
+!1,f.boneMatrices))}e.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray);h.normalMatrix&&e.uniformMatrix3fv(h.normalMatrix,!1,f._normalMatrixArray);(c instanceof THREE.ShaderMaterial||c.envMap||c.skinning||f.receiveShadow)&&h.objectMatrix!==null&&e.uniformMatrix4fv(h.objectMatrix,!1,f._objectMatrixArray);return g}function J(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}
+function O(a){wa!==a&&(e.depthMask(a),wa=a)}function P(a,b,c){Ca!==a&&(a?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Ca=a);if(a&&(za!==b||Aa!==c))e.polygonOffset(b,c),za=b,Aa=c}function V(a,b){var c;a==="fragment"?c=e.createShader(e.FRAGMENT_SHADER):a==="vertex"&&(c=e.createShader(e.VERTEX_SHADER));e.shaderSource(c,b);e.compileShader(c);if(!e.getShaderParameter(c,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(c)),console.error(b),null;return c}function D(a,b,c){return(c.width&
+c.width-1)===0&&(c.height&c.height-1)===0?(e.texParameteri(a,e.TEXTURE_WRAP_S,Q(b.wrapS)),e.texParameteri(a,e.TEXTURE_WRAP_T,Q(b.wrapT)),e.texParameteri(a,e.TEXTURE_MAG_FILTER,Q(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,Q(b.minFilter)),!0):(e.texParameteri(a,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_MAG_FILTER,N(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,N(b.minFilter)),!1)}function E(a,b){e.bindRenderbuffer(e.RENDERBUFFER,
+a);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,a)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height)}function N(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
+default:return e.LINEAR}}function Q(a){switch(a){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
+var a=a||{},ma=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ua=a.precision!==void 0?a.precision:"mediump",ha=a.antialias!==void 0?a.antialias:!1,ca=a.stencil!==void 0?a.stencil:!0,pa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ja=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),xa=a.clearAlpha!==void 0?a.clearAlpha:0,va=a.maxLights!==void 0?a.maxLights:4;this.domElement=ma;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.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,
+geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var H=this,e,ya=[],T=null,qa=null,I=-1,R=null,na=0,ra=null,Z=null,sa=null,oa=null,wa=null,Ca=null,za=null,Aa=null,ta=null,Fa=0,Ga=0,Ha=0,Ia=0,Ka=0,La=0,Ja=new THREE.Frustum,Da=new THREE.Matrix4,Ba=new THREE.Vector4,Ma={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};e=function(){var a;try{if(!(a=ma.getContext("experimental-webgl",{antialias:ha,stencil:ca,preserveDrawingBuffer:pa})))throw"Error creating WebGL context.";
+console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(ja.r,ja.g,ja.b,xa);
+this.context=e;var Na=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);e.getParameter(e.TEXTURE_SIZE);var Ea=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return e};this.supportsVertexTextures=function(){return Na>0};this.setSize=function(a,b){ma.width=a;ma.height=b;this.setViewport(0,0,ma.width,ma.height)};this.setViewport=function(a,b,c,d){Fa=a;Ga=b;Ha=c;Ia=d;e.viewport(Fa,Ga,Ha,Ia)};this.setScissor=function(a,b,c,d){e.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?
+e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ja.setHex(a);xa=b;e.clearColor(ja.r,ja.g,ja.b,xa)};this.setClearColor=function(a,b){ja.copy(a);xa=b;e.clearColor(ja.r,ja.g,ja.b,xa)};this.getClearColor=function(){return ja};this.getClearAlpha=function(){return xa};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=e.COLOR_BUFFER_BIT;if(b===void 0||b)d|=e.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=e.STENCIL_BUFFER_BIT;e.clear(d)};this.clearTarget=function(a,b,c,
+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];e.deleteBuffer(c.__webglVertexBuffer);
+e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);
+if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)e.deleteBuffer(c.__webglCustomAttributesList[d].buffer);H.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=
+a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,e.deleteTexture(a.__webglTexture),H.info.memory.textures--};this.updateShadowMap=function(a,b){T=null;I=R=wa=oa=sa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=e.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=e.createBuffer();
+a.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,a.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(b.attributes.position),e.vertexAttribPointer(b.attributes.position,3,e.FLOAT,!1,0,0));if(a.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,g,h,i,j,k,n,l,m,q=a.count*3;for(m=0;m<q;m+=9)c=a.normalArray,d=c[m],f=c[m+1],g=c[m+2],h=c[m+3],j=c[m+4],n=c[m+5],i=c[m+6],k=c[m+7],l=c[m+8],d=(d+h+i)/3,f=(f+j+k)/3,g=
+(g+n+l)/3,c[m]=d,c[m+1]=f,c[m+2]=g,c[m+3]=d,c[m+4]=f,c[m+5]=g,c[m+6]=d,c[m+7]=f,c[m+8]=g}e.bufferData(e.ARRAY_BUFFER,a.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(b.attributes.normal);e.vertexAttribPointer(b.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,g){if(d.opacity!==0&&(c=y(a,b,c,d,g),a=c.attributes,b=!1,d=f.id*16777215+c.id*2+(d.wireframe?1:0),d!==R&&(R=d,b=!0),g instanceof THREE.Mesh)){d=f.offsets;for(g=
+0;g<d.length;++g)b&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexPositionBuffer),e.vertexAttribPointer(a.position,f.vertexPositionBuffer.itemSize,e.FLOAT,!1,0,d[g].index*12),a.normal>=0&&f.vertexNormalBuffer&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexNormalBuffer),e.vertexAttribPointer(a.normal,f.vertexNormalBuffer.itemSize,e.FLOAT,!1,0,d[g].index*12)),a.uv>=0&&f.vertexUvBuffer&&(f.vertexUvBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.vertexUvBuffer),e.vertexAttribPointer(a.uv,f.vertexUvBuffer.itemSize,e.FLOAT,!1,0,d[g].index*
+8),e.enableVertexAttribArray(a.uv)):e.disableVertexAttribArray(a.uv)),a.color>=0&&f.vertexColorBuffer&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexColorBuffer),e.vertexAttribPointer(a.color,f.vertexColorBuffer.itemSize,e.FLOAT,!1,0,d[g].index*16)),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.vertexIndexBuffer)),e.drawElements(e.TRIANGLES,d[g].count,e.UNSIGNED_SHORT,d[g].start*2),H.info.render.calls++,H.info.render.vertices+=d[g].count,H.info.render.faces+=d[g].count/3}};this.renderBuffer=function(a,b,c,d,f,g){if(d.opacity!==
+0){var h,i,c=y(a,b,c,d,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(d.wireframe?1:0);c!==R&&(R=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),
+e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){h=0;var j=g.morphTargetForcedOrder;for(i=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<j.length;)e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[j[h]]),e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[h]=i[j[h]],h++}else{var j=[],k=-1,n=0;i=g.morphTargetInfluences;var l,m=i.length;h=0;for(g.morphTargetBase!==-1&&(j[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(l=
+0;l<m;l++)!j[l]&&i[l]>k&&(n=l,k=i[n]);e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[n]);e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=k;j[n]=1;k=-1;h++}}d.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){h=0;for(i=f.__webglCustomAttributesList.length;h<i;h++)c=f.__webglCustomAttributesList[h],b[c.buffer.belongsToAttribute]>=
+0&&(e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,e.FLOAT,!1,0,0))}b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,
+f.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,
+e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ta&&(e.lineWidth(d),ta=d),a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),e.drawElements(e.LINES,
+f.__webglLineCount,e.UNSIGNED_SHORT,0)):(a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),e.drawElements(e.TRIANGLES,f.__webglFaceCount,e.UNSIGNED_SHORT,0)),H.info.render.calls++,H.info.render.vertices+=f.__webglFaceCount,H.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?e.LINE_STRIP:e.LINES,d=d.linewidth,d!==ta&&(e.lineWidth(d),ta=d),e.drawArrays(g,0,f.__webglLineCount),H.info.render.calls++):g instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,
+0,f.__webglParticleCount),H.info.render.calls++,H.info.render.points+=f.__webglParticleCount):g instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,f.__webglVertexCount),H.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,h,n,p=a.lights,r=a.fog;I=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();l(this.renderPluginsPre,a,b);H.info.render.calls=
+0;H.info.render.vertices=0;H.info.render.faces=0;H.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);Da.multiply(b.projectionMatrix,b.matrixWorldInverse);Ja.setFromMatrix(Da);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
+this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;d=0;for(f=n.length;d<f;d++)if(g=n[d],h=g.object,g.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||Ja.contains(h))){h.matrixWorld.flattenToArray(h._objectMatrixArray);J(h,b);var u=g,v=u.object,m=u.buffer,q=void 0,q=q=void 0,q=v.material;if(q instanceof THREE.MeshFaceMaterial){if(q=m.materialIndex,q>=0)q=v.geometry.materials[q],q.transparent?(u.transparent=q,u.opaque=null):(u.opaque=
+q,u.transparent=null)}else if(q)q.transparent?(u.transparent=q,u.opaque=null):(u.opaque=q,u.transparent=null);g.render=!0;if(this.sortObjects)h.renderDepth?g.z=h.renderDepth:(Ba.copy(h.position),Da.multiplyVector3(Ba),g.z=Ba.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;d=0;for(f=n.length;d<f;d++)if(g=n[d],h=g.object,h.visible)h.matrixAutoUpdate&&h.matrixWorld.flattenToArray(h._objectMatrixArray),J(h,b),h=g.object.material,h.transparent?(g.transparent=h,g.opaque=null):(g.opaque=h,g.transparent=
+null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),O(a.overrideMaterial.depthWrite),P(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,p,r,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,p,r,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,p,r,!1),j(a.__webglObjectsImmediate,"opaque",b,
+p,r,!1),k(a.__webglObjects,!1,"transparent",b,p,r,!0),j(a.__webglObjectsImmediate,"transparent",b,p,r,!0));l(this.renderPluginsPost,a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,c.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)))};this.renderImmediateObject=
+function(a,b,c,d,f){var g=y(a,b,c,d,f);R=-1;H.setObjectFaces(f);f.immediateRenderCallback?f.immediateRenderCallback(g,e,Ja):f.render(function(a){H.renderBufferImmediate(a,g,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var i=a.__objectsAdded[0],j=a,k=void 0,l=void 0,F=void 0;if(!i.__webglInit)if(i.__webglInit=!0,i._modelViewMatrix=new THREE.Matrix4,i._normalMatrixArray=
+new Float32Array(9),i._modelViewMatrixArray=new Float32Array(16),i._objectMatrixArray=new Float32Array(16),i.matrixWorld.flattenToArray(i._objectMatrixArray),i instanceof THREE.Mesh){if(l=i.geometry,l instanceof THREE.Geometry){if(l.geometryGroups===void 0){var F=l,G=void 0,w=void 0,y=void 0,D=void 0,u=void 0,E=void 0,m=void 0,q={},J=F.morphTargets.length;F.geometryGroups={};G=0;for(w=F.faces.length;G<w;G++)y=F.faces[G],D=y.materialIndex,E=D!==void 0?D:-1,q[E]===void 0&&(q[E]={hash:E,counter:0}),
+m=q[E].hash+"_"+q[E].counter,F.geometryGroups[m]===void 0&&(F.geometryGroups[m]={faces3:[],faces4:[],materialIndex:D,vertices:0,numMorphTargets:J}),u=y instanceof THREE.Face3?3:4,F.geometryGroups[m].vertices+u>65535&&(q[E].counter+=1,m=q[E].hash+"_"+q[E].counter,F.geometryGroups[m]===void 0&&(F.geometryGroups[m]={faces3:[],faces4:[],materialIndex:D,vertices:0,numMorphTargets:J})),y instanceof THREE.Face3?F.geometryGroups[m].faces3.push(G):F.geometryGroups[m].faces4.push(G),F.geometryGroups[m].vertices+=
+u;F.geometryGroupsList=[];G=void 0;for(G in F.geometryGroups)F.geometryGroups[G].id=na++,F.geometryGroupsList.push(F.geometryGroups[G])}for(k in l.geometryGroups)if(F=l.geometryGroups[k],!F.__webglVertexBuffer){G=F;G.__webglVertexBuffer=e.createBuffer();G.__webglNormalBuffer=e.createBuffer();G.__webglTangentBuffer=e.createBuffer();G.__webglColorBuffer=e.createBuffer();G.__webglUVBuffer=e.createBuffer();G.__webglUV2Buffer=e.createBuffer();G.__webglSkinVertexABuffer=e.createBuffer();G.__webglSkinVertexBBuffer=
+e.createBuffer();G.__webglSkinIndicesBuffer=e.createBuffer();G.__webglSkinWeightsBuffer=e.createBuffer();G.__webglFaceBuffer=e.createBuffer();G.__webglLineBuffer=e.createBuffer();if(G.numMorphTargets){y=w=void 0;G.__webglMorphTargetsBuffers=[];w=0;for(y=G.numMorphTargets;w<y;w++)G.__webglMorphTargetsBuffers.push(e.createBuffer())}H.info.memory.geometries++;D=i;u=D.geometry;w=F.faces3;E=F.faces4;G=w.length*3+E.length*4;y=w.length*1+E.length*2;E=w.length*3+E.length*4;w=d(D,F);m=g(w);q=c(w);J=f(w);F.__vertexArray=
+new Float32Array(G*3);if(q)F.__normalArray=new Float32Array(G*3);if(u.hasTangents)F.__tangentArray=new Float32Array(G*4);if(J)F.__colorArray=new Float32Array(G*3);if(m){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)F.__uvArray=new Float32Array(G*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)F.__uv2Array=new Float32Array(G*2)}if(D.geometry.skinWeights.length&&D.geometry.skinIndices.length)F.__skinVertexAArray=new Float32Array(G*4),F.__skinVertexBArray=new Float32Array(G*4),F.__skinIndexArray=
+new Float32Array(G*4),F.__skinWeightArray=new Float32Array(G*4);F.__faceArray=new Uint16Array(y*3);F.__lineArray=new Uint16Array(E*2);if(F.numMorphTargets){F.__morphTargetsArrays=[];D=0;for(u=F.numMorphTargets;D<u;D++)F.__morphTargetsArrays.push(new Float32Array(G*3))}F.__webglFaceCount=y*3;F.__webglLineCount=E*2;if(w.attributes){if(F.__webglCustomAttributesList===void 0)F.__webglCustomAttributesList=[];y=void 0;for(y in w.attributes){var D=w.attributes[y],u={},ka;for(ka in D)u[ka]=D[ka];if(!u.__webglInitialized||
+u.createUniqueBuffers)u.__webglInitialized=!0,E=1,u.type==="v2"?E=2:u.type==="v3"?E=3:u.type==="v4"?E=4:u.type==="c"&&(E=3),u.size=E,u.array=new Float32Array(G*E),u.buffer=e.createBuffer(),u.buffer.belongsToAttribute=y,D.needsUpdate=!0,u.__original=D;F.__webglCustomAttributesList.push(u)}}F.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=!0}}}else if(i instanceof THREE.Ribbon){if(l=i.geometry,
+!l.__webglVertexBuffer)F=l,F.__webglVertexBuffer=e.createBuffer(),F.__webglColorBuffer=e.createBuffer(),H.info.memory.geometries++,F=l,G=F.vertices.length,F.__vertexArray=new Float32Array(G*3),F.__colorArray=new Float32Array(G*3),F.__webglVertexCount=G,l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(i instanceof THREE.Line){if(l=i.geometry,!l.__webglVertexBuffer)F=l,F.__webglVertexBuffer=e.createBuffer(),F.__webglColorBuffer=e.createBuffer(),H.info.memory.geometries++,F=l,G=i,w=F.vertices.length,
+F.__vertexArray=new Float32Array(w*3),F.__colorArray=new Float32Array(w*3),F.__webglLineCount=w,b(F,G),l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(i instanceof THREE.ParticleSystem&&(l=i.geometry,!l.__webglVertexBuffer))F=l,F.__webglVertexBuffer=e.createBuffer(),F.__webglColorBuffer=e.createBuffer(),H.info.geometries++,F=l,G=i,w=F.vertices.length,F.__vertexArray=new Float32Array(w*3),F.__colorArray=new Float32Array(w*3),F.__sortArray=[],F.__webglParticleCount=w,b(F,G),l.__dirtyVertices=!0,l.__dirtyColors=
+!0;if(!i.__webglActive){if(i instanceof THREE.Mesh)if(l=i.geometry,l instanceof THREE.BufferGeometry)p(j.__webglObjects,l,i);else for(k in l.geometryGroups)F=l.geometryGroups[k],p(j.__webglObjects,F,i);else i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem?(l=i.geometry,p(j.__webglObjects,l,i)):THREE.MarchingCubes!==void 0&&i instanceof THREE.MarchingCubes||i.immediateRenderCallback?j.__webglObjectsImmediate.push({object:i,opaque:null,transparent:null}):i instanceof
+THREE.Sprite?j.__webglSprites.push(i):i instanceof THREE.LensFlare&&j.__webglFlares.push(i);i.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)i=a.__objectsRemoved[0],j=a,i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem||i instanceof THREE.Ribbon||i instanceof THREE.Line?n(j.__webglObjects,i):i instanceof THREE.Sprite?C(j.__webglSprites,i):i instanceof THREE.LensFlare?C(j.__webglFlares,i):(i instanceof THREE.MarchingCubes||i.immediateRenderCallback)&&n(j.__webglObjectsImmediate,
+i),i.__webglActive=!1,a.__objectsRemoved.splice(0,1);i=0;for(j=a.__webglObjects.length;i<j;i++)if(ka=a.__webglObjects[i].object,k=ka.geometry,l=y=w=void 0,ka instanceof THREE.Mesh)if(k instanceof THREE.BufferGeometry)k.__dirtyVertices=!1,k.__dirtyElements=!1,k.__dirtyUvs=!1,k.__dirtyNormals=!1,k.__dirtyColors=!1;else{F=0;for(G=k.geometryGroupsList.length;F<G;F++)if(w=k.geometryGroupsList[F],l=d(ka,w),y=l.attributes&&v(l),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||
+k.__dirtyColors||k.__dirtyTangents||y){var M=ka,y=e.DYNAMIC_DRAW,D=!k.dynamic,m=l;if(w.__inittedArrays){var u=c(m),E=f(m),O=g(m),Q=u===THREE.SmoothShading,I=q=m=void 0,t=void 0,ba=void 0,N=void 0,x=void 0,U=void 0,P=void 0,V=I=void 0,z=void 0,A=void 0,B=void 0,da=t=void 0,ea=void 0,la=void 0,W=t=P=void 0,X=void 0,R=B=A=z=x=void 0,K=t=B=A=z=R=B=A=z=R=B=A=z=void 0,L=void 0,T=N=void 0,Z=void 0,$=void 0,ma=void 0,fa=void 0,ja=V=$=L=0,ha=0,ca=K=I=0,S=x=da=0,s=0,ga=void 0,S=w.__vertexArray,Z=w.__uvArray,
+s=w.__uv2Array,T=w.__normalArray,ba=w.__tangentArray,ea=w.__colorArray,W=w.__skinVertexAArray,X=w.__skinVertexBArray,U=w.__skinIndexArray,ia=w.__skinWeightArray,R=w.__morphTargetsArrays,J=w.__webglCustomAttributesList,o=void 0,o=w.__faceArray,ga=w.__lineArray,la=M.geometry,ra=la.__dirtyElements,ua=la.__dirtyUvs,N=la.__dirtyNormals,P=la.__dirtyTangents,xa=la.__dirtyColors,ma=la.__dirtyMorphTargets,fa=la.vertices,M=w.faces3,Y=w.faces4,aa=la.faces,qa=la.faceVertexUvs[0],sa=la.faceVertexUvs[1],oa=la.skinVerticesA,
+pa=la.skinVerticesB,va=la.skinIndices,ta=la.skinWeights,wa=la.morphTargets;if(la.__dirtyVertices){m=0;for(q=M.length;m<q;m++)t=aa[M[m]],z=fa[t.a].position,A=fa[t.b].position,B=fa[t.c].position,S[$]=z.x,S[$+1]=z.y,S[$+2]=z.z,S[$+3]=A.x,S[$+4]=A.y,S[$+5]=A.z,S[$+6]=B.x,S[$+7]=B.y,S[$+8]=B.z,$+=9;m=0;for(q=Y.length;m<q;m++)t=aa[Y[m]],z=fa[t.a].position,A=fa[t.b].position,B=fa[t.c].position,t=fa[t.d].position,S[$]=z.x,S[$+1]=z.y,S[$+2]=z.z,S[$+3]=A.x,S[$+4]=A.y,S[$+5]=A.z,S[$+6]=B.x,S[$+7]=B.y,S[$+8]=
+B.z,S[$+9]=t.x,S[$+10]=t.y,S[$+11]=t.z,$+=12;e.bindBuffer(e.ARRAY_BUFFER,w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,S,y)}if(ma){$=0;for(ma=wa.length;$<ma;$++){m=S=0;for(q=M.length;m<q;m++)t=aa[M[m]],z=wa[$].vertices[t.a].position,A=wa[$].vertices[t.b].position,B=wa[$].vertices[t.c].position,fa=R[$],fa[S]=z.x,fa[S+1]=z.y,fa[S+2]=z.z,fa[S+3]=A.x,fa[S+4]=A.y,fa[S+5]=A.z,fa[S+6]=B.x,fa[S+7]=B.y,fa[S+8]=B.z,S+=9;m=0;for(q=Y.length;m<q;m++)t=aa[Y[m]],z=wa[$].vertices[t.a].position,A=wa[$].vertices[t.b].position,
+B=wa[$].vertices[t.c].position,t=wa[$].vertices[t.d].position,fa=R[$],fa[S]=z.x,fa[S+1]=z.y,fa[S+2]=z.z,fa[S+3]=A.x,fa[S+4]=A.y,fa[S+5]=A.z,fa[S+6]=B.x,fa[S+7]=B.y,fa[S+8]=B.z,fa[S+9]=t.x,fa[S+10]=t.y,fa[S+11]=t.z,S+=12;e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[$]);e.bufferData(e.ARRAY_BUFFER,R[$],y)}}if(ta.length){m=0;for(q=M.length;m<q;m++)t=aa[M[m]],z=ta[t.a],A=ta[t.b],B=ta[t.c],ia[x]=z.x,ia[x+1]=z.y,ia[x+2]=z.z,ia[x+3]=z.w,ia[x+4]=A.x,ia[x+5]=A.y,ia[x+6]=A.z,ia[x+7]=A.w,ia[x+8]=
+B.x,ia[x+9]=B.y,ia[x+10]=B.z,ia[x+11]=B.w,z=va[t.a],A=va[t.b],B=va[t.c],U[x]=z.x,U[x+1]=z.y,U[x+2]=z.z,U[x+3]=z.w,U[x+4]=A.x,U[x+5]=A.y,U[x+6]=A.z,U[x+7]=A.w,U[x+8]=B.x,U[x+9]=B.y,U[x+10]=B.z,U[x+11]=B.w,z=oa[t.a],A=oa[t.b],B=oa[t.c],W[x]=z.x,W[x+1]=z.y,W[x+2]=z.z,W[x+3]=1,W[x+4]=A.x,W[x+5]=A.y,W[x+6]=A.z,W[x+7]=1,W[x+8]=B.x,W[x+9]=B.y,W[x+10]=B.z,W[x+11]=1,z=pa[t.a],A=pa[t.b],B=pa[t.c],X[x]=z.x,X[x+1]=z.y,X[x+2]=z.z,X[x+3]=1,X[x+4]=A.x,X[x+5]=A.y,X[x+6]=A.z,X[x+7]=1,X[x+8]=B.x,X[x+9]=B.y,X[x+10]=
+B.z,X[x+11]=1,x+=12;m=0;for(q=Y.length;m<q;m++)t=aa[Y[m]],z=ta[t.a],A=ta[t.b],B=ta[t.c],R=ta[t.d],ia[x]=z.x,ia[x+1]=z.y,ia[x+2]=z.z,ia[x+3]=z.w,ia[x+4]=A.x,ia[x+5]=A.y,ia[x+6]=A.z,ia[x+7]=A.w,ia[x+8]=B.x,ia[x+9]=B.y,ia[x+10]=B.z,ia[x+11]=B.w,ia[x+12]=R.x,ia[x+13]=R.y,ia[x+14]=R.z,ia[x+15]=R.w,z=va[t.a],A=va[t.b],B=va[t.c],R=va[t.d],U[x]=z.x,U[x+1]=z.y,U[x+2]=z.z,U[x+3]=z.w,U[x+4]=A.x,U[x+5]=A.y,U[x+6]=A.z,U[x+7]=A.w,U[x+8]=B.x,U[x+9]=B.y,U[x+10]=B.z,U[x+11]=B.w,U[x+12]=R.x,U[x+13]=R.y,U[x+14]=R.z,
+U[x+15]=R.w,z=oa[t.a],A=oa[t.b],B=oa[t.c],R=oa[t.d],W[x]=z.x,W[x+1]=z.y,W[x+2]=z.z,W[x+3]=1,W[x+4]=A.x,W[x+5]=A.y,W[x+6]=A.z,W[x+7]=1,W[x+8]=B.x,W[x+9]=B.y,W[x+10]=B.z,W[x+11]=1,W[x+12]=R.x,W[x+13]=R.y,W[x+14]=R.z,W[x+15]=1,z=pa[t.a],A=pa[t.b],B=pa[t.c],t=pa[t.d],X[x]=z.x,X[x+1]=z.y,X[x+2]=z.z,X[x+3]=1,X[x+4]=A.x,X[x+5]=A.y,X[x+6]=A.z,X[x+7]=1,X[x+8]=B.x,X[x+9]=B.y,X[x+10]=B.z,X[x+11]=1,X[x+12]=t.x,X[x+13]=t.y,X[x+14]=t.z,X[x+15]=1,x+=16;x>0&&(e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer),
+e.bufferData(e.ARRAY_BUFFER,W,y),e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,X,y),e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,U,y),e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ia,y))}if(xa&&E){m=0;for(q=M.length;m<q;m++)t=aa[M[m]],x=t.vertexColors,U=t.color,x.length===3&&E===THREE.VertexColors?(t=x[0],W=x[1],X=x[2]):X=W=t=U,ea[da]=t.r,ea[da+1]=t.g,ea[da+2]=t.b,ea[da+3]=W.r,ea[da+
+4]=W.g,ea[da+5]=W.b,ea[da+6]=X.r,ea[da+7]=X.g,ea[da+8]=X.b,da+=9;m=0;for(q=Y.length;m<q;m++)t=aa[Y[m]],x=t.vertexColors,U=t.color,x.length===4&&E===THREE.VertexColors?(t=x[0],W=x[1],X=x[2],x=x[3]):x=X=W=t=U,ea[da]=t.r,ea[da+1]=t.g,ea[da+2]=t.b,ea[da+3]=W.r,ea[da+4]=W.g,ea[da+5]=W.b,ea[da+6]=X.r,ea[da+7]=X.g,ea[da+8]=X.b,ea[da+9]=x.r,ea[da+10]=x.g,ea[da+11]=x.b,da+=12;da>0&&(e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,ea,y))}if(P&&la.hasTangents){m=0;for(q=M.length;m<
+q;m++)t=aa[M[m]],P=t.vertexTangents,da=P[0],ea=P[1],la=P[2],ba[K]=da.x,ba[K+1]=da.y,ba[K+2]=da.z,ba[K+3]=da.w,ba[K+4]=ea.x,ba[K+5]=ea.y,ba[K+6]=ea.z,ba[K+7]=ea.w,ba[K+8]=la.x,ba[K+9]=la.y,ba[K+10]=la.z,ba[K+11]=la.w,K+=12;m=0;for(q=Y.length;m<q;m++)t=aa[Y[m]],P=t.vertexTangents,da=P[0],ea=P[1],la=P[2],P=P[3],ba[K]=da.x,ba[K+1]=da.y,ba[K+2]=da.z,ba[K+3]=da.w,ba[K+4]=ea.x,ba[K+5]=ea.y,ba[K+6]=ea.z,ba[K+7]=ea.w,ba[K+8]=la.x,ba[K+9]=la.y,ba[K+10]=la.z,ba[K+11]=la.w,ba[K+12]=P.x,ba[K+13]=P.y,ba[K+14]=
+P.z,ba[K+15]=P.w,K+=16;e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ba,y)}if(N&&u){m=0;for(q=M.length;m<q;m++)if(t=aa[M[m]],ba=t.vertexNormals,N=t.normal,ba.length===3&&Q)for(K=0;K<3;K++)N=ba[K],T[I]=N.x,T[I+1]=N.y,T[I+2]=N.z,I+=3;else for(K=0;K<3;K++)T[I]=N.x,T[I+1]=N.y,T[I+2]=N.z,I+=3;m=0;for(q=Y.length;m<q;m++)if(t=aa[Y[m]],ba=t.vertexNormals,N=t.normal,ba.length===4&&Q)for(K=0;K<4;K++)N=ba[K],T[I]=N.x,T[I+1]=N.y,T[I+2]=N.z,I+=3;else for(K=0;K<4;K++)T[I]=N.x,
+T[I+1]=N.y,T[I+2]=N.z,I+=3;e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,T,y)}if(ua&&qa&&O){m=0;for(q=M.length;m<q;m++)if(I=M[m],I=qa[I],I!==void 0)for(K=0;K<3;K++)T=I[K],Z[V]=T.u,Z[V+1]=T.v,V+=2;m=0;for(q=Y.length;m<q;m++)if(I=Y[m],I=qa[I],I!==void 0)for(K=0;K<4;K++)T=I[K],Z[V]=T.u,Z[V+1]=T.v,V+=2;V>0&&(e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,Z,y))}if(ua&&sa&&O){m=0;for(q=M.length;m<q;m++)if(I=M[m],V=sa[I],V!==void 0)for(K=0;K<3;K++)Z=
+V[K],s[ja]=Z.u,s[ja+1]=Z.v,ja+=2;m=0;for(q=Y.length;m<q;m++)if(I=Y[m],V=sa[I],V!==void 0)for(K=0;K<4;K++)Z=V[K],s[ja]=Z.u,s[ja+1]=Z.v,ja+=2;ja>0&&(e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,s,y))}if(ra){m=0;for(q=M.length;m<q;m++)o[ha]=L,o[ha+1]=L+1,o[ha+2]=L+2,ha+=3,ga[ca]=L,ga[ca+1]=L+1,ga[ca+2]=L,ga[ca+3]=L+2,ga[ca+4]=L+1,ga[ca+5]=L+2,ca+=6,L+=3;m=0;for(q=Y.length;m<q;m++)o[ha]=L,o[ha+1]=L+1,o[ha+2]=L+3,o[ha+3]=L+1,o[ha+4]=L+2,o[ha+5]=L+3,ha+=6,ga[ca]=L,ga[ca+1]=
+L+1,ga[ca+2]=L,ga[ca+3]=L+3,ga[ca+4]=L+1,ga[ca+5]=L+2,ga[ca+6]=L+2,ga[ca+7]=L+3,ca+=8,L+=4;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,o,y);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ga,y)}if(J){K=0;for(L=J.length;K<L;K++)if(o=J[K],o.__original.needsUpdate){s=0;if(o.size===1)if(o.boundTo===void 0||o.boundTo==="vertices"){m=0;for(q=M.length;m<q;m++)t=aa[M[m]],o.array[s]=o.value[t.a],o.array[s+1]=o.value[t.b],
+o.array[s+2]=o.value[t.c],s+=3;m=0;for(q=Y.length;m<q;m++)t=aa[Y[m]],o.array[s]=o.value[t.a],o.array[s+1]=o.value[t.b],o.array[s+2]=o.value[t.c],o.array[s+3]=o.value[t.d],s+=4}else{if(o.boundTo==="faces"){m=0;for(q=M.length;m<q;m++)ga=o.value[M[m]],o.array[s]=ga,o.array[s+1]=ga,o.array[s+2]=ga,s+=3;m=0;for(q=Y.length;m<q;m++)ga=o.value[Y[m]],o.array[s]=ga,o.array[s+1]=ga,o.array[s+2]=ga,o.array[s+3]=ga,s+=4}}else if(o.size===2)if(o.boundTo===void 0||o.boundTo==="vertices"){m=0;for(q=M.length;m<q;m++)t=
+aa[M[m]],z=o.value[t.a],A=o.value[t.b],B=o.value[t.c],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=A.x,o.array[s+3]=A.y,o.array[s+4]=B.x,o.array[s+5]=B.y,s+=6;m=0;for(q=Y.length;m<q;m++)t=aa[Y[m]],z=o.value[t.a],A=o.value[t.b],B=o.value[t.c],t=o.value[t.d],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=A.x,o.array[s+3]=A.y,o.array[s+4]=B.x,o.array[s+5]=B.y,o.array[s+6]=t.x,o.array[s+7]=t.y,s+=8}else{if(o.boundTo==="faces"){m=0;for(q=M.length;m<q;m++)B=A=z=ga=o.value[M[m]],o.array[s]=z.x,o.array[s+1]=
+z.y,o.array[s+2]=A.x,o.array[s+3]=A.y,o.array[s+4]=B.x,o.array[s+5]=B.y,s+=6;m=0;for(q=Y.length;m<q;m++)t=B=A=z=ga=o.value[Y[m]],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=A.x,o.array[s+3]=A.y,o.array[s+4]=B.x,o.array[s+5]=B.y,o.array[s+6]=t.x,o.array[s+7]=t.y,s+=8}}else if(o.size===3)if(u=o.type==="c"?["r","g","b"]:["x","y","z"],o.boundTo===void 0||o.boundTo==="vertices"){m=0;for(q=M.length;m<q;m++)t=aa[M[m]],z=o.value[t.a],A=o.value[t.b],B=o.value[t.c],o.array[s]=z[u[0]],o.array[s+1]=z[u[1]],
+o.array[s+2]=z[u[2]],o.array[s+3]=A[u[0]],o.array[s+4]=A[u[1]],o.array[s+5]=A[u[2]],o.array[s+6]=B[u[0]],o.array[s+7]=B[u[1]],o.array[s+8]=B[u[2]],s+=9;m=0;for(q=Y.length;m<q;m++)t=aa[Y[m]],z=o.value[t.a],A=o.value[t.b],B=o.value[t.c],t=o.value[t.d],o.array[s]=z[u[0]],o.array[s+1]=z[u[1]],o.array[s+2]=z[u[2]],o.array[s+3]=A[u[0]],o.array[s+4]=A[u[1]],o.array[s+5]=A[u[2]],o.array[s+6]=B[u[0]],o.array[s+7]=B[u[1]],o.array[s+8]=B[u[2]],o.array[s+9]=t[u[0]],o.array[s+10]=t[u[1]],o.array[s+11]=t[u[2]],
+s+=12}else{if(o.boundTo==="faces"){m=0;for(q=M.length;m<q;m++)B=A=z=ga=o.value[M[m]],o.array[s]=z[u[0]],o.array[s+1]=z[u[1]],o.array[s+2]=z[u[2]],o.array[s+3]=A[u[0]],o.array[s+4]=A[u[1]],o.array[s+5]=A[u[2]],o.array[s+6]=B[u[0]],o.array[s+7]=B[u[1]],o.array[s+8]=B[u[2]],s+=9;m=0;for(q=Y.length;m<q;m++)t=B=A=z=ga=o.value[Y[m]],o.array[s]=z[u[0]],o.array[s+1]=z[u[1]],o.array[s+2]=z[u[2]],o.array[s+3]=A[u[0]],o.array[s+4]=A[u[1]],o.array[s+5]=A[u[2]],o.array[s+6]=B[u[0]],o.array[s+7]=B[u[1]],o.array[s+
+8]=B[u[2]],o.array[s+9]=t[u[0]],o.array[s+10]=t[u[1]],o.array[s+11]=t[u[2]],s+=12}}else if(o.size===4)if(o.boundTo===void 0||o.boundTo==="vertices"){m=0;for(q=M.length;m<q;m++)t=aa[M[m]],z=o.value[t.a],A=o.value[t.b],B=o.value[t.c],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=z.z,o.array[s+3]=z.w,o.array[s+4]=A.x,o.array[s+5]=A.y,o.array[s+6]=A.z,o.array[s+7]=A.w,o.array[s+8]=B.x,o.array[s+9]=B.y,o.array[s+10]=B.z,o.array[s+11]=B.w,s+=12;m=0;for(q=Y.length;m<q;m++)t=aa[Y[m]],z=o.value[t.a],A=o.value[t.b],
+B=o.value[t.c],t=o.value[t.d],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=z.z,o.array[s+3]=z.w,o.array[s+4]=A.x,o.array[s+5]=A.y,o.array[s+6]=A.z,o.array[s+7]=A.w,o.array[s+8]=B.x,o.array[s+9]=B.y,o.array[s+10]=B.z,o.array[s+11]=B.w,o.array[s+12]=t.x,o.array[s+13]=t.y,o.array[s+14]=t.z,o.array[s+15]=t.w,s+=16}else if(o.boundTo==="faces"){m=0;for(q=M.length;m<q;m++)B=A=z=ga=o.value[M[m]],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=z.z,o.array[s+3]=z.w,o.array[s+4]=A.x,o.array[s+5]=A.y,o.array[s+
+6]=A.z,o.array[s+7]=A.w,o.array[s+8]=B.x,o.array[s+9]=B.y,o.array[s+10]=B.z,o.array[s+11]=B.w,s+=12;m=0;for(q=Y.length;m<q;m++)t=B=A=z=ga=o.value[Y[m]],o.array[s]=z.x,o.array[s+1]=z.y,o.array[s+2]=z.z,o.array[s+3]=z.w,o.array[s+4]=A.x,o.array[s+5]=A.y,o.array[s+6]=A.z,o.array[s+7]=A.w,o.array[s+8]=B.x,o.array[s+9]=B.y,o.array[s+10]=B.z,o.array[s+11]=B.w,o.array[s+12]=t.x,o.array[s+13]=t.y,o.array[s+14]=t.z,o.array[s+15]=t.w,s+=16}e.bindBuffer(e.ARRAY_BUFFER,o.buffer);e.bufferData(e.ARRAY_BUFFER,o.array,
+y)}}D&&(delete w.__inittedArrays,delete w.__colorArray,delete w.__normalArray,delete w.__tangentArray,delete w.__uvArray,delete w.__uv2Array,delete w.__faceArray,delete w.__vertexArray,delete w.__lineArray,delete w.__skinVertexAArray,delete w.__skinVertexBArray,delete w.__skinIndexArray,delete w.__skinWeightArray)}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;l.attributes&&r(l)}else if(ka instanceof THREE.Ribbon){if(k.__dirtyVertices||
+k.__dirtyColors){l=k;ka=e.DYNAMIC_DRAW;u=F=u=D=D=void 0;E=l.vertices;G=l.colors;m=E.length;w=G.length;q=l.__vertexArray;y=l.__colorArray;J=l.__dirtyColors;if(l.__dirtyVertices){for(D=0;D<m;D++)u=E[D].position,F=D*3,q[F]=u.x,q[F+1]=u.y,q[F+2]=u.z;e.bindBuffer(e.ARRAY_BUFFER,l.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,q,ka)}if(J){for(D=0;D<w;D++)u=G[D],F=D*3,y[F]=u.r,y[F+1]=u.g,y[F+2]=u.b;e.bindBuffer(e.ARRAY_BUFFER,l.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,y,ka)}}k.__dirtyVertices=!1;
+k.__dirtyColors=!1}else if(ka instanceof THREE.Line){l=d(ka,w);y=l.attributes&&v(l);if(k.__dirtyVertices||k.__dirtyColors||y){ka=k;F=e.DYNAMIC_DRAW;m=G=Q=E=O=void 0;E=ka.vertices;w=ka.colors;m=E.length;y=w.length;q=ka.__vertexArray;D=ka.__colorArray;J=ka.__dirtyColors;u=ka.__webglCustomAttributesList;L=aa=Y=M=Q=O=void 0;if(ka.__dirtyVertices){for(O=0;O<m;O++)Q=E[O].position,G=O*3,q[G]=Q.x,q[G+1]=Q.y,q[G+2]=Q.z;e.bindBuffer(e.ARRAY_BUFFER,ka.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,q,F)}if(J){for(E=
+0;E<y;E++)m=w[E],G=E*3,D[G]=m.r,D[G+1]=m.g,D[G+2]=m.b;e.bindBuffer(e.ARRAY_BUFFER,ka.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,D,F)}if(u){O=0;for(Q=u.length;O<Q;O++)if(L=u[O],L.needsUpdate&&(L.boundTo===void 0||L.boundTo==="vertices")){G=0;Y=L.value.length;if(L.size===1)for(M=0;M<Y;M++)L.array[M]=L.value[M];else if(L.size===2)for(M=0;M<Y;M++)aa=L.value[M],L.array[G]=aa.x,L.array[G+1]=aa.y,G+=2;else if(L.size===3)if(L.type==="c")for(M=0;M<Y;M++)aa=L.value[M],L.array[G]=aa.r,L.array[G+1]=aa.g,
+L.array[G+2]=aa.b,G+=3;else for(M=0;M<Y;M++)aa=L.value[M],L.array[G]=aa.x,L.array[G+1]=aa.y,L.array[G+2]=aa.z,G+=3;else if(L.size===4)for(M=0;M<Y;M++)aa=L.value[M],L.array[G]=aa.x,L.array[G+1]=aa.y,L.array[G+2]=aa.z,L.array[G+3]=aa.w,G+=4;e.bindBuffer(e.ARRAY_BUFFER,L.buffer);e.bufferData(e.ARRAY_BUFFER,L.array,F)}}}k.__dirtyVertices=!1;k.__dirtyColors=!1;l.attributes&&r(l)}else if(ka instanceof THREE.ParticleSystem)l=d(ka,w),y=l.attributes&&v(l),(k.__dirtyVertices||k.__dirtyColors||ka.sortParticles||
+y)&&h(k,e.DYNAMIC_DRAW,ka),k.__dirtyVertices=!1,k.__dirtyColors=!1,l.attributes&&r(l)};this.initMaterial=function(a,b,c,d){var f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];
+a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var k,l,n;k=n=j=0;for(l=b.length;k<l;k++)h=b[k],h instanceof THREE.SpotLight&&!h.onlyShadow&&n++,h instanceof THREE.DirectionalLight&&n++,h instanceof THREE.PointLight&&j++;j+n<=va?k=n:(k=Math.ceil(va*n/(j+n)),j=va-k);h={directional:k,point:j};j=n=0;for(k=b.length;j<k;j++)l=b[j],l instanceof THREE.SpotLight&&l.castShadow&&n++;var m=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)m=d.bones.length;
+var q;a:{k=a.fragmentShader;l=a.vertexShader;var j=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,
+maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},p,d=[];i?d.push(i):(d.push(k),d.push(l));for(p in c)d.push(p),d.push(c[p]);i=d.join();p=0;for(d=ya.length;p<d;p++)if(ya[p].code===i){q=ya[p].program;break a}p=e.createProgram();d=[Na>0?"#define VERTEX_TEXTURES":"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.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.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":
+"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 h=["precision "+ua+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.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.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(p,V("fragment",
 h+k));e.attachShader(p,V("vertex",d+l));e.linkProgram(p);e.getProgramParameter(p,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(p,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");p.uniforms={};p.attributes={};var r,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(r in j)d.push(r);r=d;d=0;for(j=r.length;d<j;d++)k=r[d],p.uniforms[k]=
@@ -287,11 +288,11 @@ e.getUniformLocation(p,k);d=["position","normal","uv","uv2","tangent","color","s
 q.normal>=0&&e.enableVertexAttribArray(q.normal);q.tangent>=0&&e.enableVertexAttribArray(q.tangent);a.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0&&(e.enableVertexAttribArray(q.skinVertexA),e.enableVertexAttribArray(q.skinVertexB),e.enableVertexAttribArray(q.skinIndex),e.enableVertexAttribArray(q.skinWeight));if(a.attributes)for(g in a.attributes)q[g]!==void 0&&q[g]>=0&&e.enableVertexAttribArray(q[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)r=
 "morphTarget"+g,q[r]>=0&&(e.enableVertexAttribArray(q[r]),a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),a==="back"?e.cullFace(e.BACK):a==="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.setObjectFaces=function(a){if(ra!==a.doubleSided)a.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),
 ra=a.doubleSided;if(Z!==a.flipSided)a.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),Z=a.flipSided};this.setDepthTest=function(a){oa!==a&&(a?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),oa=a)};this.setBlending=function(a){if(a!==sa){switch(a){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);
-e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}sa=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=e.createTexture(),H.info.memory.textures++;e.activeTexture(e.TEXTURE0+b);e.bindTexture(e.TEXTURE_2D,a.__webglTexture);var c=C(e.TEXTURE_2D,a,a.image),d=Q(a.format),f=Q(a.type);a instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,
+e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}sa=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=e.createTexture(),H.info.memory.textures++;e.activeTexture(e.TEXTURE0+b);e.bindTexture(e.TEXTURE_2D,a.__webglTexture);var c=D(e.TEXTURE_2D,a,a.image),d=Q(a.format),f=Q(a.type);a instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,
 0,d,a.image.width,a.image.height,0,d,f,a.image.data):e.texImage2D(e.TEXTURE_2D,0,d,d,f,a.image);c&&e.generateMipmap(e.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else e.activeTexture(e.TEXTURE0+b),e.bindTexture(e.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=e.createTexture();var c=Q(a.format),
-d=Q(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];e.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture);C(e.TEXTURE_CUBE_MAP,a,a);for(var f=0;f<6;f++){a.__webglFramebuffer[f]=e.createFramebuffer();a.__webglRenderbuffer[f]=e.createRenderbuffer();e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,c,a.width,a.height,0,c,d,null);var g=a,h=e.TEXTURE_CUBE_MAP_POSITIVE_X+f;e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[f]);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,h,g.__webglTexture,
-0);D(a.__webglRenderbuffer[f],a)}}else a.__webglFramebuffer=e.createFramebuffer(),a.__webglRenderbuffer=e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,a.__webglTexture),C(e.TEXTURE_2D,a,a),e.texImage2D(e.TEXTURE_2D,0,c,a.width,a.height,0,c,d,null),c=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,c,a.__webglTexture,0),D(a.__webglRenderbuffer,a);b?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,
-null);e.bindFramebuffer(e.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=d=0):(b=null,c=Ga,a=Ha,d=Ea,f=Fa);b!==qa&&(e.bindFramebuffer(e.FRAMEBUFFER,b),e.viewport(d,f,c,a),qa=b);Ja=c;Ka=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+d=Q(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];e.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture);D(e.TEXTURE_CUBE_MAP,a,a);for(var f=0;f<6;f++){a.__webglFramebuffer[f]=e.createFramebuffer();a.__webglRenderbuffer[f]=e.createRenderbuffer();e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,c,a.width,a.height,0,c,d,null);var g=a,h=e.TEXTURE_CUBE_MAP_POSITIVE_X+f;e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[f]);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,h,g.__webglTexture,
+0);E(a.__webglRenderbuffer[f],a)}}else a.__webglFramebuffer=e.createFramebuffer(),a.__webglRenderbuffer=e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,a.__webglTexture),D(e.TEXTURE_2D,a,a),e.texImage2D(e.TEXTURE_2D,0,c,a.width,a.height,0,c,d,null),c=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,c,a.__webglTexture,0),E(a.__webglRenderbuffer,a);b?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,
+null);e.bindFramebuffer(e.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=d=0):(b=null,c=Ha,a=Ia,d=Fa,f=Ga);b!==qa&&(e.bindFramebuffer(e.FRAMEBUFFER,b),e.viewport(d,f,c,a),qa=b);Ka=c;La=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,d){this.width=a;this.height=b;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
 THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
 THREE.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,d){THREE.WebGLRenderTarget.call(this,a,b,d);this.activeCubeFace=0};
@@ -305,25 +306,25 @@ c.vertices[f++]=1;c.vertices[f++]=-1;c.vertices[f++]=1;c.vertices[f++]=0;c.verti
 c.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,c.faces,b.STATIC_DRAW);c.tempTexture=b.createTexture();c.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,c.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
 b.bindTexture(b.TEXTURE_2D,c.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(c.hasVertexTexture=!1,c.program=a(THREE.ShaderFlares.lensFlare)):(c.hasVertexTexture=
 !0,c.program=a(THREE.ShaderFlares.lensFlareVertexTexture));c.attributes={};c.uniforms={};c.attributes.vertex=b.getAttribLocation(c.program,"position");c.attributes.uv=b.getAttribLocation(c.program,"uv");c.uniforms.renderType=b.getUniformLocation(c.program,"renderType");c.uniforms.map=b.getUniformLocation(c.program,"map");c.uniforms.occlusionMap=b.getUniformLocation(c.program,"occlusionMap");c.uniforms.opacity=b.getUniformLocation(c.program,"opacity");c.uniforms.color=b.getUniformLocation(c.program,
-"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,r=i*0.5,v=16/i,m=new THREE.Vector2(v*j,v),E=new THREE.Vector3(1,1,0),y=new THREE.Vector2(1,1),J=c.uniforms,v=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(v.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(v.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var O,P,V,C,D;for(O=0;O<l;O++)if(v=16/i,m.set(v*j,v),C=a[O],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*r+r,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,m.x,m.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);P=0;for(V=C.lensFlares.length;P<V;P++)if(D=C.lensFlares[P],D.opacity>0.0010&&D.scale>0.0010)E.x=D.x,E.y=D.y,E.z=D.z,v=D.size*D.scale/
-i,m.x=v*j,m.y=v,b.uniform3f(J.screenPosition,E.x,E.y,E.z),b.uniform2f(J.scale,m.x,m.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)}}};
+"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,v=i*0.5,r=16/i,n=new THREE.Vector2(r*j,r),C=new THREE.Vector3(1,1,0),y=new THREE.Vector2(1,1),J=c.uniforms,r=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(r.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var O,P,V,D,E;for(O=0;O<l;O++)if(r=16/i,n.set(r*j,r),D=a[O],k.set(D.matrixWorld.n14,D.matrixWorld.n24,D.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(k),
+g.projectionMatrix.multiplyVector3(k),C.copy(k),y.x=C.x*p+p,y.y=C.y*v+v,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,C.x,C.y,C.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);D.positionScreen.copy(C);D.customUpdateCallback?D.customUpdateCallback(D):D.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);P=0;for(V=D.lensFlares.length;P<V;P++)if(E=D.lensFlares[P],E.opacity>0.0010&&E.scale>0.0010)C.x=E.x,C.y=E.y,C.z=E.z,r=E.size*E.scale/
+i,n.x=r*j,n.y=r,b.uniform3f(J.screenPosition,C.x,C.y,C.z),b.uniform2f(J.scale,n.x,n.y),b.uniform1f(J.rotation,E.rotation),b.uniform1f(J.opacity,E.opacity),b.uniform3f(J.color,E.color.r,E.color.g,E.color.b),d.setBlending(E.blending),d.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,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,r,v,m,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(m=J[l],m.castShadow&&m instanceof THREE.SpotLight){this.shadowMap[y]||(this.shadowMap[y]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
-format:THREE.RGBAFormat}),this.shadowMatrix[y]=new THREE.Matrix4);j=this.shadowMap[y];p=this.shadowMatrix[y];f.position.copy(m.position);f.lookAt(m.target.position);f.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),i.add(f),b.autoUpdateScene&&i.updateMatrixWorld());f.matrixWorldInverse.getInverse(f.matrixWorld);p.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);p.multiplySelf(f.projectionMatrix);p.multiplySelf(f.matrixWorldInverse);if(!f._viewMatrixArray)f._viewMatrixArray=
-new Float32Array(16);f.matrixWorldInverse.flattenToArray(f._viewMatrixArray);if(!f._projectionMatrixArray)f._projectionMatrixArray=new Float32Array(16);f.projectionMatrix.flattenToArray(f._projectionMatrixArray);h.multiply(f.projectionMatrix,f.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();p=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,p);E=i.__webglObjects;j=0;for(p=E.length;j<p;j++)if(r=E[j],m=r.object,r.render=!1,m.visible&&m.castShadow&&
-(!(m instanceof THREE.Mesh)||!m.frustumCulled||g.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),r.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(p=E.length;j<p;j++)if(r=E[j],r.render)m=r.object,r=r.buffer,b.setObjectFaces(m),v=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?c:d,r instanceof THREE.BufferGeometry?b.renderBufferDirect(f,
-J,null,v,r,m):b.renderBuffer(f,J,null,v,r,m);E=i.__webglObjectsImmediate;j=0;for(p=E.length;j<p;j++)r=E[j],m=r.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(f,J,null,d,m));y++}}};
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i){var l,k,j,p,v,r,n,C,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,
+format:THREE.RGBAFormat}),this.shadowMatrix[y]=new THREE.Matrix4);j=this.shadowMap[y];p=this.shadowMatrix[y];f.position.copy(n.position);f.lookAt(n.target.position);f.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),i.add(f),b.autoUpdateScene&&i.updateMatrixWorld());f.matrixWorldInverse.getInverse(f.matrixWorld);p.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);p.multiplySelf(f.projectionMatrix);p.multiplySelf(f.matrixWorldInverse);if(!f._viewMatrixArray)f._viewMatrixArray=
+new Float32Array(16);f.matrixWorldInverse.flattenToArray(f._viewMatrixArray);if(!f._projectionMatrixArray)f._projectionMatrixArray=new Float32Array(16);f.projectionMatrix.flattenToArray(f._projectionMatrixArray);h.multiply(f.projectionMatrix,f.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();p=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,p);C=i.__webglObjects;j=0;for(p=C.length;j<p;j++)if(v=C[j],n=v.object,v.render=!1,n.visible&&n.castShadow&&
+(!(n instanceof THREE.Mesh)||!n.frustumCulled||g.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),v.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(p=C.length;j<p;j++)if(v=C[j],v.render)n=v.object,v=v.buffer,b.setObjectFaces(n),r=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?c:d,v instanceof THREE.BufferGeometry?b.renderBufferDirect(f,
+J,null,r,v,n):b.renderBuffer(f,J,null,r,v,n);C=i.__webglObjectsImmediate;j=0;for(p=C.length;j<p;j++)v=C[j],n=v.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(f,J,null,d,n));y++}}};
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,d,c={};this.init=function(a){b=a.context;d=a;c.vertices=new Float32Array(16);c.faces=new Uint16Array(6);a=0;c.vertices[a++]=-1;c.vertices[a++]=-1;c.vertices[a++]=0;c.vertices[a++]=1;c.vertices[a++]=1;c.vertices[a++]=-1;c.vertices[a++]=1;c.vertices[a++]=1;c.vertices[a++]=1;c.vertices[a++]=1;c.vertices[a++]=1;c.vertices[a++]=0;c.vertices[a++]=-1;c.vertices[a++]=1;c.vertices[a++]=0;a=c.vertices[a++]=0;c.faces[a++]=0;c.faces[a++]=1;c.faces[a++]=
 2;c.faces[a++]=0;c.faces[a++]=2;c.faces[a++]=3;c.vertexBuffer=b.createBuffer();c.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,c.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,c.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,c.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),h=b.createShader(b.FRAGMENT_SHADER),i=b.createShader(b.VERTEX_SHADER);b.shaderSource(h,a.fragmentShader);b.shaderSource(i,a.vertexShader);
 b.compileShader(h);b.compileShader(i);b.attachShader(g,h);b.attachShader(g,i);b.linkProgram(g);c.program=g;c.attributes={};c.uniforms={};c.attributes.position=b.getAttribLocation(c.program,"position");c.attributes.uv=b.getAttribLocation(c.program,"uv");c.uniforms.uvOffset=b.getUniformLocation(c.program,"uvOffset");c.uniforms.uvScale=b.getUniformLocation(c.program,"uvScale");c.uniforms.rotation=b.getUniformLocation(c.program,"rotation");c.uniforms.scale=b.getUniformLocation(c.program,"scale");c.uniforms.alignment=
 b.getUniformLocation(c.program,"alignment");c.uniforms.color=b.getUniformLocation(c.program,"color");c.uniforms.map=b.getUniformLocation(c.program,"map");c.uniforms.opacity=b.getUniformLocation(c.program,"opacity");c.uniforms.useScreenCoordinates=b.getUniformLocation(c.program,"useScreenCoordinates");c.uniforms.affectedByDistance=b.getUniformLocation(c.program,"affectedByDistance");c.uniforms.screenPosition=b.getUniformLocation(c.program,"screenPosition");c.uniforms.modelViewMatrix=b.getUniformLocation(c.program,
-"modelViewMatrix");c.uniforms.projectionMatrix=b.getUniformLocation(c.program,"projectionMatrix");c.attributesEnabled=!1};this.render=function(f,g,h,i){var f=f.__webglSprites,l=f.length;if(l){var k=c.attributes,j=c.uniforms,p=i/h;h*=0.5;var r=i*0.5,v=!0;b.useProgram(c.program);if(!c.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),c.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,c.vertexBuffer);b.vertexAttribPointer(k.position,
-2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var m,E=[],k=0;k<l;k++)if(m=f[k],m.visible&&m.opacity!==0)m.useScreenCoordinates?m.z=-m.position.z:(m._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),m.z=-m._modelViewMatrix.n34);f.sort(a);for(k=0;k<l;k++)m=f[k],m.visible&&
-m.opacity!==0&&m.map&&m.map.image&&m.map.image.width&&(m.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(m.position.x-h)/h,(r-m.position.y)/r,Math.max(0,Math.min(1,m.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,m.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,m._modelViewMatrixArray)),g=m.map.image.width/(m.scaleByViewport?i:1),E[0]=g*p*m.scale.x,E[1]=g*m.scale.y,b.uniform2f(j.uvScale,m.uvScale.x,
-m.uvScale.y),b.uniform2f(j.uvOffset,m.uvOffset.x,m.uvOffset.y),b.uniform2f(j.alignment,m.alignment.x,m.alignment.y),b.uniform1f(j.opacity,m.opacity),b.uniform3f(j.color,m.color.r,m.color.g,m.color.b),b.uniform1f(j.rotation,m.rotation),b.uniform2fv(j.scale,E),m.mergeWith3D&&!v?(b.enable(b.DEPTH_TEST),v=!0):!m.mergeWith3D&&v&&(b.disable(b.DEPTH_TEST),v=!1),d.setBlending(m.blending),d.setTexture(m.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+"modelViewMatrix");c.uniforms.projectionMatrix=b.getUniformLocation(c.program,"projectionMatrix");c.attributesEnabled=!1};this.render=function(f,g,h,i){var f=f.__webglSprites,l=f.length;if(l){var k=c.attributes,j=c.uniforms,p=i/h;h*=0.5;var v=i*0.5,r=!0;b.useProgram(c.program);if(!c.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),c.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,c.vertexBuffer);b.vertexAttribPointer(k.position,
+2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var n,C=[],k=0;k<l;k++)if(n=f[k],n.visible&&n.opacity!==0)n.useScreenCoordinates?n.z=-n.position.z:(n._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),n.z=-n._modelViewMatrix.n34);f.sort(a);for(k=0;k<l;k++)n=f[k],n.visible&&
+n.opacity!==0&&n.map&&n.map.image&&n.map.image.width&&(n.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(n.position.x-h)/h,(v-n.position.y)/v,Math.max(0,Math.min(1,n.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,n.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,n._modelViewMatrixArray)),g=n.map.image.width/(n.scaleByViewport?i:1),C[0]=g*p*n.scale.x,C[1]=g*n.scale.y,b.uniform2f(j.uvScale,n.uvScale.x,
+n.uvScale.y),b.uniform2f(j.uvOffset,n.uvOffset.x,n.uvOffset.y),b.uniform2f(j.alignment,n.alignment.x,n.alignment.y),b.uniform1f(j.opacity,n.opacity),b.uniform3f(j.color,n.color.r,n.color.g,n.color.b),b.uniform1f(j.rotation,n.rotation),b.uniform2fv(j.scale,C),n.mergeWith3D&&!r?(b.enable(b.DEPTH_TEST),r=!0):!n.mergeWith3D&&r&&(b.disable(b.DEPTH_TEST),r=!1),d.setBlending(n.blending),d.setTexture(n.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
 fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
 fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};

+ 55 - 11
src/renderers/WebGLRenderer.js

@@ -67,6 +67,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.maxMorphTargets = 8;
 
+	// flags
+
+	this.autoScaleCubemaps = true;
+
 	// custom render plugins
 
 	this.renderPluginsPre = [];
@@ -158,7 +162,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.context = _gl;
 
-	var _supportsVertexTextures = ( maxVertexTextures() > 0 );
+	// GPU capabilities
+
+	var _maxVertexTextures = _gl.getParameter( _gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ),
+	_maxTextureSize = _gl.getParameter( _gl.TEXTURE_SIZE ),
+	_maxCubemapSize = _gl.getParameter( _gl.MAX_CUBE_MAP_TEXTURE_SIZE );
 
 	// API
 
@@ -170,7 +178,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.supportsVertexTextures = function () {
 
-		return _supportsVertexTextures;
+		return _maxVertexTextures > 0;
 
 	};
 
@@ -5043,7 +5051,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		var prefix_vertex = [
 
-			_supportsVertexTextures ? "#define VERTEX_TEXTURES" : "",
+			( _maxVertexTextures > 0 ) ? "#define VERTEX_TEXTURES" : "",
 
 			_this.gammaInput ? "#define GAMMA_INPUT" : "",
 			_this.gammaOutput ? "#define GAMMA_OUTPUT" : "",
@@ -5364,6 +5372,32 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
+	function clampToMaxSize ( image, maxSize ) {
+
+		if ( image.width <= maxSize && image.height <= maxSize ) {
+
+			return image;
+
+		}
+
+		// Warning: Scaling through the canvas will only work with images that use
+		// premultiplied alpha.
+
+		var maxDimension = Math.max( image.width, image.height );
+		var newWidth = Math.floor( image.width * maxSize / maxDimension );
+		var newHeight = Math.floor( image.height * maxSize / maxDimension );
+
+		var canvas = document.createElement( 'canvas' );
+		canvas.width = newWidth;
+		canvas.height = newHeight;
+
+		var ctx = canvas.getContext( "2d" );
+		ctx.drawImage( image, 0, 0, image.width, image.height, 0, 0, newWidth, newHeight );
+
+		return canvas;
+
+	}
+
 	function setCubeTexture ( texture, slot ) {
 
 		if ( texture.image.length === 6 ) {
@@ -5379,13 +5413,29 @@ THREE.WebGLRenderer = function ( parameters ) {
 				_gl.activeTexture( _gl.TEXTURE0 + slot );
 				_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube );
 
-				var needsMipMaps = setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, texture.image[ 0 ] ),
+				var cubeImage = [];
+
+				for ( var i = 0; i < 6; i ++ ) {
+
+					if ( _this.autoScaleCubemaps ) {
+
+						cubeImage[ i ] = clampToMaxSize( texture.image[ i ], _maxCubemapSize );
+
+					} else {
+
+						cubeImage[ i ] = texture.image[ i ];
+
+					}
+
+				}
+
+				var needsMipMaps = setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, cubeImage[ 0 ] ),
 				glFormat = paramThreeToGL( texture.format ),
 				glType = paramThreeToGL( texture.type );
 
 				for ( var i = 0; i < 6; i ++ ) {
 
-					_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, glFormat, glType, texture.image[ i ] );
+					_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, glFormat, glType, cubeImage[ i ] );
 
 				}
 
@@ -5714,12 +5764,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
-	function maxVertexTextures () {
-
-		return _gl.getParameter( _gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
-
-	};
-
 	// Initialization
 
 	function initGL () {