Browse Source

Merge remote branch 'alteredq/master'

Mr.doob 14 years ago
parent
commit
e89a1de8c2
5 changed files with 372 additions and 560 deletions
  1. 182 182
      build/Three.js
  2. 183 183
      build/ThreeDebug.js
  3. 0 190
      build/ThreeExtras.js
  4. 1 1
      examples/geometry_terrain_fog_gl.html
  5. 6 4
      src/renderers/WebGLRenderer.js

+ 182 - 182
build/Three.js

@@ -1,182 +1,182 @@
-// Three.js r31 - http://github.com/mrdoob/three.js
-var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};
-THREE.Color.prototype={setRGB:function(a,b,f){this.r=a;this.g=b;this.b=f;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+
-","+~~(this.g*255)+","+~~(this.b*255)+")"},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
-THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
-this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,f){this.x=a||0;this.y=b||0;this.z=f||0};
-THREE.Vector3.prototype={set:function(a,b,f){this.x=a;this.y=b;this.z=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
-cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,f=this.y,d=this.z;this.x=f*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-f*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=
-a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+f*f+a*a)},distanceToSquared:function(a){var b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return b*b+f*f+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=
-Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
-THREE.Vector4=function(a,b,f,d){this.x=a||0;this.y=b||0;this.z=f||0;this.w=d||1};
-THREE.Vector4.prototype={set:function(a,b,f,d){this.x=a;this.y=b;this.z=f;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},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){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
-THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,f,d=a.objects,h=[];a=0;for(b=d.length;a<b;a++){f=d[a];if(f instanceof THREE.Mesh)h=h.concat(this.intersectObject(f))}h.sort(function(j,q){return j.distance-q.distance});return h},intersectObject:function(a){function b(N,t,R,D){D=D.clone().subSelf(t);R=R.clone().subSelf(t);var L=N.clone().subSelf(t);N=D.dot(D);t=D.dot(R);D=D.dot(L);var M=R.dot(R);R=R.dot(L);L=1/(N*M-t*t);M=(M*D-t*R)*L;N=(N*R-t*D)*L;return M>0&&N>0&&M+N<1}var f,d,h,j,q,m,p,c,C,A,
-w,v=a.geometry,K=v.vertices,P=[];f=0;for(d=v.faces.length;f<d;f++){h=v.faces[f];A=this.origin.clone();w=this.direction.clone();j=a.matrix.multiplyVector3(K[h.a].position.clone());q=a.matrix.multiplyVector3(K[h.b].position.clone());m=a.matrix.multiplyVector3(K[h.c].position.clone());p=h instanceof THREE.Face4?a.matrix.multiplyVector3(K[h.d].position.clone()):null;c=a.rotationMatrix.multiplyVector3(h.normal.clone());C=w.dot(c);if(C<0){c=c.dot((new THREE.Vector3).sub(j,A))/C;A=A.addSelf(w.multiplyScalar(c));
-if(h instanceof THREE.Face3){if(b(A,j,q,m)){h={distance:this.origin.distanceTo(A),point:A,face:h,object:a};P.push(h)}}else if(h instanceof THREE.Face4)if(b(A,j,q,p)||b(A,q,m,p)){h={distance:this.origin.distanceTo(A),point:A,face:h,object:a};P.push(h)}}}return P}};
-THREE.Rectangle=function(){function a(){j=d-b;q=h-f}var b,f,d,h,j,q,m=true;this.getX=function(){return b};this.getY=function(){return f};this.getWidth=function(){return j};this.getHeight=function(){return q};this.getLeft=function(){return b};this.getTop=function(){return f};this.getRight=function(){return d};this.getBottom=function(){return h};this.set=function(p,c,C,A){m=false;b=p;f=c;d=C;h=A;a()};this.addPoint=function(p,c){if(m){m=false;b=p;f=c;d=p;h=c}else{b=b<p?b:p;f=f<c?f:c;d=d>p?d:p;h=h>c?
-h:c}a()};this.add3Points=function(p,c,C,A,w,v){if(m){m=false;b=p<C?p<w?p:w:C<w?C:w;f=c<A?c<v?c:v:A<v?A:v;d=p>C?p>w?p:w:C>w?C:w;h=c>A?c>v?c:v:A>v?A:v}else{b=p<C?p<w?p<b?p:b:w<b?w:b:C<w?C<b?C:b:w<b?w:b;f=c<A?c<v?c<f?c:f:v<f?v:f:A<v?A<f?A:f:v<f?v:f;d=p>C?p>w?p>d?p:d:w>d?w:d:C>w?C>d?C:d:w>d?w:d;h=c>A?c>v?c>h?c:h:v>h?v:h:A>v?A>h?A:h:v>h?v:h}a()};this.addRectangle=function(p){if(m){m=false;b=p.getLeft();f=p.getTop();d=p.getRight();h=p.getBottom()}else{b=b<p.getLeft()?b:p.getLeft();f=f<p.getTop()?f:p.getTop();
-d=d>p.getRight()?d:p.getRight();h=h>p.getBottom()?h:p.getBottom()}a()};this.inflate=function(p){b-=p;f-=p;d+=p;h+=p;a()};this.minSelf=function(p){b=b>p.getLeft()?b:p.getLeft();f=f>p.getTop()?f:p.getTop();d=d<p.getRight()?d:p.getRight();h=h<p.getBottom()?h:p.getBottom();a()};this.instersects=function(p){return Math.min(d,p.getRight())-Math.max(b,p.getLeft())>=0&&Math.min(h,p.getBottom())-Math.max(f,p.getTop())>=0};this.empty=function(){m=true;h=d=f=b=0;a()};this.isEmpty=function(){return m};this.toString=
-function(){return"THREE.Rectangle ( left: "+b+", right: "+d+", top: "+f+", bottom: "+h+", width: "+j+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
-THREE.Matrix4=function(a,b,f,d,h,j,q,m,p,c,C,A,w,v,K,P){this.n11=a||1;this.n12=b||0;this.n13=f||0;this.n14=d||0;this.n21=h||0;this.n22=j||1;this.n23=q||0;this.n24=m||0;this.n31=p||0;this.n32=c||0;this.n33=C||1;this.n34=A||0;this.n41=w||0;this.n42=v||0;this.n43=K||0;this.n44=P||1};
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,f,d,h,j,q,m,p,c,C,A,w,v,K,P){this.n11=a;this.n12=b;this.n13=f;this.n14=d;this.n21=h;this.n22=j;this.n23=q;this.n24=m;this.n31=p;this.n32=c;this.n33=C;this.n34=A;this.n41=w;this.n42=v;this.n43=K;this.n44=P;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
-a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,f){var d=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3;j.sub(a,b).normalize();d.cross(f,j).normalize();h.cross(j,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);this.n31=j.x;
-this.n32=j.y;this.n33=j.z;this.n34=-j.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,f=a.y,d=a.z,h=1/(this.n41*b+this.n42*f+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*f+this.n13*d+this.n14)*h;a.y=(this.n21*b+this.n22*f+this.n23*d+this.n24)*h;a.z=(this.n31*b+this.n32*f+this.n33*d+this.n34)*h;return a},multiplyVector4:function(a){var b=a.x,f=a.y,d=a.z,h=a.w;a.x=this.n11*b+this.n12*f+this.n13*d+this.n14*h;a.y=this.n21*b+this.n22*f+this.n23*d+this.n24*
-h;a.z=this.n31*b+this.n32*f+this.n33*d+this.n34*h;a.w=this.n41*b+this.n42*f+this.n43*d+this.n44*h;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},multiply:function(a,b){var f=a.n11,d=a.n12,h=a.n13,j=a.n14,q=a.n21,m=a.n22,p=a.n23,c=a.n24,C=a.n31,A=a.n32,
-w=a.n33,v=a.n34,K=a.n41,P=a.n42,N=a.n43,t=a.n44,R=b.n11,D=b.n12,L=b.n13,M=b.n14,e=b.n21,k=b.n22,i=b.n23,g=b.n24,n=b.n31,l=b.n32,o=b.n33,r=b.n34,u=b.n41,E=b.n42,V=b.n43,x=b.n44;this.n11=f*R+d*e+h*n+j*u;this.n12=f*D+d*k+h*l+j*E;this.n13=f*L+d*i+h*o+j*V;this.n14=f*M+d*g+h*r+j*x;this.n21=q*R+m*e+p*n+c*u;this.n22=q*D+m*k+p*l+c*E;this.n23=q*L+m*i+p*o+c*V;this.n24=q*M+m*g+p*r+c*x;this.n31=C*R+A*e+w*n+v*u;this.n32=C*D+A*k+w*l+v*E;this.n33=C*L+A*i+w*o+v*V;this.n34=C*M+A*g+w*r+v*x;this.n41=K*R+P*e+N*n+t*u;
-this.n42=K*D+P*k+N*l+t*E;this.n43=K*L+P*i+N*o+t*V;this.n44=K*M+P*g+N*r+t*x;return this},multiplySelf:function(a){var b=this.n11,f=this.n12,d=this.n13,h=this.n14,j=this.n21,q=this.n22,m=this.n23,p=this.n24,c=this.n31,C=this.n32,A=this.n33,w=this.n34,v=this.n41,K=this.n42,P=this.n43,N=this.n44,t=a.n11,R=a.n21,D=a.n31,L=a.n41,M=a.n12,e=a.n22,k=a.n32,i=a.n42,g=a.n13,n=a.n23,l=a.n33,o=a.n43,r=a.n14,u=a.n24,E=a.n34;a=a.n44;this.n11=b*t+f*R+d*D+h*L;this.n12=b*M+f*e+d*k+h*i;this.n13=b*g+f*n+d*l+h*o;this.n14=
-b*r+f*u+d*E+h*a;this.n21=j*t+q*R+m*D+p*L;this.n22=j*M+q*e+m*k+p*i;this.n23=j*g+q*n+m*l+p*o;this.n24=j*r+q*u+m*E+p*a;this.n31=c*t+C*R+A*D+w*L;this.n32=c*M+C*e+A*k+w*i;this.n33=c*g+C*n+A*l+w*o;this.n34=c*r+C*u+A*E+w*a;this.n41=v*t+K*R+P*D+N*L;this.n42=v*M+K*e+P*k+N*i;this.n43=v*g+K*n+P*l+N*o;this.n44=v*r+K*u+P*E+N*a;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},determinant:function(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*
-this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,f,d){var h=b[f];b[f]=b[d];
-b[d]=h}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
-this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,f){var d=new THREE.Matrix4;d.n14=a;d.n24=b;d.n34=f;return d};
-THREE.Matrix4.scaleMatrix=function(a,b,f){var d=new THREE.Matrix4;d.n11=a;d.n22=b;d.n33=f;return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b};
-THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var f=new THREE.Matrix4,d=Math.cos(b),h=Math.sin(b),j=1-d,q=a.x,m=a.y,p=a.z;f.n11=j*q*q+d;f.n12=j*q*m-h*p;f.n13=j*q*p+h*m;f.n21=j*q*m+h*p;f.n22=j*m*m+d;f.n23=j*m*p-h*q;f.n31=j*q*p-h*m;f.n32=j*m*p+h*q;f.n33=j*p*p+d;return f};
-THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;b.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;b.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;b.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12*
-a.n23*a.n34;b.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;b.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;b.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;b.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;b.n31=a.n22*a.n34*a.n41-a.n24*a.n32*
-a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;b.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;b.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;b.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;b.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22*
-a.n31*a.n43-a.n21*a.n32*a.n43;b.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;b.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;b.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var f=b[10]*b[5]-b[6]*b[9],d=-b[10]*b[1]+b[2]*b[9],h=b[6]*b[1]-b[2]*b[5],j=-b[10]*b[4]+b[6]*b[8],q=b[10]*b[0]-b[2]*b[8],m=-b[6]*b[0]+b[2]*b[4],p=b[9]*b[4]-b[5]*b[8],c=-b[9]*b[0]+b[1]*b[8],C=b[5]*b[0]-b[1]*b[4];b=b[0]*f+b[1]*j+b[2]*p;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*f;a.m[1]=b*d;a.m[2]=b*h;a.m[3]=b*j;a.m[4]=b*q;a.m[5]=b*m;a.m[6]=b*p;a.m[7]=b*c;a.m[8]=b*C;return a};
-THREE.Matrix4.makeFrustum=function(a,b,f,d,h,j){var q,m,p;q=new THREE.Matrix4;m=2*h/(b-a);p=2*h/(d-f);a=(b+a)/(b-a);f=(d+f)/(d-f);d=-(j+h)/(j-h);h=-2*j*h/(j-h);q.n11=m;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=p;q.n23=f;q.n24=0;q.n31=0;q.n32=0;q.n33=d;q.n34=h;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,b,f,d){var h;a=f*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*b,a*b,h,a,f,d)};
-THREE.Matrix4.makeOrtho=function(a,b,f,d,h,j){var q,m,p,c;q=new THREE.Matrix4;m=b-a;p=f-d;c=j-h;a=(b+a)/m;f=(f+d)/p;h=(j+h)/c;q.n11=2/m;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/p;q.n23=0;q.n24=-f;q.n31=0;q.n32=0;q.n33=-2/c;q.n34=-h;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};
-THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
-THREE.Face3=function(a,b,f,d,h){this.a=a;this.b=b;this.c=f;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,b,f,d,h,j){this.a=a;this.b=b;this.c=f;this.d=d;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.material=j instanceof Array?j:[j]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
-THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
-THREE.Geometry.prototype={computeCentroids:function(){var a,b,f;a=0;for(b=this.faces.length;a<b;a++){f=this.faces[a];f.centroid.set(0,0,0);if(f instanceof THREE.Face3){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);f.centroid.divideScalar(3)}else if(f instanceof THREE.Face4){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);
-f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,f,d,h,j,q,m=new THREE.Vector3,p=new THREE.Vector3;d=0;for(h=this.vertices.length;d<h;d++){j=this.vertices[d];j.normal.set(0,0,0)}d=0;for(h=this.faces.length;d<h;d++){j=this.faces[d];if(a&&j.vertexNormals.length){m.set(0,0,0);b=0;for(f=j.normal.length;b<f;b++)m.addSelf(j.vertexNormals[b]);m.divideScalar(3)}else{b=this.vertices[j.a];f=this.vertices[j.b];q=this.vertices[j.c];m.sub(q.position,
-f.position);p.sub(b.position,f.position);m.crossSelf(p)}m.isZero()||m.normalize();j.normal.copy(m)}},computeVertexNormals:function(){var a,b=[],f,d;a=0;for(vl=this.vertices.length;a<vl;a++)b[a]=new THREE.Vector3;a=0;for(f=this.faces.length;a<f;a++){d=this.faces[a];if(d instanceof THREE.Face3){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal);b[d.d].addSelf(d.normal)}}a=
-0;for(vl=this.vertices.length;a<vl;a++)b[a].normalize();a=0;for(f=this.faces.length;a<f;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone()}else if(d instanceof THREE.Face4){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone();d.vertexNormals[3]=b[d.d].clone()}}},computeTangents:function(){function a(r,u,E,V){j=r.vertices[u].position;q=r.vertices[E].position;
-m=r.vertices[V].position;p=h[0];c=h[1];C=h[2];A=q.x-j.x;w=m.x-j.x;v=q.y-j.y;K=m.y-j.y;P=q.z-j.z;N=m.z-j.z;t=c.u-p.u;R=C.u-p.u;D=c.v-p.v;L=C.v-p.v;M=1/(t*L-R*D);g.set((L*A-D*w)*M,(L*v-D*K)*M,(L*P-D*N)*M);n.set((t*w-R*A)*M,(t*K-R*v)*M,(t*N-R*P)*M);k[u].addSelf(g);k[E].addSelf(g);k[V].addSelf(g);i[u].addSelf(n);i[E].addSelf(n);i[V].addSelf(n)}var b,f,d,h,j,q,m,p,c,C,A,w,v,K,P,N,t,R,D,L,M,e,k=[],i=[],g=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3,o=new THREE.Vector3;e=new THREE.Vector3;b=
-0;for(f=this.vertices.length;b<f;b++){k[b]=new THREE.Vector3;i[b]=new THREE.Vector3}b=0;for(f=this.faces.length;b<f;b++){d=this.faces[b];h=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);
-this.vertices[d.c].normal.copy(d.vertexNormals[2]);this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(f=this.vertices.length;b<f;b++){e.copy(this.vertices[b].normal);d=k[b];l.copy(d);l.subSelf(e.multiplyScalar(e.dot(d))).normalize();o.cross(this.vertices[b].normal,d);test=o.dot(i[b]);d=test<0?-1:1;this.vertices[b].tangent.set(l.x,l.y,l.z,d)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.bbox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
-y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,f=this.vertices.length;b<f;b++){a=this.vertices[b];if(a.position.x<this.bbox.x[0])this.bbox.x[0]=a.position.x;else if(a.position.x>this.bbox.x[1])this.bbox.x[1]=a.position.x;if(a.position.y<this.bbox.y[0])this.bbox.y[0]=a.position.y;else if(a.position.y>this.bbox.y[1])this.bbox.y[1]=a.position.y;if(a.position.z<this.bbox.z[0])this.bbox.z[0]=a.position.z;else if(a.position.z>
-this.bbox.z[1])this.bbox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,f=this.vertices.length;b<f;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(C){var A=[];b=0;for(f=C.length;b<f;b++)C[b]==undefined?A.push("undefined"):A.push(C[b].toString());return A.join("_")}var b,f,d,h,j,q,m,p,c={};d=0;for(h=this.faces.length;d<h;d++){j=this.faces[d];q=
-j.material;m=a(q);if(c[m]==undefined)c[m]={hash:m,counter:0};p=c[m].hash+"_"+c[m].counter;if(this.geometryChunks[p]==undefined)this.geometryChunks[p]={faces:[],material:q,vertices:0};j=j instanceof THREE.Face3?3:4;if(this.geometryChunks[p].vertices+j>65535){c[m].counter+=1;p=c[m].hash+"_"+c[m].counter;if(this.geometryChunks[p]==undefined)this.geometryChunks[p]={faces:[],material:q,vertices:0}}this.geometryChunks[p].faces.push(d);this.geometryChunks[p].vertices+=j}},toString:function(){return"THREE.Geometry ( vertices: "+
-this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
-THREE.Camera=function(a,b,f,d){this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,b,f,d);this.autoUpdateMatrix=true;this.translateX=function(h){h=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(h);h.cross(h.clone(),this.up);this.position.addSelf(h);this.target.position.addSelf(h)};this.translateZ=function(h){h=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(h);
-this.position.subSelf(h);this.target.position.subSelf(h)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.toString=function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
-THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.PointLight;
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.translationMatrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.scaleMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.autoUpdateMatrix=this.visible=true;this.updateMatrix=function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);
-this.rotationMatrix=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.scaleMatrix=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.rotationMatrix);this.matrix.multiplySelf(this.scaleMatrix)}};THREE.Object3DCounter={value:0};
-THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b]};THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
-THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+
-this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
-THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
-a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=
-a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+
-this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
-THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
-a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=
-a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+
-this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
-THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap=
-"round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
-a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=
-a.wireframe_linejoin}this.toString=function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
-this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>"+ +")"}};THREE.MeshPhongMaterialCounter={value:0};
-THREE.MeshDepthMaterial=function(a){this.near=1;this.far=1E3;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.near!==undefined)this.near=a.near;if(a.far!==undefined)this.far=a.far;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.__2near=2*this.near;this.__farPlusNear=this.far+this.near;this.__farMinusNear=
-this.far-this.near;this.toString=function(){return"THREE.MeshDepthMaterial"}};THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){this.toString=function(){return"THREE.MeshFaceMaterial"}};
-THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==
-undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+
-"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
-THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+
-this.blending+"<br/>)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
-THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
-THREE.Texture=function(a,b,f,d,h,j){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=f!==undefined?f:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=j!==undefined?j:THREE.LinearMipMapLinearFilter;this.toString=function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+
-this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;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.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
-THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
-THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
-THREE.Fog=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
-THREE.Projector=function(){function a(k,i){return i.z-k.z}function b(k,i){var g=0,n=1,l=k.z+k.w,o=i.z+i.w,r=-k.z+k.w,u=-i.z+i.w;if(l>=0&&o>=0&&r>=0&&u>=0)return true;else if(l<0&&o<0||r<0&&u<0)return false;else{if(l<0)g=Math.max(g,l/(l-o));else if(o<0)n=Math.min(n,l/(l-o));if(r<0)g=Math.max(g,r/(r-u));else if(u<0)n=Math.min(n,r/(r-u));if(n<g)return false;else{k.lerpSelf(i,g);i.lerpSelf(k,1-n);return true}}}var f,d,h=[],j,q,m,p=[],c,C,A=[],w,v,K=[],P=new THREE.Vector4,N=new THREE.Vector4,t=new THREE.Matrix4,
-R=new THREE.Matrix4,D=[],L=new THREE.Vector4,M=new THREE.Vector4,e;this.projectObjects=function(k,i,g){var n=[],l,o;d=0;t.multiply(i.projectionMatrix,i.matrix);D[0]=new THREE.Vector4(t.n41-t.n11,t.n42-t.n12,t.n43-t.n13,t.n44-t.n14);D[1]=new THREE.Vector4(t.n41+t.n11,t.n42+t.n12,t.n43+t.n13,t.n44+t.n14);D[2]=new THREE.Vector4(t.n41+t.n21,t.n42+t.n22,t.n43+t.n23,t.n44+t.n24);D[3]=new THREE.Vector4(t.n41-t.n21,t.n42-t.n22,t.n43-t.n23,t.n44-t.n24);D[4]=new THREE.Vector4(t.n41-t.n31,t.n42-t.n32,t.n43-
-t.n33,t.n44-t.n34);D[5]=new THREE.Vector4(t.n41+t.n31,t.n42+t.n32,t.n43+t.n33,t.n44+t.n34);i=0;for(l=D.length;i<l;i++){o=D[i];o.divideScalar(Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z))}l=k.objects;k=0;for(i=l.length;k<i;k++){o=l[k];var r;if(!(r=!o.visible)){if(r=o instanceof THREE.Mesh){a:{r=void 0;for(var u=o.position,E=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),V=0;V<6;V++){r=D[V].x*u.x+D[V].y*u.y+D[V].z*u.z+D[V].w;if(r<=E){r=false;break a}}r=true}r=!r}r=r}if(!r){f=
-h[d]=h[d]||new THREE.RenderableObject;P.copy(o.position);t.multiplyVector3(P);f.object=o;f.z=P.z;n.push(f);d++}}g&&n.sort(a);return n};this.projectScene=function(k,i,g){var n=[],l,o,r,u,E,V,x,G,H,S,U,F,s,B,Q,I;m=C=v=0;i.autoUpdateMatrix&&i.updateMatrix();t.multiply(i.projectionMatrix,i.matrix);V=this.projectObjects(k,i,true);k=0;for(l=V.length;k<l;k++){x=V[k].object;if(x.visible){x.autoUpdateMatrix&&x.updateMatrix();G=x.matrix;H=x.rotationMatrix;S=x.material;U=x.overdraw;if(x instanceof THREE.Mesh){F=
-x.geometry;s=F.vertices;o=0;for(r=s.length;o<r;o++){B=s[o];B.positionWorld.copy(B.position);G.multiplyVector3(B.positionWorld);u=B.positionScreen;u.copy(B.positionWorld);t.multiplyVector4(u);u.multiplyScalar(1/u.w);B.__visible=u.z>0&&u.z<1}F=F.faces;o=0;for(r=F.length;o<r;o++){B=F[o];if(B instanceof THREE.Face3){u=s[B.a];E=s[B.b];Q=s[B.c];if(u.__visible&&E.__visible&&Q.__visible)if(x.doubleSided||x.flipSided!=(Q.positionScreen.x-u.positionScreen.x)*(E.positionScreen.y-u.positionScreen.y)-(Q.positionScreen.y-
-u.positionScreen.y)*(E.positionScreen.x-u.positionScreen.x)<0){j=p[m]=p[m]||new THREE.RenderableFace3;j.v1.positionWorld.copy(u.positionWorld);j.v2.positionWorld.copy(E.positionWorld);j.v3.positionWorld.copy(Q.positionWorld);j.v1.positionScreen.copy(u.positionScreen);j.v2.positionScreen.copy(E.positionScreen);j.v3.positionScreen.copy(Q.positionScreen);j.normalWorld.copy(B.normal);H.multiplyVector3(j.normalWorld);j.centroidWorld.copy(B.centroid);G.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);
-t.multiplyVector3(j.centroidScreen);Q=B.vertexNormals;e=j.vertexNormalsWorld;u=0;for(E=Q.length;u<E;u++){I=e[u]=e[u]||new THREE.Vector3;I.copy(Q[u]);H.multiplyVector3(I)}j.z=j.centroidScreen.z;j.meshMaterial=S;j.faceMaterial=B.material;j.overdraw=U;if(x.geometry.uvs[o]){j.uvs[0]=x.geometry.uvs[o][0];j.uvs[1]=x.geometry.uvs[o][1];j.uvs[2]=x.geometry.uvs[o][2]}n.push(j);m++}}else if(B instanceof THREE.Face4){u=s[B.a];E=s[B.b];Q=s[B.c];I=s[B.d];if(u.__visible&&E.__visible&&Q.__visible&&I.__visible)if(x.doubleSided||
-x.flipSided!=((I.positionScreen.x-u.positionScreen.x)*(E.positionScreen.y-u.positionScreen.y)-(I.positionScreen.y-u.positionScreen.y)*(E.positionScreen.x-u.positionScreen.x)<0||(E.positionScreen.x-Q.positionScreen.x)*(I.positionScreen.y-Q.positionScreen.y)-(E.positionScreen.y-Q.positionScreen.y)*(I.positionScreen.x-Q.positionScreen.x)<0)){j=p[m]=p[m]||new THREE.RenderableFace3;j.v1.positionWorld.copy(u.positionWorld);j.v2.positionWorld.copy(E.positionWorld);j.v3.positionWorld.copy(I.positionWorld);
-j.v1.positionScreen.copy(u.positionScreen);j.v2.positionScreen.copy(E.positionScreen);j.v3.positionScreen.copy(I.positionScreen);j.normalWorld.copy(B.normal);H.multiplyVector3(j.normalWorld);j.centroidWorld.copy(B.centroid);G.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);t.multiplyVector3(j.centroidScreen);j.z=j.centroidScreen.z;j.meshMaterial=S;j.faceMaterial=B.material;j.overdraw=U;if(x.geometry.uvs[o]){j.uvs[0]=x.geometry.uvs[o][0];j.uvs[1]=x.geometry.uvs[o][1];j.uvs[2]=
-x.geometry.uvs[o][3]}n.push(j);m++;q=p[m]=p[m]||new THREE.RenderableFace3;q.v1.positionWorld.copy(E.positionWorld);q.v2.positionWorld.copy(Q.positionWorld);q.v3.positionWorld.copy(I.positionWorld);q.v1.positionScreen.copy(E.positionScreen);q.v2.positionScreen.copy(Q.positionScreen);q.v3.positionScreen.copy(I.positionScreen);q.normalWorld.copy(j.normalWorld);q.centroidWorld.copy(j.centroidWorld);q.centroidScreen.copy(j.centroidScreen);q.z=q.centroidScreen.z;q.meshMaterial=S;q.faceMaterial=B.material;
-q.overdraw=U;if(x.geometry.uvs[o]){q.uvs[0]=x.geometry.uvs[o][1];q.uvs[1]=x.geometry.uvs[o][2];q.uvs[2]=x.geometry.uvs[o][3]}n.push(q);m++}}}}else if(x instanceof THREE.Line){R.multiply(t,G);s=x.geometry.vertices;B=s[0];B.positionScreen.copy(B.position);R.multiplyVector4(B.positionScreen);o=1;for(r=s.length;o<r;o++){u=s[o];u.positionScreen.copy(u.position);R.multiplyVector4(u.positionScreen);E=s[o-1];L.copy(u.positionScreen);M.copy(E.positionScreen);if(b(L,M)){L.multiplyScalar(1/L.w);M.multiplyScalar(1/
-M.w);c=A[C]=A[C]||new THREE.RenderableLine;c.v1.positionScreen.copy(L);c.v2.positionScreen.copy(M);c.z=Math.max(L.z,M.z);c.material=x.material;n.push(c);C++}}}else if(x instanceof THREE.Particle){N.set(x.position.x,x.position.y,x.position.z,1);t.multiplyVector4(N);N.z/=N.w;if(N.z>0&&N.z<1){w=K[v]=K[v]||new THREE.RenderableParticle;w.x=N.x/N.w;w.y=N.y/N.w;w.z=N.z;w.rotation=x.rotation.z;w.scale.x=x.scale.x*Math.abs(w.x-(N.x+i.projectionMatrix.n11)/(N.w+i.projectionMatrix.n14));w.scale.y=x.scale.y*
-Math.abs(w.y-(N.y+i.projectionMatrix.n22)/(N.w+i.projectionMatrix.n24));w.material=x.material;n.push(w);v++}}}}g&&n.sort(a);return n};this.unprojectVector=function(k,i){var g=new THREE.Matrix4;g.multiply(THREE.Matrix4.makeInvert(i.matrix),THREE.Matrix4.makeInvert(i.projectionMatrix));g.multiplyVector3(k);return k}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,f,d,h,j;this.domElement=document.createElement("div");this.setSize=function(q,m){f=q;d=m;h=f/2;j=d/2};this.render=function(q,m){var p,c,C,A,w,v,K,P;a=b.projectScene(q,m);p=0;for(c=a.length;p<c;p++){w=a[p];if(w instanceof THREE.RenderableParticle){K=w.x*h+h;P=w.y*j+j;C=0;for(A=w.material.length;C<A;C++){v=w.material[C];if(v instanceof THREE.ParticleDOMMaterial){v=v.domElement;v.style.left=K+"px";v.style.top=P+"px"}}}}}};
-THREE.CanvasRenderer=function(){var a=null,b=new THREE.Projector,f=document.createElement("canvas"),d,h,j,q,m=f.getContext("2d"),p=1,c=0,C=null,A=null,w=1,v,K,P,N,t,R,D,L,M,e=new THREE.Color,k=new THREE.Color,i=new THREE.Color,g=new THREE.Color,n=new THREE.Color,l,o,r,u,E,V,x,G,H,S,U=new THREE.Rectangle,F=new THREE.Rectangle,s=new THREE.Rectangle,B=false,Q=new THREE.Color,I=new THREE.Color,W=new THREE.Color,aa=new THREE.Color,Ja=Math.PI*2,Y=new THREE.Vector3,na,oa,Aa,da,pa,ta,la=16;na=document.createElement("canvas");
-na.width=na.height=2;oa=na.getContext("2d");oa.fillStyle="rgba(0,0,0,1)";oa.fillRect(0,0,2,2);Aa=oa.getImageData(0,0,2,2);da=Aa.data;pa=document.createElement("canvas");pa.width=pa.height=la;ta=pa.getContext("2d");ta.translate(-la/2,-la/2);ta.scale(la,la);la--;this.domElement=f;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ga,ua){d=ga;h=ua;j=d/2;q=h/2;f.width=d;f.height=h;U.set(-j,-q,j,q)};this.clear=function(){if(!F.isEmpty()){F.inflate(1);F.minSelf(U);m.clearRect(F.getX(),
-F.getY(),F.getWidth(),F.getHeight());F.empty()}};this.render=function(ga,ua){function Ka(y){var T,O,z,J=y.lights;I.setRGB(0,0,0);W.setRGB(0,0,0);aa.setRGB(0,0,0);y=0;for(T=J.length;y<T;y++){O=J[y];z=O.color;if(O instanceof THREE.AmbientLight){I.r+=z.r;I.g+=z.g;I.b+=z.b}else if(O instanceof THREE.DirectionalLight){W.r+=z.r;W.g+=z.g;W.b+=z.b}else if(O instanceof THREE.PointLight){aa.r+=z.r;aa.g+=z.g;aa.b+=z.b}}}function va(y,T,O,z){var J,X,$,ba,ca=y.lights;y=0;for(J=ca.length;y<J;y++){X=ca[y];$=X.color;
-ba=X.intensity;if(X instanceof THREE.DirectionalLight){X=O.dot(X.position)*ba;if(X>0){z.r+=$.r*X;z.g+=$.g*X;z.b+=$.b*X}}else if(X instanceof THREE.PointLight){Y.sub(X.position,T);Y.normalize();X=O.dot(Y)*ba;if(X>0){z.r+=$.r*X;z.g+=$.g*X;z.b+=$.b*X}}}}function La(y,T,O){if(O.opacity!=0){Ba(O.opacity);wa(O.blending);var z,J,X,$,ba,ca;if(O instanceof THREE.ParticleBasicMaterial){if(O.map){$=O.map;ba=$.width>>1;ca=$.height>>1;J=T.scale.x*j;X=T.scale.y*q;O=J*ba;z=X*ca;s.set(y.x-O,y.y-z,y.x+O,y.y+z);if(U.instersects(s)){m.save();
-m.translate(y.x,y.y);m.rotate(-T.rotation);m.scale(J,-X);m.translate(-ba,-ca);m.drawImage($,0,0);m.restore()}}}else if(O instanceof THREE.ParticleCircleMaterial){if(B){Q.r=I.r+W.r+aa.r;Q.g=I.g+W.g+aa.g;Q.b=I.b+W.b+aa.b;e.r=O.color.r*Q.r;e.g=O.color.g*Q.g;e.b=O.color.b*Q.b;e.updateStyleString()}else e.__styleString=O.color.__styleString;O=T.scale.x*j;z=T.scale.y*q;s.set(y.x-O,y.y-z,y.x+O,y.y+z);if(U.instersects(s)){J=e.__styleString;if(A!=J)m.fillStyle=A=J;m.save();m.translate(y.x,y.y);m.rotate(-T.rotation);
-m.scale(O,z);m.beginPath();m.arc(0,0,1,0,Ja,true);m.closePath();m.fill();m.restore()}}}}function Ma(y,T,O,z){if(z.opacity!=0){Ba(z.opacity);wa(z.blending);m.beginPath();m.moveTo(y.positionScreen.x,y.positionScreen.y);m.lineTo(T.positionScreen.x,T.positionScreen.y);m.closePath();if(z instanceof THREE.LineBasicMaterial){e.__styleString=z.color.__styleString;y=z.linewidth;if(w!=y)m.lineWidth=w=y;y=e.__styleString;if(C!=y)m.strokeStyle=C=y;m.stroke();s.inflate(z.linewidth*2)}}}function Fa(y,T,O,z,J,X){if(J.opacity!=
-0){Ba(J.opacity);wa(J.blending);N=y.positionScreen.x;t=y.positionScreen.y;R=T.positionScreen.x;D=T.positionScreen.y;L=O.positionScreen.x;M=O.positionScreen.y;m.beginPath();m.moveTo(N,t);m.lineTo(R,D);m.lineTo(L,M);m.lineTo(N,t);m.closePath();if(J instanceof THREE.MeshBasicMaterial)if(J.map)J.map.image.loaded&&J.map.mapping instanceof THREE.UVMapping&&qa(N,t,R,D,L,M,J.map.image,z.uvs[0].u,z.uvs[0].v,z.uvs[1].u,z.uvs[1].v,z.uvs[2].u,z.uvs[2].v);else if(J.env_map){if(J.env_map.image.loaded)if(J.env_map.mapping instanceof
-THREE.SphericalReflectionMapping){y=ua.matrix;Y.copy(z.vertexNormalsWorld[0]);E=(Y.x*y.n11+Y.y*y.n12+Y.z*y.n13)*0.5+0.5;V=-(Y.x*y.n21+Y.y*y.n22+Y.z*y.n23)*0.5+0.5;Y.copy(z.vertexNormalsWorld[1]);x=(Y.x*y.n11+Y.y*y.n12+Y.z*y.n13)*0.5+0.5;G=-(Y.x*y.n21+Y.y*y.n22+Y.z*y.n23)*0.5+0.5;Y.copy(z.vertexNormalsWorld[2]);H=(Y.x*y.n11+Y.y*y.n12+Y.z*y.n13)*0.5+0.5;S=-(Y.x*y.n21+Y.y*y.n22+Y.z*y.n23)*0.5+0.5;qa(N,t,R,D,L,M,J.env_map.image,E,V,x,G,H,S)}}else J.wireframe?xa(J.color.__styleString,J.wireframe_linewidth):
-ya(J.color.__styleString);else if(J instanceof THREE.MeshLambertMaterial){if(J.map&&!J.wireframe){J.map.mapping instanceof THREE.UVMapping&&qa(N,t,R,D,L,M,J.map.image,z.uvs[0].u,z.uvs[0].v,z.uvs[1].u,z.uvs[1].v,z.uvs[2].u,z.uvs[2].v);wa(THREE.SubtractiveBlending)}if(B)if(!J.wireframe&&J.shading==THREE.SmoothShading&&z.vertexNormalsWorld.length==3){k.r=i.r=g.r=I.r;k.g=i.g=g.g=I.g;k.b=i.b=g.b=I.b;va(X,z.v1.positionWorld,z.vertexNormalsWorld[0],k);va(X,z.v2.positionWorld,z.vertexNormalsWorld[1],i);va(X,
-z.v3.positionWorld,z.vertexNormalsWorld[2],g);n.r=(i.r+g.r)*0.5;n.g=(i.g+g.g)*0.5;n.b=(i.b+g.b)*0.5;u=Ga(k,i,g,n);qa(N,t,R,D,L,M,u,0,0,1,0,0,1)}else{Q.r=I.r;Q.g=I.g;Q.b=I.b;va(X,z.centroidWorld,z.normalWorld,Q);e.r=J.color.r*Q.r;e.g=J.color.g*Q.g;e.b=J.color.b*Q.b;e.updateStyleString();J.wireframe?xa(e.__styleString,J.wireframe_linewidth):ya(e.__styleString)}else J.wireframe?xa(J.color.__styleString,J.wireframe_linewidth):ya(J.color.__styleString)}else if(J instanceof THREE.MeshDepthMaterial){l=J.__2near;
-o=J.__farPlusNear;r=J.__farMinusNear;k.r=k.g=k.b=1-l/(o-y.positionScreen.z*r);i.r=i.g=i.b=1-l/(o-T.positionScreen.z*r);g.r=g.g=g.b=1-l/(o-O.positionScreen.z*r);n.r=(i.r+g.r)*0.5;n.g=(i.g+g.g)*0.5;n.b=(i.b+g.b)*0.5;u=Ga(k,i,g,n);qa(N,t,R,D,L,M,u,0,0,1,0,0,1)}else if(J instanceof THREE.MeshNormalMaterial){e.r=Ca(z.normalWorld.x);e.g=Ca(z.normalWorld.y);e.b=Ca(z.normalWorld.z);e.updateStyleString();J.wireframe?xa(e.__styleString,J.wireframe_linewidth):ya(e.__styleString)}}}function xa(y,T){if(C!=y)m.strokeStyle=
-C=y;if(w!=T)m.lineWidth=w=T;m.stroke();s.inflate(T*2)}function ya(y){if(A!=y)m.fillStyle=A=y;m.fill()}function qa(y,T,O,z,J,X,$,ba,ca,ha,ea,ia,ra){var ka,ja;ka=$.width-1;ja=$.height-1;ba*=ka;ca*=ja;ha*=ka;ea*=ja;ia*=ka;ra*=ja;O-=y;z-=T;J-=y;X-=T;ha-=ba;ea-=ca;ia-=ba;ra-=ca;ja=1/(ha*ra-ia*ea);ka=(ra*O-ea*J)*ja;ea=(ra*z-ea*X)*ja;O=(ha*J-ia*O)*ja;z=(ha*X-ia*z)*ja;y=y-ka*ba-O*ca;T=T-ea*ba-z*ca;m.save();m.transform(ka,ea,O,z,y,T);m.clip();m.drawImage($,0,0);m.restore()}function Ba(y){if(p!=y)m.globalAlpha=
-p=y}function wa(y){if(c!=y){switch(y){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}c=y}}function Ga(y,T,O,z){var J=~~(y.r*255),X=~~(y.g*255);y=~~(y.b*255);var $=~~(T.r*255),ba=~~(T.g*255);T=~~(T.b*255);var ca=~~(O.r*255),ha=~~(O.g*255);O=~~(O.b*255);var ea=~~(z.r*255),ia=~~(z.g*255);z=~~(z.b*255);da[0]=J<0?0:J>255?255:J;da[1]=X<0?0:X>
-255?255:X;da[2]=y<0?0:y>255?255:y;da[4]=$<0?0:$>255?255:$;da[5]=ba<0?0:ba>255?255:ba;da[6]=T<0?0:T>255?255:T;da[8]=ca<0?0:ca>255?255:ca;da[9]=ha<0?0:ha>255?255:ha;da[10]=O<0?0:O>255?255:O;da[12]=ea<0?0:ea>255?255:ea;da[13]=ia<0?0:ia>255?255:ia;da[14]=z<0?0:z>255?255:z;oa.putImageData(Aa,0,0);ta.drawImage(na,0,0);return pa}function Ca(y){y=(y+1)*0.5;return y<0?0:y>1?1:y}function Da(y,T){var O=T.x-y.x,z=T.y-y.y,J=1/Math.sqrt(O*O+z*z);O*=J;z*=J;T.x+=O;T.y+=z;y.x-=O;y.y-=z}var za,Ha,Z,fa,ma,Ea,Ia,sa;
-m.setTransform(1,0,0,-1,j,q);this.autoClear&&this.clear();a=b.projectScene(ga,ua,this.sortElements);(B=ga.lights.length>0)&&Ka(ga);za=0;for(Ha=a.length;za<Ha;za++){Z=a[za];s.empty();if(Z instanceof THREE.RenderableParticle){v=Z;v.x*=j;v.y*=q;fa=0;for(ma=Z.material.length;fa<ma;fa++)La(v,Z,Z.material[fa],ga)}else if(Z instanceof THREE.RenderableLine){v=Z.v1;K=Z.v2;v.positionScreen.x*=j;v.positionScreen.y*=q;K.positionScreen.x*=j;K.positionScreen.y*=q;s.addPoint(v.positionScreen.x,v.positionScreen.y);
-s.addPoint(K.positionScreen.x,K.positionScreen.y);if(U.instersects(s)){fa=0;for(ma=Z.material.length;fa<ma;)Ma(v,K,Z,Z.material[fa++],ga)}}else if(Z instanceof THREE.RenderableFace3){v=Z.v1;K=Z.v2;P=Z.v3;v.positionScreen.x*=j;v.positionScreen.y*=q;K.positionScreen.x*=j;K.positionScreen.y*=q;P.positionScreen.x*=j;P.positionScreen.y*=q;if(Z.overdraw){Da(v.positionScreen,K.positionScreen);Da(K.positionScreen,P.positionScreen);Da(P.positionScreen,v.positionScreen)}s.add3Points(v.positionScreen.x,v.positionScreen.y,
-K.positionScreen.x,K.positionScreen.y,P.positionScreen.x,P.positionScreen.y);if(U.instersects(s)){fa=0;for(ma=Z.meshMaterial.length;fa<ma;){sa=Z.meshMaterial[fa++];if(sa instanceof THREE.MeshFaceMaterial){Ea=0;for(Ia=Z.faceMaterial.length;Ea<Ia;)(sa=Z.faceMaterial[Ea++])&&Fa(v,K,P,Z,sa,ga)}else Fa(v,K,P,Z,sa,ga)}}}F.addRectangle(s)}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(G,H,S){var U,F,s,B;U=0;for(F=G.lights.length;U<F;U++){s=G.lights[U];if(s instanceof THREE.DirectionalLight){B=H.normalWorld.dot(s.position)*s.intensity;if(B>0){S.r+=s.color.r*B;S.g+=s.color.g*B;S.b+=s.color.b*B}}else if(s instanceof THREE.PointLight){g.sub(s.position,H.centroidWorld);g.normalize();B=H.normalWorld.dot(g)*s.intensity;if(B>0){S.r+=s.color.r*B;S.g+=s.color.g*B;S.b+=s.color.b*B}}}}function b(G,H,S,U,F,s){r=d(u++);r.setAttribute("d","M "+G.positionScreen.x+
-" "+G.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(F instanceof THREE.MeshBasicMaterial)D.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshLambertMaterial)if(R){L.r=M.r;L.g=M.g;L.b=M.b;a(s,U,L);D.r=F.color.r*L.r;D.g=F.color.g*L.g;D.b=F.color.b*L.b;D.updateStyleString()}else D.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshDepthMaterial){i=1-F.__2near/(F.__farPlusNear-U.z*F.__farMinusNear);
-D.setRGB(i,i,i)}else F instanceof THREE.MeshNormalMaterial&&D.setRGB(h(U.normalWorld.x),h(U.normalWorld.y),h(U.normalWorld.z));F.wireframe?r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+F.wireframe_linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframe_linecap+"; stroke-linejoin: "+F.wireframe_linejoin):r.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+F.opacity);m.appendChild(r)}function f(G,H,S,U,F,s,B){r=d(u++);r.setAttribute("d",
-"M "+G.positionScreen.x+" "+G.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+" L "+U.positionScreen.x+","+U.positionScreen.y+"z");if(s instanceof THREE.MeshBasicMaterial)D.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshLambertMaterial)if(R){L.r=M.r;L.g=M.g;L.b=M.b;a(B,F,L);D.r=s.color.r*L.r;D.g=s.color.g*L.g;D.b=s.color.b*L.b;D.updateStyleString()}else D.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshDepthMaterial){i=
-1-s.__2near/(s.__farPlusNear-F.z*s.__farMinusNear);D.setRGB(i,i,i)}else s instanceof THREE.MeshNormalMaterial&&D.setRGB(h(F.normalWorld.x),h(F.normalWorld.y),h(F.normalWorld.z));s.wireframe?r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+s.wireframe_linewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframe_linecap+"; stroke-linejoin: "+s.wireframe_linejoin):r.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+s.opacity);m.appendChild(r)}
-function d(G){if(n[G]==null){n[G]=document.createElementNS("http://www.w3.org/2000/svg","path");x==0&&n[G].setAttribute("shape-rendering","crispEdges");return n[G]}return n[G]}function h(G){return G<0?Math.min((1+G)*0.5,0.5):0.5+Math.min(G*0.5,0.5)}var j=null,q=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,c,C,A,w,v,K,P,N=new THREE.Rectangle,t=new THREE.Rectangle,R=false,D=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),e=new THREE.Color(0),
-k=new THREE.Color(0),i,g=new THREE.Vector3,n=[],l=[],o=[],r,u,E,V,x=1;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(G){switch(G){case "high":x=1;break;case "low":x=0}};this.setSize=function(G,H){p=G;c=H;C=p/2;A=c/2;m.setAttribute("viewBox",-C+" "+-A+" "+p+" "+c);m.setAttribute("width",p);m.setAttribute("height",c);N.set(-C,-A,C,A)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(G,H){var S,U,
-F,s,B,Q,I,W;this.autoClear&&this.clear();j=q.projectScene(G,H,this.sortElements);V=E=u=0;if(R=G.lights.length>0){I=G.lights;M.setRGB(0,0,0);e.setRGB(0,0,0);k.setRGB(0,0,0);S=0;for(U=I.length;S<U;S++){F=I[S];s=F.color;if(F instanceof THREE.AmbientLight){M.r+=s.r;M.g+=s.g;M.b+=s.b}else if(F instanceof THREE.DirectionalLight){e.r+=s.r;e.g+=s.g;e.b+=s.b}else if(F instanceof THREE.PointLight){k.r+=s.r;k.g+=s.g;k.b+=s.b}}}S=0;for(U=j.length;S<U;S++){I=j[S];t.empty();if(I instanceof THREE.RenderableParticle){w=
-I;w.x*=C;w.y*=-A;F=0;for(s=I.material.length;F<s;F++)if(W=I.material[F]){B=w;Q=I;W=W;var aa=E++;if(l[aa]==null){l[aa]=document.createElementNS("http://www.w3.org/2000/svg","circle");x==0&&l[aa].setAttribute("shape-rendering","crispEdges")}r=l[aa];r.setAttribute("cx",B.x);r.setAttribute("cy",B.y);r.setAttribute("r",Q.scale.x*C);if(W instanceof THREE.ParticleCircleMaterial){if(R){L.r=M.r+e.r+k.r;L.g=M.g+e.g+k.g;L.b=M.b+e.b+k.b;D.r=W.color.r*L.r;D.g=W.color.g*L.g;D.b=W.color.b*L.b;D.updateStyleString()}else D=
-W.color;r.setAttribute("style","fill: "+D.__styleString)}m.appendChild(r)}}else if(I instanceof THREE.RenderableLine){w=I.v1;v=I.v2;w.positionScreen.x*=C;w.positionScreen.y*=-A;v.positionScreen.x*=C;v.positionScreen.y*=-A;t.addPoint(w.positionScreen.x,w.positionScreen.y);t.addPoint(v.positionScreen.x,v.positionScreen.y);if(N.instersects(t)){F=0;for(s=I.material.length;F<s;)if(W=I.material[F++]){B=w;Q=v;W=W;aa=V++;if(o[aa]==null){o[aa]=document.createElementNS("http://www.w3.org/2000/svg","line");
-x==0&&o[aa].setAttribute("shape-rendering","crispEdges")}r=o[aa];r.setAttribute("x1",B.positionScreen.x);r.setAttribute("y1",B.positionScreen.y);r.setAttribute("x2",Q.positionScreen.x);r.setAttribute("y2",Q.positionScreen.y);if(W instanceof THREE.LineBasicMaterial){D.__styleString=W.color.__styleString;r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin);m.appendChild(r)}}}}else if(I instanceof
-THREE.RenderableFace3){w=I.v1;v=I.v2;K=I.v3;w.positionScreen.x*=C;w.positionScreen.y*=-A;v.positionScreen.x*=C;v.positionScreen.y*=-A;K.positionScreen.x*=C;K.positionScreen.y*=-A;t.addPoint(w.positionScreen.x,w.positionScreen.y);t.addPoint(v.positionScreen.x,v.positionScreen.y);t.addPoint(K.positionScreen.x,K.positionScreen.y);if(N.instersects(t)){F=0;for(s=I.meshMaterial.length;F<s;){W=I.meshMaterial[F++];if(W instanceof THREE.MeshFaceMaterial){B=0;for(Q=I.faceMaterial.length;B<Q;)(W=I.faceMaterial[B++])&&
-b(w,v,K,I,W,G)}else W&&b(w,v,K,I,W,G)}}}else if(I instanceof THREE.RenderableFace4){w=I.v1;v=I.v2;K=I.v3;P=I.v4;w.positionScreen.x*=C;w.positionScreen.y*=-A;v.positionScreen.x*=C;v.positionScreen.y*=-A;K.positionScreen.x*=C;K.positionScreen.y*=-A;P.positionScreen.x*=C;P.positionScreen.y*=-A;t.addPoint(w.positionScreen.x,w.positionScreen.y);t.addPoint(v.positionScreen.x,v.positionScreen.y);t.addPoint(K.positionScreen.x,K.positionScreen.y);t.addPoint(P.positionScreen.x,P.positionScreen.y);if(N.instersects(t)){F=
-0;for(s=I.meshMaterial.length;F<s;){W=I.meshMaterial[F++];if(W instanceof THREE.MeshFaceMaterial){B=0;for(Q=I.faceMaterial.length;B<Q;)(W=I.faceMaterial[B++])&&f(w,v,K,P,I,W,G)}else W&&f(w,v,K,P,I,W,G)}}}}}};
-THREE.WebGLRenderer=function(a){function b(e,k,i){var g=c.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif",i?"#define USE_FOG":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");var n=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");
-c.attachShader(g,q("fragment",i+e));c.attachShader(g,q("vertex",n+k));c.linkProgram(g);c.getProgramParameter(g,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(g,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");g.uniforms={};g.attributes={};return g}function f(e,k){if(e.image.length==6){if(!e.image.__webGLTextureCube&&!e.image.__cubeMapInitialized&&e.image.loadCount==6){e.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,e.image.__webGLTextureCube);
-c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(var i=0;i<6;++i)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e.image[i]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);e.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+
-k);c.bindTexture(c.TEXTURE_CUBE_MAP,e.image.__webGLTextureCube)}}function d(e,k){if(!e.__webGLTexture&&e.image.loaded){e.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,e.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,m(e.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,m(e.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,m(e.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
-m(e.min_filter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_2D,e.__webGLTexture)}function h(e,k){var i,g,n;i=0;for(g=k.length;i<g;i++){n=k[i];e.uniforms[n]=c.getUniformLocation(e,n)}}function j(e,k){var i,g,n;i=0;for(g=k.length;i<g;i++){n=k[i];e.attributes[n]=c.getAttribLocation(e,n)}}function q(e,k){var i;if(e=="fragment")i=c.createShader(c.FRAGMENT_SHADER);else if(e=="vertex")i=c.createShader(c.VERTEX_SHADER);c.shaderSource(i,
-k);c.compileShader(i);if(!c.getShaderParameter(i,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(i));return null}return i}function m(e){switch(e){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;
-case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR}return 0}var p=document.createElement("canvas"),c,C,A,w=new THREE.Matrix4,v,K=new Float32Array(16),P=new Float32Array(16),N=new Float32Array(16),t=new Float32Array(9),R=new Float32Array(16),D=function(e,k){if(e){var i,g,n,l=pointLights=maxDirLights=maxPointLights=0;i=0;for(g=e.lights.length;i<g;i++){n=e.lights[i];n instanceof THREE.DirectionalLight&&l++;n instanceof
-THREE.PointLight&&pointLights++}if(pointLights+l<=k){maxDirLights=l;maxPointLights=pointLights}else{maxDirLights=Math.ceil(k*l/(pointLights+l));maxPointLights=k-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:k-1}}(a,4);fog=a?a.fog:null;this.domElement=p;this.autoClear=true;try{c=p.getContext("experimental-webgl",{antialias:true})}catch(L){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);
-c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(0,0,0,0);C=A=function(e,k,i){var g=[e?"#define MAX_DIR_LIGHTS "+e:"",k?"#define MAX_POINT_LIGHTS "+k:"","uniform bool enableLighting;\nuniform bool useRefract;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;\nuniform vec3 ambientLightColor;",e?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":"",e?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":
-"",k?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",k?"uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",k?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform float mRefractionRatio;\nvoid main(void) {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec3 transformedNormal = normalize( normalMatrix * normal );\nif ( !enableLighting ) {\nvLightWeighting = vec3( 1.0, 1.0, 1.0 );\n} else {\nvLightWeighting = ambientLightColor;",
-e?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",e?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",e?"float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );":"",e?"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;":"",e?"}":"",k?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",k?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",k?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
-"",k?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",k?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",k?"}":"","}\nvNormal = transformedNormal;\nvUv = uv;\nif ( useRefract ) {\nvReflect = refract( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz), mRefractionRatio );\n} else {\nvReflect = reflect( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz) );\n}\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"),
-n=[e?"#define MAX_DIR_LIGHTS "+e:"",k?"#define MAX_POINT_LIGHTS "+k:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\n#ifdef USE_FOG\nuniform vec3 fogColor;\nuniform float fogDensity;\n#endif\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
-e?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",k?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n}\nif ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
-k?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",k?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",k?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",k?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",k?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",k?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",k?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",k?"float pointSpecularWeight = 0.0;":"",k?"if ( pointDotNormalHalf >= 0.0 )":
-"",k?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",k?"pointDiffuse  += mColor * pointDiffuseWeight;":"",k?"pointSpecular += mSpecular * pointSpecularWeight;":"",k?"}":"",e?"vec4 dirDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",e?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",e?"vec3 dirVector = normalize( lDirection.xyz );":"",e?"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );":
-"",e?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",e?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",e?"float dirSpecularWeight = 0.0;":"",e?"if ( dirDotNormalHalf >= 0.0 )":"",e?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",e?"dirDiffuse  += mColor * dirDiffuseWeight;":"",e?"dirSpecular += mSpecular * dirSpecularWeight;":"",e?"}":"","vec4 totalLight = mAmbient;",e?"totalLight += dirDiffuse + dirSpecular;":"",k?"totalLight += pointDiffuse + pointSpecular;":
-"","if ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mapColor.rgb * totalLight.xyz * vLightWeighting, cubeColor.rgb, mReflectivity ), mapColor.a );\n} else {\ngl_FragColor = vec4( mapColor.rgb * cubeColor.rgb * totalLight.xyz * vLightWeighting, mapColor.a );\n}\n} else if ( material == 1 ) {\nif ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mColor.rgb * mapColor.rgb * vLightWeighting, cubeColor.rgb, mReflectivity ), mColor.a * mapColor.a );\n} else {\ngl_FragColor = vec4( mColor.rgb * mapColor.rgb * cubeColor.rgb * vLightWeighting, mColor.a * mapColor.a );\n}\n} else {\nif ( mixEnvMap ) {\ngl_FragColor = mix( mColor * mapColor, cubeColor, mReflectivity );\n} else {\ngl_FragColor = mColor * mapColor * cubeColor;\n}\n}\n#ifdef USE_FOG\nconst float LOG2 = 1.442695;\nfloat z = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = exp2( - fogDensity * fogDensity * z * z * LOG2 );\nfogFactor = clamp( fogFactor, 0.0, 1.0 );\ngl_FragColor = mix( vec4( fogColor, 1.0 ), gl_FragColor, fogFactor );\n#endif\n}"].join("\n");
-g=b(n,g,i);c.useProgram(g);h(g,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract"]);i&&h(g,["fogColor","fogDensity"]);e&&h(g,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);k&&h(g,["pointLightNumber","pointLightColor",
-"pointLightPosition"]);c.uniform1i(g.uniforms.enableMap,0);c.uniform1i(g.uniforms.tMap,0);c.uniform1i(g.uniforms.enableCubeMap,0);c.uniform1i(g.uniforms.tCube,1);c.uniform1i(g.uniforms.mixEnvMap,0);c.uniform1i(g.uniforms.useRefract,0);j(g,["position","normal","uv"]);return g}(D.directional,D.point,fog);this.setSize=function(e,k){p.width=e;p.height=k;c.viewport(0,0,p.width,p.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(e,k){var i,g,n,l,o,
-r=[],u=[],E=[];l=[];o=[];c.uniform1i(e.uniforms.enableLighting,k.length);i=0;for(g=k.length;i<g;i++){n=k[i];if(n instanceof THREE.AmbientLight)r.push(n);else if(n instanceof THREE.DirectionalLight)E.push(n);else n instanceof THREE.PointLight&&u.push(n)}i=n=l=o=0;for(g=r.length;i<g;i++){n+=r[i].color.r;l+=r[i].color.g;o+=r[i].color.b}c.uniform3f(e.uniforms.ambientLightColor,n,l,o);l=[];o=[];i=0;for(g=E.length;i<g;i++){n=E[i];l.push(n.color.r*n.intensity);l.push(n.color.g*n.intensity);l.push(n.color.b*
-n.intensity);o.push(n.position.x);o.push(n.position.y);o.push(n.position.z)}if(E.length){c.uniform1i(e.uniforms.directionalLightNumber,E.length);c.uniform3fv(e.uniforms.directionalLightDirection,o);c.uniform3fv(e.uniforms.directionalLightColor,l)}l=[];o=[];i=0;for(g=u.length;i<g;i++){n=u[i];l.push(n.color.r*n.intensity);l.push(n.color.g*n.intensity);l.push(n.color.b*n.intensity);o.push(n.position.x);o.push(n.position.y);o.push(n.position.z)}if(u.length){c.uniform1i(e.uniforms.pointLightNumber,u.length);
-c.uniform3fv(e.uniforms.pointLightPosition,o);c.uniform3fv(e.uniforms.pointLightColor,l)}};this.createBuffers=function(e,k){var i,g,n,l,o,r,u,E,V,x=[],G=[],H=[],S=[],U=[],F=[],s=0,B=e.geometry.geometryChunks[k],Q;n=false;i=0;for(g=e.material.length;i<g;i++){meshMaterial=e.material[i];if(meshMaterial instanceof THREE.MeshFaceMaterial){o=0;for(Q=B.material.length;o<Q;o++)if(B.material[o]&&B.material[o].shading!=undefined&&B.material[o].shading==THREE.SmoothShading){n=true;break}}else if(meshMaterial&&
-meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){n=true;break}if(n)break}Q=n;i=0;for(g=B.faces.length;i<g;i++){n=B.faces[i];l=e.geometry.faces[n];o=l.vertexNormals;faceNormal=l.normal;n=e.geometry.uvs[n];if(l instanceof THREE.Face3){r=e.geometry.vertices[l.a].position;u=e.geometry.vertices[l.b].position;E=e.geometry.vertices[l.c].position;H.push(r.x,r.y,r.z);H.push(u.x,u.y,u.z);H.push(E.x,E.y,E.z);if(e.geometry.hasTangents){r=e.geometry.vertices[l.a].tangent;u=e.geometry.vertices[l.b].tangent;
-E=e.geometry.vertices[l.c].tangent;U.push(r.x,r.y,r.z,r.w);U.push(u.x,u.y,u.z,u.w);U.push(E.x,E.y,E.z,E.w)}if(o.length==3&&Q)for(l=0;l<3;l++)S.push(o[l].x,o[l].y,o[l].z);else for(l=0;l<3;l++)S.push(faceNormal.x,faceNormal.y,faceNormal.z);if(n)for(l=0;l<3;l++)F.push(n[l].u,n[l].v);x.push(s,s+1,s+2);G.push(s,s+1);G.push(s,s+2);G.push(s+1,s+2);s+=3}else if(l instanceof THREE.Face4){r=e.geometry.vertices[l.a].position;u=e.geometry.vertices[l.b].position;E=e.geometry.vertices[l.c].position;V=e.geometry.vertices[l.d].position;
-H.push(r.x,r.y,r.z);H.push(u.x,u.y,u.z);H.push(E.x,E.y,E.z);H.push(V.x,V.y,V.z);if(e.geometry.hasTangents){r=e.geometry.vertices[l.a].tangent;u=e.geometry.vertices[l.b].tangent;E=e.geometry.vertices[l.c].tangent;l=e.geometry.vertices[l.d].tangent;U.push(r.x,r.y,r.z,r.w);U.push(u.x,u.y,u.z,u.w);U.push(E.x,E.y,E.z,E.w);U.push(l.x,l.y,l.z,l.w)}if(o.length==4&&Q)for(l=0;l<4;l++)S.push(o[l].x,o[l].y,o[l].z);else for(l=0;l<4;l++)S.push(faceNormal.x,faceNormal.y,faceNormal.z);if(n)for(l=0;l<4;l++)F.push(n[l].u,
-n[l].v);x.push(s,s+1,s+2);x.push(s,s+2,s+3);G.push(s,s+1);G.push(s,s+2);G.push(s,s+3);G.push(s+1,s+2);G.push(s+2,s+3);s+=4}}if(H.length){B.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(H),c.STATIC_DRAW);B.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(S),c.STATIC_DRAW);if(e.geometry.hasTangents){B.__webGLTangentBuffer=c.createBuffer();
-c.bindBuffer(c.ARRAY_BUFFER,B.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(U),c.STATIC_DRAW)}if(F.length>0){B.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(F),c.STATIC_DRAW)}B.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(x),c.STATIC_DRAW);B.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-B.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(G),c.STATIC_DRAW);B.__webGLFaceCount=x.length;B.__webGLLineCount=G.length}};this.renderBuffer=function(e,k,i,g,n){var l,o,r,u,E,V,x,G,H;if(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshDepthMaterial||g instanceof THREE.MeshNormalMaterial){if(!g.program){if(g instanceof THREE.MeshDepthMaterial){x=M.depth;g.fragment_shader=x.fragment_shader;g.vertex_shader=x.vertex_shader;g.uniforms=x.uniforms;g.uniforms.mNear.value=
-g.near;g.uniforms.mFar.value=g.far}else if(g instanceof THREE.MeshNormalMaterial){x=M.normal;g.fragment_shader=x.fragment_shader;g.vertex_shader=x.vertex_shader;g.uniforms=x.uniforms}g.program=b(g.fragment_shader,g.vertex_shader,null);x=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(H in g.uniforms)x.push(H);h(g.program,x);j(g.program,["position","normal","uv","tangent"])}H=g.program}else H=A;if(H!=C){c.useProgram(H);C=H}H==A&&this.setupLights(H,
-k);this.loadCamera(H,e);this.loadMatrices(H);if(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshDepthMaterial||g instanceof THREE.MeshNormalMaterial){r=g.wireframe;u=g.wireframe_linewidth;e=H;k=g.uniforms;var S;for(l in k){G=k[l].type;x=k[l].value;S=e.uniforms[l];if(G=="i")c.uniform1i(S,x);else if(G=="f")c.uniform1f(S,x);else if(G=="v3")c.uniform3f(S,x.x,x.y,x.z);else if(G=="c")c.uniform3f(S,x.r,x.g,x.b);else if(G=="t"){c.uniform1i(S,x);if(G=k[l].texture)G.image instanceof Array&&G.image.length==
-6?f(G,x):d(G,x)}}}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshBasicMaterial){l=g.color;o=g.opacity;r=g.wireframe;u=g.wireframe_linewidth;E=g.map;V=g.env_map;k=g.combine==THREE.MixOperation;e=g.reflectivity;G=g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping;x=g.refraction_ratio;c.uniform4f(H.uniforms.mColor,l.r*o,l.g*o,l.b*o,o);c.uniform1i(H.uniforms.mixEnvMap,k);c.uniform1f(H.uniforms.mReflectivity,e);c.uniform1i(H.uniforms.useRefract,
-G);c.uniform1f(H.uniforms.mRefractionRatio,x);if(i){c.uniform1f(H.uniforms.fogDensity,i.density);c.uniform3f(H.uniforms.fogColor,i.color.r,i.color.g,i.color.b)}}if(g instanceof THREE.MeshPhongMaterial){i=g.ambient;l=g.specular;g=g.shininess;c.uniform4f(H.uniforms.mAmbient,i.r,i.g,i.b,o);c.uniform4f(H.uniforms.mSpecular,l.r,l.g,l.b,o);c.uniform1f(H.uniforms.mShininess,g);c.uniform1i(H.uniforms.material,2)}else if(g instanceof THREE.MeshLambertMaterial)c.uniform1i(H.uniforms.material,1);else g instanceof
-THREE.MeshBasicMaterial&&c.uniform1i(H.uniforms.material,0);if(E){d(E,0);c.uniform1i(H.uniforms.tMap,0);c.uniform1i(H.uniforms.enableMap,1)}else c.uniform1i(H.uniforms.enableMap,0);if(V){f(V,1);c.uniform1i(H.uniforms.tCube,1);c.uniform1i(H.uniforms.enableCubeMap,1)}else c.uniform1i(H.uniforms.enableCubeMap,0);o=H.attributes;c.bindBuffer(c.ARRAY_BUFFER,n.__webGLVertexBuffer);c.vertexAttribPointer(o.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.position);if(o.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,
-n.__webGLNormalBuffer);c.vertexAttribPointer(o.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.normal)}if(o.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLTangentBuffer);c.vertexAttribPointer(o.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.tangent)}if(o.uv>=0)if(n.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLUVBuffer);c.vertexAttribPointer(o.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.uv)}else c.disableVertexAttribArray(o.uv);if(r){c.lineWidth(u);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-n.__webGLLineBuffer);c.drawElements(c.LINES,n.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,n.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(e,k,i,g,n,l,o){var r,u,E,V,x;E=0;for(V=g.material.length;E<V;E++){r=g.material[E];if(r instanceof THREE.MeshFaceMaterial){r=0;for(u=n.material.length;r<u;r++)if((x=n.material[r])&&x.blending==l&&x.opacity<1==o){this.setBlending(x.blending);this.renderBuffer(e,k,i,
-x,n)}}else if((x=r)&&x.blending==l&&x.opacity<1==o){this.setBlending(x.blending);this.renderBuffer(e,k,i,x,n)}}};this.render=function(e,k){var i,g,n,l,o=e.lights,r=e.fog;this.initWebGLObjects(e);this.autoClear&&this.clear();k.autoUpdateMatrix&&k.updateMatrix();K.set(k.matrix.flatten());N.set(k.projectionMatrix.flatten());i=0;for(g=e.__webGLObjects.length;i<g;i++){n=e.__webGLObjects[i];l=n.object;n=n.buffer;if(l.visible){this.setupMatrices(l,k);this.renderPass(k,o,r,l,n,THREE.NormalBlending,false)}}i=
-0;for(g=e.__webGLObjects.length;i<g;i++){n=e.__webGLObjects[i];l=n.object;n=n.buffer;if(l.visible){this.setupMatrices(l,k);this.renderPass(k,o,r,l,n,THREE.AdditiveBlending,false);this.renderPass(k,o,r,l,n,THREE.SubtractiveBlending,false);this.renderPass(k,o,r,l,n,THREE.AdditiveBlending,true);this.renderPass(k,o,r,l,n,THREE.SubtractiveBlending,true);this.renderPass(k,o,r,l,n,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(e){var k,i,g,n,l,o;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap=
-{}}k=0;for(i=e.objects.length;k<i;k++){g=e.objects[k];if(e.__webGLObjectsMap[g.id]==undefined)e.__webGLObjectsMap[g.id]={};o=e.__webGLObjectsMap[g.id];if(g instanceof THREE.Mesh)for(l in g.geometry.geometryChunks){n=g.geometry.geometryChunks[l];n.__webGLVertexBuffer||this.createBuffers(g,l);if(o[l]==undefined){n={buffer:n,object:g};e.__webGLObjects.push(n);o[l]=1}}}};this.removeObject=function(e,k){var i,g;for(i=e.__webGLObjects.length-1;i>=0;i--){g=e.__webGLObjects[i].object;k==g&&e.__webGLObjects.splice(i,
-1)}};this.setupMatrices=function(e,k){e.autoUpdateMatrix&&e.updateMatrix();w.multiply(k.matrix,e.matrix);P.set(w.flatten());v=THREE.Matrix4.makeInvert3x3(w).transpose();t.set(v.m);R.set(e.matrix.flatten())};this.loadMatrices=function(e){c.uniformMatrix4fv(e.uniforms.viewMatrix,false,K);c.uniformMatrix4fv(e.uniforms.modelViewMatrix,false,P);c.uniformMatrix4fv(e.uniforms.projectionMatrix,false,N);c.uniformMatrix3fv(e.uniforms.normalMatrix,false,t);c.uniformMatrix4fv(e.uniforms.objectMatrix,false,R)};
-this.loadCamera=function(e,k){c.uniform3f(e.uniforms.cameraPosition,k.position.x,k.position.y,k.position.z)};this.setBlending=function(e){switch(e){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(e,k){if(e){!k||k=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(e=="back")c.cullFace(c.BACK);
-else e=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0};var M={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",
-vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"}}};
-THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterial=this.meshMaterial=null;this.overdraw=false;this.uvs=[null,null,null]};
-THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.material=null};
+// Three.js r31 - http://github.com/mrdoob/three.js
+var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};
+THREE.Color.prototype={setRGB:function(a,b,f){this.r=a;this.g=b;this.b=f;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+
+","+~~(this.g*255)+","+~~(this.b*255)+")"},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
+THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
+this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,f){this.x=a||0;this.y=b||0;this.z=f||0};
+THREE.Vector3.prototype={set:function(a,b,f){this.x=a;this.y=b;this.z=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
+cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,f=this.y,d=this.z;this.x=f*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-f*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=
+a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+f*f+a*a)},distanceToSquared:function(a){var b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return b*b+f*f+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=
+Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
+THREE.Vector4=function(a,b,f,d){this.x=a||0;this.y=b||0;this.z=f||0;this.w=d||1};
+THREE.Vector4.prototype={set:function(a,b,f,d){this.x=a;this.y=b;this.z=f;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},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){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
+THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
+THREE.Ray.prototype={intersectScene:function(a){var b,f,d=a.objects,j=[];a=0;for(b=d.length;a<b;a++){f=d[a];if(f instanceof THREE.Mesh)j=j.concat(this.intersectObject(f))}j.sort(function(k,q){return k.distance-q.distance});return j},intersectObject:function(a){function b(N,s,T,C){C=C.clone().subSelf(s);T=T.clone().subSelf(s);var L=N.clone().subSelf(s);N=C.dot(C);s=C.dot(T);C=C.dot(L);var O=T.dot(T);T=T.dot(L);L=1/(N*O-s*s);O=(O*C-s*T)*L;N=(N*T-s*C)*L;return O>0&&N>0&&O+N<1}var f,d,j,k,q,l,o,y,c,B,
+u,t=a.geometry,J=t.vertices,R=[];f=0;for(d=t.faces.length;f<d;f++){j=t.faces[f];B=this.origin.clone();u=this.direction.clone();k=a.matrix.multiplyVector3(J[j.a].position.clone());q=a.matrix.multiplyVector3(J[j.b].position.clone());l=a.matrix.multiplyVector3(J[j.c].position.clone());o=j instanceof THREE.Face4?a.matrix.multiplyVector3(J[j.d].position.clone()):null;y=a.rotationMatrix.multiplyVector3(j.normal.clone());c=u.dot(y);if(c<0){y=y.dot((new THREE.Vector3).sub(k,B))/c;B=B.addSelf(u.multiplyScalar(y));
+if(j instanceof THREE.Face3){if(b(B,k,q,l)){j={distance:this.origin.distanceTo(B),point:B,face:j,object:a};R.push(j)}}else if(j instanceof THREE.Face4)if(b(B,k,q,o)||b(B,q,l,o)){j={distance:this.origin.distanceTo(B),point:B,face:j,object:a};R.push(j)}}}return R}};
+THREE.Rectangle=function(){function a(){k=d-b;q=j-f}var b,f,d,j,k,q,l=true;this.getX=function(){return b};this.getY=function(){return f};this.getWidth=function(){return k};this.getHeight=function(){return q};this.getLeft=function(){return b};this.getTop=function(){return f};this.getRight=function(){return d};this.getBottom=function(){return j};this.set=function(o,y,c,B){l=false;b=o;f=y;d=c;j=B;a()};this.addPoint=function(o,y){if(l){l=false;b=o;f=y;d=o;j=y}else{b=b<o?b:o;f=f<y?f:y;d=d>o?d:o;j=j>y?
+j:y}a()};this.add3Points=function(o,y,c,B,u,t){if(l){l=false;b=o<c?o<u?o:u:c<u?c:u;f=y<B?y<t?y:t:B<t?B:t;d=o>c?o>u?o:u:c>u?c:u;j=y>B?y>t?y:t:B>t?B:t}else{b=o<c?o<u?o<b?o:b:u<b?u:b:c<u?c<b?c:b:u<b?u:b;f=y<B?y<t?y<f?y:f:t<f?t:f:B<t?B<f?B:f:t<f?t:f;d=o>c?o>u?o>d?o:d:u>d?u:d:c>u?c>d?c:d:u>d?u:d;j=y>B?y>t?y>j?y:j:t>j?t:j:B>t?B>j?B:j:t>j?t:j}a()};this.addRectangle=function(o){if(l){l=false;b=o.getLeft();f=o.getTop();d=o.getRight();j=o.getBottom()}else{b=b<o.getLeft()?b:o.getLeft();f=f<o.getTop()?f:o.getTop();
+d=d>o.getRight()?d:o.getRight();j=j>o.getBottom()?j:o.getBottom()}a()};this.inflate=function(o){b-=o;f-=o;d+=o;j+=o;a()};this.minSelf=function(o){b=b>o.getLeft()?b:o.getLeft();f=f>o.getTop()?f:o.getTop();d=d<o.getRight()?d:o.getRight();j=j<o.getBottom()?j:o.getBottom();a()};this.instersects=function(o){return Math.min(d,o.getRight())-Math.max(b,o.getLeft())>=0&&Math.min(j,o.getBottom())-Math.max(f,o.getTop())>=0};this.empty=function(){l=true;j=d=f=b=0;a()};this.isEmpty=function(){return l};this.toString=
+function(){return"THREE.Rectangle ( left: "+b+", right: "+d+", top: "+f+", bottom: "+j+", width: "+k+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
+THREE.Matrix4=function(a,b,f,d,j,k,q,l,o,y,c,B,u,t,J,R){this.n11=a||1;this.n12=b||0;this.n13=f||0;this.n14=d||0;this.n21=j||0;this.n22=k||1;this.n23=q||0;this.n24=l||0;this.n31=o||0;this.n32=y||0;this.n33=c||1;this.n34=B||0;this.n41=u||0;this.n42=t||0;this.n43=J||0;this.n44=R||1};
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,f,d,j,k,q,l,o,y,c,B,u,t,J,R){this.n11=a;this.n12=b;this.n13=f;this.n14=d;this.n21=j;this.n22=k;this.n23=q;this.n24=l;this.n31=o;this.n32=y;this.n33=c;this.n34=B;this.n41=u;this.n42=t;this.n43=J;this.n44=R;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
+a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,f){var d=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3;k.sub(a,b).normalize();d.cross(f,k).normalize();j.cross(k,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=j.x;this.n22=j.y;this.n23=j.z;this.n24=-j.dot(a);this.n31=k.x;
+this.n32=k.y;this.n33=k.z;this.n34=-k.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,f=a.y,d=a.z,j=1/(this.n41*b+this.n42*f+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*f+this.n13*d+this.n14)*j;a.y=(this.n21*b+this.n22*f+this.n23*d+this.n24)*j;a.z=(this.n31*b+this.n32*f+this.n33*d+this.n34)*j;return a},multiplyVector4:function(a){var b=a.x,f=a.y,d=a.z,j=a.w;a.x=this.n11*b+this.n12*f+this.n13*d+this.n14*j;a.y=this.n21*b+this.n22*f+this.n23*d+this.n24*
+j;a.z=this.n31*b+this.n32*f+this.n33*d+this.n34*j;a.w=this.n41*b+this.n42*f+this.n43*d+this.n44*j;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},multiply:function(a,b){var f=a.n11,d=a.n12,j=a.n13,k=a.n14,q=a.n21,l=a.n22,o=a.n23,y=a.n24,c=a.n31,B=a.n32,
+u=a.n33,t=a.n34,J=a.n41,R=a.n42,N=a.n43,s=a.n44,T=b.n11,C=b.n12,L=b.n13,O=b.n14,Q=b.n21,e=b.n22,h=b.n23,m=b.n24,i=b.n31,n=b.n32,g=b.n33,p=b.n34,r=b.n41,D=b.n42,M=b.n43,H=b.n44;this.n11=f*T+d*Q+j*i+k*r;this.n12=f*C+d*e+j*n+k*D;this.n13=f*L+d*h+j*g+k*M;this.n14=f*O+d*m+j*p+k*H;this.n21=q*T+l*Q+o*i+y*r;this.n22=q*C+l*e+o*n+y*D;this.n23=q*L+l*h+o*g+y*M;this.n24=q*O+l*m+o*p+y*H;this.n31=c*T+B*Q+u*i+t*r;this.n32=c*C+B*e+u*n+t*D;this.n33=c*L+B*h+u*g+t*M;this.n34=c*O+B*m+u*p+t*H;this.n41=J*T+R*Q+N*i+s*r;
+this.n42=J*C+R*e+N*n+s*D;this.n43=J*L+R*h+N*g+s*M;this.n44=J*O+R*m+N*p+s*H;return this},multiplySelf:function(a){var b=this.n11,f=this.n12,d=this.n13,j=this.n14,k=this.n21,q=this.n22,l=this.n23,o=this.n24,y=this.n31,c=this.n32,B=this.n33,u=this.n34,t=this.n41,J=this.n42,R=this.n43,N=this.n44,s=a.n11,T=a.n21,C=a.n31,L=a.n41,O=a.n12,Q=a.n22,e=a.n32,h=a.n42,m=a.n13,i=a.n23,n=a.n33,g=a.n43,p=a.n14,r=a.n24,D=a.n34;a=a.n44;this.n11=b*s+f*T+d*C+j*L;this.n12=b*O+f*Q+d*e+j*h;this.n13=b*m+f*i+d*n+j*g;this.n14=
+b*p+f*r+d*D+j*a;this.n21=k*s+q*T+l*C+o*L;this.n22=k*O+q*Q+l*e+o*h;this.n23=k*m+q*i+l*n+o*g;this.n24=k*p+q*r+l*D+o*a;this.n31=y*s+c*T+B*C+u*L;this.n32=y*O+c*Q+B*e+u*h;this.n33=y*m+c*i+B*n+u*g;this.n34=y*p+c*r+B*D+u*a;this.n41=t*s+J*T+R*C+N*L;this.n42=t*O+J*Q+R*e+N*h;this.n43=t*m+J*i+R*n+N*g;this.n44=t*p+J*r+R*D+N*a;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},determinant:function(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*
+this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,f,d){var j=b[f];b[f]=b[d];
+b[d]=j}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
+this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,f){var d=new THREE.Matrix4;d.n14=a;d.n24=b;d.n34=f;return d};
+THREE.Matrix4.scaleMatrix=function(a,b,f){var d=new THREE.Matrix4;d.n11=a;d.n22=b;d.n33=f;return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b};
+THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var f=new THREE.Matrix4,d=Math.cos(b),j=Math.sin(b),k=1-d,q=a.x,l=a.y,o=a.z;f.n11=k*q*q+d;f.n12=k*q*l-j*o;f.n13=k*q*o+j*l;f.n21=k*q*l+j*o;f.n22=k*l*l+d;f.n23=k*l*o-j*q;f.n31=k*q*o-j*l;f.n32=k*l*o+j*q;f.n33=k*o*o+d;return f};
+THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;b.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;b.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;b.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12*
+a.n23*a.n34;b.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;b.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;b.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;b.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;b.n31=a.n22*a.n34*a.n41-a.n24*a.n32*
+a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;b.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;b.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;b.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;b.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22*
+a.n31*a.n43-a.n21*a.n32*a.n43;b.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;b.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;b.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var f=b[10]*b[5]-b[6]*b[9],d=-b[10]*b[1]+b[2]*b[9],j=b[6]*b[1]-b[2]*b[5],k=-b[10]*b[4]+b[6]*b[8],q=b[10]*b[0]-b[2]*b[8],l=-b[6]*b[0]+b[2]*b[4],o=b[9]*b[4]-b[5]*b[8],y=-b[9]*b[0]+b[1]*b[8],c=b[5]*b[0]-b[1]*b[4];b=b[0]*f+b[1]*k+b[2]*o;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*f;a.m[1]=b*d;a.m[2]=b*j;a.m[3]=b*k;a.m[4]=b*q;a.m[5]=b*l;a.m[6]=b*o;a.m[7]=b*y;a.m[8]=b*c;return a};
+THREE.Matrix4.makeFrustum=function(a,b,f,d,j,k){var q,l,o;q=new THREE.Matrix4;l=2*j/(b-a);o=2*j/(d-f);a=(b+a)/(b-a);f=(d+f)/(d-f);d=-(k+j)/(k-j);j=-2*k*j/(k-j);q.n11=l;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=o;q.n23=f;q.n24=0;q.n31=0;q.n32=0;q.n33=d;q.n34=j;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,b,f,d){var j;a=f*Math.tan(a*Math.PI/360);j=-a;return THREE.Matrix4.makeFrustum(j*b,a*b,j,a,f,d)};
+THREE.Matrix4.makeOrtho=function(a,b,f,d,j,k){var q,l,o,y;q=new THREE.Matrix4;l=b-a;o=f-d;y=k-j;a=(b+a)/l;f=(f+d)/o;j=(k+j)/y;q.n11=2/l;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/o;q.n23=0;q.n24=-f;q.n31=0;q.n32=0;q.n33=-2/y;q.n34=-j;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};
+THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
+THREE.Face3=function(a,b,f,d,j){this.a=a;this.b=b;this.c=f;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=j instanceof Array?j:[j]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,b,f,d,j,k){this.a=a;this.b=b;this.c=f;this.d=d;this.centroid=new THREE.Vector3;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.material=k instanceof Array?k:[k]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
+THREE.Geometry.prototype={computeCentroids:function(){var a,b,f;a=0;for(b=this.faces.length;a<b;a++){f=this.faces[a];f.centroid.set(0,0,0);if(f instanceof THREE.Face3){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);f.centroid.divideScalar(3)}else if(f instanceof THREE.Face4){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);
+f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,f,d,j,k,q,l=new THREE.Vector3,o=new THREE.Vector3;d=0;for(j=this.vertices.length;d<j;d++){k=this.vertices[d];k.normal.set(0,0,0)}d=0;for(j=this.faces.length;d<j;d++){k=this.faces[d];if(a&&k.vertexNormals.length){l.set(0,0,0);b=0;for(f=k.normal.length;b<f;b++)l.addSelf(k.vertexNormals[b]);l.divideScalar(3)}else{b=this.vertices[k.a];f=this.vertices[k.b];q=this.vertices[k.c];l.sub(q.position,
+f.position);o.sub(b.position,f.position);l.crossSelf(o)}l.isZero()||l.normalize();k.normal.copy(l)}},computeVertexNormals:function(){var a,b=[],f,d;a=0;for(vl=this.vertices.length;a<vl;a++)b[a]=new THREE.Vector3;a=0;for(f=this.faces.length;a<f;a++){d=this.faces[a];if(d instanceof THREE.Face3){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal);b[d.d].addSelf(d.normal)}}a=
+0;for(vl=this.vertices.length;a<vl;a++)b[a].normalize();a=0;for(f=this.faces.length;a<f;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone()}else if(d instanceof THREE.Face4){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone();d.vertexNormals[3]=b[d.d].clone()}}},computeTangents:function(){function a(p,r,D,M){k=p.vertices[r].position;q=p.vertices[D].position;
+l=p.vertices[M].position;o=j[0];y=j[1];c=j[2];B=q.x-k.x;u=l.x-k.x;t=q.y-k.y;J=l.y-k.y;R=q.z-k.z;N=l.z-k.z;s=y.u-o.u;T=c.u-o.u;C=y.v-o.v;L=c.v-o.v;O=1/(s*L-T*C);m.set((L*B-C*u)*O,(L*t-C*J)*O,(L*R-C*N)*O);i.set((s*u-T*B)*O,(s*J-T*t)*O,(s*N-T*R)*O);e[r].addSelf(m);e[D].addSelf(m);e[M].addSelf(m);h[r].addSelf(i);h[D].addSelf(i);h[M].addSelf(i)}var b,f,d,j,k,q,l,o,y,c,B,u,t,J,R,N,s,T,C,L,O,Q,e=[],h=[],m=new THREE.Vector3,i=new THREE.Vector3,n=new THREE.Vector3,g=new THREE.Vector3;Q=new THREE.Vector3;b=
+0;for(f=this.vertices.length;b<f;b++){e[b]=new THREE.Vector3;h[b]=new THREE.Vector3}b=0;for(f=this.faces.length;b<f;b++){d=this.faces[b];j=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);
+this.vertices[d.c].normal.copy(d.vertexNormals[2]);this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(f=this.vertices.length;b<f;b++){Q.copy(this.vertices[b].normal);d=e[b];n.copy(d);n.subSelf(Q.multiplyScalar(Q.dot(d))).normalize();g.cross(this.vertices[b].normal,d);test=g.dot(h[b]);d=test<0?-1:1;this.vertices[b].tangent.set(n.x,n.y,n.z,d)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.bbox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
+y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,f=this.vertices.length;b<f;b++){a=this.vertices[b];if(a.position.x<this.bbox.x[0])this.bbox.x[0]=a.position.x;else if(a.position.x>this.bbox.x[1])this.bbox.x[1]=a.position.x;if(a.position.y<this.bbox.y[0])this.bbox.y[0]=a.position.y;else if(a.position.y>this.bbox.y[1])this.bbox.y[1]=a.position.y;if(a.position.z<this.bbox.z[0])this.bbox.z[0]=a.position.z;else if(a.position.z>
+this.bbox.z[1])this.bbox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,f=this.vertices.length;b<f;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(c){var B=[];b=0;for(f=c.length;b<f;b++)c[b]==undefined?B.push("undefined"):B.push(c[b].toString());return B.join("_")}var b,f,d,j,k,q,l,o,y={};d=0;for(j=this.faces.length;d<j;d++){k=this.faces[d];q=
+k.material;l=a(q);if(y[l]==undefined)y[l]={hash:l,counter:0};o=y[l].hash+"_"+y[l].counter;if(this.geometryChunks[o]==undefined)this.geometryChunks[o]={faces:[],material:q,vertices:0};k=k instanceof THREE.Face3?3:4;if(this.geometryChunks[o].vertices+k>65535){y[l].counter+=1;o=y[l].hash+"_"+y[l].counter;if(this.geometryChunks[o]==undefined)this.geometryChunks[o]={faces:[],material:q,vertices:0}}this.geometryChunks[o].faces.push(d);this.geometryChunks[o].vertices+=k}},toString:function(){return"THREE.Geometry ( vertices: "+
+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
+THREE.Camera=function(a,b,f,d){this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,b,f,d);this.autoUpdateMatrix=true;this.translateX=function(j){j=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(j);j.cross(j.clone(),this.up);this.position.addSelf(j);this.target.position.addSelf(j)};this.translateZ=function(j){j=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(j);
+this.position.subSelf(j);this.target.position.subSelf(j)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.toString=function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
+THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.PointLight;
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.translationMatrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.scaleMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.autoUpdateMatrix=this.visible=true;this.updateMatrix=function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);
+this.rotationMatrix=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.scaleMatrix=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.rotationMatrix);this.matrix.multiplySelf(this.scaleMatrix)}};THREE.Object3DCounter={value:0};
+THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b]};THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
+THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+
+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
+a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=
+a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+
+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
+a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=
+a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+
+this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap=
+"round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
+a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=
+a.wireframe_linejoin}this.toString=function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>"+ +")"}};THREE.MeshPhongMaterialCounter={value:0};
+THREE.MeshDepthMaterial=function(a){this.near=1;this.far=1E3;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.near!==undefined)this.near=a.near;if(a.far!==undefined)this.far=a.far;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.__2near=2*this.near;this.__farPlusNear=this.far+this.near;this.__farMinusNear=
+this.far-this.near;this.toString=function(){return"THREE.MeshDepthMaterial"}};THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){this.toString=function(){return"THREE.MeshFaceMaterial"}};
+THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==
+undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+
+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
+THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+
+this.blending+"<br/>)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
+THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
+THREE.Texture=function(a,b,f,d,j,k){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=f!==undefined?f:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=j!==undefined?j:THREE.LinearFilter;this.min_filter=k!==undefined?k:THREE.LinearMipMapLinearFilter;this.toString=function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+
+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;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.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
+THREE.Fog=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
+THREE.Projector=function(){function a(e,h){return h.z-e.z}function b(e,h){var m=0,i=1,n=e.z+e.w,g=h.z+h.w,p=-e.z+e.w,r=-h.z+h.w;if(n>=0&&g>=0&&p>=0&&r>=0)return true;else if(n<0&&g<0||p<0&&r<0)return false;else{if(n<0)m=Math.max(m,n/(n-g));else if(g<0)i=Math.min(i,n/(n-g));if(p<0)m=Math.max(m,p/(p-r));else if(r<0)i=Math.min(i,p/(p-r));if(i<m)return false;else{e.lerpSelf(h,m);h.lerpSelf(e,1-i);return true}}}var f,d,j=[],k,q,l,o=[],y,c,B=[],u,t,J=[],R=new THREE.Vector4,N=new THREE.Vector4,s=new THREE.Matrix4,
+T=new THREE.Matrix4,C=[],L=new THREE.Vector4,O=new THREE.Vector4,Q;this.projectObjects=function(e,h,m){var i=[],n,g;d=0;s.multiply(h.projectionMatrix,h.matrix);C[0]=new THREE.Vector4(s.n41-s.n11,s.n42-s.n12,s.n43-s.n13,s.n44-s.n14);C[1]=new THREE.Vector4(s.n41+s.n11,s.n42+s.n12,s.n43+s.n13,s.n44+s.n14);C[2]=new THREE.Vector4(s.n41+s.n21,s.n42+s.n22,s.n43+s.n23,s.n44+s.n24);C[3]=new THREE.Vector4(s.n41-s.n21,s.n42-s.n22,s.n43-s.n23,s.n44-s.n24);C[4]=new THREE.Vector4(s.n41-s.n31,s.n42-s.n32,s.n43-
+s.n33,s.n44-s.n34);C[5]=new THREE.Vector4(s.n41+s.n31,s.n42+s.n32,s.n43+s.n33,s.n44+s.n34);h=0;for(n=C.length;h<n;h++){g=C[h];g.divideScalar(Math.sqrt(g.x*g.x+g.y*g.y+g.z*g.z))}n=e.objects;e=0;for(h=n.length;e<h;e++){g=n[e];var p;if(!(p=!g.visible)){if(p=g instanceof THREE.Mesh){a:{p=void 0;for(var r=g.position,D=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),M=0;M<6;M++){p=C[M].x*r.x+C[M].y*r.y+C[M].z*r.z+C[M].w;if(p<=D){p=false;break a}}p=true}p=!p}p=p}if(!p){f=
+j[d]=j[d]||new THREE.RenderableObject;R.copy(g.position);s.multiplyVector3(R);f.object=g;f.z=R.z;i.push(f);d++}}m&&i.sort(a);return i};this.projectScene=function(e,h,m){var i=[],n,g,p,r,D,M,H,z,S,E,U,F,w,x,K,G;l=c=t=0;h.autoUpdateMatrix&&h.updateMatrix();s.multiply(h.projectionMatrix,h.matrix);M=this.projectObjects(e,h,true);e=0;for(n=M.length;e<n;e++){H=M[e].object;if(H.visible){H.autoUpdateMatrix&&H.updateMatrix();z=H.matrix;S=H.rotationMatrix;E=H.material;U=H.overdraw;if(H instanceof THREE.Mesh){F=
+H.geometry;w=F.vertices;g=0;for(p=w.length;g<p;g++){x=w[g];x.positionWorld.copy(x.position);z.multiplyVector3(x.positionWorld);r=x.positionScreen;r.copy(x.positionWorld);s.multiplyVector4(r);r.multiplyScalar(1/r.w);x.__visible=r.z>0&&r.z<1}F=F.faces;g=0;for(p=F.length;g<p;g++){x=F[g];if(x instanceof THREE.Face3){r=w[x.a];D=w[x.b];K=w[x.c];if(r.__visible&&D.__visible&&K.__visible)if(H.doubleSided||H.flipSided!=(K.positionScreen.x-r.positionScreen.x)*(D.positionScreen.y-r.positionScreen.y)-(K.positionScreen.y-
+r.positionScreen.y)*(D.positionScreen.x-r.positionScreen.x)<0){k=o[l]=o[l]||new THREE.RenderableFace3;k.v1.positionWorld.copy(r.positionWorld);k.v2.positionWorld.copy(D.positionWorld);k.v3.positionWorld.copy(K.positionWorld);k.v1.positionScreen.copy(r.positionScreen);k.v2.positionScreen.copy(D.positionScreen);k.v3.positionScreen.copy(K.positionScreen);k.normalWorld.copy(x.normal);S.multiplyVector3(k.normalWorld);k.centroidWorld.copy(x.centroid);z.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);
+s.multiplyVector3(k.centroidScreen);K=x.vertexNormals;Q=k.vertexNormalsWorld;r=0;for(D=K.length;r<D;r++){G=Q[r]=Q[r]||new THREE.Vector3;G.copy(K[r]);S.multiplyVector3(G)}k.z=k.centroidScreen.z;k.meshMaterial=E;k.faceMaterial=x.material;k.overdraw=U;if(H.geometry.uvs[g]){k.uvs[0]=H.geometry.uvs[g][0];k.uvs[1]=H.geometry.uvs[g][1];k.uvs[2]=H.geometry.uvs[g][2]}i.push(k);l++}}else if(x instanceof THREE.Face4){r=w[x.a];D=w[x.b];K=w[x.c];G=w[x.d];if(r.__visible&&D.__visible&&K.__visible&&G.__visible)if(H.doubleSided||
+H.flipSided!=((G.positionScreen.x-r.positionScreen.x)*(D.positionScreen.y-r.positionScreen.y)-(G.positionScreen.y-r.positionScreen.y)*(D.positionScreen.x-r.positionScreen.x)<0||(D.positionScreen.x-K.positionScreen.x)*(G.positionScreen.y-K.positionScreen.y)-(D.positionScreen.y-K.positionScreen.y)*(G.positionScreen.x-K.positionScreen.x)<0)){k=o[l]=o[l]||new THREE.RenderableFace3;k.v1.positionWorld.copy(r.positionWorld);k.v2.positionWorld.copy(D.positionWorld);k.v3.positionWorld.copy(G.positionWorld);
+k.v1.positionScreen.copy(r.positionScreen);k.v2.positionScreen.copy(D.positionScreen);k.v3.positionScreen.copy(G.positionScreen);k.normalWorld.copy(x.normal);S.multiplyVector3(k.normalWorld);k.centroidWorld.copy(x.centroid);z.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);s.multiplyVector3(k.centroidScreen);k.z=k.centroidScreen.z;k.meshMaterial=E;k.faceMaterial=x.material;k.overdraw=U;if(H.geometry.uvs[g]){k.uvs[0]=H.geometry.uvs[g][0];k.uvs[1]=H.geometry.uvs[g][1];k.uvs[2]=
+H.geometry.uvs[g][3]}i.push(k);l++;q=o[l]=o[l]||new THREE.RenderableFace3;q.v1.positionWorld.copy(D.positionWorld);q.v2.positionWorld.copy(K.positionWorld);q.v3.positionWorld.copy(G.positionWorld);q.v1.positionScreen.copy(D.positionScreen);q.v2.positionScreen.copy(K.positionScreen);q.v3.positionScreen.copy(G.positionScreen);q.normalWorld.copy(k.normalWorld);q.centroidWorld.copy(k.centroidWorld);q.centroidScreen.copy(k.centroidScreen);q.z=q.centroidScreen.z;q.meshMaterial=E;q.faceMaterial=x.material;
+q.overdraw=U;if(H.geometry.uvs[g]){q.uvs[0]=H.geometry.uvs[g][1];q.uvs[1]=H.geometry.uvs[g][2];q.uvs[2]=H.geometry.uvs[g][3]}i.push(q);l++}}}}else if(H instanceof THREE.Line){T.multiply(s,z);w=H.geometry.vertices;x=w[0];x.positionScreen.copy(x.position);T.multiplyVector4(x.positionScreen);g=1;for(p=w.length;g<p;g++){r=w[g];r.positionScreen.copy(r.position);T.multiplyVector4(r.positionScreen);D=w[g-1];L.copy(r.positionScreen);O.copy(D.positionScreen);if(b(L,O)){L.multiplyScalar(1/L.w);O.multiplyScalar(1/
+O.w);y=B[c]=B[c]||new THREE.RenderableLine;y.v1.positionScreen.copy(L);y.v2.positionScreen.copy(O);y.z=Math.max(L.z,O.z);y.material=H.material;i.push(y);c++}}}else if(H instanceof THREE.Particle){N.set(H.position.x,H.position.y,H.position.z,1);s.multiplyVector4(N);N.z/=N.w;if(N.z>0&&N.z<1){u=J[t]=J[t]||new THREE.RenderableParticle;u.x=N.x/N.w;u.y=N.y/N.w;u.z=N.z;u.rotation=H.rotation.z;u.scale.x=H.scale.x*Math.abs(u.x-(N.x+h.projectionMatrix.n11)/(N.w+h.projectionMatrix.n14));u.scale.y=H.scale.y*
+Math.abs(u.y-(N.y+h.projectionMatrix.n22)/(N.w+h.projectionMatrix.n24));u.material=H.material;i.push(u);t++}}}}m&&i.sort(a);return i};this.unprojectVector=function(e,h){var m=new THREE.Matrix4;m.multiply(THREE.Matrix4.makeInvert(h.matrix),THREE.Matrix4.makeInvert(h.projectionMatrix));m.multiplyVector3(e);return e}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,f,d,j,k;this.domElement=document.createElement("div");this.setSize=function(q,l){f=q;d=l;j=f/2;k=d/2};this.render=function(q,l){var o,y,c,B,u,t,J,R;a=b.projectScene(q,l);o=0;for(y=a.length;o<y;o++){u=a[o];if(u instanceof THREE.RenderableParticle){J=u.x*j+j;R=u.y*k+k;c=0;for(B=u.material.length;c<B;c++){t=u.material[c];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=J+"px";t.style.top=R+"px"}}}}}};
+THREE.CanvasRenderer=function(){var a=null,b=new THREE.Projector,f=document.createElement("canvas"),d,j,k,q,l=f.getContext("2d"),o=1,y=0,c=null,B=null,u=1,t,J,R,N,s,T,C,L,O,Q=new THREE.Color,e=new THREE.Color,h=new THREE.Color,m=new THREE.Color,i=new THREE.Color,n,g,p,r,D,M,H,z,S,E,U=new THREE.Rectangle,F=new THREE.Rectangle,w=new THREE.Rectangle,x=false,K=new THREE.Color,G=new THREE.Color,W=new THREE.Color,ba=new THREE.Color,Ka=Math.PI*2,Y=new THREE.Vector3,oa,pa,Ba,ea,qa,ua,ma=16;oa=document.createElement("canvas");
+oa.width=oa.height=2;pa=oa.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);Ba=pa.getImageData(0,0,2,2);ea=Ba.data;qa=document.createElement("canvas");qa.width=qa.height=ma;ua=qa.getContext("2d");ua.translate(-ma/2,-ma/2);ua.scale(ma,ma);ma--;this.domElement=f;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ha,va){d=ha;j=va;k=d/2;q=j/2;f.width=d;f.height=j;U.set(-k,-q,k,q)};this.clear=function(){if(!F.isEmpty()){F.inflate(1);F.minSelf(U);l.clearRect(F.getX(),
+F.getY(),F.getWidth(),F.getHeight());F.empty()}};this.render=function(ha,va){function La(v){var V,P,A,I=v.lights;G.setRGB(0,0,0);W.setRGB(0,0,0);ba.setRGB(0,0,0);v=0;for(V=I.length;v<V;v++){P=I[v];A=P.color;if(P instanceof THREE.AmbientLight){G.r+=A.r;G.g+=A.g;G.b+=A.b}else if(P instanceof THREE.DirectionalLight){W.r+=A.r;W.g+=A.g;W.b+=A.b}else if(P instanceof THREE.PointLight){ba.r+=A.r;ba.g+=A.g;ba.b+=A.b}}}function wa(v,V,P,A){var I,X,$,ca,da=v.lights;v=0;for(I=da.length;v<I;v++){X=da[v];$=X.color;
+ca=X.intensity;if(X instanceof THREE.DirectionalLight){X=P.dot(X.position)*ca;if(X>0){A.r+=$.r*X;A.g+=$.g*X;A.b+=$.b*X}}else if(X instanceof THREE.PointLight){Y.sub(X.position,V);Y.normalize();X=P.dot(Y)*ca;if(X>0){A.r+=$.r*X;A.g+=$.g*X;A.b+=$.b*X}}}}function Ma(v,V,P){if(P.opacity!=0){Ca(P.opacity);xa(P.blending);var A,I,X,$,ca,da;if(P instanceof THREE.ParticleBasicMaterial){if(P.map){$=P.map;ca=$.width>>1;da=$.height>>1;I=V.scale.x*k;X=V.scale.y*q;P=I*ca;A=X*da;w.set(v.x-P,v.y-A,v.x+P,v.y+A);if(U.instersects(w)){l.save();
+l.translate(v.x,v.y);l.rotate(-V.rotation);l.scale(I,-X);l.translate(-ca,-da);l.drawImage($,0,0);l.restore()}}}else if(P instanceof THREE.ParticleCircleMaterial){if(x){K.r=G.r+W.r+ba.r;K.g=G.g+W.g+ba.g;K.b=G.b+W.b+ba.b;Q.r=P.color.r*K.r;Q.g=P.color.g*K.g;Q.b=P.color.b*K.b;Q.updateStyleString()}else Q.__styleString=P.color.__styleString;P=V.scale.x*k;A=V.scale.y*q;w.set(v.x-P,v.y-A,v.x+P,v.y+A);if(U.instersects(w)){I=Q.__styleString;if(B!=I)l.fillStyle=B=I;l.save();l.translate(v.x,v.y);l.rotate(-V.rotation);
+l.scale(P,A);l.beginPath();l.arc(0,0,1,0,Ka,true);l.closePath();l.fill();l.restore()}}}}function Na(v,V,P,A){if(A.opacity!=0){Ca(A.opacity);xa(A.blending);l.beginPath();l.moveTo(v.positionScreen.x,v.positionScreen.y);l.lineTo(V.positionScreen.x,V.positionScreen.y);l.closePath();if(A instanceof THREE.LineBasicMaterial){Q.__styleString=A.color.__styleString;v=A.linewidth;if(u!=v)l.lineWidth=u=v;v=Q.__styleString;if(c!=v)l.strokeStyle=c=v;l.stroke();w.inflate(A.linewidth*2)}}}function Ga(v,V,P,A,I,X){if(I.opacity!=
+0){Ca(I.opacity);xa(I.blending);N=v.positionScreen.x;s=v.positionScreen.y;T=V.positionScreen.x;C=V.positionScreen.y;L=P.positionScreen.x;O=P.positionScreen.y;l.beginPath();l.moveTo(N,s);l.lineTo(T,C);l.lineTo(L,O);l.lineTo(N,s);l.closePath();if(I instanceof THREE.MeshBasicMaterial)if(I.map)I.map.image.loaded&&I.map.mapping instanceof THREE.UVMapping&&ra(N,s,T,C,L,O,I.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);else if(I.env_map){if(I.env_map.image.loaded)if(I.env_map.mapping instanceof
+THREE.SphericalReflectionMapping){v=va.matrix;Y.copy(A.vertexNormalsWorld[0]);D=(Y.x*v.n11+Y.y*v.n12+Y.z*v.n13)*0.5+0.5;M=-(Y.x*v.n21+Y.y*v.n22+Y.z*v.n23)*0.5+0.5;Y.copy(A.vertexNormalsWorld[1]);H=(Y.x*v.n11+Y.y*v.n12+Y.z*v.n13)*0.5+0.5;z=-(Y.x*v.n21+Y.y*v.n22+Y.z*v.n23)*0.5+0.5;Y.copy(A.vertexNormalsWorld[2]);S=(Y.x*v.n11+Y.y*v.n12+Y.z*v.n13)*0.5+0.5;E=-(Y.x*v.n21+Y.y*v.n22+Y.z*v.n23)*0.5+0.5;ra(N,s,T,C,L,O,I.env_map.image,D,M,H,z,S,E)}}else I.wireframe?ya(I.color.__styleString,I.wireframe_linewidth):
+za(I.color.__styleString);else if(I instanceof THREE.MeshLambertMaterial){if(I.map&&!I.wireframe){I.map.mapping instanceof THREE.UVMapping&&ra(N,s,T,C,L,O,I.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);xa(THREE.SubtractiveBlending)}if(x)if(!I.wireframe&&I.shading==THREE.SmoothShading&&A.vertexNormalsWorld.length==3){e.r=h.r=m.r=G.r;e.g=h.g=m.g=G.g;e.b=h.b=m.b=G.b;wa(X,A.v1.positionWorld,A.vertexNormalsWorld[0],e);wa(X,A.v2.positionWorld,A.vertexNormalsWorld[1],h);wa(X,
+A.v3.positionWorld,A.vertexNormalsWorld[2],m);i.r=(h.r+m.r)*0.5;i.g=(h.g+m.g)*0.5;i.b=(h.b+m.b)*0.5;r=Ha(e,h,m,i);ra(N,s,T,C,L,O,r,0,0,1,0,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.b;wa(X,A.centroidWorld,A.normalWorld,K);Q.r=I.color.r*K.r;Q.g=I.color.g*K.g;Q.b=I.color.b*K.b;Q.updateStyleString();I.wireframe?ya(Q.__styleString,I.wireframe_linewidth):za(Q.__styleString)}else I.wireframe?ya(I.color.__styleString,I.wireframe_linewidth):za(I.color.__styleString)}else if(I instanceof THREE.MeshDepthMaterial){n=I.__2near;
+g=I.__farPlusNear;p=I.__farMinusNear;e.r=e.g=e.b=1-n/(g-v.positionScreen.z*p);h.r=h.g=h.b=1-n/(g-V.positionScreen.z*p);m.r=m.g=m.b=1-n/(g-P.positionScreen.z*p);i.r=(h.r+m.r)*0.5;i.g=(h.g+m.g)*0.5;i.b=(h.b+m.b)*0.5;r=Ha(e,h,m,i);ra(N,s,T,C,L,O,r,0,0,1,0,0,1)}else if(I instanceof THREE.MeshNormalMaterial){Q.r=Da(A.normalWorld.x);Q.g=Da(A.normalWorld.y);Q.b=Da(A.normalWorld.z);Q.updateStyleString();I.wireframe?ya(Q.__styleString,I.wireframe_linewidth):za(Q.__styleString)}}}function ya(v,V){if(c!=v)l.strokeStyle=
+c=v;if(u!=V)l.lineWidth=u=V;l.stroke();w.inflate(V*2)}function za(v){if(B!=v)l.fillStyle=B=v;l.fill()}function ra(v,V,P,A,I,X,$,ca,da,ia,fa,ja,sa){var la,ka;la=$.width-1;ka=$.height-1;ca*=la;da*=ka;ia*=la;fa*=ka;ja*=la;sa*=ka;P-=v;A-=V;I-=v;X-=V;ia-=ca;fa-=da;ja-=ca;sa-=da;ka=1/(ia*sa-ja*fa);la=(sa*P-fa*I)*ka;fa=(sa*A-fa*X)*ka;P=(ia*I-ja*P)*ka;A=(ia*X-ja*A)*ka;v=v-la*ca-P*da;V=V-fa*ca-A*da;l.save();l.transform(la,fa,P,A,v,V);l.clip();l.drawImage($,0,0);l.restore()}function Ca(v){if(o!=v)l.globalAlpha=
+o=v}function xa(v){if(y!=v){switch(v){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}y=v}}function Ha(v,V,P,A){var I=~~(v.r*255),X=~~(v.g*255);v=~~(v.b*255);var $=~~(V.r*255),ca=~~(V.g*255);V=~~(V.b*255);var da=~~(P.r*255),ia=~~(P.g*255);P=~~(P.b*255);var fa=~~(A.r*255),ja=~~(A.g*255);A=~~(A.b*255);ea[0]=I<0?0:I>255?255:I;ea[1]=X<0?0:X>
+255?255:X;ea[2]=v<0?0:v>255?255:v;ea[4]=$<0?0:$>255?255:$;ea[5]=ca<0?0:ca>255?255:ca;ea[6]=V<0?0:V>255?255:V;ea[8]=da<0?0:da>255?255:da;ea[9]=ia<0?0:ia>255?255:ia;ea[10]=P<0?0:P>255?255:P;ea[12]=fa<0?0:fa>255?255:fa;ea[13]=ja<0?0:ja>255?255:ja;ea[14]=A<0?0:A>255?255:A;pa.putImageData(Ba,0,0);ua.drawImage(oa,0,0);return qa}function Da(v){v=(v+1)*0.5;return v<0?0:v>1?1:v}function Ea(v,V){var P=V.x-v.x,A=V.y-v.y,I=1/Math.sqrt(P*P+A*A);P*=I;A*=I;V.x+=P;V.y+=A;v.x-=P;v.y-=A}var Aa,Ia,Z,ga,na,Fa,Ja,ta;
+l.setTransform(1,0,0,-1,k,q);this.autoClear&&this.clear();a=b.projectScene(ha,va,this.sortElements);(x=ha.lights.length>0)&&La(ha);Aa=0;for(Ia=a.length;Aa<Ia;Aa++){Z=a[Aa];w.empty();if(Z instanceof THREE.RenderableParticle){t=Z;t.x*=k;t.y*=q;ga=0;for(na=Z.material.length;ga<na;ga++)Ma(t,Z,Z.material[ga],ha)}else if(Z instanceof THREE.RenderableLine){t=Z.v1;J=Z.v2;t.positionScreen.x*=k;t.positionScreen.y*=q;J.positionScreen.x*=k;J.positionScreen.y*=q;w.addPoint(t.positionScreen.x,t.positionScreen.y);
+w.addPoint(J.positionScreen.x,J.positionScreen.y);if(U.instersects(w)){ga=0;for(na=Z.material.length;ga<na;)Na(t,J,Z,Z.material[ga++],ha)}}else if(Z instanceof THREE.RenderableFace3){t=Z.v1;J=Z.v2;R=Z.v3;t.positionScreen.x*=k;t.positionScreen.y*=q;J.positionScreen.x*=k;J.positionScreen.y*=q;R.positionScreen.x*=k;R.positionScreen.y*=q;if(Z.overdraw){Ea(t.positionScreen,J.positionScreen);Ea(J.positionScreen,R.positionScreen);Ea(R.positionScreen,t.positionScreen)}w.add3Points(t.positionScreen.x,t.positionScreen.y,
+J.positionScreen.x,J.positionScreen.y,R.positionScreen.x,R.positionScreen.y);if(U.instersects(w)){ga=0;for(na=Z.meshMaterial.length;ga<na;){ta=Z.meshMaterial[ga++];if(ta instanceof THREE.MeshFaceMaterial){Fa=0;for(Ja=Z.faceMaterial.length;Fa<Ja;)(ta=Z.faceMaterial[Fa++])&&Ga(t,J,R,Z,ta,ha)}else Ga(t,J,R,Z,ta,ha)}}}F.addRectangle(w)}l.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(z,S,E){var U,F,w,x;U=0;for(F=z.lights.length;U<F;U++){w=z.lights[U];if(w instanceof THREE.DirectionalLight){x=S.normalWorld.dot(w.position)*w.intensity;if(x>0){E.r+=w.color.r*x;E.g+=w.color.g*x;E.b+=w.color.b*x}}else if(w instanceof THREE.PointLight){m.sub(w.position,S.centroidWorld);m.normalize();x=S.normalWorld.dot(m)*w.intensity;if(x>0){E.r+=w.color.r*x;E.g+=w.color.g*x;E.b+=w.color.b*x}}}}function b(z,S,E,U,F,w){p=d(r++);p.setAttribute("d","M "+z.positionScreen.x+
+" "+z.positionScreen.y+" L "+S.positionScreen.x+" "+S.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+"z");if(F instanceof THREE.MeshBasicMaterial)C.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshLambertMaterial)if(T){L.r=O.r;L.g=O.g;L.b=O.b;a(w,U,L);C.r=F.color.r*L.r;C.g=F.color.g*L.g;C.b=F.color.b*L.b;C.updateStyleString()}else C.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshDepthMaterial){h=1-F.__2near/(F.__farPlusNear-U.z*F.__farMinusNear);
+C.setRGB(h,h,h)}else F instanceof THREE.MeshNormalMaterial&&C.setRGB(j(U.normalWorld.x),j(U.normalWorld.y),j(U.normalWorld.z));F.wireframe?p.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+F.wireframe_linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframe_linecap+"; stroke-linejoin: "+F.wireframe_linejoin):p.setAttribute("style","fill: "+C.__styleString+"; fill-opacity: "+F.opacity);l.appendChild(p)}function f(z,S,E,U,F,w,x){p=d(r++);p.setAttribute("d",
+"M "+z.positionScreen.x+" "+z.positionScreen.y+" L "+S.positionScreen.x+" "+S.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+" L "+U.positionScreen.x+","+U.positionScreen.y+"z");if(w instanceof THREE.MeshBasicMaterial)C.__styleString=w.color.__styleString;else if(w instanceof THREE.MeshLambertMaterial)if(T){L.r=O.r;L.g=O.g;L.b=O.b;a(x,F,L);C.r=w.color.r*L.r;C.g=w.color.g*L.g;C.b=w.color.b*L.b;C.updateStyleString()}else C.__styleString=w.color.__styleString;else if(w instanceof THREE.MeshDepthMaterial){h=
+1-w.__2near/(w.__farPlusNear-F.z*w.__farMinusNear);C.setRGB(h,h,h)}else w instanceof THREE.MeshNormalMaterial&&C.setRGB(j(F.normalWorld.x),j(F.normalWorld.y),j(F.normalWorld.z));w.wireframe?p.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+w.wireframe_linewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.wireframe_linecap+"; stroke-linejoin: "+w.wireframe_linejoin):p.setAttribute("style","fill: "+C.__styleString+"; fill-opacity: "+w.opacity);l.appendChild(p)}
+function d(z){if(i[z]==null){i[z]=document.createElementNS("http://www.w3.org/2000/svg","path");H==0&&i[z].setAttribute("shape-rendering","crispEdges");return i[z]}return i[z]}function j(z){return z<0?Math.min((1+z)*0.5,0.5):0.5+Math.min(z*0.5,0.5)}var k=null,q=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,y,c,B,u,t,J,R,N=new THREE.Rectangle,s=new THREE.Rectangle,T=false,C=new THREE.Color(16777215),L=new THREE.Color(16777215),O=new THREE.Color(0),Q=new THREE.Color(0),
+e=new THREE.Color(0),h,m=new THREE.Vector3,i=[],n=[],g=[],p,r,D,M,H=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(z){switch(z){case "high":H=1;break;case "low":H=0}};this.setSize=function(z,S){o=z;y=S;c=o/2;B=y/2;l.setAttribute("viewBox",-c+" "+-B+" "+o+" "+y);l.setAttribute("width",o);l.setAttribute("height",y);N.set(-c,-B,c,B)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(z,S){var E,U,
+F,w,x,K,G,W;this.autoClear&&this.clear();k=q.projectScene(z,S,this.sortElements);M=D=r=0;if(T=z.lights.length>0){G=z.lights;O.setRGB(0,0,0);Q.setRGB(0,0,0);e.setRGB(0,0,0);E=0;for(U=G.length;E<U;E++){F=G[E];w=F.color;if(F instanceof THREE.AmbientLight){O.r+=w.r;O.g+=w.g;O.b+=w.b}else if(F instanceof THREE.DirectionalLight){Q.r+=w.r;Q.g+=w.g;Q.b+=w.b}else if(F instanceof THREE.PointLight){e.r+=w.r;e.g+=w.g;e.b+=w.b}}}E=0;for(U=k.length;E<U;E++){G=k[E];s.empty();if(G instanceof THREE.RenderableParticle){u=
+G;u.x*=c;u.y*=-B;F=0;for(w=G.material.length;F<w;F++)if(W=G.material[F]){x=u;K=G;W=W;var ba=D++;if(n[ba]==null){n[ba]=document.createElementNS("http://www.w3.org/2000/svg","circle");H==0&&n[ba].setAttribute("shape-rendering","crispEdges")}p=n[ba];p.setAttribute("cx",x.x);p.setAttribute("cy",x.y);p.setAttribute("r",K.scale.x*c);if(W instanceof THREE.ParticleCircleMaterial){if(T){L.r=O.r+Q.r+e.r;L.g=O.g+Q.g+e.g;L.b=O.b+Q.b+e.b;C.r=W.color.r*L.r;C.g=W.color.g*L.g;C.b=W.color.b*L.b;C.updateStyleString()}else C=
+W.color;p.setAttribute("style","fill: "+C.__styleString)}l.appendChild(p)}}else if(G instanceof THREE.RenderableLine){u=G.v1;t=G.v2;u.positionScreen.x*=c;u.positionScreen.y*=-B;t.positionScreen.x*=c;t.positionScreen.y*=-B;s.addPoint(u.positionScreen.x,u.positionScreen.y);s.addPoint(t.positionScreen.x,t.positionScreen.y);if(N.instersects(s)){F=0;for(w=G.material.length;F<w;)if(W=G.material[F++]){x=u;K=t;W=W;ba=M++;if(g[ba]==null){g[ba]=document.createElementNS("http://www.w3.org/2000/svg","line");
+H==0&&g[ba].setAttribute("shape-rendering","crispEdges")}p=g[ba];p.setAttribute("x1",x.positionScreen.x);p.setAttribute("y1",x.positionScreen.y);p.setAttribute("x2",K.positionScreen.x);p.setAttribute("y2",K.positionScreen.y);if(W instanceof THREE.LineBasicMaterial){C.__styleString=W.color.__styleString;p.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin);l.appendChild(p)}}}}else if(G instanceof
+THREE.RenderableFace3){u=G.v1;t=G.v2;J=G.v3;u.positionScreen.x*=c;u.positionScreen.y*=-B;t.positionScreen.x*=c;t.positionScreen.y*=-B;J.positionScreen.x*=c;J.positionScreen.y*=-B;s.addPoint(u.positionScreen.x,u.positionScreen.y);s.addPoint(t.positionScreen.x,t.positionScreen.y);s.addPoint(J.positionScreen.x,J.positionScreen.y);if(N.instersects(s)){F=0;for(w=G.meshMaterial.length;F<w;){W=G.meshMaterial[F++];if(W instanceof THREE.MeshFaceMaterial){x=0;for(K=G.faceMaterial.length;x<K;)(W=G.faceMaterial[x++])&&
+b(u,t,J,G,W,z)}else W&&b(u,t,J,G,W,z)}}}else if(G instanceof THREE.RenderableFace4){u=G.v1;t=G.v2;J=G.v3;R=G.v4;u.positionScreen.x*=c;u.positionScreen.y*=-B;t.positionScreen.x*=c;t.positionScreen.y*=-B;J.positionScreen.x*=c;J.positionScreen.y*=-B;R.positionScreen.x*=c;R.positionScreen.y*=-B;s.addPoint(u.positionScreen.x,u.positionScreen.y);s.addPoint(t.positionScreen.x,t.positionScreen.y);s.addPoint(J.positionScreen.x,J.positionScreen.y);s.addPoint(R.positionScreen.x,R.positionScreen.y);if(N.instersects(s)){F=
+0;for(w=G.meshMaterial.length;F<w;){W=G.meshMaterial[F++];if(W instanceof THREE.MeshFaceMaterial){x=0;for(K=G.faceMaterial.length;x<K;)(W=G.faceMaterial[x++])&&f(u,t,J,R,G,W,z)}else W&&f(u,t,J,R,G,W,z)}}}}}};
+THREE.WebGLRenderer=function(a,b){function f(e,h,m){var i=c.createProgram();m=["#ifdef GL_ES\nprecision highp float;\n#endif",m?"#define USE_FOG":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");var n=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");
+c.attachShader(i,l("fragment",m+e));c.attachShader(i,l("vertex",n+h));c.linkProgram(i);c.getProgramParameter(i,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(i,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");i.uniforms={};i.attributes={};return i}function d(e,h){if(e.image.length==6){if(!e.image.__webGLTextureCube&&!e.image.__cubeMapInitialized&&e.image.loadCount==6){e.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,e.image.__webGLTextureCube);
+c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(var m=0;m<6;++m)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e.image[m]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);e.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+
+h);c.bindTexture(c.TEXTURE_CUBE_MAP,e.image.__webGLTextureCube)}}function j(e,h){if(!e.__webGLTexture&&e.image.loaded){e.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,e.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,o(e.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,o(e.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,o(e.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
+o(e.min_filter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+h);c.bindTexture(c.TEXTURE_2D,e.__webGLTexture)}function k(e,h){var m,i,n;m=0;for(i=h.length;m<i;m++){n=h[m];e.uniforms[n]=c.getUniformLocation(e,n)}}function q(e,h){var m,i,n;m=0;for(i=h.length;m<i;m++){n=h[m];e.attributes[n]=c.getAttribLocation(e,n)}}function l(e,h){var m;if(e=="fragment")m=c.createShader(c.FRAGMENT_SHADER);else if(e=="vertex")m=c.createShader(c.VERTEX_SHADER);c.shaderSource(m,
+h);c.compileShader(m);if(!c.getShaderParameter(m,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(m));return null}return m}function o(e){switch(e){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;
+case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR}return 0}var y=document.createElement("canvas"),c,B,u,t=new THREE.Matrix4,J,R=new Float32Array(16),N=new Float32Array(16),s=new Float32Array(16),T=new Float32Array(9),C=new Float32Array(16),L=function(e,h){if(e){var m,i,n,g=pointLights=maxDirLights=maxPointLights=0;m=0;for(i=e.lights.length;m<i;m++){n=e.lights[m];n instanceof THREE.DirectionalLight&&g++;n instanceof
+THREE.PointLight&&pointLights++}if(pointLights+g<=h){maxDirLights=g;maxPointLights=pointLights}else{maxDirLights=Math.ceil(h*g/(pointLights+g));maxPointLights=h-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:h-1}}(a,4);fog=a?a.fog:null;aa=b!=undefined?b:true;this.domElement=y;this.autoClear=true;try{c=y.getContext("experimental-webgl",{antialias:aa})}catch(O){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,
+1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(0,0,0,0);B=u=function(e,h,m){var i=[e?"#define MAX_DIR_LIGHTS "+e:"",h?"#define MAX_POINT_LIGHTS "+h:"","uniform bool enableLighting;\nuniform bool useRefract;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;\nuniform vec3 ambientLightColor;",e?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":
+"",e?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"",h?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",h?"uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",h?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform float mRefractionRatio;\nvoid main(void) {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec3 transformedNormal = normalize( normalMatrix * normal );\nif ( !enableLighting ) {\nvLightWeighting = vec3( 1.0, 1.0, 1.0 );\n} else {\nvLightWeighting = ambientLightColor;",
+e?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",e?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",e?"float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );":"",e?"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;":"",e?"}":"",h?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",h?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",h?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
+"",h?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",h?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",h?"}":"","}\nvNormal = transformedNormal;\nvUv = uv;\nif ( useRefract ) {\nvReflect = refract( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz), mRefractionRatio );\n} else {\nvReflect = reflect( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz) );\n}\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"),
+n=[e?"#define MAX_DIR_LIGHTS "+e:"",h?"#define MAX_POINT_LIGHTS "+h:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\n#ifdef USE_FOG\nuniform vec3 fogColor;\nuniform float fogDensity;\n#endif\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
+e?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",h?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n}\nif ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
+h?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",h?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",h?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",h?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",h?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",h?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",h?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",h?"float pointSpecularWeight = 0.0;":"",h?"if ( pointDotNormalHalf >= 0.0 )":
+"",h?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",h?"pointDiffuse  += mColor * pointDiffuseWeight;":"",h?"pointSpecular += mSpecular * pointSpecularWeight;":"",h?"}":"",e?"vec4 dirDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",e?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",e?"vec3 dirVector = normalize( lDirection.xyz );":"",e?"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );":
+"",e?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",e?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",e?"float dirSpecularWeight = 0.0;":"",e?"if ( dirDotNormalHalf >= 0.0 )":"",e?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",e?"dirDiffuse  += mColor * dirDiffuseWeight;":"",e?"dirSpecular += mSpecular * dirSpecularWeight;":"",e?"}":"","vec4 totalLight = mAmbient;",e?"totalLight += dirDiffuse + dirSpecular;":"",h?"totalLight += pointDiffuse + pointSpecular;":
+"","if ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mapColor.rgb * totalLight.xyz * vLightWeighting, cubeColor.rgb, mReflectivity ), mapColor.a );\n} else {\ngl_FragColor = vec4( mapColor.rgb * cubeColor.rgb * totalLight.xyz * vLightWeighting, mapColor.a );\n}\n} else if ( material == 1 ) {\nif ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mColor.rgb * mapColor.rgb * vLightWeighting, cubeColor.rgb, mReflectivity ), mColor.a * mapColor.a );\n} else {\ngl_FragColor = vec4( mColor.rgb * mapColor.rgb * cubeColor.rgb * vLightWeighting, mColor.a * mapColor.a );\n}\n} else {\nif ( mixEnvMap ) {\ngl_FragColor = mix( mColor * mapColor, cubeColor, mReflectivity );\n} else {\ngl_FragColor = mColor * mapColor * cubeColor;\n}\n}\n#ifdef USE_FOG\nconst float LOG2 = 1.442695;\nfloat z = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = exp2( - fogDensity * fogDensity * z * z * LOG2 );\nfogFactor = clamp( fogFactor, 0.0, 1.0 );\ngl_FragColor = mix( vec4( fogColor, 1.0 ), gl_FragColor, fogFactor );\n#endif\n}"].join("\n");
+i=f(n,i,m);c.useProgram(i);k(i,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract"]);m&&k(i,["fogColor","fogDensity"]);e&&k(i,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);h&&k(i,["pointLightNumber","pointLightColor",
+"pointLightPosition"]);c.uniform1i(i.uniforms.enableMap,0);c.uniform1i(i.uniforms.tMap,0);c.uniform1i(i.uniforms.enableCubeMap,0);c.uniform1i(i.uniforms.tCube,1);c.uniform1i(i.uniforms.mixEnvMap,0);c.uniform1i(i.uniforms.useRefract,0);q(i,["position","normal","uv"]);return i}(L.directional,L.point,fog);this.setSize=function(e,h){y.width=e;y.height=h;c.viewport(0,0,y.width,y.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(e,h){var m,i,n,g,p,
+r=[],D=[],M=[];g=[];p=[];c.uniform1i(e.uniforms.enableLighting,h.length);m=0;for(i=h.length;m<i;m++){n=h[m];if(n instanceof THREE.AmbientLight)r.push(n);else if(n instanceof THREE.DirectionalLight)M.push(n);else n instanceof THREE.PointLight&&D.push(n)}m=n=g=p=0;for(i=r.length;m<i;m++){n+=r[m].color.r;g+=r[m].color.g;p+=r[m].color.b}c.uniform3f(e.uniforms.ambientLightColor,n,g,p);g=[];p=[];m=0;for(i=M.length;m<i;m++){n=M[m];g.push(n.color.r*n.intensity);g.push(n.color.g*n.intensity);g.push(n.color.b*
+n.intensity);p.push(n.position.x);p.push(n.position.y);p.push(n.position.z)}if(M.length){c.uniform1i(e.uniforms.directionalLightNumber,M.length);c.uniform3fv(e.uniforms.directionalLightDirection,p);c.uniform3fv(e.uniforms.directionalLightColor,g)}g=[];p=[];m=0;for(i=D.length;m<i;m++){n=D[m];g.push(n.color.r*n.intensity);g.push(n.color.g*n.intensity);g.push(n.color.b*n.intensity);p.push(n.position.x);p.push(n.position.y);p.push(n.position.z)}if(D.length){c.uniform1i(e.uniforms.pointLightNumber,D.length);
+c.uniform3fv(e.uniforms.pointLightPosition,p);c.uniform3fv(e.uniforms.pointLightColor,g)}};this.createBuffers=function(e,h){var m,i,n,g,p,r,D,M,H,z=[],S=[],E=[],U=[],F=[],w=[],x=0,K=e.geometry.geometryChunks[h],G;n=false;m=0;for(i=e.material.length;m<i;m++){meshMaterial=e.material[m];if(meshMaterial instanceof THREE.MeshFaceMaterial){p=0;for(G=K.material.length;p<G;p++)if(K.material[p]&&K.material[p].shading!=undefined&&K.material[p].shading==THREE.SmoothShading){n=true;break}}else if(meshMaterial&&
+meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){n=true;break}if(n)break}G=n;m=0;for(i=K.faces.length;m<i;m++){n=K.faces[m];g=e.geometry.faces[n];p=g.vertexNormals;faceNormal=g.normal;n=e.geometry.uvs[n];if(g instanceof THREE.Face3){r=e.geometry.vertices[g.a].position;D=e.geometry.vertices[g.b].position;M=e.geometry.vertices[g.c].position;E.push(r.x,r.y,r.z);E.push(D.x,D.y,D.z);E.push(M.x,M.y,M.z);if(e.geometry.hasTangents){r=e.geometry.vertices[g.a].tangent;D=e.geometry.vertices[g.b].tangent;
+M=e.geometry.vertices[g.c].tangent;F.push(r.x,r.y,r.z,r.w);F.push(D.x,D.y,D.z,D.w);F.push(M.x,M.y,M.z,M.w)}if(p.length==3&&G)for(g=0;g<3;g++)U.push(p[g].x,p[g].y,p[g].z);else for(g=0;g<3;g++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(n)for(g=0;g<3;g++)w.push(n[g].u,n[g].v);z.push(x,x+1,x+2);S.push(x,x+1);S.push(x,x+2);S.push(x+1,x+2);x+=3}else if(g instanceof THREE.Face4){r=e.geometry.vertices[g.a].position;D=e.geometry.vertices[g.b].position;M=e.geometry.vertices[g.c].position;H=e.geometry.vertices[g.d].position;
+E.push(r.x,r.y,r.z);E.push(D.x,D.y,D.z);E.push(M.x,M.y,M.z);E.push(H.x,H.y,H.z);if(e.geometry.hasTangents){r=e.geometry.vertices[g.a].tangent;D=e.geometry.vertices[g.b].tangent;M=e.geometry.vertices[g.c].tangent;g=e.geometry.vertices[g.d].tangent;F.push(r.x,r.y,r.z,r.w);F.push(D.x,D.y,D.z,D.w);F.push(M.x,M.y,M.z,M.w);F.push(g.x,g.y,g.z,g.w)}if(p.length==4&&G)for(g=0;g<4;g++)U.push(p[g].x,p[g].y,p[g].z);else for(g=0;g<4;g++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(n)for(g=0;g<4;g++)w.push(n[g].u,
+n[g].v);z.push(x,x+1,x+2);z.push(x,x+2,x+3);S.push(x,x+1);S.push(x,x+2);S.push(x,x+3);S.push(x+1,x+2);S.push(x+2,x+3);x+=4}}if(E.length){K.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,K.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(E),c.STATIC_DRAW);K.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,K.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(U),c.STATIC_DRAW);if(e.geometry.hasTangents){K.__webGLTangentBuffer=c.createBuffer();
+c.bindBuffer(c.ARRAY_BUFFER,K.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(F),c.STATIC_DRAW)}if(w.length>0){K.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,K.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(w),c.STATIC_DRAW)}K.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(z),c.STATIC_DRAW);K.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
+K.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(S),c.STATIC_DRAW);K.__webGLFaceCount=z.length;K.__webGLLineCount=S.length}};this.renderBuffer=function(e,h,m,i,n){var g,p,r,D,M,H,z,S,E;if(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshDepthMaterial||i instanceof THREE.MeshNormalMaterial){if(!i.program){if(i instanceof THREE.MeshDepthMaterial){z=Q.depth;i.fragment_shader=z.fragment_shader;i.vertex_shader=z.vertex_shader;i.uniforms=z.uniforms;i.uniforms.mNear.value=
+i.near;i.uniforms.mFar.value=i.far}else if(i instanceof THREE.MeshNormalMaterial){z=Q.normal;i.fragment_shader=z.fragment_shader;i.vertex_shader=z.vertex_shader;i.uniforms=z.uniforms}i.program=f(i.fragment_shader,i.vertex_shader,null);z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(E in i.uniforms)z.push(E);k(i.program,z);q(i.program,["position","normal","uv","tangent"])}E=i.program}else E=u;if(E!=B){c.useProgram(E);B=E}E==u&&this.setupLights(E,
+h);this.loadCamera(E,e);this.loadMatrices(E);if(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshDepthMaterial||i instanceof THREE.MeshNormalMaterial){r=i.wireframe;D=i.wireframe_linewidth;e=E;h=i.uniforms;var U;for(g in h){S=h[g].type;z=h[g].value;U=e.uniforms[g];if(S=="i")c.uniform1i(U,z);else if(S=="f")c.uniform1f(U,z);else if(S=="v3")c.uniform3f(U,z.x,z.y,z.z);else if(S=="c")c.uniform3f(U,z.r,z.g,z.b);else if(S=="t"){c.uniform1i(U,z);if(S=h[g].texture)S.image instanceof Array&&S.image.length==
+6?d(S,z):j(S,z)}}}if(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshBasicMaterial){g=i.color;p=i.opacity;r=i.wireframe;D=i.wireframe_linewidth;M=i.map;H=i.env_map;h=i.combine==THREE.MixOperation;e=i.reflectivity;S=i.env_map&&i.env_map.mapping instanceof THREE.CubeRefractionMapping;z=i.refraction_ratio;c.uniform4f(E.uniforms.mColor,g.r*p,g.g*p,g.b*p,p);c.uniform1i(E.uniforms.mixEnvMap,h);c.uniform1f(E.uniforms.mReflectivity,e);c.uniform1i(E.uniforms.useRefract,
+S);c.uniform1f(E.uniforms.mRefractionRatio,z);if(m){c.uniform1f(E.uniforms.fogDensity,m.density);c.uniform3f(E.uniforms.fogColor,m.color.r,m.color.g,m.color.b)}}if(i instanceof THREE.MeshPhongMaterial){m=i.ambient;g=i.specular;i=i.shininess;c.uniform4f(E.uniforms.mAmbient,m.r,m.g,m.b,p);c.uniform4f(E.uniforms.mSpecular,g.r,g.g,g.b,p);c.uniform1f(E.uniforms.mShininess,i);c.uniform1i(E.uniforms.material,2)}else if(i instanceof THREE.MeshLambertMaterial)c.uniform1i(E.uniforms.material,1);else i instanceof
+THREE.MeshBasicMaterial&&c.uniform1i(E.uniforms.material,0);if(M){j(M,0);c.uniform1i(E.uniforms.tMap,0);c.uniform1i(E.uniforms.enableMap,1)}else c.uniform1i(E.uniforms.enableMap,0);if(H){d(H,1);c.uniform1i(E.uniforms.tCube,1);c.uniform1i(E.uniforms.enableCubeMap,1)}else c.uniform1i(E.uniforms.enableCubeMap,0);p=E.attributes;c.bindBuffer(c.ARRAY_BUFFER,n.__webGLVertexBuffer);c.vertexAttribPointer(p.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(p.position);if(p.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,
+n.__webGLNormalBuffer);c.vertexAttribPointer(p.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(p.normal)}if(p.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLTangentBuffer);c.vertexAttribPointer(p.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(p.tangent)}if(p.uv>=0)if(n.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLUVBuffer);c.vertexAttribPointer(p.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(p.uv)}else c.disableVertexAttribArray(p.uv);if(r){c.lineWidth(D);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
+n.__webGLLineBuffer);c.drawElements(c.LINES,n.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,n.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(e,h,m,i,n,g,p){var r,D,M,H,z;M=0;for(H=i.material.length;M<H;M++){r=i.material[M];if(r instanceof THREE.MeshFaceMaterial){r=0;for(D=n.material.length;r<D;r++)if((z=n.material[r])&&z.blending==g&&z.opacity<1==p){this.setBlending(z.blending);this.renderBuffer(e,h,m,
+z,n)}}else if((z=r)&&z.blending==g&&z.opacity<1==p){this.setBlending(z.blending);this.renderBuffer(e,h,m,z,n)}}};this.render=function(e,h){var m,i,n,g,p=e.lights,r=e.fog;this.initWebGLObjects(e);this.autoClear&&this.clear();h.autoUpdateMatrix&&h.updateMatrix();R.set(h.matrix.flatten());s.set(h.projectionMatrix.flatten());m=0;for(i=e.__webGLObjects.length;m<i;m++){n=e.__webGLObjects[m];g=n.object;n=n.buffer;if(g.visible){this.setupMatrices(g,h);this.renderPass(h,p,r,g,n,THREE.NormalBlending,false)}}m=
+0;for(i=e.__webGLObjects.length;m<i;m++){n=e.__webGLObjects[m];g=n.object;n=n.buffer;if(g.visible){this.setupMatrices(g,h);this.renderPass(h,p,r,g,n,THREE.AdditiveBlending,false);this.renderPass(h,p,r,g,n,THREE.SubtractiveBlending,false);this.renderPass(h,p,r,g,n,THREE.AdditiveBlending,true);this.renderPass(h,p,r,g,n,THREE.SubtractiveBlending,true);this.renderPass(h,p,r,g,n,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(e){var h,m,i,n,g,p;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap=
+{}}h=0;for(m=e.objects.length;h<m;h++){i=e.objects[h];if(e.__webGLObjectsMap[i.id]==undefined)e.__webGLObjectsMap[i.id]={};p=e.__webGLObjectsMap[i.id];if(i instanceof THREE.Mesh)for(g in i.geometry.geometryChunks){n=i.geometry.geometryChunks[g];n.__webGLVertexBuffer||this.createBuffers(i,g);if(p[g]==undefined){n={buffer:n,object:i};e.__webGLObjects.push(n);p[g]=1}}}};this.removeObject=function(e,h){var m,i;for(m=e.__webGLObjects.length-1;m>=0;m--){i=e.__webGLObjects[m].object;h==i&&e.__webGLObjects.splice(m,
+1)}};this.setupMatrices=function(e,h){e.autoUpdateMatrix&&e.updateMatrix();t.multiply(h.matrix,e.matrix);N.set(t.flatten());J=THREE.Matrix4.makeInvert3x3(t).transpose();T.set(J.m);C.set(e.matrix.flatten())};this.loadMatrices=function(e){c.uniformMatrix4fv(e.uniforms.viewMatrix,false,R);c.uniformMatrix4fv(e.uniforms.modelViewMatrix,false,N);c.uniformMatrix4fv(e.uniforms.projectionMatrix,false,s);c.uniformMatrix3fv(e.uniforms.normalMatrix,false,T);c.uniformMatrix4fv(e.uniforms.objectMatrix,false,C)};
+this.loadCamera=function(e,h){c.uniform3f(e.uniforms.cameraPosition,h.position.x,h.position.y,h.position.z)};this.setBlending=function(e){switch(e){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(e,h){if(e){!h||h=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(e=="back")c.cullFace(c.BACK);
+else e=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0};var Q={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",
+vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"}}};
+THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterial=this.meshMaterial=null;this.overdraw=false;this.uvs=[null,null,null]};
+THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.material=null};

+ 183 - 183
build/ThreeDebug.js

@@ -1,183 +1,183 @@
-// ThreeDebug.js r31 - http://github.com/mrdoob/three.js
-var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};
-THREE.Color.prototype={setRGB:function(a,b,f){this.r=a;this.g=b;this.b=f;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+
-","+~~(this.g*255)+","+~~(this.b*255)+")"},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
-THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
-this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,f){this.x=a||0;this.y=b||0;this.z=f||0};
-THREE.Vector3.prototype={set:function(a,b,f){this.x=a;this.y=b;this.z=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
-cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,f=this.y,d=this.z;this.x=f*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-f*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=
-a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+f*f+a*a)},distanceToSquared:function(a){var b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return b*b+f*f+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=
-Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
-THREE.Vector4=function(a,b,f,d){this.x=a||0;this.y=b||0;this.z=f||0;this.w=d||1};
-THREE.Vector4.prototype={set:function(a,b,f,d){this.x=a;this.y=b;this.z=f;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},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){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
-THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,f,d=a.objects,h=[];a=0;for(b=d.length;a<b;a++){f=d[a];if(f instanceof THREE.Mesh)h=h.concat(this.intersectObject(f))}h.sort(function(k,q){return k.distance-q.distance});return h},intersectObject:function(a){function b(N,t,R,D){D=D.clone().subSelf(t);R=R.clone().subSelf(t);var L=N.clone().subSelf(t);N=D.dot(D);t=D.dot(R);D=D.dot(L);var M=R.dot(R);R=R.dot(L);L=1/(N*M-t*t);M=(M*D-t*R)*L;N=(N*R-t*D)*L;return M>0&&N>0&&M+N<1}var f,d,h,k,q,j,p,c,C,A,
-x,w=a.geometry,K=w.vertices,P=[];f=0;for(d=w.faces.length;f<d;f++){h=w.faces[f];A=this.origin.clone();x=this.direction.clone();k=a.matrix.multiplyVector3(K[h.a].position.clone());q=a.matrix.multiplyVector3(K[h.b].position.clone());j=a.matrix.multiplyVector3(K[h.c].position.clone());p=h instanceof THREE.Face4?a.matrix.multiplyVector3(K[h.d].position.clone()):null;c=a.rotationMatrix.multiplyVector3(h.normal.clone());C=x.dot(c);if(C<0){c=c.dot((new THREE.Vector3).sub(k,A))/C;A=A.addSelf(x.multiplyScalar(c));
-if(h instanceof THREE.Face3){if(b(A,k,q,j)){h={distance:this.origin.distanceTo(A),point:A,face:h,object:a};P.push(h)}}else if(h instanceof THREE.Face4)if(b(A,k,q,p)||b(A,q,j,p)){h={distance:this.origin.distanceTo(A),point:A,face:h,object:a};P.push(h)}}}return P}};
-THREE.Rectangle=function(){function a(){k=d-b;q=h-f}var b,f,d,h,k,q,j=true;this.getX=function(){return b};this.getY=function(){return f};this.getWidth=function(){return k};this.getHeight=function(){return q};this.getLeft=function(){return b};this.getTop=function(){return f};this.getRight=function(){return d};this.getBottom=function(){return h};this.set=function(p,c,C,A){j=false;b=p;f=c;d=C;h=A;a()};this.addPoint=function(p,c){if(j){j=false;b=p;f=c;d=p;h=c}else{b=b<p?b:p;f=f<c?f:c;d=d>p?d:p;h=h>c?
-h:c}a()};this.add3Points=function(p,c,C,A,x,w){if(j){j=false;b=p<C?p<x?p:x:C<x?C:x;f=c<A?c<w?c:w:A<w?A:w;d=p>C?p>x?p:x:C>x?C:x;h=c>A?c>w?c:w:A>w?A:w}else{b=p<C?p<x?p<b?p:b:x<b?x:b:C<x?C<b?C:b:x<b?x:b;f=c<A?c<w?c<f?c:f:w<f?w:f:A<w?A<f?A:f:w<f?w:f;d=p>C?p>x?p>d?p:d:x>d?x:d:C>x?C>d?C:d:x>d?x:d;h=c>A?c>w?c>h?c:h:w>h?w:h:A>w?A>h?A:h:w>h?w:h}a()};this.addRectangle=function(p){if(j){j=false;b=p.getLeft();f=p.getTop();d=p.getRight();h=p.getBottom()}else{b=b<p.getLeft()?b:p.getLeft();f=f<p.getTop()?f:p.getTop();
-d=d>p.getRight()?d:p.getRight();h=h>p.getBottom()?h:p.getBottom()}a()};this.inflate=function(p){b-=p;f-=p;d+=p;h+=p;a()};this.minSelf=function(p){b=b>p.getLeft()?b:p.getLeft();f=f>p.getTop()?f:p.getTop();d=d<p.getRight()?d:p.getRight();h=h<p.getBottom()?h:p.getBottom();a()};this.instersects=function(p){return Math.min(d,p.getRight())-Math.max(b,p.getLeft())>=0&&Math.min(h,p.getBottom())-Math.max(f,p.getTop())>=0};this.empty=function(){j=true;h=d=f=b=0;a()};this.isEmpty=function(){return j};this.toString=
-function(){return"THREE.Rectangle ( left: "+b+", right: "+d+", top: "+f+", bottom: "+h+", width: "+k+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
-THREE.Matrix4=function(a,b,f,d,h,k,q,j,p,c,C,A,x,w,K,P){this.n11=a||1;this.n12=b||0;this.n13=f||0;this.n14=d||0;this.n21=h||0;this.n22=k||1;this.n23=q||0;this.n24=j||0;this.n31=p||0;this.n32=c||0;this.n33=C||1;this.n34=A||0;this.n41=x||0;this.n42=w||0;this.n43=K||0;this.n44=P||1};
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,f,d,h,k,q,j,p,c,C,A,x,w,K,P){this.n11=a;this.n12=b;this.n13=f;this.n14=d;this.n21=h;this.n22=k;this.n23=q;this.n24=j;this.n31=p;this.n32=c;this.n33=C;this.n34=A;this.n41=x;this.n42=w;this.n43=K;this.n44=P;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
-a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,f){var d=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3;k.sub(a,b).normalize();d.cross(f,k).normalize();h.cross(k,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);this.n31=k.x;
-this.n32=k.y;this.n33=k.z;this.n34=-k.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,f=a.y,d=a.z,h=1/(this.n41*b+this.n42*f+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*f+this.n13*d+this.n14)*h;a.y=(this.n21*b+this.n22*f+this.n23*d+this.n24)*h;a.z=(this.n31*b+this.n32*f+this.n33*d+this.n34)*h;return a},multiplyVector4:function(a){var b=a.x,f=a.y,d=a.z,h=a.w;a.x=this.n11*b+this.n12*f+this.n13*d+this.n14*h;a.y=this.n21*b+this.n22*f+this.n23*d+this.n24*
-h;a.z=this.n31*b+this.n32*f+this.n33*d+this.n34*h;a.w=this.n41*b+this.n42*f+this.n43*d+this.n44*h;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},multiply:function(a,b){var f=a.n11,d=a.n12,h=a.n13,k=a.n14,q=a.n21,j=a.n22,p=a.n23,c=a.n24,C=a.n31,A=a.n32,
-x=a.n33,w=a.n34,K=a.n41,P=a.n42,N=a.n43,t=a.n44,R=b.n11,D=b.n12,L=b.n13,M=b.n14,e=b.n21,l=b.n22,i=b.n23,g=b.n24,n=b.n31,m=b.n32,o=b.n33,r=b.n34,v=b.n41,E=b.n42,V=b.n43,y=b.n44;this.n11=f*R+d*e+h*n+k*v;this.n12=f*D+d*l+h*m+k*E;this.n13=f*L+d*i+h*o+k*V;this.n14=f*M+d*g+h*r+k*y;this.n21=q*R+j*e+p*n+c*v;this.n22=q*D+j*l+p*m+c*E;this.n23=q*L+j*i+p*o+c*V;this.n24=q*M+j*g+p*r+c*y;this.n31=C*R+A*e+x*n+w*v;this.n32=C*D+A*l+x*m+w*E;this.n33=C*L+A*i+x*o+w*V;this.n34=C*M+A*g+x*r+w*y;this.n41=K*R+P*e+N*n+t*v;
-this.n42=K*D+P*l+N*m+t*E;this.n43=K*L+P*i+N*o+t*V;this.n44=K*M+P*g+N*r+t*y;return this},multiplySelf:function(a){var b=this.n11,f=this.n12,d=this.n13,h=this.n14,k=this.n21,q=this.n22,j=this.n23,p=this.n24,c=this.n31,C=this.n32,A=this.n33,x=this.n34,w=this.n41,K=this.n42,P=this.n43,N=this.n44,t=a.n11,R=a.n21,D=a.n31,L=a.n41,M=a.n12,e=a.n22,l=a.n32,i=a.n42,g=a.n13,n=a.n23,m=a.n33,o=a.n43,r=a.n14,v=a.n24,E=a.n34;a=a.n44;this.n11=b*t+f*R+d*D+h*L;this.n12=b*M+f*e+d*l+h*i;this.n13=b*g+f*n+d*m+h*o;this.n14=
-b*r+f*v+d*E+h*a;this.n21=k*t+q*R+j*D+p*L;this.n22=k*M+q*e+j*l+p*i;this.n23=k*g+q*n+j*m+p*o;this.n24=k*r+q*v+j*E+p*a;this.n31=c*t+C*R+A*D+x*L;this.n32=c*M+C*e+A*l+x*i;this.n33=c*g+C*n+A*m+x*o;this.n34=c*r+C*v+A*E+x*a;this.n41=w*t+K*R+P*D+N*L;this.n42=w*M+K*e+P*l+N*i;this.n43=w*g+K*n+P*m+N*o;this.n44=w*r+K*v+P*E+N*a;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},determinant:function(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*
-this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,f,d){var h=b[f];b[f]=b[d];
-b[d]=h}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
-this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,f){var d=new THREE.Matrix4;d.n14=a;d.n24=b;d.n34=f;return d};
-THREE.Matrix4.scaleMatrix=function(a,b,f){var d=new THREE.Matrix4;d.n11=a;d.n22=b;d.n33=f;return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b};
-THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var f=new THREE.Matrix4,d=Math.cos(b),h=Math.sin(b),k=1-d,q=a.x,j=a.y,p=a.z;f.n11=k*q*q+d;f.n12=k*q*j-h*p;f.n13=k*q*p+h*j;f.n21=k*q*j+h*p;f.n22=k*j*j+d;f.n23=k*j*p-h*q;f.n31=k*q*p-h*j;f.n32=k*j*p+h*q;f.n33=k*p*p+d;return f};
-THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;b.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;b.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;b.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12*
-a.n23*a.n34;b.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;b.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;b.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;b.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;b.n31=a.n22*a.n34*a.n41-a.n24*a.n32*
-a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;b.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;b.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;b.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;b.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22*
-a.n31*a.n43-a.n21*a.n32*a.n43;b.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;b.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;b.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var f=b[10]*b[5]-b[6]*b[9],d=-b[10]*b[1]+b[2]*b[9],h=b[6]*b[1]-b[2]*b[5],k=-b[10]*b[4]+b[6]*b[8],q=b[10]*b[0]-b[2]*b[8],j=-b[6]*b[0]+b[2]*b[4],p=b[9]*b[4]-b[5]*b[8],c=-b[9]*b[0]+b[1]*b[8],C=b[5]*b[0]-b[1]*b[4];b=b[0]*f+b[1]*k+b[2]*p;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*f;a.m[1]=b*d;a.m[2]=b*h;a.m[3]=b*k;a.m[4]=b*q;a.m[5]=b*j;a.m[6]=b*p;a.m[7]=b*c;a.m[8]=b*C;return a};
-THREE.Matrix4.makeFrustum=function(a,b,f,d,h,k){var q,j,p;q=new THREE.Matrix4;j=2*h/(b-a);p=2*h/(d-f);a=(b+a)/(b-a);f=(d+f)/(d-f);d=-(k+h)/(k-h);h=-2*k*h/(k-h);q.n11=j;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=p;q.n23=f;q.n24=0;q.n31=0;q.n32=0;q.n33=d;q.n34=h;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,b,f,d){var h;a=f*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*b,a*b,h,a,f,d)};
-THREE.Matrix4.makeOrtho=function(a,b,f,d,h,k){var q,j,p,c;q=new THREE.Matrix4;j=b-a;p=f-d;c=k-h;a=(b+a)/j;f=(f+d)/p;h=(k+h)/c;q.n11=2/j;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/p;q.n23=0;q.n24=-f;q.n31=0;q.n32=0;q.n33=-2/c;q.n34=-h;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};
-THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
-THREE.Face3=function(a,b,f,d,h){this.a=a;this.b=b;this.c=f;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,b,f,d,h,k){this.a=a;this.b=b;this.c=f;this.d=d;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.material=k instanceof Array?k:[k]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
-THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
-THREE.Geometry.prototype={computeCentroids:function(){var a,b,f;a=0;for(b=this.faces.length;a<b;a++){f=this.faces[a];f.centroid.set(0,0,0);if(f instanceof THREE.Face3){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);f.centroid.divideScalar(3)}else if(f instanceof THREE.Face4){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);
-f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,f,d,h,k,q,j=new THREE.Vector3,p=new THREE.Vector3;d=0;for(h=this.vertices.length;d<h;d++){k=this.vertices[d];k.normal.set(0,0,0)}d=0;for(h=this.faces.length;d<h;d++){k=this.faces[d];if(a&&k.vertexNormals.length){j.set(0,0,0);b=0;for(f=k.normal.length;b<f;b++)j.addSelf(k.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[k.a];f=this.vertices[k.b];q=this.vertices[k.c];j.sub(q.position,
-f.position);p.sub(b.position,f.position);j.crossSelf(p)}j.isZero()||j.normalize();k.normal.copy(j)}},computeVertexNormals:function(){var a,b=[],f,d;a=0;for(vl=this.vertices.length;a<vl;a++)b[a]=new THREE.Vector3;a=0;for(f=this.faces.length;a<f;a++){d=this.faces[a];if(d instanceof THREE.Face3){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal);b[d.d].addSelf(d.normal)}}a=
-0;for(vl=this.vertices.length;a<vl;a++)b[a].normalize();a=0;for(f=this.faces.length;a<f;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone()}else if(d instanceof THREE.Face4){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone();d.vertexNormals[3]=b[d.d].clone()}}},computeTangents:function(){function a(r,v,E,V){k=r.vertices[v].position;q=r.vertices[E].position;
-j=r.vertices[V].position;p=h[0];c=h[1];C=h[2];A=q.x-k.x;x=j.x-k.x;w=q.y-k.y;K=j.y-k.y;P=q.z-k.z;N=j.z-k.z;t=c.u-p.u;R=C.u-p.u;D=c.v-p.v;L=C.v-p.v;M=1/(t*L-R*D);g.set((L*A-D*x)*M,(L*w-D*K)*M,(L*P-D*N)*M);n.set((t*x-R*A)*M,(t*K-R*w)*M,(t*N-R*P)*M);l[v].addSelf(g);l[E].addSelf(g);l[V].addSelf(g);i[v].addSelf(n);i[E].addSelf(n);i[V].addSelf(n)}var b,f,d,h,k,q,j,p,c,C,A,x,w,K,P,N,t,R,D,L,M,e,l=[],i=[],g=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;e=new THREE.Vector3;b=
-0;for(f=this.vertices.length;b<f;b++){l[b]=new THREE.Vector3;i[b]=new THREE.Vector3}b=0;for(f=this.faces.length;b<f;b++){d=this.faces[b];h=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);
-this.vertices[d.c].normal.copy(d.vertexNormals[2]);this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(f=this.vertices.length;b<f;b++){e.copy(this.vertices[b].normal);d=l[b];m.copy(d);m.subSelf(e.multiplyScalar(e.dot(d))).normalize();o.cross(this.vertices[b].normal,d);test=o.dot(i[b]);d=test<0?-1:1;this.vertices[b].tangent.set(m.x,m.y,m.z,d)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.bbox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
-y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,f=this.vertices.length;b<f;b++){a=this.vertices[b];if(a.position.x<this.bbox.x[0])this.bbox.x[0]=a.position.x;else if(a.position.x>this.bbox.x[1])this.bbox.x[1]=a.position.x;if(a.position.y<this.bbox.y[0])this.bbox.y[0]=a.position.y;else if(a.position.y>this.bbox.y[1])this.bbox.y[1]=a.position.y;if(a.position.z<this.bbox.z[0])this.bbox.z[0]=a.position.z;else if(a.position.z>
-this.bbox.z[1])this.bbox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,f=this.vertices.length;b<f;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(C){var A=[];b=0;for(f=C.length;b<f;b++)C[b]==undefined?A.push("undefined"):A.push(C[b].toString());return A.join("_")}var b,f,d,h,k,q,j,p,c={};d=0;for(h=this.faces.length;d<h;d++){k=this.faces[d];q=
-k.material;j=a(q);if(c[j]==undefined)c[j]={hash:j,counter:0};p=c[j].hash+"_"+c[j].counter;if(this.geometryChunks[p]==undefined)this.geometryChunks[p]={faces:[],material:q,vertices:0};k=k instanceof THREE.Face3?3:4;if(this.geometryChunks[p].vertices+k>65535){c[j].counter+=1;p=c[j].hash+"_"+c[j].counter;if(this.geometryChunks[p]==undefined)this.geometryChunks[p]={faces:[],material:q,vertices:0}}this.geometryChunks[p].faces.push(d);this.geometryChunks[p].vertices+=k}},toString:function(){return"THREE.Geometry ( vertices: "+
-this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
-THREE.Camera=function(a,b,f,d){this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,b,f,d);this.autoUpdateMatrix=true;this.translateX=function(h){h=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(h);h.cross(h.clone(),this.up);this.position.addSelf(h);this.target.position.addSelf(h)};this.translateZ=function(h){h=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(h);
-this.position.subSelf(h);this.target.position.subSelf(h)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.toString=function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
-THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.PointLight;
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.translationMatrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.scaleMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.autoUpdateMatrix=this.visible=true;this.updateMatrix=function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);
-this.rotationMatrix=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.scaleMatrix=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.rotationMatrix);this.matrix.multiplySelf(this.scaleMatrix)}};THREE.Object3DCounter={value:0};
-THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b]};THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
-THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+
-this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
-THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
-a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=
-a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+
-this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
-THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
-a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=
-a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+
-this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
-THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap=
-"round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
-a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=
-a.wireframe_linejoin}this.toString=function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
-this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>"+ +")"}};THREE.MeshPhongMaterialCounter={value:0};
-THREE.MeshDepthMaterial=function(a){this.near=1;this.far=1E3;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.near!==undefined)this.near=a.near;if(a.far!==undefined)this.far=a.far;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.__2near=2*this.near;this.__farPlusNear=this.far+this.near;this.__farMinusNear=
-this.far-this.near;this.toString=function(){return"THREE.MeshDepthMaterial"}};THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){this.toString=function(){return"THREE.MeshFaceMaterial"}};
-THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==
-undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+
-"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
-THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+
-this.blending+"<br/>)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
-THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
-THREE.Texture=function(a,b,f,d,h,k){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=f!==undefined?f:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=k!==undefined?k:THREE.LinearMipMapLinearFilter;this.toString=function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+
-this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;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.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
-THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
-THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
-THREE.Fog=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
-THREE.Projector=function(){function a(l,i){return i.z-l.z}function b(l,i){var g=0,n=1,m=l.z+l.w,o=i.z+i.w,r=-l.z+l.w,v=-i.z+i.w;if(m>=0&&o>=0&&r>=0&&v>=0)return true;else if(m<0&&o<0||r<0&&v<0)return false;else{if(m<0)g=Math.max(g,m/(m-o));else if(o<0)n=Math.min(n,m/(m-o));if(r<0)g=Math.max(g,r/(r-v));else if(v<0)n=Math.min(n,r/(r-v));if(n<g)return false;else{l.lerpSelf(i,g);i.lerpSelf(l,1-n);return true}}}var f,d,h=[],k,q,j,p=[],c,C,A=[],x,w,K=[],P=new THREE.Vector4,N=new THREE.Vector4,t=new THREE.Matrix4,
-R=new THREE.Matrix4,D=[],L=new THREE.Vector4,M=new THREE.Vector4,e;this.projectObjects=function(l,i,g){var n=[],m,o;d=0;t.multiply(i.projectionMatrix,i.matrix);D[0]=new THREE.Vector4(t.n41-t.n11,t.n42-t.n12,t.n43-t.n13,t.n44-t.n14);D[1]=new THREE.Vector4(t.n41+t.n11,t.n42+t.n12,t.n43+t.n13,t.n44+t.n14);D[2]=new THREE.Vector4(t.n41+t.n21,t.n42+t.n22,t.n43+t.n23,t.n44+t.n24);D[3]=new THREE.Vector4(t.n41-t.n21,t.n42-t.n22,t.n43-t.n23,t.n44-t.n24);D[4]=new THREE.Vector4(t.n41-t.n31,t.n42-t.n32,t.n43-
-t.n33,t.n44-t.n34);D[5]=new THREE.Vector4(t.n41+t.n31,t.n42+t.n32,t.n43+t.n33,t.n44+t.n34);i=0;for(m=D.length;i<m;i++){o=D[i];o.divideScalar(Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z))}m=l.objects;l=0;for(i=m.length;l<i;l++){o=m[l];var r;if(!(r=!o.visible)){if(r=o instanceof THREE.Mesh){a:{r=void 0;for(var v=o.position,E=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),V=0;V<6;V++){r=D[V].x*v.x+D[V].y*v.y+D[V].z*v.z+D[V].w;if(r<=E){r=false;break a}}r=true}r=!r}r=r}if(!r){f=
-h[d]=h[d]||new THREE.RenderableObject;P.copy(o.position);t.multiplyVector3(P);f.object=o;f.z=P.z;n.push(f);d++}}g&&n.sort(a);return n};this.projectScene=function(l,i,g){var n=[],m,o,r,v,E,V,y,G,H,T,S,F,s,B,Q,I;j=C=w=0;i.autoUpdateMatrix&&i.updateMatrix();t.multiply(i.projectionMatrix,i.matrix);V=this.projectObjects(l,i,true);l=0;for(m=V.length;l<m;l++){y=V[l].object;if(y.visible){y.autoUpdateMatrix&&y.updateMatrix();G=y.matrix;H=y.rotationMatrix;T=y.material;S=y.overdraw;if(y instanceof THREE.Mesh){F=
-y.geometry;s=F.vertices;o=0;for(r=s.length;o<r;o++){B=s[o];B.positionWorld.copy(B.position);G.multiplyVector3(B.positionWorld);v=B.positionScreen;v.copy(B.positionWorld);t.multiplyVector4(v);v.multiplyScalar(1/v.w);B.__visible=v.z>0&&v.z<1}F=F.faces;o=0;for(r=F.length;o<r;o++){B=F[o];if(B instanceof THREE.Face3){v=s[B.a];E=s[B.b];Q=s[B.c];if(v.__visible&&E.__visible&&Q.__visible)if(y.doubleSided||y.flipSided!=(Q.positionScreen.x-v.positionScreen.x)*(E.positionScreen.y-v.positionScreen.y)-(Q.positionScreen.y-
-v.positionScreen.y)*(E.positionScreen.x-v.positionScreen.x)<0){k=p[j]=p[j]||new THREE.RenderableFace3;k.v1.positionWorld.copy(v.positionWorld);k.v2.positionWorld.copy(E.positionWorld);k.v3.positionWorld.copy(Q.positionWorld);k.v1.positionScreen.copy(v.positionScreen);k.v2.positionScreen.copy(E.positionScreen);k.v3.positionScreen.copy(Q.positionScreen);k.normalWorld.copy(B.normal);H.multiplyVector3(k.normalWorld);k.centroidWorld.copy(B.centroid);G.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);
-t.multiplyVector3(k.centroidScreen);Q=B.vertexNormals;e=k.vertexNormalsWorld;v=0;for(E=Q.length;v<E;v++){I=e[v]=e[v]||new THREE.Vector3;I.copy(Q[v]);H.multiplyVector3(I)}k.z=k.centroidScreen.z;k.meshMaterial=T;k.faceMaterial=B.material;k.overdraw=S;if(y.geometry.uvs[o]){k.uvs[0]=y.geometry.uvs[o][0];k.uvs[1]=y.geometry.uvs[o][1];k.uvs[2]=y.geometry.uvs[o][2]}n.push(k);j++}}else if(B instanceof THREE.Face4){v=s[B.a];E=s[B.b];Q=s[B.c];I=s[B.d];if(v.__visible&&E.__visible&&Q.__visible&&I.__visible)if(y.doubleSided||
-y.flipSided!=((I.positionScreen.x-v.positionScreen.x)*(E.positionScreen.y-v.positionScreen.y)-(I.positionScreen.y-v.positionScreen.y)*(E.positionScreen.x-v.positionScreen.x)<0||(E.positionScreen.x-Q.positionScreen.x)*(I.positionScreen.y-Q.positionScreen.y)-(E.positionScreen.y-Q.positionScreen.y)*(I.positionScreen.x-Q.positionScreen.x)<0)){k=p[j]=p[j]||new THREE.RenderableFace3;k.v1.positionWorld.copy(v.positionWorld);k.v2.positionWorld.copy(E.positionWorld);k.v3.positionWorld.copy(I.positionWorld);
-k.v1.positionScreen.copy(v.positionScreen);k.v2.positionScreen.copy(E.positionScreen);k.v3.positionScreen.copy(I.positionScreen);k.normalWorld.copy(B.normal);H.multiplyVector3(k.normalWorld);k.centroidWorld.copy(B.centroid);G.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);t.multiplyVector3(k.centroidScreen);k.z=k.centroidScreen.z;k.meshMaterial=T;k.faceMaterial=B.material;k.overdraw=S;if(y.geometry.uvs[o]){k.uvs[0]=y.geometry.uvs[o][0];k.uvs[1]=y.geometry.uvs[o][1];k.uvs[2]=
-y.geometry.uvs[o][3]}n.push(k);j++;q=p[j]=p[j]||new THREE.RenderableFace3;q.v1.positionWorld.copy(E.positionWorld);q.v2.positionWorld.copy(Q.positionWorld);q.v3.positionWorld.copy(I.positionWorld);q.v1.positionScreen.copy(E.positionScreen);q.v2.positionScreen.copy(Q.positionScreen);q.v3.positionScreen.copy(I.positionScreen);q.normalWorld.copy(k.normalWorld);q.centroidWorld.copy(k.centroidWorld);q.centroidScreen.copy(k.centroidScreen);q.z=q.centroidScreen.z;q.meshMaterial=T;q.faceMaterial=B.material;
-q.overdraw=S;if(y.geometry.uvs[o]){q.uvs[0]=y.geometry.uvs[o][1];q.uvs[1]=y.geometry.uvs[o][2];q.uvs[2]=y.geometry.uvs[o][3]}n.push(q);j++}}}}else if(y instanceof THREE.Line){R.multiply(t,G);s=y.geometry.vertices;B=s[0];B.positionScreen.copy(B.position);R.multiplyVector4(B.positionScreen);o=1;for(r=s.length;o<r;o++){v=s[o];v.positionScreen.copy(v.position);R.multiplyVector4(v.positionScreen);E=s[o-1];L.copy(v.positionScreen);M.copy(E.positionScreen);if(b(L,M)){L.multiplyScalar(1/L.w);M.multiplyScalar(1/
-M.w);c=A[C]=A[C]||new THREE.RenderableLine;c.v1.positionScreen.copy(L);c.v2.positionScreen.copy(M);c.z=Math.max(L.z,M.z);c.material=y.material;n.push(c);C++}}}else if(y instanceof THREE.Particle){N.set(y.position.x,y.position.y,y.position.z,1);t.multiplyVector4(N);N.z/=N.w;if(N.z>0&&N.z<1){x=K[w]=K[w]||new THREE.RenderableParticle;x.x=N.x/N.w;x.y=N.y/N.w;x.z=N.z;x.rotation=y.rotation.z;x.scale.x=y.scale.x*Math.abs(x.x-(N.x+i.projectionMatrix.n11)/(N.w+i.projectionMatrix.n14));x.scale.y=y.scale.y*
-Math.abs(x.y-(N.y+i.projectionMatrix.n22)/(N.w+i.projectionMatrix.n24));x.material=y.material;n.push(x);w++}}}}g&&n.sort(a);return n};this.unprojectVector=function(l,i){var g=new THREE.Matrix4;g.multiply(THREE.Matrix4.makeInvert(i.matrix),THREE.Matrix4.makeInvert(i.projectionMatrix));g.multiplyVector3(l);return l}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,f,d,h,k;this.domElement=document.createElement("div");this.setSize=function(q,j){f=q;d=j;h=f/2;k=d/2};this.render=function(q,j){var p,c,C,A,x,w,K,P;a=b.projectScene(q,j);p=0;for(c=a.length;p<c;p++){x=a[p];if(x instanceof THREE.RenderableParticle){K=x.x*h+h;P=x.y*k+k;C=0;for(A=x.material.length;C<A;C++){w=x.material[C];if(w instanceof THREE.ParticleDOMMaterial){w=w.domElement;w.style.left=K+"px";w.style.top=P+"px"}}}}}};
-THREE.CanvasRenderer=function(){var a=null,b=new THREE.Projector,f=document.createElement("canvas"),d,h,k,q,j=f.getContext("2d"),p=1,c=0,C=null,A=null,x=1,w,K,P,N,t,R,D,L,M,e=new THREE.Color,l=new THREE.Color,i=new THREE.Color,g=new THREE.Color,n=new THREE.Color,m,o,r,v,E,V,y,G,H,T,S=new THREE.Rectangle,F=new THREE.Rectangle,s=new THREE.Rectangle,B=false,Q=new THREE.Color,I=new THREE.Color,W=new THREE.Color,aa=new THREE.Color,Ja=Math.PI*2,Y=new THREE.Vector3,na,oa,Aa,da,pa,ta,la=16;na=document.createElement("canvas");
-na.width=na.height=2;oa=na.getContext("2d");oa.fillStyle="rgba(0,0,0,1)";oa.fillRect(0,0,2,2);Aa=oa.getImageData(0,0,2,2);da=Aa.data;pa=document.createElement("canvas");pa.width=pa.height=la;ta=pa.getContext("2d");ta.translate(-la/2,-la/2);ta.scale(la,la);la--;this.domElement=f;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ga,ua){d=ga;h=ua;k=d/2;q=h/2;f.width=d;f.height=h;S.set(-k,-q,k,q)};this.clear=function(){if(!F.isEmpty()){F.inflate(1);F.minSelf(S);j.clearRect(F.getX(),
-F.getY(),F.getWidth(),F.getHeight());F.empty()}};this.render=function(ga,ua){function Ka(u){var U,O,z,J=u.lights;I.setRGB(0,0,0);W.setRGB(0,0,0);aa.setRGB(0,0,0);u=0;for(U=J.length;u<U;u++){O=J[u];z=O.color;if(O instanceof THREE.AmbientLight){I.r+=z.r;I.g+=z.g;I.b+=z.b}else if(O instanceof THREE.DirectionalLight){W.r+=z.r;W.g+=z.g;W.b+=z.b}else if(O instanceof THREE.PointLight){aa.r+=z.r;aa.g+=z.g;aa.b+=z.b}}}function va(u,U,O,z){var J,X,$,ba,ca=u.lights;u=0;for(J=ca.length;u<J;u++){X=ca[u];$=X.color;
-ba=X.intensity;if(X instanceof THREE.DirectionalLight){X=O.dot(X.position)*ba;if(X>0){z.r+=$.r*X;z.g+=$.g*X;z.b+=$.b*X}}else if(X instanceof THREE.PointLight){Y.sub(X.position,U);Y.normalize();X=O.dot(Y)*ba;if(X>0){z.r+=$.r*X;z.g+=$.g*X;z.b+=$.b*X}}}}function La(u,U,O){if(O.opacity!=0){Ba(O.opacity);wa(O.blending);var z,J,X,$,ba,ca;if(O instanceof THREE.ParticleBasicMaterial){if(O.map){$=O.map;ba=$.width>>1;ca=$.height>>1;J=U.scale.x*k;X=U.scale.y*q;O=J*ba;z=X*ca;s.set(u.x-O,u.y-z,u.x+O,u.y+z);if(!S.instersects(s))return;
-j.save();j.translate(u.x,u.y);j.rotate(-U.rotation);j.scale(J,-X);j.translate(-ba,-ca);j.drawImage($,0,0);j.restore()}j.beginPath();j.moveTo(u.x-10,u.y);j.lineTo(u.x+10,u.y);j.moveTo(u.x,u.y-10);j.lineTo(u.x,u.y+10);j.closePath();j.strokeStyle="rgb(255,255,0)";j.stroke()}else if(O instanceof THREE.ParticleCircleMaterial){if(B){Q.r=I.r+W.r+aa.r;Q.g=I.g+W.g+aa.g;Q.b=I.b+W.b+aa.b;e.r=O.color.r*Q.r;e.g=O.color.g*Q.g;e.b=O.color.b*Q.b;e.updateStyleString()}else e.__styleString=O.color.__styleString;O=
-U.scale.x*k;z=U.scale.y*q;s.set(u.x-O,u.y-z,u.x+O,u.y+z);if(S.instersects(s)){J=e.__styleString;if(A!=J)j.fillStyle=A=J;j.save();j.translate(u.x,u.y);j.rotate(-U.rotation);j.scale(O,z);j.beginPath();j.arc(0,0,1,0,Ja,true);j.closePath();j.fill();j.restore()}}}}function Ma(u,U,O,z){if(z.opacity!=0){Ba(z.opacity);wa(z.blending);j.beginPath();j.moveTo(u.positionScreen.x,u.positionScreen.y);j.lineTo(U.positionScreen.x,U.positionScreen.y);j.closePath();if(z instanceof THREE.LineBasicMaterial){e.__styleString=
-z.color.__styleString;u=z.linewidth;if(x!=u)j.lineWidth=x=u;u=e.__styleString;if(C!=u)j.strokeStyle=C=u;j.stroke();s.inflate(z.linewidth*2)}}}function Fa(u,U,O,z,J,X){if(J.opacity!=0){Ba(J.opacity);wa(J.blending);N=u.positionScreen.x;t=u.positionScreen.y;R=U.positionScreen.x;D=U.positionScreen.y;L=O.positionScreen.x;M=O.positionScreen.y;j.beginPath();j.moveTo(N,t);j.lineTo(R,D);j.lineTo(L,M);j.lineTo(N,t);j.closePath();if(J instanceof THREE.MeshBasicMaterial)if(J.map)J.map.image.loaded&&J.map.mapping instanceof
-THREE.UVMapping&&qa(N,t,R,D,L,M,J.map.image,z.uvs[0].u,z.uvs[0].v,z.uvs[1].u,z.uvs[1].v,z.uvs[2].u,z.uvs[2].v);else if(J.env_map){if(J.env_map.image.loaded)if(J.env_map.mapping instanceof THREE.SphericalReflectionMapping){u=ua.matrix;Y.copy(z.vertexNormalsWorld[0]);E=(Y.x*u.n11+Y.y*u.n12+Y.z*u.n13)*0.5+0.5;V=-(Y.x*u.n21+Y.y*u.n22+Y.z*u.n23)*0.5+0.5;Y.copy(z.vertexNormalsWorld[1]);y=(Y.x*u.n11+Y.y*u.n12+Y.z*u.n13)*0.5+0.5;G=-(Y.x*u.n21+Y.y*u.n22+Y.z*u.n23)*0.5+0.5;Y.copy(z.vertexNormalsWorld[2]);H=
-(Y.x*u.n11+Y.y*u.n12+Y.z*u.n13)*0.5+0.5;T=-(Y.x*u.n21+Y.y*u.n22+Y.z*u.n23)*0.5+0.5;qa(N,t,R,D,L,M,J.env_map.image,E,V,y,G,H,T)}}else J.wireframe?xa(J.color.__styleString,J.wireframe_linewidth):ya(J.color.__styleString);else if(J instanceof THREE.MeshLambertMaterial){if(J.map&&!J.wireframe){J.map.mapping instanceof THREE.UVMapping&&qa(N,t,R,D,L,M,J.map.image,z.uvs[0].u,z.uvs[0].v,z.uvs[1].u,z.uvs[1].v,z.uvs[2].u,z.uvs[2].v);wa(THREE.SubtractiveBlending)}if(B)if(!J.wireframe&&J.shading==THREE.SmoothShading&&
-z.vertexNormalsWorld.length==3){l.r=i.r=g.r=I.r;l.g=i.g=g.g=I.g;l.b=i.b=g.b=I.b;va(X,z.v1.positionWorld,z.vertexNormalsWorld[0],l);va(X,z.v2.positionWorld,z.vertexNormalsWorld[1],i);va(X,z.v3.positionWorld,z.vertexNormalsWorld[2],g);n.r=(i.r+g.r)*0.5;n.g=(i.g+g.g)*0.5;n.b=(i.b+g.b)*0.5;v=Ga(l,i,g,n);qa(N,t,R,D,L,M,v,0,0,1,0,0,1)}else{Q.r=I.r;Q.g=I.g;Q.b=I.b;va(X,z.centroidWorld,z.normalWorld,Q);e.r=J.color.r*Q.r;e.g=J.color.g*Q.g;e.b=J.color.b*Q.b;e.updateStyleString();J.wireframe?xa(e.__styleString,
-J.wireframe_linewidth):ya(e.__styleString)}else J.wireframe?xa(J.color.__styleString,J.wireframe_linewidth):ya(J.color.__styleString)}else if(J instanceof THREE.MeshDepthMaterial){m=J.__2near;o=J.__farPlusNear;r=J.__farMinusNear;l.r=l.g=l.b=1-m/(o-u.positionScreen.z*r);i.r=i.g=i.b=1-m/(o-U.positionScreen.z*r);g.r=g.g=g.b=1-m/(o-O.positionScreen.z*r);n.r=(i.r+g.r)*0.5;n.g=(i.g+g.g)*0.5;n.b=(i.b+g.b)*0.5;v=Ga(l,i,g,n);qa(N,t,R,D,L,M,v,0,0,1,0,0,1)}else if(J instanceof THREE.MeshNormalMaterial){e.r=
-Ca(z.normalWorld.x);e.g=Ca(z.normalWorld.y);e.b=Ca(z.normalWorld.z);e.updateStyleString();J.wireframe?xa(e.__styleString,J.wireframe_linewidth):ya(e.__styleString)}}}function xa(u,U){if(C!=u)j.strokeStyle=C=u;if(x!=U)j.lineWidth=x=U;j.stroke();s.inflate(U*2)}function ya(u){if(A!=u)j.fillStyle=A=u;j.fill()}function qa(u,U,O,z,J,X,$,ba,ca,ha,ea,ia,ra){var ka,ja;ka=$.width-1;ja=$.height-1;ba*=ka;ca*=ja;ha*=ka;ea*=ja;ia*=ka;ra*=ja;O-=u;z-=U;J-=u;X-=U;ha-=ba;ea-=ca;ia-=ba;ra-=ca;ja=1/(ha*ra-ia*ea);ka=
-(ra*O-ea*J)*ja;ea=(ra*z-ea*X)*ja;O=(ha*J-ia*O)*ja;z=(ha*X-ia*z)*ja;u=u-ka*ba-O*ca;U=U-ea*ba-z*ca;j.save();j.transform(ka,ea,O,z,u,U);j.clip();j.drawImage($,0,0);j.restore()}function Ba(u){if(p!=u)j.globalAlpha=p=u}function wa(u){if(c!=u){switch(u){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}c=u}}function Ga(u,U,O,z){var J=~~(u.r*255),
-X=~~(u.g*255);u=~~(u.b*255);var $=~~(U.r*255),ba=~~(U.g*255);U=~~(U.b*255);var ca=~~(O.r*255),ha=~~(O.g*255);O=~~(O.b*255);var ea=~~(z.r*255),ia=~~(z.g*255);z=~~(z.b*255);da[0]=J<0?0:J>255?255:J;da[1]=X<0?0:X>255?255:X;da[2]=u<0?0:u>255?255:u;da[4]=$<0?0:$>255?255:$;da[5]=ba<0?0:ba>255?255:ba;da[6]=U<0?0:U>255?255:U;da[8]=ca<0?0:ca>255?255:ca;da[9]=ha<0?0:ha>255?255:ha;da[10]=O<0?0:O>255?255:O;da[12]=ea<0?0:ea>255?255:ea;da[13]=ia<0?0:ia>255?255:ia;da[14]=z<0?0:z>255?255:z;oa.putImageData(Aa,0,0);
-ta.drawImage(na,0,0);return pa}function Ca(u){u=(u+1)*0.5;return u<0?0:u>1?1:u}function Da(u,U){var O=U.x-u.x,z=U.y-u.y,J=1/Math.sqrt(O*O+z*z);O*=J;z*=J;U.x+=O;U.y+=z;u.x-=O;u.y-=z}var za,Ha,Z,fa,ma,Ea,Ia,sa;j.setTransform(1,0,0,-1,k,q);this.autoClear&&this.clear();a=b.projectScene(ga,ua,this.sortElements);j.fillStyle="rgba(0, 255, 255, 0.5)";j.fillRect(S.getX(),S.getY(),S.getWidth(),S.getHeight());(B=ga.lights.length>0)&&Ka(ga);za=0;for(Ha=a.length;za<Ha;za++){Z=a[za];s.empty();if(Z instanceof THREE.RenderableParticle){w=
-Z;w.x*=k;w.y*=q;fa=0;for(ma=Z.material.length;fa<ma;fa++)La(w,Z,Z.material[fa],ga)}else if(Z instanceof THREE.RenderableLine){w=Z.v1;K=Z.v2;w.positionScreen.x*=k;w.positionScreen.y*=q;K.positionScreen.x*=k;K.positionScreen.y*=q;s.addPoint(w.positionScreen.x,w.positionScreen.y);s.addPoint(K.positionScreen.x,K.positionScreen.y);if(S.instersects(s)){fa=0;for(ma=Z.material.length;fa<ma;)Ma(w,K,Z,Z.material[fa++],ga)}}else if(Z instanceof THREE.RenderableFace3){w=Z.v1;K=Z.v2;P=Z.v3;w.positionScreen.x*=
-k;w.positionScreen.y*=q;K.positionScreen.x*=k;K.positionScreen.y*=q;P.positionScreen.x*=k;P.positionScreen.y*=q;if(Z.overdraw){Da(w.positionScreen,K.positionScreen);Da(K.positionScreen,P.positionScreen);Da(P.positionScreen,w.positionScreen)}s.add3Points(w.positionScreen.x,w.positionScreen.y,K.positionScreen.x,K.positionScreen.y,P.positionScreen.x,P.positionScreen.y);if(S.instersects(s)){fa=0;for(ma=Z.meshMaterial.length;fa<ma;){sa=Z.meshMaterial[fa++];if(sa instanceof THREE.MeshFaceMaterial){Ea=0;
-for(Ia=Z.faceMaterial.length;Ea<Ia;)(sa=Z.faceMaterial[Ea++])&&Fa(w,K,P,Z,sa,ga)}else Fa(w,K,P,Z,sa,ga)}}}F.addRectangle(s)}j.lineWidth=1;j.strokeStyle="rgba( 255, 0, 0, 0.5 )";j.strokeRect(F.getX(),F.getY(),F.getWidth(),F.getHeight());j.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(G,H,T){var S,F,s,B;S=0;for(F=G.lights.length;S<F;S++){s=G.lights[S];if(s instanceof THREE.DirectionalLight){B=H.normalWorld.dot(s.position)*s.intensity;if(B>0){T.r+=s.color.r*B;T.g+=s.color.g*B;T.b+=s.color.b*B}}else if(s instanceof THREE.PointLight){g.sub(s.position,H.centroidWorld);g.normalize();B=H.normalWorld.dot(g)*s.intensity;if(B>0){T.r+=s.color.r*B;T.g+=s.color.g*B;T.b+=s.color.b*B}}}}function b(G,H,T,S,F,s){r=d(v++);r.setAttribute("d","M "+G.positionScreen.x+
-" "+G.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+T.positionScreen.x+","+T.positionScreen.y+"z");if(F instanceof THREE.MeshBasicMaterial)D.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshLambertMaterial)if(R){L.r=M.r;L.g=M.g;L.b=M.b;a(s,S,L);D.r=F.color.r*L.r;D.g=F.color.g*L.g;D.b=F.color.b*L.b;D.updateStyleString()}else D.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshDepthMaterial){i=1-F.__2near/(F.__farPlusNear-S.z*F.__farMinusNear);
-D.setRGB(i,i,i)}else F instanceof THREE.MeshNormalMaterial&&D.setRGB(h(S.normalWorld.x),h(S.normalWorld.y),h(S.normalWorld.z));F.wireframe?r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+F.wireframe_linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframe_linecap+"; stroke-linejoin: "+F.wireframe_linejoin):r.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+F.opacity);j.appendChild(r)}function f(G,H,T,S,F,s,B){r=d(v++);r.setAttribute("d",
-"M "+G.positionScreen.x+" "+G.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+T.positionScreen.x+","+T.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(s instanceof THREE.MeshBasicMaterial)D.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshLambertMaterial)if(R){L.r=M.r;L.g=M.g;L.b=M.b;a(B,F,L);D.r=s.color.r*L.r;D.g=s.color.g*L.g;D.b=s.color.b*L.b;D.updateStyleString()}else D.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshDepthMaterial){i=
-1-s.__2near/(s.__farPlusNear-F.z*s.__farMinusNear);D.setRGB(i,i,i)}else s instanceof THREE.MeshNormalMaterial&&D.setRGB(h(F.normalWorld.x),h(F.normalWorld.y),h(F.normalWorld.z));s.wireframe?r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+s.wireframe_linewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframe_linecap+"; stroke-linejoin: "+s.wireframe_linejoin):r.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+s.opacity);j.appendChild(r)}
-function d(G){if(n[G]==null){n[G]=document.createElementNS("http://www.w3.org/2000/svg","path");y==0&&n[G].setAttribute("shape-rendering","crispEdges");return n[G]}return n[G]}function h(G){return G<0?Math.min((1+G)*0.5,0.5):0.5+Math.min(G*0.5,0.5)}var k=null,q=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,c,C,A,x,w,K,P,N=new THREE.Rectangle,t=new THREE.Rectangle,R=false,D=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),e=new THREE.Color(0),
-l=new THREE.Color(0),i,g=new THREE.Vector3,n=[],m=[],o=[],r,v,E,V,y=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(G){switch(G){case "high":y=1;break;case "low":y=0}};this.setSize=function(G,H){p=G;c=H;C=p/2;A=c/2;j.setAttribute("viewBox",-C+" "+-A+" "+p+" "+c);j.setAttribute("width",p);j.setAttribute("height",c);N.set(-C,-A,C,A)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(G,H){var T,S,
-F,s,B,Q,I,W;this.autoClear&&this.clear();k=q.projectScene(G,H,this.sortElements);V=E=v=0;if(R=G.lights.length>0){I=G.lights;M.setRGB(0,0,0);e.setRGB(0,0,0);l.setRGB(0,0,0);T=0;for(S=I.length;T<S;T++){F=I[T];s=F.color;if(F instanceof THREE.AmbientLight){M.r+=s.r;M.g+=s.g;M.b+=s.b}else if(F instanceof THREE.DirectionalLight){e.r+=s.r;e.g+=s.g;e.b+=s.b}else if(F instanceof THREE.PointLight){l.r+=s.r;l.g+=s.g;l.b+=s.b}}}T=0;for(S=k.length;T<S;T++){I=k[T];t.empty();if(I instanceof THREE.RenderableParticle){x=
-I;x.x*=C;x.y*=-A;F=0;for(s=I.material.length;F<s;F++)if(W=I.material[F]){B=x;Q=I;W=W;var aa=E++;if(m[aa]==null){m[aa]=document.createElementNS("http://www.w3.org/2000/svg","circle");y==0&&m[aa].setAttribute("shape-rendering","crispEdges")}r=m[aa];r.setAttribute("cx",B.x);r.setAttribute("cy",B.y);r.setAttribute("r",Q.scale.x*C);if(W instanceof THREE.ParticleCircleMaterial){if(R){L.r=M.r+e.r+l.r;L.g=M.g+e.g+l.g;L.b=M.b+e.b+l.b;D.r=W.color.r*L.r;D.g=W.color.g*L.g;D.b=W.color.b*L.b;D.updateStyleString()}else D=
-W.color;r.setAttribute("style","fill: "+D.__styleString)}j.appendChild(r)}}else if(I instanceof THREE.RenderableLine){x=I.v1;w=I.v2;x.positionScreen.x*=C;x.positionScreen.y*=-A;w.positionScreen.x*=C;w.positionScreen.y*=-A;t.addPoint(x.positionScreen.x,x.positionScreen.y);t.addPoint(w.positionScreen.x,w.positionScreen.y);if(N.instersects(t)){F=0;for(s=I.material.length;F<s;)if(W=I.material[F++]){B=x;Q=w;W=W;aa=V++;if(o[aa]==null){o[aa]=document.createElementNS("http://www.w3.org/2000/svg","line");
-y==0&&o[aa].setAttribute("shape-rendering","crispEdges")}r=o[aa];r.setAttribute("x1",B.positionScreen.x);r.setAttribute("y1",B.positionScreen.y);r.setAttribute("x2",Q.positionScreen.x);r.setAttribute("y2",Q.positionScreen.y);if(W instanceof THREE.LineBasicMaterial){D.__styleString=W.color.__styleString;r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin);j.appendChild(r)}}}}else if(I instanceof
-THREE.RenderableFace3){x=I.v1;w=I.v2;K=I.v3;x.positionScreen.x*=C;x.positionScreen.y*=-A;w.positionScreen.x*=C;w.positionScreen.y*=-A;K.positionScreen.x*=C;K.positionScreen.y*=-A;t.addPoint(x.positionScreen.x,x.positionScreen.y);t.addPoint(w.positionScreen.x,w.positionScreen.y);t.addPoint(K.positionScreen.x,K.positionScreen.y);if(N.instersects(t)){F=0;for(s=I.meshMaterial.length;F<s;){W=I.meshMaterial[F++];if(W instanceof THREE.MeshFaceMaterial){B=0;for(Q=I.faceMaterial.length;B<Q;)(W=I.faceMaterial[B++])&&
-b(x,w,K,I,W,G)}else W&&b(x,w,K,I,W,G)}}}else if(I instanceof THREE.RenderableFace4){x=I.v1;w=I.v2;K=I.v3;P=I.v4;x.positionScreen.x*=C;x.positionScreen.y*=-A;w.positionScreen.x*=C;w.positionScreen.y*=-A;K.positionScreen.x*=C;K.positionScreen.y*=-A;P.positionScreen.x*=C;P.positionScreen.y*=-A;t.addPoint(x.positionScreen.x,x.positionScreen.y);t.addPoint(w.positionScreen.x,w.positionScreen.y);t.addPoint(K.positionScreen.x,K.positionScreen.y);t.addPoint(P.positionScreen.x,P.positionScreen.y);if(N.instersects(t)){F=
-0;for(s=I.meshMaterial.length;F<s;){W=I.meshMaterial[F++];if(W instanceof THREE.MeshFaceMaterial){B=0;for(Q=I.faceMaterial.length;B<Q;)(W=I.faceMaterial[B++])&&f(x,w,K,P,I,W,G)}else W&&f(x,w,K,P,I,W,G)}}}}}};
-THREE.WebGLRenderer=function(a){function b(e,l,i){var g=c.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif",i?"#define USE_FOG":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");var n=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");
-c.attachShader(g,q("fragment",i+e));c.attachShader(g,q("vertex",n+l));c.linkProgram(g);c.getProgramParameter(g,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(g,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");g.uniforms={};g.attributes={};return g}function f(e,l){if(e.image.length==6){if(!e.image.__webGLTextureCube&&!e.image.__cubeMapInitialized&&e.image.loadCount==6){e.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,e.image.__webGLTextureCube);
-c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(var i=0;i<6;++i)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e.image[i]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);e.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+
-l);c.bindTexture(c.TEXTURE_CUBE_MAP,e.image.__webGLTextureCube)}}function d(e,l){if(!e.__webGLTexture&&e.image.loaded){e.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,e.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,j(e.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,j(e.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,j(e.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
-j(e.min_filter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+l);c.bindTexture(c.TEXTURE_2D,e.__webGLTexture)}function h(e,l){var i,g,n;i=0;for(g=l.length;i<g;i++){n=l[i];e.uniforms[n]=c.getUniformLocation(e,n)}}function k(e,l){var i,g,n;i=0;for(g=l.length;i<g;i++){n=l[i];e.attributes[n]=c.getAttribLocation(e,n)}}function q(e,l){var i;if(e=="fragment")i=c.createShader(c.FRAGMENT_SHADER);else if(e=="vertex")i=c.createShader(c.VERTEX_SHADER);c.shaderSource(i,
-l);c.compileShader(i);if(!c.getShaderParameter(i,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(i));return null}return i}function j(e){switch(e){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;
-case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR}return 0}var p=document.createElement("canvas"),c,C,A,x=new THREE.Matrix4,w,K=new Float32Array(16),P=new Float32Array(16),N=new Float32Array(16),t=new Float32Array(9),R=new Float32Array(16),D=function(e,l){if(e){var i,g,n,m=pointLights=maxDirLights=maxPointLights=0;i=0;for(g=e.lights.length;i<g;i++){n=e.lights[i];n instanceof THREE.DirectionalLight&&m++;n instanceof
-THREE.PointLight&&pointLights++}if(pointLights+m<=l){maxDirLights=m;maxPointLights=pointLights}else{maxDirLights=Math.ceil(l*m/(pointLights+m));maxPointLights=l-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:l-1}}(a,4);fog=a?a.fog:null;this.domElement=p;this.autoClear=true;try{c=p.getContext("experimental-webgl",{antialias:true})}catch(L){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);
-c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(0,0,0,0);C=A=function(e,l,i){var g=[e?"#define MAX_DIR_LIGHTS "+e:"",l?"#define MAX_POINT_LIGHTS "+l:"","uniform bool enableLighting;\nuniform bool useRefract;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;\nuniform vec3 ambientLightColor;",e?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":"",e?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":
-"",l?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",l?"uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",l?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform float mRefractionRatio;\nvoid main(void) {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec3 transformedNormal = normalize( normalMatrix * normal );\nif ( !enableLighting ) {\nvLightWeighting = vec3( 1.0, 1.0, 1.0 );\n} else {\nvLightWeighting = ambientLightColor;",
-e?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",e?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",e?"float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );":"",e?"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;":"",e?"}":"",l?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",l?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",l?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
-"",l?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",l?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",l?"}":"","}\nvNormal = transformedNormal;\nvUv = uv;\nif ( useRefract ) {\nvReflect = refract( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz), mRefractionRatio );\n} else {\nvReflect = reflect( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz) );\n}\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"),
-n=[e?"#define MAX_DIR_LIGHTS "+e:"",l?"#define MAX_POINT_LIGHTS "+l:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\n#ifdef USE_FOG\nuniform vec3 fogColor;\nuniform float fogDensity;\n#endif\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
-e?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",l?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n}\nif ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
-l?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",l?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",l?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",l?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",l?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",l?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",l?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",l?"float pointSpecularWeight = 0.0;":"",l?"if ( pointDotNormalHalf >= 0.0 )":
-"",l?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",l?"pointDiffuse  += mColor * pointDiffuseWeight;":"",l?"pointSpecular += mSpecular * pointSpecularWeight;":"",l?"}":"",e?"vec4 dirDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",e?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",e?"vec3 dirVector = normalize( lDirection.xyz );":"",e?"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );":
-"",e?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",e?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",e?"float dirSpecularWeight = 0.0;":"",e?"if ( dirDotNormalHalf >= 0.0 )":"",e?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",e?"dirDiffuse  += mColor * dirDiffuseWeight;":"",e?"dirSpecular += mSpecular * dirSpecularWeight;":"",e?"}":"","vec4 totalLight = mAmbient;",e?"totalLight += dirDiffuse + dirSpecular;":"",l?"totalLight += pointDiffuse + pointSpecular;":
-"","if ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mapColor.rgb * totalLight.xyz * vLightWeighting, cubeColor.rgb, mReflectivity ), mapColor.a );\n} else {\ngl_FragColor = vec4( mapColor.rgb * cubeColor.rgb * totalLight.xyz * vLightWeighting, mapColor.a );\n}\n} else if ( material == 1 ) {\nif ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mColor.rgb * mapColor.rgb * vLightWeighting, cubeColor.rgb, mReflectivity ), mColor.a * mapColor.a );\n} else {\ngl_FragColor = vec4( mColor.rgb * mapColor.rgb * cubeColor.rgb * vLightWeighting, mColor.a * mapColor.a );\n}\n} else {\nif ( mixEnvMap ) {\ngl_FragColor = mix( mColor * mapColor, cubeColor, mReflectivity );\n} else {\ngl_FragColor = mColor * mapColor * cubeColor;\n}\n}\n#ifdef USE_FOG\nconst float LOG2 = 1.442695;\nfloat z = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = exp2( - fogDensity * fogDensity * z * z * LOG2 );\nfogFactor = clamp( fogFactor, 0.0, 1.0 );\ngl_FragColor = mix( vec4( fogColor, 1.0 ), gl_FragColor, fogFactor );\n#endif\n}"].join("\n");
-g=b(n,g,i);c.useProgram(g);h(g,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract"]);i&&h(g,["fogColor","fogDensity"]);e&&h(g,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);l&&h(g,["pointLightNumber","pointLightColor",
-"pointLightPosition"]);c.uniform1i(g.uniforms.enableMap,0);c.uniform1i(g.uniforms.tMap,0);c.uniform1i(g.uniforms.enableCubeMap,0);c.uniform1i(g.uniforms.tCube,1);c.uniform1i(g.uniforms.mixEnvMap,0);c.uniform1i(g.uniforms.useRefract,0);k(g,["position","normal","uv"]);return g}(D.directional,D.point,fog);this.setSize=function(e,l){p.width=e;p.height=l;c.viewport(0,0,p.width,p.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(e,l){var i,g,n,m,o,
-r=[],v=[],E=[];m=[];o=[];c.uniform1i(e.uniforms.enableLighting,l.length);i=0;for(g=l.length;i<g;i++){n=l[i];if(n instanceof THREE.AmbientLight)r.push(n);else if(n instanceof THREE.DirectionalLight)E.push(n);else n instanceof THREE.PointLight&&v.push(n)}i=n=m=o=0;for(g=r.length;i<g;i++){n+=r[i].color.r;m+=r[i].color.g;o+=r[i].color.b}c.uniform3f(e.uniforms.ambientLightColor,n,m,o);m=[];o=[];i=0;for(g=E.length;i<g;i++){n=E[i];m.push(n.color.r*n.intensity);m.push(n.color.g*n.intensity);m.push(n.color.b*
-n.intensity);o.push(n.position.x);o.push(n.position.y);o.push(n.position.z)}if(E.length){c.uniform1i(e.uniforms.directionalLightNumber,E.length);c.uniform3fv(e.uniforms.directionalLightDirection,o);c.uniform3fv(e.uniforms.directionalLightColor,m)}m=[];o=[];i=0;for(g=v.length;i<g;i++){n=v[i];m.push(n.color.r*n.intensity);m.push(n.color.g*n.intensity);m.push(n.color.b*n.intensity);o.push(n.position.x);o.push(n.position.y);o.push(n.position.z)}if(v.length){c.uniform1i(e.uniforms.pointLightNumber,v.length);
-c.uniform3fv(e.uniforms.pointLightPosition,o);c.uniform3fv(e.uniforms.pointLightColor,m)}};this.createBuffers=function(e,l){var i,g,n,m,o,r,v,E,V,y=[],G=[],H=[],T=[],S=[],F=[],s=0,B=e.geometry.geometryChunks[l],Q;n=false;i=0;for(g=e.material.length;i<g;i++){meshMaterial=e.material[i];if(meshMaterial instanceof THREE.MeshFaceMaterial){o=0;for(Q=B.material.length;o<Q;o++)if(B.material[o]&&B.material[o].shading!=undefined&&B.material[o].shading==THREE.SmoothShading){n=true;break}}else if(meshMaterial&&
-meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){n=true;break}if(n)break}Q=n;i=0;for(g=B.faces.length;i<g;i++){n=B.faces[i];m=e.geometry.faces[n];o=m.vertexNormals;faceNormal=m.normal;n=e.geometry.uvs[n];if(m instanceof THREE.Face3){r=e.geometry.vertices[m.a].position;v=e.geometry.vertices[m.b].position;E=e.geometry.vertices[m.c].position;H.push(r.x,r.y,r.z);H.push(v.x,v.y,v.z);H.push(E.x,E.y,E.z);if(e.geometry.hasTangents){r=e.geometry.vertices[m.a].tangent;v=e.geometry.vertices[m.b].tangent;
-E=e.geometry.vertices[m.c].tangent;S.push(r.x,r.y,r.z,r.w);S.push(v.x,v.y,v.z,v.w);S.push(E.x,E.y,E.z,E.w)}if(o.length==3&&Q)for(m=0;m<3;m++)T.push(o[m].x,o[m].y,o[m].z);else for(m=0;m<3;m++)T.push(faceNormal.x,faceNormal.y,faceNormal.z);if(n)for(m=0;m<3;m++)F.push(n[m].u,n[m].v);y.push(s,s+1,s+2);G.push(s,s+1);G.push(s,s+2);G.push(s+1,s+2);s+=3}else if(m instanceof THREE.Face4){r=e.geometry.vertices[m.a].position;v=e.geometry.vertices[m.b].position;E=e.geometry.vertices[m.c].position;V=e.geometry.vertices[m.d].position;
-H.push(r.x,r.y,r.z);H.push(v.x,v.y,v.z);H.push(E.x,E.y,E.z);H.push(V.x,V.y,V.z);if(e.geometry.hasTangents){r=e.geometry.vertices[m.a].tangent;v=e.geometry.vertices[m.b].tangent;E=e.geometry.vertices[m.c].tangent;m=e.geometry.vertices[m.d].tangent;S.push(r.x,r.y,r.z,r.w);S.push(v.x,v.y,v.z,v.w);S.push(E.x,E.y,E.z,E.w);S.push(m.x,m.y,m.z,m.w)}if(o.length==4&&Q)for(m=0;m<4;m++)T.push(o[m].x,o[m].y,o[m].z);else for(m=0;m<4;m++)T.push(faceNormal.x,faceNormal.y,faceNormal.z);if(n)for(m=0;m<4;m++)F.push(n[m].u,
-n[m].v);y.push(s,s+1,s+2);y.push(s,s+2,s+3);G.push(s,s+1);G.push(s,s+2);G.push(s,s+3);G.push(s+1,s+2);G.push(s+2,s+3);s+=4}}if(H.length){B.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(H),c.STATIC_DRAW);B.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(T),c.STATIC_DRAW);if(e.geometry.hasTangents){B.__webGLTangentBuffer=c.createBuffer();
-c.bindBuffer(c.ARRAY_BUFFER,B.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(S),c.STATIC_DRAW)}if(F.length>0){B.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,B.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(F),c.STATIC_DRAW)}B.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(y),c.STATIC_DRAW);B.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-B.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(G),c.STATIC_DRAW);B.__webGLFaceCount=y.length;B.__webGLLineCount=G.length}};this.renderBuffer=function(e,l,i,g,n){var m,o,r,v,E,V,y,G,H;if(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshDepthMaterial||g instanceof THREE.MeshNormalMaterial){if(!g.program){if(g instanceof THREE.MeshDepthMaterial){y=M.depth;g.fragment_shader=y.fragment_shader;g.vertex_shader=y.vertex_shader;g.uniforms=y.uniforms;g.uniforms.mNear.value=
-g.near;g.uniforms.mFar.value=g.far}else if(g instanceof THREE.MeshNormalMaterial){y=M.normal;g.fragment_shader=y.fragment_shader;g.vertex_shader=y.vertex_shader;g.uniforms=y.uniforms}g.program=b(g.fragment_shader,g.vertex_shader,null);y=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(H in g.uniforms)y.push(H);h(g.program,y);k(g.program,["position","normal","uv","tangent"])}H=g.program}else H=A;if(H!=C){c.useProgram(H);C=H}H==A&&this.setupLights(H,
-l);this.loadCamera(H,e);this.loadMatrices(H);if(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshDepthMaterial||g instanceof THREE.MeshNormalMaterial){r=g.wireframe;v=g.wireframe_linewidth;e=H;l=g.uniforms;var T;for(m in l){G=l[m].type;y=l[m].value;T=e.uniforms[m];if(G=="i")c.uniform1i(T,y);else if(G=="f")c.uniform1f(T,y);else if(G=="v3")c.uniform3f(T,y.x,y.y,y.z);else if(G=="c")c.uniform3f(T,y.r,y.g,y.b);else if(G=="t"){c.uniform1i(T,y);if(G=l[m].texture)G.image instanceof Array&&G.image.length==
-6?f(G,y):d(G,y)}}}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshBasicMaterial){m=g.color;o=g.opacity;r=g.wireframe;v=g.wireframe_linewidth;E=g.map;V=g.env_map;l=g.combine==THREE.MixOperation;e=g.reflectivity;G=g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping;y=g.refraction_ratio;c.uniform4f(H.uniforms.mColor,m.r*o,m.g*o,m.b*o,o);c.uniform1i(H.uniforms.mixEnvMap,l);c.uniform1f(H.uniforms.mReflectivity,e);c.uniform1i(H.uniforms.useRefract,
-G);c.uniform1f(H.uniforms.mRefractionRatio,y);if(i){c.uniform1f(H.uniforms.fogDensity,i.density);c.uniform3f(H.uniforms.fogColor,i.color.r,i.color.g,i.color.b)}}if(g instanceof THREE.MeshPhongMaterial){i=g.ambient;m=g.specular;g=g.shininess;c.uniform4f(H.uniforms.mAmbient,i.r,i.g,i.b,o);c.uniform4f(H.uniforms.mSpecular,m.r,m.g,m.b,o);c.uniform1f(H.uniforms.mShininess,g);c.uniform1i(H.uniforms.material,2)}else if(g instanceof THREE.MeshLambertMaterial)c.uniform1i(H.uniforms.material,1);else g instanceof
-THREE.MeshBasicMaterial&&c.uniform1i(H.uniforms.material,0);if(E){d(E,0);c.uniform1i(H.uniforms.tMap,0);c.uniform1i(H.uniforms.enableMap,1)}else c.uniform1i(H.uniforms.enableMap,0);if(V){f(V,1);c.uniform1i(H.uniforms.tCube,1);c.uniform1i(H.uniforms.enableCubeMap,1)}else c.uniform1i(H.uniforms.enableCubeMap,0);o=H.attributes;c.bindBuffer(c.ARRAY_BUFFER,n.__webGLVertexBuffer);c.vertexAttribPointer(o.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.position);if(o.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,
-n.__webGLNormalBuffer);c.vertexAttribPointer(o.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.normal)}if(o.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLTangentBuffer);c.vertexAttribPointer(o.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.tangent)}if(o.uv>=0)if(n.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLUVBuffer);c.vertexAttribPointer(o.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.uv)}else c.disableVertexAttribArray(o.uv);if(r){c.lineWidth(v);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-n.__webGLLineBuffer);c.drawElements(c.LINES,n.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,n.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(e,l,i,g,n,m,o){var r,v,E,V,y;E=0;for(V=g.material.length;E<V;E++){r=g.material[E];if(r instanceof THREE.MeshFaceMaterial){r=0;for(v=n.material.length;r<v;r++)if((y=n.material[r])&&y.blending==m&&y.opacity<1==o){this.setBlending(y.blending);this.renderBuffer(e,l,i,
-y,n)}}else if((y=r)&&y.blending==m&&y.opacity<1==o){this.setBlending(y.blending);this.renderBuffer(e,l,i,y,n)}}};this.render=function(e,l){var i,g,n,m,o=e.lights,r=e.fog;this.initWebGLObjects(e);this.autoClear&&this.clear();l.autoUpdateMatrix&&l.updateMatrix();K.set(l.matrix.flatten());N.set(l.projectionMatrix.flatten());i=0;for(g=e.__webGLObjects.length;i<g;i++){n=e.__webGLObjects[i];m=n.object;n=n.buffer;if(m.visible){this.setupMatrices(m,l);this.renderPass(l,o,r,m,n,THREE.NormalBlending,false)}}i=
-0;for(g=e.__webGLObjects.length;i<g;i++){n=e.__webGLObjects[i];m=n.object;n=n.buffer;if(m.visible){this.setupMatrices(m,l);this.renderPass(l,o,r,m,n,THREE.AdditiveBlending,false);this.renderPass(l,o,r,m,n,THREE.SubtractiveBlending,false);this.renderPass(l,o,r,m,n,THREE.AdditiveBlending,true);this.renderPass(l,o,r,m,n,THREE.SubtractiveBlending,true);this.renderPass(l,o,r,m,n,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(e){var l,i,g,n,m,o;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap=
-{}}l=0;for(i=e.objects.length;l<i;l++){g=e.objects[l];if(e.__webGLObjectsMap[g.id]==undefined)e.__webGLObjectsMap[g.id]={};o=e.__webGLObjectsMap[g.id];if(g instanceof THREE.Mesh)for(m in g.geometry.geometryChunks){n=g.geometry.geometryChunks[m];n.__webGLVertexBuffer||this.createBuffers(g,m);if(o[m]==undefined){n={buffer:n,object:g};e.__webGLObjects.push(n);o[m]=1}}}};this.removeObject=function(e,l){var i,g;for(i=e.__webGLObjects.length-1;i>=0;i--){g=e.__webGLObjects[i].object;l==g&&e.__webGLObjects.splice(i,
-1)}};this.setupMatrices=function(e,l){e.autoUpdateMatrix&&e.updateMatrix();x.multiply(l.matrix,e.matrix);P.set(x.flatten());w=THREE.Matrix4.makeInvert3x3(x).transpose();t.set(w.m);R.set(e.matrix.flatten())};this.loadMatrices=function(e){c.uniformMatrix4fv(e.uniforms.viewMatrix,false,K);c.uniformMatrix4fv(e.uniforms.modelViewMatrix,false,P);c.uniformMatrix4fv(e.uniforms.projectionMatrix,false,N);c.uniformMatrix3fv(e.uniforms.normalMatrix,false,t);c.uniformMatrix4fv(e.uniforms.objectMatrix,false,R)};
-this.loadCamera=function(e,l){c.uniform3f(e.uniforms.cameraPosition,l.position.x,l.position.y,l.position.z)};this.setBlending=function(e){switch(e){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(e,l){if(e){!l||l=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(e=="back")c.cullFace(c.BACK);
-else e=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0};var M={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",
-vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"}}};
-THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterial=this.meshMaterial=null;this.overdraw=false;this.uvs=[null,null,null]};
-THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.material=null};
+// ThreeDebug.js r31 - http://github.com/mrdoob/three.js
+var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};
+THREE.Color.prototype={setRGB:function(a,b,f){this.r=a;this.g=b;this.b=f;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+
+","+~~(this.g*255)+","+~~(this.b*255)+")"},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
+THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
+this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,f){this.x=a||0;this.y=b||0;this.z=f||0};
+THREE.Vector3.prototype={set:function(a,b,f){this.x=a;this.y=b;this.z=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
+cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,f=this.y,d=this.z;this.x=f*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-f*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=
+a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+f*f+a*a)},distanceToSquared:function(a){var b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return b*b+f*f+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=
+Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
+THREE.Vector4=function(a,b,f,d){this.x=a||0;this.y=b||0;this.z=f||0;this.w=d||1};
+THREE.Vector4.prototype={set:function(a,b,f,d){this.x=a;this.y=b;this.z=f;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},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){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
+THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
+THREE.Ray.prototype={intersectScene:function(a){var b,f,d=a.objects,j=[];a=0;for(b=d.length;a<b;a++){f=d[a];if(f instanceof THREE.Mesh)j=j.concat(this.intersectObject(f))}j.sort(function(k,q){return k.distance-q.distance});return j},intersectObject:function(a){function b(N,s,U,C){C=C.clone().subSelf(s);U=U.clone().subSelf(s);var L=N.clone().subSelf(s);N=C.dot(C);s=C.dot(U);C=C.dot(L);var O=U.dot(U);U=U.dot(L);L=1/(N*O-s*s);O=(O*C-s*U)*L;N=(N*U-s*C)*L;return O>0&&N>0&&O+N<1}var f,d,j,k,q,l,o,y,c,B,
+v,u=a.geometry,J=u.vertices,R=[];f=0;for(d=u.faces.length;f<d;f++){j=u.faces[f];B=this.origin.clone();v=this.direction.clone();k=a.matrix.multiplyVector3(J[j.a].position.clone());q=a.matrix.multiplyVector3(J[j.b].position.clone());l=a.matrix.multiplyVector3(J[j.c].position.clone());o=j instanceof THREE.Face4?a.matrix.multiplyVector3(J[j.d].position.clone()):null;y=a.rotationMatrix.multiplyVector3(j.normal.clone());c=v.dot(y);if(c<0){y=y.dot((new THREE.Vector3).sub(k,B))/c;B=B.addSelf(v.multiplyScalar(y));
+if(j instanceof THREE.Face3){if(b(B,k,q,l)){j={distance:this.origin.distanceTo(B),point:B,face:j,object:a};R.push(j)}}else if(j instanceof THREE.Face4)if(b(B,k,q,o)||b(B,q,l,o)){j={distance:this.origin.distanceTo(B),point:B,face:j,object:a};R.push(j)}}}return R}};
+THREE.Rectangle=function(){function a(){k=d-b;q=j-f}var b,f,d,j,k,q,l=true;this.getX=function(){return b};this.getY=function(){return f};this.getWidth=function(){return k};this.getHeight=function(){return q};this.getLeft=function(){return b};this.getTop=function(){return f};this.getRight=function(){return d};this.getBottom=function(){return j};this.set=function(o,y,c,B){l=false;b=o;f=y;d=c;j=B;a()};this.addPoint=function(o,y){if(l){l=false;b=o;f=y;d=o;j=y}else{b=b<o?b:o;f=f<y?f:y;d=d>o?d:o;j=j>y?
+j:y}a()};this.add3Points=function(o,y,c,B,v,u){if(l){l=false;b=o<c?o<v?o:v:c<v?c:v;f=y<B?y<u?y:u:B<u?B:u;d=o>c?o>v?o:v:c>v?c:v;j=y>B?y>u?y:u:B>u?B:u}else{b=o<c?o<v?o<b?o:b:v<b?v:b:c<v?c<b?c:b:v<b?v:b;f=y<B?y<u?y<f?y:f:u<f?u:f:B<u?B<f?B:f:u<f?u:f;d=o>c?o>v?o>d?o:d:v>d?v:d:c>v?c>d?c:d:v>d?v:d;j=y>B?y>u?y>j?y:j:u>j?u:j:B>u?B>j?B:j:u>j?u:j}a()};this.addRectangle=function(o){if(l){l=false;b=o.getLeft();f=o.getTop();d=o.getRight();j=o.getBottom()}else{b=b<o.getLeft()?b:o.getLeft();f=f<o.getTop()?f:o.getTop();
+d=d>o.getRight()?d:o.getRight();j=j>o.getBottom()?j:o.getBottom()}a()};this.inflate=function(o){b-=o;f-=o;d+=o;j+=o;a()};this.minSelf=function(o){b=b>o.getLeft()?b:o.getLeft();f=f>o.getTop()?f:o.getTop();d=d<o.getRight()?d:o.getRight();j=j<o.getBottom()?j:o.getBottom();a()};this.instersects=function(o){return Math.min(d,o.getRight())-Math.max(b,o.getLeft())>=0&&Math.min(j,o.getBottom())-Math.max(f,o.getTop())>=0};this.empty=function(){l=true;j=d=f=b=0;a()};this.isEmpty=function(){return l};this.toString=
+function(){return"THREE.Rectangle ( left: "+b+", right: "+d+", top: "+f+", bottom: "+j+", width: "+k+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
+THREE.Matrix4=function(a,b,f,d,j,k,q,l,o,y,c,B,v,u,J,R){this.n11=a||1;this.n12=b||0;this.n13=f||0;this.n14=d||0;this.n21=j||0;this.n22=k||1;this.n23=q||0;this.n24=l||0;this.n31=o||0;this.n32=y||0;this.n33=c||1;this.n34=B||0;this.n41=v||0;this.n42=u||0;this.n43=J||0;this.n44=R||1};
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,f,d,j,k,q,l,o,y,c,B,v,u,J,R){this.n11=a;this.n12=b;this.n13=f;this.n14=d;this.n21=j;this.n22=k;this.n23=q;this.n24=l;this.n31=o;this.n32=y;this.n33=c;this.n34=B;this.n41=v;this.n42=u;this.n43=J;this.n44=R;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
+a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,f){var d=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3;k.sub(a,b).normalize();d.cross(f,k).normalize();j.cross(k,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=j.x;this.n22=j.y;this.n23=j.z;this.n24=-j.dot(a);this.n31=k.x;
+this.n32=k.y;this.n33=k.z;this.n34=-k.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,f=a.y,d=a.z,j=1/(this.n41*b+this.n42*f+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*f+this.n13*d+this.n14)*j;a.y=(this.n21*b+this.n22*f+this.n23*d+this.n24)*j;a.z=(this.n31*b+this.n32*f+this.n33*d+this.n34)*j;return a},multiplyVector4:function(a){var b=a.x,f=a.y,d=a.z,j=a.w;a.x=this.n11*b+this.n12*f+this.n13*d+this.n14*j;a.y=this.n21*b+this.n22*f+this.n23*d+this.n24*
+j;a.z=this.n31*b+this.n32*f+this.n33*d+this.n34*j;a.w=this.n41*b+this.n42*f+this.n43*d+this.n44*j;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},multiply:function(a,b){var f=a.n11,d=a.n12,j=a.n13,k=a.n14,q=a.n21,l=a.n22,o=a.n23,y=a.n24,c=a.n31,B=a.n32,
+v=a.n33,u=a.n34,J=a.n41,R=a.n42,N=a.n43,s=a.n44,U=b.n11,C=b.n12,L=b.n13,O=b.n14,Q=b.n21,e=b.n22,h=b.n23,m=b.n24,i=b.n31,n=b.n32,g=b.n33,p=b.n34,r=b.n41,E=b.n42,M=b.n43,H=b.n44;this.n11=f*U+d*Q+j*i+k*r;this.n12=f*C+d*e+j*n+k*E;this.n13=f*L+d*h+j*g+k*M;this.n14=f*O+d*m+j*p+k*H;this.n21=q*U+l*Q+o*i+y*r;this.n22=q*C+l*e+o*n+y*E;this.n23=q*L+l*h+o*g+y*M;this.n24=q*O+l*m+o*p+y*H;this.n31=c*U+B*Q+v*i+u*r;this.n32=c*C+B*e+v*n+u*E;this.n33=c*L+B*h+v*g+u*M;this.n34=c*O+B*m+v*p+u*H;this.n41=J*U+R*Q+N*i+s*r;
+this.n42=J*C+R*e+N*n+s*E;this.n43=J*L+R*h+N*g+s*M;this.n44=J*O+R*m+N*p+s*H;return this},multiplySelf:function(a){var b=this.n11,f=this.n12,d=this.n13,j=this.n14,k=this.n21,q=this.n22,l=this.n23,o=this.n24,y=this.n31,c=this.n32,B=this.n33,v=this.n34,u=this.n41,J=this.n42,R=this.n43,N=this.n44,s=a.n11,U=a.n21,C=a.n31,L=a.n41,O=a.n12,Q=a.n22,e=a.n32,h=a.n42,m=a.n13,i=a.n23,n=a.n33,g=a.n43,p=a.n14,r=a.n24,E=a.n34;a=a.n44;this.n11=b*s+f*U+d*C+j*L;this.n12=b*O+f*Q+d*e+j*h;this.n13=b*m+f*i+d*n+j*g;this.n14=
+b*p+f*r+d*E+j*a;this.n21=k*s+q*U+l*C+o*L;this.n22=k*O+q*Q+l*e+o*h;this.n23=k*m+q*i+l*n+o*g;this.n24=k*p+q*r+l*E+o*a;this.n31=y*s+c*U+B*C+v*L;this.n32=y*O+c*Q+B*e+v*h;this.n33=y*m+c*i+B*n+v*g;this.n34=y*p+c*r+B*E+v*a;this.n41=u*s+J*U+R*C+N*L;this.n42=u*O+J*Q+R*e+N*h;this.n43=u*m+J*i+R*n+N*g;this.n44=u*p+J*r+R*E+N*a;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},determinant:function(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*
+this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,f,d){var j=b[f];b[f]=b[d];
+b[d]=j}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
+this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,f){var d=new THREE.Matrix4;d.n14=a;d.n24=b;d.n34=f;return d};
+THREE.Matrix4.scaleMatrix=function(a,b,f){var d=new THREE.Matrix4;d.n11=a;d.n22=b;d.n33=f;return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b};
+THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var f=new THREE.Matrix4,d=Math.cos(b),j=Math.sin(b),k=1-d,q=a.x,l=a.y,o=a.z;f.n11=k*q*q+d;f.n12=k*q*l-j*o;f.n13=k*q*o+j*l;f.n21=k*q*l+j*o;f.n22=k*l*l+d;f.n23=k*l*o-j*q;f.n31=k*q*o-j*l;f.n32=k*l*o+j*q;f.n33=k*o*o+d;return f};
+THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;b.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;b.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;b.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12*
+a.n23*a.n34;b.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;b.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;b.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;b.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;b.n31=a.n22*a.n34*a.n41-a.n24*a.n32*
+a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;b.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;b.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;b.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;b.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22*
+a.n31*a.n43-a.n21*a.n32*a.n43;b.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;b.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;b.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var f=b[10]*b[5]-b[6]*b[9],d=-b[10]*b[1]+b[2]*b[9],j=b[6]*b[1]-b[2]*b[5],k=-b[10]*b[4]+b[6]*b[8],q=b[10]*b[0]-b[2]*b[8],l=-b[6]*b[0]+b[2]*b[4],o=b[9]*b[4]-b[5]*b[8],y=-b[9]*b[0]+b[1]*b[8],c=b[5]*b[0]-b[1]*b[4];b=b[0]*f+b[1]*k+b[2]*o;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*f;a.m[1]=b*d;a.m[2]=b*j;a.m[3]=b*k;a.m[4]=b*q;a.m[5]=b*l;a.m[6]=b*o;a.m[7]=b*y;a.m[8]=b*c;return a};
+THREE.Matrix4.makeFrustum=function(a,b,f,d,j,k){var q,l,o;q=new THREE.Matrix4;l=2*j/(b-a);o=2*j/(d-f);a=(b+a)/(b-a);f=(d+f)/(d-f);d=-(k+j)/(k-j);j=-2*k*j/(k-j);q.n11=l;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=o;q.n23=f;q.n24=0;q.n31=0;q.n32=0;q.n33=d;q.n34=j;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,b,f,d){var j;a=f*Math.tan(a*Math.PI/360);j=-a;return THREE.Matrix4.makeFrustum(j*b,a*b,j,a,f,d)};
+THREE.Matrix4.makeOrtho=function(a,b,f,d,j,k){var q,l,o,y;q=new THREE.Matrix4;l=b-a;o=f-d;y=k-j;a=(b+a)/l;f=(f+d)/o;j=(k+j)/y;q.n11=2/l;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/o;q.n23=0;q.n24=-f;q.n31=0;q.n32=0;q.n33=-2/y;q.n34=-j;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};
+THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
+THREE.Face3=function(a,b,f,d,j){this.a=a;this.b=b;this.c=f;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=j instanceof Array?j:[j]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,b,f,d,j,k){this.a=a;this.b=b;this.c=f;this.d=d;this.centroid=new THREE.Vector3;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.material=k instanceof Array?k:[k]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
+THREE.Geometry.prototype={computeCentroids:function(){var a,b,f;a=0;for(b=this.faces.length;a<b;a++){f=this.faces[a];f.centroid.set(0,0,0);if(f instanceof THREE.Face3){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);f.centroid.divideScalar(3)}else if(f instanceof THREE.Face4){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);
+f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,f,d,j,k,q,l=new THREE.Vector3,o=new THREE.Vector3;d=0;for(j=this.vertices.length;d<j;d++){k=this.vertices[d];k.normal.set(0,0,0)}d=0;for(j=this.faces.length;d<j;d++){k=this.faces[d];if(a&&k.vertexNormals.length){l.set(0,0,0);b=0;for(f=k.normal.length;b<f;b++)l.addSelf(k.vertexNormals[b]);l.divideScalar(3)}else{b=this.vertices[k.a];f=this.vertices[k.b];q=this.vertices[k.c];l.sub(q.position,
+f.position);o.sub(b.position,f.position);l.crossSelf(o)}l.isZero()||l.normalize();k.normal.copy(l)}},computeVertexNormals:function(){var a,b=[],f,d;a=0;for(vl=this.vertices.length;a<vl;a++)b[a]=new THREE.Vector3;a=0;for(f=this.faces.length;a<f;a++){d=this.faces[a];if(d instanceof THREE.Face3){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal);b[d.d].addSelf(d.normal)}}a=
+0;for(vl=this.vertices.length;a<vl;a++)b[a].normalize();a=0;for(f=this.faces.length;a<f;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone()}else if(d instanceof THREE.Face4){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone();d.vertexNormals[3]=b[d.d].clone()}}},computeTangents:function(){function a(p,r,E,M){k=p.vertices[r].position;q=p.vertices[E].position;
+l=p.vertices[M].position;o=j[0];y=j[1];c=j[2];B=q.x-k.x;v=l.x-k.x;u=q.y-k.y;J=l.y-k.y;R=q.z-k.z;N=l.z-k.z;s=y.u-o.u;U=c.u-o.u;C=y.v-o.v;L=c.v-o.v;O=1/(s*L-U*C);m.set((L*B-C*v)*O,(L*u-C*J)*O,(L*R-C*N)*O);i.set((s*v-U*B)*O,(s*J-U*u)*O,(s*N-U*R)*O);e[r].addSelf(m);e[E].addSelf(m);e[M].addSelf(m);h[r].addSelf(i);h[E].addSelf(i);h[M].addSelf(i)}var b,f,d,j,k,q,l,o,y,c,B,v,u,J,R,N,s,U,C,L,O,Q,e=[],h=[],m=new THREE.Vector3,i=new THREE.Vector3,n=new THREE.Vector3,g=new THREE.Vector3;Q=new THREE.Vector3;b=
+0;for(f=this.vertices.length;b<f;b++){e[b]=new THREE.Vector3;h[b]=new THREE.Vector3}b=0;for(f=this.faces.length;b<f;b++){d=this.faces[b];j=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);
+this.vertices[d.c].normal.copy(d.vertexNormals[2]);this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(f=this.vertices.length;b<f;b++){Q.copy(this.vertices[b].normal);d=e[b];n.copy(d);n.subSelf(Q.multiplyScalar(Q.dot(d))).normalize();g.cross(this.vertices[b].normal,d);test=g.dot(h[b]);d=test<0?-1:1;this.vertices[b].tangent.set(n.x,n.y,n.z,d)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.bbox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
+y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,f=this.vertices.length;b<f;b++){a=this.vertices[b];if(a.position.x<this.bbox.x[0])this.bbox.x[0]=a.position.x;else if(a.position.x>this.bbox.x[1])this.bbox.x[1]=a.position.x;if(a.position.y<this.bbox.y[0])this.bbox.y[0]=a.position.y;else if(a.position.y>this.bbox.y[1])this.bbox.y[1]=a.position.y;if(a.position.z<this.bbox.z[0])this.bbox.z[0]=a.position.z;else if(a.position.z>
+this.bbox.z[1])this.bbox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,f=this.vertices.length;b<f;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(c){var B=[];b=0;for(f=c.length;b<f;b++)c[b]==undefined?B.push("undefined"):B.push(c[b].toString());return B.join("_")}var b,f,d,j,k,q,l,o,y={};d=0;for(j=this.faces.length;d<j;d++){k=this.faces[d];q=
+k.material;l=a(q);if(y[l]==undefined)y[l]={hash:l,counter:0};o=y[l].hash+"_"+y[l].counter;if(this.geometryChunks[o]==undefined)this.geometryChunks[o]={faces:[],material:q,vertices:0};k=k instanceof THREE.Face3?3:4;if(this.geometryChunks[o].vertices+k>65535){y[l].counter+=1;o=y[l].hash+"_"+y[l].counter;if(this.geometryChunks[o]==undefined)this.geometryChunks[o]={faces:[],material:q,vertices:0}}this.geometryChunks[o].faces.push(d);this.geometryChunks[o].vertices+=k}},toString:function(){return"THREE.Geometry ( vertices: "+
+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
+THREE.Camera=function(a,b,f,d){this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,b,f,d);this.autoUpdateMatrix=true;this.translateX=function(j){j=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(j);j.cross(j.clone(),this.up);this.position.addSelf(j);this.target.position.addSelf(j)};this.translateZ=function(j){j=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(j);
+this.position.subSelf(j);this.target.position.subSelf(j)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.toString=function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
+THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.PointLight;
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.translationMatrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.scaleMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.autoUpdateMatrix=this.visible=true;this.updateMatrix=function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);
+this.rotationMatrix=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.scaleMatrix=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.rotationMatrix);this.matrix.multiplySelf(this.scaleMatrix)}};THREE.Object3DCounter={value:0};
+THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b]};THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
+THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}this.toString=function(){return"THREE.LineBasicMaterial (<br/>color: "+
+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
+a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=
+a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+
+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
+a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=
+a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+
+this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap=
+"round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
+a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=
+a.wireframe_linejoin}this.toString=function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>"+ +")"}};THREE.MeshPhongMaterialCounter={value:0};
+THREE.MeshDepthMaterial=function(a){this.near=1;this.far=1E3;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.near!==undefined)this.near=a.near;if(a.far!==undefined)this.far=a.far;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.__2near=2*this.near;this.__farPlusNear=this.far+this.near;this.__farMinusNear=
+this.far-this.near;this.toString=function(){return"THREE.MeshDepthMaterial"}};THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){this.toString=function(){return"THREE.MeshFaceMaterial"}};
+THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==
+undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}this.toString=function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+
+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
+THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+
+this.blending+"<br/>)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.toString=function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
+THREE.ParticleDOMMaterial=function(a){this.domElement=a;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
+THREE.Texture=function(a,b,f,d,j,k){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=f!==undefined?f:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=j!==undefined?j:THREE.LinearFilter;this.min_filter=k!==undefined?k:THREE.LinearMipMapLinearFilter;this.toString=function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+
+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;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.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
+THREE.Fog=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
+THREE.Projector=function(){function a(e,h){return h.z-e.z}function b(e,h){var m=0,i=1,n=e.z+e.w,g=h.z+h.w,p=-e.z+e.w,r=-h.z+h.w;if(n>=0&&g>=0&&p>=0&&r>=0)return true;else if(n<0&&g<0||p<0&&r<0)return false;else{if(n<0)m=Math.max(m,n/(n-g));else if(g<0)i=Math.min(i,n/(n-g));if(p<0)m=Math.max(m,p/(p-r));else if(r<0)i=Math.min(i,p/(p-r));if(i<m)return false;else{e.lerpSelf(h,m);h.lerpSelf(e,1-i);return true}}}var f,d,j=[],k,q,l,o=[],y,c,B=[],v,u,J=[],R=new THREE.Vector4,N=new THREE.Vector4,s=new THREE.Matrix4,
+U=new THREE.Matrix4,C=[],L=new THREE.Vector4,O=new THREE.Vector4,Q;this.projectObjects=function(e,h,m){var i=[],n,g;d=0;s.multiply(h.projectionMatrix,h.matrix);C[0]=new THREE.Vector4(s.n41-s.n11,s.n42-s.n12,s.n43-s.n13,s.n44-s.n14);C[1]=new THREE.Vector4(s.n41+s.n11,s.n42+s.n12,s.n43+s.n13,s.n44+s.n14);C[2]=new THREE.Vector4(s.n41+s.n21,s.n42+s.n22,s.n43+s.n23,s.n44+s.n24);C[3]=new THREE.Vector4(s.n41-s.n21,s.n42-s.n22,s.n43-s.n23,s.n44-s.n24);C[4]=new THREE.Vector4(s.n41-s.n31,s.n42-s.n32,s.n43-
+s.n33,s.n44-s.n34);C[5]=new THREE.Vector4(s.n41+s.n31,s.n42+s.n32,s.n43+s.n33,s.n44+s.n34);h=0;for(n=C.length;h<n;h++){g=C[h];g.divideScalar(Math.sqrt(g.x*g.x+g.y*g.y+g.z*g.z))}n=e.objects;e=0;for(h=n.length;e<h;e++){g=n[e];var p;if(!(p=!g.visible)){if(p=g instanceof THREE.Mesh){a:{p=void 0;for(var r=g.position,E=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),M=0;M<6;M++){p=C[M].x*r.x+C[M].y*r.y+C[M].z*r.z+C[M].w;if(p<=E){p=false;break a}}p=true}p=!p}p=p}if(!p){f=
+j[d]=j[d]||new THREE.RenderableObject;R.copy(g.position);s.multiplyVector3(R);f.object=g;f.z=R.z;i.push(f);d++}}m&&i.sort(a);return i};this.projectScene=function(e,h,m){var i=[],n,g,p,r,E,M,H,z,T,F,S,D,w,x,K,G;l=c=u=0;h.autoUpdateMatrix&&h.updateMatrix();s.multiply(h.projectionMatrix,h.matrix);M=this.projectObjects(e,h,true);e=0;for(n=M.length;e<n;e++){H=M[e].object;if(H.visible){H.autoUpdateMatrix&&H.updateMatrix();z=H.matrix;T=H.rotationMatrix;F=H.material;S=H.overdraw;if(H instanceof THREE.Mesh){D=
+H.geometry;w=D.vertices;g=0;for(p=w.length;g<p;g++){x=w[g];x.positionWorld.copy(x.position);z.multiplyVector3(x.positionWorld);r=x.positionScreen;r.copy(x.positionWorld);s.multiplyVector4(r);r.multiplyScalar(1/r.w);x.__visible=r.z>0&&r.z<1}D=D.faces;g=0;for(p=D.length;g<p;g++){x=D[g];if(x instanceof THREE.Face3){r=w[x.a];E=w[x.b];K=w[x.c];if(r.__visible&&E.__visible&&K.__visible)if(H.doubleSided||H.flipSided!=(K.positionScreen.x-r.positionScreen.x)*(E.positionScreen.y-r.positionScreen.y)-(K.positionScreen.y-
+r.positionScreen.y)*(E.positionScreen.x-r.positionScreen.x)<0){k=o[l]=o[l]||new THREE.RenderableFace3;k.v1.positionWorld.copy(r.positionWorld);k.v2.positionWorld.copy(E.positionWorld);k.v3.positionWorld.copy(K.positionWorld);k.v1.positionScreen.copy(r.positionScreen);k.v2.positionScreen.copy(E.positionScreen);k.v3.positionScreen.copy(K.positionScreen);k.normalWorld.copy(x.normal);T.multiplyVector3(k.normalWorld);k.centroidWorld.copy(x.centroid);z.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);
+s.multiplyVector3(k.centroidScreen);K=x.vertexNormals;Q=k.vertexNormalsWorld;r=0;for(E=K.length;r<E;r++){G=Q[r]=Q[r]||new THREE.Vector3;G.copy(K[r]);T.multiplyVector3(G)}k.z=k.centroidScreen.z;k.meshMaterial=F;k.faceMaterial=x.material;k.overdraw=S;if(H.geometry.uvs[g]){k.uvs[0]=H.geometry.uvs[g][0];k.uvs[1]=H.geometry.uvs[g][1];k.uvs[2]=H.geometry.uvs[g][2]}i.push(k);l++}}else if(x instanceof THREE.Face4){r=w[x.a];E=w[x.b];K=w[x.c];G=w[x.d];if(r.__visible&&E.__visible&&K.__visible&&G.__visible)if(H.doubleSided||
+H.flipSided!=((G.positionScreen.x-r.positionScreen.x)*(E.positionScreen.y-r.positionScreen.y)-(G.positionScreen.y-r.positionScreen.y)*(E.positionScreen.x-r.positionScreen.x)<0||(E.positionScreen.x-K.positionScreen.x)*(G.positionScreen.y-K.positionScreen.y)-(E.positionScreen.y-K.positionScreen.y)*(G.positionScreen.x-K.positionScreen.x)<0)){k=o[l]=o[l]||new THREE.RenderableFace3;k.v1.positionWorld.copy(r.positionWorld);k.v2.positionWorld.copy(E.positionWorld);k.v3.positionWorld.copy(G.positionWorld);
+k.v1.positionScreen.copy(r.positionScreen);k.v2.positionScreen.copy(E.positionScreen);k.v3.positionScreen.copy(G.positionScreen);k.normalWorld.copy(x.normal);T.multiplyVector3(k.normalWorld);k.centroidWorld.copy(x.centroid);z.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);s.multiplyVector3(k.centroidScreen);k.z=k.centroidScreen.z;k.meshMaterial=F;k.faceMaterial=x.material;k.overdraw=S;if(H.geometry.uvs[g]){k.uvs[0]=H.geometry.uvs[g][0];k.uvs[1]=H.geometry.uvs[g][1];k.uvs[2]=
+H.geometry.uvs[g][3]}i.push(k);l++;q=o[l]=o[l]||new THREE.RenderableFace3;q.v1.positionWorld.copy(E.positionWorld);q.v2.positionWorld.copy(K.positionWorld);q.v3.positionWorld.copy(G.positionWorld);q.v1.positionScreen.copy(E.positionScreen);q.v2.positionScreen.copy(K.positionScreen);q.v3.positionScreen.copy(G.positionScreen);q.normalWorld.copy(k.normalWorld);q.centroidWorld.copy(k.centroidWorld);q.centroidScreen.copy(k.centroidScreen);q.z=q.centroidScreen.z;q.meshMaterial=F;q.faceMaterial=x.material;
+q.overdraw=S;if(H.geometry.uvs[g]){q.uvs[0]=H.geometry.uvs[g][1];q.uvs[1]=H.geometry.uvs[g][2];q.uvs[2]=H.geometry.uvs[g][3]}i.push(q);l++}}}}else if(H instanceof THREE.Line){U.multiply(s,z);w=H.geometry.vertices;x=w[0];x.positionScreen.copy(x.position);U.multiplyVector4(x.positionScreen);g=1;for(p=w.length;g<p;g++){r=w[g];r.positionScreen.copy(r.position);U.multiplyVector4(r.positionScreen);E=w[g-1];L.copy(r.positionScreen);O.copy(E.positionScreen);if(b(L,O)){L.multiplyScalar(1/L.w);O.multiplyScalar(1/
+O.w);y=B[c]=B[c]||new THREE.RenderableLine;y.v1.positionScreen.copy(L);y.v2.positionScreen.copy(O);y.z=Math.max(L.z,O.z);y.material=H.material;i.push(y);c++}}}else if(H instanceof THREE.Particle){N.set(H.position.x,H.position.y,H.position.z,1);s.multiplyVector4(N);N.z/=N.w;if(N.z>0&&N.z<1){v=J[u]=J[u]||new THREE.RenderableParticle;v.x=N.x/N.w;v.y=N.y/N.w;v.z=N.z;v.rotation=H.rotation.z;v.scale.x=H.scale.x*Math.abs(v.x-(N.x+h.projectionMatrix.n11)/(N.w+h.projectionMatrix.n14));v.scale.y=H.scale.y*
+Math.abs(v.y-(N.y+h.projectionMatrix.n22)/(N.w+h.projectionMatrix.n24));v.material=H.material;i.push(v);u++}}}}m&&i.sort(a);return i};this.unprojectVector=function(e,h){var m=new THREE.Matrix4;m.multiply(THREE.Matrix4.makeInvert(h.matrix),THREE.Matrix4.makeInvert(h.projectionMatrix));m.multiplyVector3(e);return e}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,f,d,j,k;this.domElement=document.createElement("div");this.setSize=function(q,l){f=q;d=l;j=f/2;k=d/2};this.render=function(q,l){var o,y,c,B,v,u,J,R;a=b.projectScene(q,l);o=0;for(y=a.length;o<y;o++){v=a[o];if(v instanceof THREE.RenderableParticle){J=v.x*j+j;R=v.y*k+k;c=0;for(B=v.material.length;c<B;c++){u=v.material[c];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=J+"px";u.style.top=R+"px"}}}}}};
+THREE.CanvasRenderer=function(){var a=null,b=new THREE.Projector,f=document.createElement("canvas"),d,j,k,q,l=f.getContext("2d"),o=1,y=0,c=null,B=null,v=1,u,J,R,N,s,U,C,L,O,Q=new THREE.Color,e=new THREE.Color,h=new THREE.Color,m=new THREE.Color,i=new THREE.Color,n,g,p,r,E,M,H,z,T,F,S=new THREE.Rectangle,D=new THREE.Rectangle,w=new THREE.Rectangle,x=false,K=new THREE.Color,G=new THREE.Color,W=new THREE.Color,ba=new THREE.Color,Ka=Math.PI*2,Y=new THREE.Vector3,oa,pa,Ba,ea,qa,ua,ma=16;oa=document.createElement("canvas");
+oa.width=oa.height=2;pa=oa.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);Ba=pa.getImageData(0,0,2,2);ea=Ba.data;qa=document.createElement("canvas");qa.width=qa.height=ma;ua=qa.getContext("2d");ua.translate(-ma/2,-ma/2);ua.scale(ma,ma);ma--;this.domElement=f;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ha,va){d=ha;j=va;k=d/2;q=j/2;f.width=d;f.height=j;S.set(-k,-q,k,q)};this.clear=function(){if(!D.isEmpty()){D.inflate(1);D.minSelf(S);l.clearRect(D.getX(),
+D.getY(),D.getWidth(),D.getHeight());D.empty()}};this.render=function(ha,va){function La(t){var V,P,A,I=t.lights;G.setRGB(0,0,0);W.setRGB(0,0,0);ba.setRGB(0,0,0);t=0;for(V=I.length;t<V;t++){P=I[t];A=P.color;if(P instanceof THREE.AmbientLight){G.r+=A.r;G.g+=A.g;G.b+=A.b}else if(P instanceof THREE.DirectionalLight){W.r+=A.r;W.g+=A.g;W.b+=A.b}else if(P instanceof THREE.PointLight){ba.r+=A.r;ba.g+=A.g;ba.b+=A.b}}}function wa(t,V,P,A){var I,X,$,ca,da=t.lights;t=0;for(I=da.length;t<I;t++){X=da[t];$=X.color;
+ca=X.intensity;if(X instanceof THREE.DirectionalLight){X=P.dot(X.position)*ca;if(X>0){A.r+=$.r*X;A.g+=$.g*X;A.b+=$.b*X}}else if(X instanceof THREE.PointLight){Y.sub(X.position,V);Y.normalize();X=P.dot(Y)*ca;if(X>0){A.r+=$.r*X;A.g+=$.g*X;A.b+=$.b*X}}}}function Ma(t,V,P){if(P.opacity!=0){Ca(P.opacity);xa(P.blending);var A,I,X,$,ca,da;if(P instanceof THREE.ParticleBasicMaterial){if(P.map){$=P.map;ca=$.width>>1;da=$.height>>1;I=V.scale.x*k;X=V.scale.y*q;P=I*ca;A=X*da;w.set(t.x-P,t.y-A,t.x+P,t.y+A);if(!S.instersects(w))return;
+l.save();l.translate(t.x,t.y);l.rotate(-V.rotation);l.scale(I,-X);l.translate(-ca,-da);l.drawImage($,0,0);l.restore()}l.beginPath();l.moveTo(t.x-10,t.y);l.lineTo(t.x+10,t.y);l.moveTo(t.x,t.y-10);l.lineTo(t.x,t.y+10);l.closePath();l.strokeStyle="rgb(255,255,0)";l.stroke()}else if(P instanceof THREE.ParticleCircleMaterial){if(x){K.r=G.r+W.r+ba.r;K.g=G.g+W.g+ba.g;K.b=G.b+W.b+ba.b;Q.r=P.color.r*K.r;Q.g=P.color.g*K.g;Q.b=P.color.b*K.b;Q.updateStyleString()}else Q.__styleString=P.color.__styleString;P=
+V.scale.x*k;A=V.scale.y*q;w.set(t.x-P,t.y-A,t.x+P,t.y+A);if(S.instersects(w)){I=Q.__styleString;if(B!=I)l.fillStyle=B=I;l.save();l.translate(t.x,t.y);l.rotate(-V.rotation);l.scale(P,A);l.beginPath();l.arc(0,0,1,0,Ka,true);l.closePath();l.fill();l.restore()}}}}function Na(t,V,P,A){if(A.opacity!=0){Ca(A.opacity);xa(A.blending);l.beginPath();l.moveTo(t.positionScreen.x,t.positionScreen.y);l.lineTo(V.positionScreen.x,V.positionScreen.y);l.closePath();if(A instanceof THREE.LineBasicMaterial){Q.__styleString=
+A.color.__styleString;t=A.linewidth;if(v!=t)l.lineWidth=v=t;t=Q.__styleString;if(c!=t)l.strokeStyle=c=t;l.stroke();w.inflate(A.linewidth*2)}}}function Ga(t,V,P,A,I,X){if(I.opacity!=0){Ca(I.opacity);xa(I.blending);N=t.positionScreen.x;s=t.positionScreen.y;U=V.positionScreen.x;C=V.positionScreen.y;L=P.positionScreen.x;O=P.positionScreen.y;l.beginPath();l.moveTo(N,s);l.lineTo(U,C);l.lineTo(L,O);l.lineTo(N,s);l.closePath();if(I instanceof THREE.MeshBasicMaterial)if(I.map)I.map.image.loaded&&I.map.mapping instanceof
+THREE.UVMapping&&ra(N,s,U,C,L,O,I.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);else if(I.env_map){if(I.env_map.image.loaded)if(I.env_map.mapping instanceof THREE.SphericalReflectionMapping){t=va.matrix;Y.copy(A.vertexNormalsWorld[0]);E=(Y.x*t.n11+Y.y*t.n12+Y.z*t.n13)*0.5+0.5;M=-(Y.x*t.n21+Y.y*t.n22+Y.z*t.n23)*0.5+0.5;Y.copy(A.vertexNormalsWorld[1]);H=(Y.x*t.n11+Y.y*t.n12+Y.z*t.n13)*0.5+0.5;z=-(Y.x*t.n21+Y.y*t.n22+Y.z*t.n23)*0.5+0.5;Y.copy(A.vertexNormalsWorld[2]);T=
+(Y.x*t.n11+Y.y*t.n12+Y.z*t.n13)*0.5+0.5;F=-(Y.x*t.n21+Y.y*t.n22+Y.z*t.n23)*0.5+0.5;ra(N,s,U,C,L,O,I.env_map.image,E,M,H,z,T,F)}}else I.wireframe?ya(I.color.__styleString,I.wireframe_linewidth):za(I.color.__styleString);else if(I instanceof THREE.MeshLambertMaterial){if(I.map&&!I.wireframe){I.map.mapping instanceof THREE.UVMapping&&ra(N,s,U,C,L,O,I.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);xa(THREE.SubtractiveBlending)}if(x)if(!I.wireframe&&I.shading==THREE.SmoothShading&&
+A.vertexNormalsWorld.length==3){e.r=h.r=m.r=G.r;e.g=h.g=m.g=G.g;e.b=h.b=m.b=G.b;wa(X,A.v1.positionWorld,A.vertexNormalsWorld[0],e);wa(X,A.v2.positionWorld,A.vertexNormalsWorld[1],h);wa(X,A.v3.positionWorld,A.vertexNormalsWorld[2],m);i.r=(h.r+m.r)*0.5;i.g=(h.g+m.g)*0.5;i.b=(h.b+m.b)*0.5;r=Ha(e,h,m,i);ra(N,s,U,C,L,O,r,0,0,1,0,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.b;wa(X,A.centroidWorld,A.normalWorld,K);Q.r=I.color.r*K.r;Q.g=I.color.g*K.g;Q.b=I.color.b*K.b;Q.updateStyleString();I.wireframe?ya(Q.__styleString,
+I.wireframe_linewidth):za(Q.__styleString)}else I.wireframe?ya(I.color.__styleString,I.wireframe_linewidth):za(I.color.__styleString)}else if(I instanceof THREE.MeshDepthMaterial){n=I.__2near;g=I.__farPlusNear;p=I.__farMinusNear;e.r=e.g=e.b=1-n/(g-t.positionScreen.z*p);h.r=h.g=h.b=1-n/(g-V.positionScreen.z*p);m.r=m.g=m.b=1-n/(g-P.positionScreen.z*p);i.r=(h.r+m.r)*0.5;i.g=(h.g+m.g)*0.5;i.b=(h.b+m.b)*0.5;r=Ha(e,h,m,i);ra(N,s,U,C,L,O,r,0,0,1,0,0,1)}else if(I instanceof THREE.MeshNormalMaterial){Q.r=
+Da(A.normalWorld.x);Q.g=Da(A.normalWorld.y);Q.b=Da(A.normalWorld.z);Q.updateStyleString();I.wireframe?ya(Q.__styleString,I.wireframe_linewidth):za(Q.__styleString)}}}function ya(t,V){if(c!=t)l.strokeStyle=c=t;if(v!=V)l.lineWidth=v=V;l.stroke();w.inflate(V*2)}function za(t){if(B!=t)l.fillStyle=B=t;l.fill()}function ra(t,V,P,A,I,X,$,ca,da,ia,fa,ja,sa){var la,ka;la=$.width-1;ka=$.height-1;ca*=la;da*=ka;ia*=la;fa*=ka;ja*=la;sa*=ka;P-=t;A-=V;I-=t;X-=V;ia-=ca;fa-=da;ja-=ca;sa-=da;ka=1/(ia*sa-ja*fa);la=
+(sa*P-fa*I)*ka;fa=(sa*A-fa*X)*ka;P=(ia*I-ja*P)*ka;A=(ia*X-ja*A)*ka;t=t-la*ca-P*da;V=V-fa*ca-A*da;l.save();l.transform(la,fa,P,A,t,V);l.clip();l.drawImage($,0,0);l.restore()}function Ca(t){if(o!=t)l.globalAlpha=o=t}function xa(t){if(y!=t){switch(t){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}y=t}}function Ha(t,V,P,A){var I=~~(t.r*255),
+X=~~(t.g*255);t=~~(t.b*255);var $=~~(V.r*255),ca=~~(V.g*255);V=~~(V.b*255);var da=~~(P.r*255),ia=~~(P.g*255);P=~~(P.b*255);var fa=~~(A.r*255),ja=~~(A.g*255);A=~~(A.b*255);ea[0]=I<0?0:I>255?255:I;ea[1]=X<0?0:X>255?255:X;ea[2]=t<0?0:t>255?255:t;ea[4]=$<0?0:$>255?255:$;ea[5]=ca<0?0:ca>255?255:ca;ea[6]=V<0?0:V>255?255:V;ea[8]=da<0?0:da>255?255:da;ea[9]=ia<0?0:ia>255?255:ia;ea[10]=P<0?0:P>255?255:P;ea[12]=fa<0?0:fa>255?255:fa;ea[13]=ja<0?0:ja>255?255:ja;ea[14]=A<0?0:A>255?255:A;pa.putImageData(Ba,0,0);
+ua.drawImage(oa,0,0);return qa}function Da(t){t=(t+1)*0.5;return t<0?0:t>1?1:t}function Ea(t,V){var P=V.x-t.x,A=V.y-t.y,I=1/Math.sqrt(P*P+A*A);P*=I;A*=I;V.x+=P;V.y+=A;t.x-=P;t.y-=A}var Aa,Ia,Z,ga,na,Fa,Ja,ta;l.setTransform(1,0,0,-1,k,q);this.autoClear&&this.clear();a=b.projectScene(ha,va,this.sortElements);l.fillStyle="rgba(0, 255, 255, 0.5)";l.fillRect(S.getX(),S.getY(),S.getWidth(),S.getHeight());(x=ha.lights.length>0)&&La(ha);Aa=0;for(Ia=a.length;Aa<Ia;Aa++){Z=a[Aa];w.empty();if(Z instanceof THREE.RenderableParticle){u=
+Z;u.x*=k;u.y*=q;ga=0;for(na=Z.material.length;ga<na;ga++)Ma(u,Z,Z.material[ga],ha)}else if(Z instanceof THREE.RenderableLine){u=Z.v1;J=Z.v2;u.positionScreen.x*=k;u.positionScreen.y*=q;J.positionScreen.x*=k;J.positionScreen.y*=q;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(J.positionScreen.x,J.positionScreen.y);if(S.instersects(w)){ga=0;for(na=Z.material.length;ga<na;)Na(u,J,Z,Z.material[ga++],ha)}}else if(Z instanceof THREE.RenderableFace3){u=Z.v1;J=Z.v2;R=Z.v3;u.positionScreen.x*=
+k;u.positionScreen.y*=q;J.positionScreen.x*=k;J.positionScreen.y*=q;R.positionScreen.x*=k;R.positionScreen.y*=q;if(Z.overdraw){Ea(u.positionScreen,J.positionScreen);Ea(J.positionScreen,R.positionScreen);Ea(R.positionScreen,u.positionScreen)}w.add3Points(u.positionScreen.x,u.positionScreen.y,J.positionScreen.x,J.positionScreen.y,R.positionScreen.x,R.positionScreen.y);if(S.instersects(w)){ga=0;for(na=Z.meshMaterial.length;ga<na;){ta=Z.meshMaterial[ga++];if(ta instanceof THREE.MeshFaceMaterial){Fa=0;
+for(Ja=Z.faceMaterial.length;Fa<Ja;)(ta=Z.faceMaterial[Fa++])&&Ga(u,J,R,Z,ta,ha)}else Ga(u,J,R,Z,ta,ha)}}}D.addRectangle(w)}l.lineWidth=1;l.strokeStyle="rgba( 255, 0, 0, 0.5 )";l.strokeRect(D.getX(),D.getY(),D.getWidth(),D.getHeight());l.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(z,T,F){var S,D,w,x;S=0;for(D=z.lights.length;S<D;S++){w=z.lights[S];if(w instanceof THREE.DirectionalLight){x=T.normalWorld.dot(w.position)*w.intensity;if(x>0){F.r+=w.color.r*x;F.g+=w.color.g*x;F.b+=w.color.b*x}}else if(w instanceof THREE.PointLight){m.sub(w.position,T.centroidWorld);m.normalize();x=T.normalWorld.dot(m)*w.intensity;if(x>0){F.r+=w.color.r*x;F.g+=w.color.g*x;F.b+=w.color.b*x}}}}function b(z,T,F,S,D,w){p=d(r++);p.setAttribute("d","M "+z.positionScreen.x+
+" "+z.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");if(D instanceof THREE.MeshBasicMaterial)C.__styleString=D.color.__styleString;else if(D instanceof THREE.MeshLambertMaterial)if(U){L.r=O.r;L.g=O.g;L.b=O.b;a(w,S,L);C.r=D.color.r*L.r;C.g=D.color.g*L.g;C.b=D.color.b*L.b;C.updateStyleString()}else C.__styleString=D.color.__styleString;else if(D instanceof THREE.MeshDepthMaterial){h=1-D.__2near/(D.__farPlusNear-S.z*D.__farMinusNear);
+C.setRGB(h,h,h)}else D instanceof THREE.MeshNormalMaterial&&C.setRGB(j(S.normalWorld.x),j(S.normalWorld.y),j(S.normalWorld.z));D.wireframe?p.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+D.wireframe_linewidth+"; stroke-opacity: "+D.opacity+"; stroke-linecap: "+D.wireframe_linecap+"; stroke-linejoin: "+D.wireframe_linejoin):p.setAttribute("style","fill: "+C.__styleString+"; fill-opacity: "+D.opacity);l.appendChild(p)}function f(z,T,F,S,D,w,x){p=d(r++);p.setAttribute("d",
+"M "+z.positionScreen.x+" "+z.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(w instanceof THREE.MeshBasicMaterial)C.__styleString=w.color.__styleString;else if(w instanceof THREE.MeshLambertMaterial)if(U){L.r=O.r;L.g=O.g;L.b=O.b;a(x,D,L);C.r=w.color.r*L.r;C.g=w.color.g*L.g;C.b=w.color.b*L.b;C.updateStyleString()}else C.__styleString=w.color.__styleString;else if(w instanceof THREE.MeshDepthMaterial){h=
+1-w.__2near/(w.__farPlusNear-D.z*w.__farMinusNear);C.setRGB(h,h,h)}else w instanceof THREE.MeshNormalMaterial&&C.setRGB(j(D.normalWorld.x),j(D.normalWorld.y),j(D.normalWorld.z));w.wireframe?p.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+w.wireframe_linewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.wireframe_linecap+"; stroke-linejoin: "+w.wireframe_linejoin):p.setAttribute("style","fill: "+C.__styleString+"; fill-opacity: "+w.opacity);l.appendChild(p)}
+function d(z){if(i[z]==null){i[z]=document.createElementNS("http://www.w3.org/2000/svg","path");H==0&&i[z].setAttribute("shape-rendering","crispEdges");return i[z]}return i[z]}function j(z){return z<0?Math.min((1+z)*0.5,0.5):0.5+Math.min(z*0.5,0.5)}var k=null,q=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,y,c,B,v,u,J,R,N=new THREE.Rectangle,s=new THREE.Rectangle,U=false,C=new THREE.Color(16777215),L=new THREE.Color(16777215),O=new THREE.Color(0),Q=new THREE.Color(0),
+e=new THREE.Color(0),h,m=new THREE.Vector3,i=[],n=[],g=[],p,r,E,M,H=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(z){switch(z){case "high":H=1;break;case "low":H=0}};this.setSize=function(z,T){o=z;y=T;c=o/2;B=y/2;l.setAttribute("viewBox",-c+" "+-B+" "+o+" "+y);l.setAttribute("width",o);l.setAttribute("height",y);N.set(-c,-B,c,B)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(z,T){var F,S,
+D,w,x,K,G,W;this.autoClear&&this.clear();k=q.projectScene(z,T,this.sortElements);M=E=r=0;if(U=z.lights.length>0){G=z.lights;O.setRGB(0,0,0);Q.setRGB(0,0,0);e.setRGB(0,0,0);F=0;for(S=G.length;F<S;F++){D=G[F];w=D.color;if(D instanceof THREE.AmbientLight){O.r+=w.r;O.g+=w.g;O.b+=w.b}else if(D instanceof THREE.DirectionalLight){Q.r+=w.r;Q.g+=w.g;Q.b+=w.b}else if(D instanceof THREE.PointLight){e.r+=w.r;e.g+=w.g;e.b+=w.b}}}F=0;for(S=k.length;F<S;F++){G=k[F];s.empty();if(G instanceof THREE.RenderableParticle){v=
+G;v.x*=c;v.y*=-B;D=0;for(w=G.material.length;D<w;D++)if(W=G.material[D]){x=v;K=G;W=W;var ba=E++;if(n[ba]==null){n[ba]=document.createElementNS("http://www.w3.org/2000/svg","circle");H==0&&n[ba].setAttribute("shape-rendering","crispEdges")}p=n[ba];p.setAttribute("cx",x.x);p.setAttribute("cy",x.y);p.setAttribute("r",K.scale.x*c);if(W instanceof THREE.ParticleCircleMaterial){if(U){L.r=O.r+Q.r+e.r;L.g=O.g+Q.g+e.g;L.b=O.b+Q.b+e.b;C.r=W.color.r*L.r;C.g=W.color.g*L.g;C.b=W.color.b*L.b;C.updateStyleString()}else C=
+W.color;p.setAttribute("style","fill: "+C.__styleString)}l.appendChild(p)}}else if(G instanceof THREE.RenderableLine){v=G.v1;u=G.v2;v.positionScreen.x*=c;v.positionScreen.y*=-B;u.positionScreen.x*=c;u.positionScreen.y*=-B;s.addPoint(v.positionScreen.x,v.positionScreen.y);s.addPoint(u.positionScreen.x,u.positionScreen.y);if(N.instersects(s)){D=0;for(w=G.material.length;D<w;)if(W=G.material[D++]){x=v;K=u;W=W;ba=M++;if(g[ba]==null){g[ba]=document.createElementNS("http://www.w3.org/2000/svg","line");
+H==0&&g[ba].setAttribute("shape-rendering","crispEdges")}p=g[ba];p.setAttribute("x1",x.positionScreen.x);p.setAttribute("y1",x.positionScreen.y);p.setAttribute("x2",K.positionScreen.x);p.setAttribute("y2",K.positionScreen.y);if(W instanceof THREE.LineBasicMaterial){C.__styleString=W.color.__styleString;p.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin);l.appendChild(p)}}}}else if(G instanceof
+THREE.RenderableFace3){v=G.v1;u=G.v2;J=G.v3;v.positionScreen.x*=c;v.positionScreen.y*=-B;u.positionScreen.x*=c;u.positionScreen.y*=-B;J.positionScreen.x*=c;J.positionScreen.y*=-B;s.addPoint(v.positionScreen.x,v.positionScreen.y);s.addPoint(u.positionScreen.x,u.positionScreen.y);s.addPoint(J.positionScreen.x,J.positionScreen.y);if(N.instersects(s)){D=0;for(w=G.meshMaterial.length;D<w;){W=G.meshMaterial[D++];if(W instanceof THREE.MeshFaceMaterial){x=0;for(K=G.faceMaterial.length;x<K;)(W=G.faceMaterial[x++])&&
+b(v,u,J,G,W,z)}else W&&b(v,u,J,G,W,z)}}}else if(G instanceof THREE.RenderableFace4){v=G.v1;u=G.v2;J=G.v3;R=G.v4;v.positionScreen.x*=c;v.positionScreen.y*=-B;u.positionScreen.x*=c;u.positionScreen.y*=-B;J.positionScreen.x*=c;J.positionScreen.y*=-B;R.positionScreen.x*=c;R.positionScreen.y*=-B;s.addPoint(v.positionScreen.x,v.positionScreen.y);s.addPoint(u.positionScreen.x,u.positionScreen.y);s.addPoint(J.positionScreen.x,J.positionScreen.y);s.addPoint(R.positionScreen.x,R.positionScreen.y);if(N.instersects(s)){D=
+0;for(w=G.meshMaterial.length;D<w;){W=G.meshMaterial[D++];if(W instanceof THREE.MeshFaceMaterial){x=0;for(K=G.faceMaterial.length;x<K;)(W=G.faceMaterial[x++])&&f(v,u,J,R,G,W,z)}else W&&f(v,u,J,R,G,W,z)}}}}}};
+THREE.WebGLRenderer=function(a,b){function f(e,h,m){var i=c.createProgram();m=["#ifdef GL_ES\nprecision highp float;\n#endif",m?"#define USE_FOG":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");var n=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");
+c.attachShader(i,l("fragment",m+e));c.attachShader(i,l("vertex",n+h));c.linkProgram(i);c.getProgramParameter(i,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(i,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");i.uniforms={};i.attributes={};return i}function d(e,h){if(e.image.length==6){if(!e.image.__webGLTextureCube&&!e.image.__cubeMapInitialized&&e.image.loadCount==6){e.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,e.image.__webGLTextureCube);
+c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(var m=0;m<6;++m)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e.image[m]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);e.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+
+h);c.bindTexture(c.TEXTURE_CUBE_MAP,e.image.__webGLTextureCube)}}function j(e,h){if(!e.__webGLTexture&&e.image.loaded){e.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,e.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,o(e.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,o(e.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,o(e.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
+o(e.min_filter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+h);c.bindTexture(c.TEXTURE_2D,e.__webGLTexture)}function k(e,h){var m,i,n;m=0;for(i=h.length;m<i;m++){n=h[m];e.uniforms[n]=c.getUniformLocation(e,n)}}function q(e,h){var m,i,n;m=0;for(i=h.length;m<i;m++){n=h[m];e.attributes[n]=c.getAttribLocation(e,n)}}function l(e,h){var m;if(e=="fragment")m=c.createShader(c.FRAGMENT_SHADER);else if(e=="vertex")m=c.createShader(c.VERTEX_SHADER);c.shaderSource(m,
+h);c.compileShader(m);if(!c.getShaderParameter(m,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(m));return null}return m}function o(e){switch(e){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;
+case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR}return 0}var y=document.createElement("canvas"),c,B,v,u=new THREE.Matrix4,J,R=new Float32Array(16),N=new Float32Array(16),s=new Float32Array(16),U=new Float32Array(9),C=new Float32Array(16),L=function(e,h){if(e){var m,i,n,g=pointLights=maxDirLights=maxPointLights=0;m=0;for(i=e.lights.length;m<i;m++){n=e.lights[m];n instanceof THREE.DirectionalLight&&g++;n instanceof
+THREE.PointLight&&pointLights++}if(pointLights+g<=h){maxDirLights=g;maxPointLights=pointLights}else{maxDirLights=Math.ceil(h*g/(pointLights+g));maxPointLights=h-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:h-1}}(a,4);fog=a?a.fog:null;aa=b!=undefined?b:true;this.domElement=y;this.autoClear=true;try{c=y.getContext("experimental-webgl",{antialias:aa})}catch(O){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,
+1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(0,0,0,0);B=v=function(e,h,m){var i=[e?"#define MAX_DIR_LIGHTS "+e:"",h?"#define MAX_POINT_LIGHTS "+h:"","uniform bool enableLighting;\nuniform bool useRefract;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;\nuniform vec3 ambientLightColor;",e?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":
+"",e?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"",h?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",h?"uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",h?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform float mRefractionRatio;\nvoid main(void) {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec3 transformedNormal = normalize( normalMatrix * normal );\nif ( !enableLighting ) {\nvLightWeighting = vec3( 1.0, 1.0, 1.0 );\n} else {\nvLightWeighting = ambientLightColor;",
+e?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",e?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",e?"float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );":"",e?"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;":"",e?"}":"",h?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",h?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",h?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
+"",h?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",h?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",h?"}":"","}\nvNormal = transformedNormal;\nvUv = uv;\nif ( useRefract ) {\nvReflect = refract( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz), mRefractionRatio );\n} else {\nvReflect = reflect( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz) );\n}\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"),
+n=[e?"#define MAX_DIR_LIGHTS "+e:"",h?"#define MAX_POINT_LIGHTS "+h:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\n#ifdef USE_FOG\nuniform vec3 fogColor;\nuniform float fogDensity;\n#endif\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
+e?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",h?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n}\nif ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
+h?"vec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",h?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",h?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",h?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",h?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",h?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",h?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",h?"float pointSpecularWeight = 0.0;":"",h?"if ( pointDotNormalHalf >= 0.0 )":
+"",h?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",h?"pointDiffuse  += mColor * pointDiffuseWeight;":"",h?"pointSpecular += mSpecular * pointSpecularWeight;":"",h?"}":"",e?"vec4 dirDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",e?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",e?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",e?"vec3 dirVector = normalize( lDirection.xyz );":"",e?"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );":
+"",e?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",e?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",e?"float dirSpecularWeight = 0.0;":"",e?"if ( dirDotNormalHalf >= 0.0 )":"",e?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",e?"dirDiffuse  += mColor * dirDiffuseWeight;":"",e?"dirSpecular += mSpecular * dirSpecularWeight;":"",e?"}":"","vec4 totalLight = mAmbient;",e?"totalLight += dirDiffuse + dirSpecular;":"",h?"totalLight += pointDiffuse + pointSpecular;":
+"","if ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mapColor.rgb * totalLight.xyz * vLightWeighting, cubeColor.rgb, mReflectivity ), mapColor.a );\n} else {\ngl_FragColor = vec4( mapColor.rgb * cubeColor.rgb * totalLight.xyz * vLightWeighting, mapColor.a );\n}\n} else if ( material == 1 ) {\nif ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mColor.rgb * mapColor.rgb * vLightWeighting, cubeColor.rgb, mReflectivity ), mColor.a * mapColor.a );\n} else {\ngl_FragColor = vec4( mColor.rgb * mapColor.rgb * cubeColor.rgb * vLightWeighting, mColor.a * mapColor.a );\n}\n} else {\nif ( mixEnvMap ) {\ngl_FragColor = mix( mColor * mapColor, cubeColor, mReflectivity );\n} else {\ngl_FragColor = mColor * mapColor * cubeColor;\n}\n}\n#ifdef USE_FOG\nconst float LOG2 = 1.442695;\nfloat z = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = exp2( - fogDensity * fogDensity * z * z * LOG2 );\nfogFactor = clamp( fogFactor, 0.0, 1.0 );\ngl_FragColor = mix( vec4( fogColor, 1.0 ), gl_FragColor, fogFactor );\n#endif\n}"].join("\n");
+i=f(n,i,m);c.useProgram(i);k(i,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract"]);m&&k(i,["fogColor","fogDensity"]);e&&k(i,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);h&&k(i,["pointLightNumber","pointLightColor",
+"pointLightPosition"]);c.uniform1i(i.uniforms.enableMap,0);c.uniform1i(i.uniforms.tMap,0);c.uniform1i(i.uniforms.enableCubeMap,0);c.uniform1i(i.uniforms.tCube,1);c.uniform1i(i.uniforms.mixEnvMap,0);c.uniform1i(i.uniforms.useRefract,0);q(i,["position","normal","uv"]);return i}(L.directional,L.point,fog);this.setSize=function(e,h){y.width=e;y.height=h;c.viewport(0,0,y.width,y.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(e,h){var m,i,n,g,p,
+r=[],E=[],M=[];g=[];p=[];c.uniform1i(e.uniforms.enableLighting,h.length);m=0;for(i=h.length;m<i;m++){n=h[m];if(n instanceof THREE.AmbientLight)r.push(n);else if(n instanceof THREE.DirectionalLight)M.push(n);else n instanceof THREE.PointLight&&E.push(n)}m=n=g=p=0;for(i=r.length;m<i;m++){n+=r[m].color.r;g+=r[m].color.g;p+=r[m].color.b}c.uniform3f(e.uniforms.ambientLightColor,n,g,p);g=[];p=[];m=0;for(i=M.length;m<i;m++){n=M[m];g.push(n.color.r*n.intensity);g.push(n.color.g*n.intensity);g.push(n.color.b*
+n.intensity);p.push(n.position.x);p.push(n.position.y);p.push(n.position.z)}if(M.length){c.uniform1i(e.uniforms.directionalLightNumber,M.length);c.uniform3fv(e.uniforms.directionalLightDirection,p);c.uniform3fv(e.uniforms.directionalLightColor,g)}g=[];p=[];m=0;for(i=E.length;m<i;m++){n=E[m];g.push(n.color.r*n.intensity);g.push(n.color.g*n.intensity);g.push(n.color.b*n.intensity);p.push(n.position.x);p.push(n.position.y);p.push(n.position.z)}if(E.length){c.uniform1i(e.uniforms.pointLightNumber,E.length);
+c.uniform3fv(e.uniforms.pointLightPosition,p);c.uniform3fv(e.uniforms.pointLightColor,g)}};this.createBuffers=function(e,h){var m,i,n,g,p,r,E,M,H,z=[],T=[],F=[],S=[],D=[],w=[],x=0,K=e.geometry.geometryChunks[h],G;n=false;m=0;for(i=e.material.length;m<i;m++){meshMaterial=e.material[m];if(meshMaterial instanceof THREE.MeshFaceMaterial){p=0;for(G=K.material.length;p<G;p++)if(K.material[p]&&K.material[p].shading!=undefined&&K.material[p].shading==THREE.SmoothShading){n=true;break}}else if(meshMaterial&&
+meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){n=true;break}if(n)break}G=n;m=0;for(i=K.faces.length;m<i;m++){n=K.faces[m];g=e.geometry.faces[n];p=g.vertexNormals;faceNormal=g.normal;n=e.geometry.uvs[n];if(g instanceof THREE.Face3){r=e.geometry.vertices[g.a].position;E=e.geometry.vertices[g.b].position;M=e.geometry.vertices[g.c].position;F.push(r.x,r.y,r.z);F.push(E.x,E.y,E.z);F.push(M.x,M.y,M.z);if(e.geometry.hasTangents){r=e.geometry.vertices[g.a].tangent;E=e.geometry.vertices[g.b].tangent;
+M=e.geometry.vertices[g.c].tangent;D.push(r.x,r.y,r.z,r.w);D.push(E.x,E.y,E.z,E.w);D.push(M.x,M.y,M.z,M.w)}if(p.length==3&&G)for(g=0;g<3;g++)S.push(p[g].x,p[g].y,p[g].z);else for(g=0;g<3;g++)S.push(faceNormal.x,faceNormal.y,faceNormal.z);if(n)for(g=0;g<3;g++)w.push(n[g].u,n[g].v);z.push(x,x+1,x+2);T.push(x,x+1);T.push(x,x+2);T.push(x+1,x+2);x+=3}else if(g instanceof THREE.Face4){r=e.geometry.vertices[g.a].position;E=e.geometry.vertices[g.b].position;M=e.geometry.vertices[g.c].position;H=e.geometry.vertices[g.d].position;
+F.push(r.x,r.y,r.z);F.push(E.x,E.y,E.z);F.push(M.x,M.y,M.z);F.push(H.x,H.y,H.z);if(e.geometry.hasTangents){r=e.geometry.vertices[g.a].tangent;E=e.geometry.vertices[g.b].tangent;M=e.geometry.vertices[g.c].tangent;g=e.geometry.vertices[g.d].tangent;D.push(r.x,r.y,r.z,r.w);D.push(E.x,E.y,E.z,E.w);D.push(M.x,M.y,M.z,M.w);D.push(g.x,g.y,g.z,g.w)}if(p.length==4&&G)for(g=0;g<4;g++)S.push(p[g].x,p[g].y,p[g].z);else for(g=0;g<4;g++)S.push(faceNormal.x,faceNormal.y,faceNormal.z);if(n)for(g=0;g<4;g++)w.push(n[g].u,
+n[g].v);z.push(x,x+1,x+2);z.push(x,x+2,x+3);T.push(x,x+1);T.push(x,x+2);T.push(x,x+3);T.push(x+1,x+2);T.push(x+2,x+3);x+=4}}if(F.length){K.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,K.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(F),c.STATIC_DRAW);K.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,K.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(S),c.STATIC_DRAW);if(e.geometry.hasTangents){K.__webGLTangentBuffer=c.createBuffer();
+c.bindBuffer(c.ARRAY_BUFFER,K.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(D),c.STATIC_DRAW)}if(w.length>0){K.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,K.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(w),c.STATIC_DRAW)}K.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,K.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(z),c.STATIC_DRAW);K.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
+K.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(T),c.STATIC_DRAW);K.__webGLFaceCount=z.length;K.__webGLLineCount=T.length}};this.renderBuffer=function(e,h,m,i,n){var g,p,r,E,M,H,z,T,F;if(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshDepthMaterial||i instanceof THREE.MeshNormalMaterial){if(!i.program){if(i instanceof THREE.MeshDepthMaterial){z=Q.depth;i.fragment_shader=z.fragment_shader;i.vertex_shader=z.vertex_shader;i.uniforms=z.uniforms;i.uniforms.mNear.value=
+i.near;i.uniforms.mFar.value=i.far}else if(i instanceof THREE.MeshNormalMaterial){z=Q.normal;i.fragment_shader=z.fragment_shader;i.vertex_shader=z.vertex_shader;i.uniforms=z.uniforms}i.program=f(i.fragment_shader,i.vertex_shader,null);z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(F in i.uniforms)z.push(F);k(i.program,z);q(i.program,["position","normal","uv","tangent"])}F=i.program}else F=v;if(F!=B){c.useProgram(F);B=F}F==v&&this.setupLights(F,
+h);this.loadCamera(F,e);this.loadMatrices(F);if(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshDepthMaterial||i instanceof THREE.MeshNormalMaterial){r=i.wireframe;E=i.wireframe_linewidth;e=F;h=i.uniforms;var S;for(g in h){T=h[g].type;z=h[g].value;S=e.uniforms[g];if(T=="i")c.uniform1i(S,z);else if(T=="f")c.uniform1f(S,z);else if(T=="v3")c.uniform3f(S,z.x,z.y,z.z);else if(T=="c")c.uniform3f(S,z.r,z.g,z.b);else if(T=="t"){c.uniform1i(S,z);if(T=h[g].texture)T.image instanceof Array&&T.image.length==
+6?d(T,z):j(T,z)}}}if(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshBasicMaterial){g=i.color;p=i.opacity;r=i.wireframe;E=i.wireframe_linewidth;M=i.map;H=i.env_map;h=i.combine==THREE.MixOperation;e=i.reflectivity;T=i.env_map&&i.env_map.mapping instanceof THREE.CubeRefractionMapping;z=i.refraction_ratio;c.uniform4f(F.uniforms.mColor,g.r*p,g.g*p,g.b*p,p);c.uniform1i(F.uniforms.mixEnvMap,h);c.uniform1f(F.uniforms.mReflectivity,e);c.uniform1i(F.uniforms.useRefract,
+T);c.uniform1f(F.uniforms.mRefractionRatio,z);if(m){c.uniform1f(F.uniforms.fogDensity,m.density);c.uniform3f(F.uniforms.fogColor,m.color.r,m.color.g,m.color.b)}}if(i instanceof THREE.MeshPhongMaterial){m=i.ambient;g=i.specular;i=i.shininess;c.uniform4f(F.uniforms.mAmbient,m.r,m.g,m.b,p);c.uniform4f(F.uniforms.mSpecular,g.r,g.g,g.b,p);c.uniform1f(F.uniforms.mShininess,i);c.uniform1i(F.uniforms.material,2)}else if(i instanceof THREE.MeshLambertMaterial)c.uniform1i(F.uniforms.material,1);else i instanceof
+THREE.MeshBasicMaterial&&c.uniform1i(F.uniforms.material,0);if(M){j(M,0);c.uniform1i(F.uniforms.tMap,0);c.uniform1i(F.uniforms.enableMap,1)}else c.uniform1i(F.uniforms.enableMap,0);if(H){d(H,1);c.uniform1i(F.uniforms.tCube,1);c.uniform1i(F.uniforms.enableCubeMap,1)}else c.uniform1i(F.uniforms.enableCubeMap,0);p=F.attributes;c.bindBuffer(c.ARRAY_BUFFER,n.__webGLVertexBuffer);c.vertexAttribPointer(p.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(p.position);if(p.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,
+n.__webGLNormalBuffer);c.vertexAttribPointer(p.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(p.normal)}if(p.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLTangentBuffer);c.vertexAttribPointer(p.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(p.tangent)}if(p.uv>=0)if(n.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLUVBuffer);c.vertexAttribPointer(p.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(p.uv)}else c.disableVertexAttribArray(p.uv);if(r){c.lineWidth(E);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
+n.__webGLLineBuffer);c.drawElements(c.LINES,n.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,n.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(e,h,m,i,n,g,p){var r,E,M,H,z;M=0;for(H=i.material.length;M<H;M++){r=i.material[M];if(r instanceof THREE.MeshFaceMaterial){r=0;for(E=n.material.length;r<E;r++)if((z=n.material[r])&&z.blending==g&&z.opacity<1==p){this.setBlending(z.blending);this.renderBuffer(e,h,m,
+z,n)}}else if((z=r)&&z.blending==g&&z.opacity<1==p){this.setBlending(z.blending);this.renderBuffer(e,h,m,z,n)}}};this.render=function(e,h){var m,i,n,g,p=e.lights,r=e.fog;this.initWebGLObjects(e);this.autoClear&&this.clear();h.autoUpdateMatrix&&h.updateMatrix();R.set(h.matrix.flatten());s.set(h.projectionMatrix.flatten());m=0;for(i=e.__webGLObjects.length;m<i;m++){n=e.__webGLObjects[m];g=n.object;n=n.buffer;if(g.visible){this.setupMatrices(g,h);this.renderPass(h,p,r,g,n,THREE.NormalBlending,false)}}m=
+0;for(i=e.__webGLObjects.length;m<i;m++){n=e.__webGLObjects[m];g=n.object;n=n.buffer;if(g.visible){this.setupMatrices(g,h);this.renderPass(h,p,r,g,n,THREE.AdditiveBlending,false);this.renderPass(h,p,r,g,n,THREE.SubtractiveBlending,false);this.renderPass(h,p,r,g,n,THREE.AdditiveBlending,true);this.renderPass(h,p,r,g,n,THREE.SubtractiveBlending,true);this.renderPass(h,p,r,g,n,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(e){var h,m,i,n,g,p;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap=
+{}}h=0;for(m=e.objects.length;h<m;h++){i=e.objects[h];if(e.__webGLObjectsMap[i.id]==undefined)e.__webGLObjectsMap[i.id]={};p=e.__webGLObjectsMap[i.id];if(i instanceof THREE.Mesh)for(g in i.geometry.geometryChunks){n=i.geometry.geometryChunks[g];n.__webGLVertexBuffer||this.createBuffers(i,g);if(p[g]==undefined){n={buffer:n,object:i};e.__webGLObjects.push(n);p[g]=1}}}};this.removeObject=function(e,h){var m,i;for(m=e.__webGLObjects.length-1;m>=0;m--){i=e.__webGLObjects[m].object;h==i&&e.__webGLObjects.splice(m,
+1)}};this.setupMatrices=function(e,h){e.autoUpdateMatrix&&e.updateMatrix();u.multiply(h.matrix,e.matrix);N.set(u.flatten());J=THREE.Matrix4.makeInvert3x3(u).transpose();U.set(J.m);C.set(e.matrix.flatten())};this.loadMatrices=function(e){c.uniformMatrix4fv(e.uniforms.viewMatrix,false,R);c.uniformMatrix4fv(e.uniforms.modelViewMatrix,false,N);c.uniformMatrix4fv(e.uniforms.projectionMatrix,false,s);c.uniformMatrix3fv(e.uniforms.normalMatrix,false,U);c.uniformMatrix4fv(e.uniforms.objectMatrix,false,C)};
+this.loadCamera=function(e,h){c.uniform3f(e.uniforms.cameraPosition,h.position.x,h.position.y,h.position.z)};this.setBlending=function(e){switch(e){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(e,h){if(e){!h||h=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(e=="back")c.cullFace(c.BACK);
+else e=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0};var Q={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",
+vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"}}};
+THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterial=this.meshMaterial=null;this.overdraw=false;this.uvs=[null,null,null]};
+THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.material=null};

File diff suppressed because it is too large
+ 0 - 190
build/ThreeExtras.js


+ 1 - 1
examples/geometry_terrain_fog_gl.html

@@ -94,7 +94,7 @@
 				mesh.rotation.x = - 90 * Math.PI / 180;
 				scene.addObject( mesh );
 
-				renderer = new THREE.WebGLRenderer( scene );
+				renderer = new THREE.WebGLRenderer( scene, false );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
 				container.innerHTML = "";

+ 6 - 4
src/renderers/WebGLRenderer.js

@@ -4,7 +4,7 @@
  * @author alteredq / http://alteredqualia.com/
  */
 
-THREE.WebGLRenderer = function ( scene ) {
+THREE.WebGLRenderer = function ( scene, antialias ) {
 
 	// Currently you can use just up to 4 directional / point lights total.
 	// Chrome barfs on shader linking when there are more than 4 lights :(
@@ -39,10 +39,12 @@ THREE.WebGLRenderer = function ( scene ) {
 	maxLightCount = allocateLights( scene, 4 );
 	fog = scene ? scene.fog : null,
 	
+	aa = antialias != undefined ? antialias : true;
+	
 	this.domElement = _canvas;
 	this.autoClear = true;
 
-	initGL();
+	initGL( aa );
 
 	_uberProgram = initUbershader( maxLightCount.directional, maxLightCount.point, fog );
 	_oldProgram = _uberProgram;
@@ -897,11 +899,11 @@ THREE.WebGLRenderer = function ( scene ) {
 	};
 
 
-	function initGL() {
+	function initGL( antialias ) {
 
 		try {
 
-			_gl = _canvas.getContext( 'experimental-webgl', { antialias: true} );
+			_gl = _canvas.getContext( 'experimental-webgl', { antialias: antialias } );
 
 		} catch(e) { }
 

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