Browse Source

Updated builds.

Mr.doob 14 years ago
parent
commit
ecedea4be1
3 changed files with 407 additions and 624 deletions
  1. 203 205
      build/Three.js
  2. 204 206
      build/ThreeDebug.js
  3. 0 213
      build/ThreeExtras.js

+ 203 - 205
build/Three.js

@@ -1,205 +1,203 @@
-// Three.js r32 - 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,c,d){this.r=a;this.g=c;this.b=d;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)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
-THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;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,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.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,c,d){this.x=a||0;this.y=c||0;this.z=d||0};
-THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
-cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,f=this.z;this.x=d*a.z-f*a.y;this.y=f*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.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},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
-a.z;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 c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+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,c,d,f){this.x=a||0;this.y=c||0;this.z=d||0;this.w=f||1};
-THREE.Vector4.prototype={set:function(a,c,d,f){this.x=a;this.y=c;this.z=d;this.w=f;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,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.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,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},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,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,d,f=a.objects,h=[];a=0;for(c=f.length;a<c;a++){d=f[a];if(d instanceof THREE.Mesh)h=h.concat(this.intersectObject(d))}h.sort(function(i,q){return i.distance-q.distance});return h},intersectObject:function(a){function c(T,u,R,D){D=D.clone().subSelf(u);R=R.clone().subSelf(u);var e=T.clone().subSelf(u);T=D.dot(D);u=D.dot(R);D=D.dot(e);var g=R.dot(R);R=R.dot(e);e=1/(T*g-u*u);g=(g*D-u*R)*e;T=(T*R-u*D)*e;return g>0&&T>0&&g+T<1}var d,f,h,i,q,b,m,p,E,H,
-x,A=a.geometry,S=A.vertices,V=[];d=0;for(f=A.faces.length;d<f;d++){h=A.faces[d];H=this.origin.clone();x=this.direction.clone();i=a.matrix.multiplyVector3(S[h.a].position.clone());q=a.matrix.multiplyVector3(S[h.b].position.clone());b=a.matrix.multiplyVector3(S[h.c].position.clone());m=h instanceof THREE.Face4?a.matrix.multiplyVector3(S[h.d].position.clone()):null;p=a.rotationMatrix.multiplyVector3(h.normal.clone());E=x.dot(p);if(E<0){p=p.dot((new THREE.Vector3).sub(i,H))/E;H=H.addSelf(x.multiplyScalar(p));
-if(h instanceof THREE.Face3){if(c(H,i,q,b)){h={distance:this.origin.distanceTo(H),point:H,face:h,object:a};V.push(h)}}else if(h instanceof THREE.Face4)if(c(H,i,q,m)||c(H,q,b,m)){h={distance:this.origin.distanceTo(H),point:H,face:h,object:a};V.push(h)}}}return V}};
-THREE.Rectangle=function(){function a(){i=f-c;q=h-d}var c,d,f,h,i,q,b=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return q};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(m,p,E,H){b=false;c=m;d=p;f=E;h=H;a()};this.addPoint=function(m,p){if(b){b=false;c=m;d=p;f=m;h=p}else{c=c<m?c:m;d=d<p?d:p;f=f>m?f:m;h=h>p?
-h:p}a()};this.add3Points=function(m,p,E,H,x,A){if(b){b=false;c=m<E?m<x?m:x:E<x?E:x;d=p<H?p<A?p:A:H<A?H:A;f=m>E?m>x?m:x:E>x?E:x;h=p>H?p>A?p:A:H>A?H:A}else{c=m<E?m<x?m<c?m:c:x<c?x:c:E<x?E<c?E:c:x<c?x:c;d=p<H?p<A?p<d?p:d:A<d?A:d:H<A?H<d?H:d:A<d?A:d;f=m>E?m>x?m>f?m:f:x>f?x:f:E>x?E>f?E:f:x>f?x:f;h=p>H?p>A?p>h?p:h:A>h?A:h:H>A?H>h?H:h:A>h?A:h}a()};this.addRectangle=function(m){if(b){b=false;c=m.getLeft();d=m.getTop();f=m.getRight();h=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();d=d<m.getTop()?d:m.getTop();
-f=f>m.getRight()?f:m.getRight();h=h>m.getBottom()?h:m.getBottom()}a()};this.inflate=function(m){c-=m;d-=m;f+=m;h+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();d=d>m.getTop()?d:m.getTop();f=f<m.getRight()?f:m.getRight();h=h<m.getBottom()?h:m.getBottom();a()};this.instersects=function(m){return Math.min(f,m.getRight())-Math.max(c,m.getLeft())>=0&&Math.min(h,m.getBottom())-Math.max(d,m.getTop())>=0};this.empty=function(){b=true;h=f=d=c=0;a()};this.isEmpty=function(){return b};this.toString=
-function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+d+", bottom: "+h+", width: "+i+", 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,c,d,f,h,i,q,b,m,p,E,H,x,A,S,V){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=h||0;this.n22=i||1;this.n23=q||0;this.n24=b||0;this.n31=m||0;this.n32=p||0;this.n33=E||1;this.n34=H||0;this.n41=x||0;this.n42=A||0;this.n43=S||0;this.n44=V||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
-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,c,d,f,h,i,q,b,m,p,E,H,x,A,S,V){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=h;this.n22=i;this.n23=q;this.n24=b;this.n31=m;this.n32=p;this.n33=E;this.n34=H;this.n41=x;this.n42=A;this.n43=S;this.n44=V;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,c,d){var f=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,c).normalize();f.cross(d,i).normalize();h.cross(i,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);
-this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,f=a.z,h=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*h;return a},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23*
-f+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*f+this.n44*h;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,f=a.n12,h=a.n13,i=a.n14,q=a.n21,b=a.n22,m=a.n23,p=a.n24,E=a.n31,
-H=a.n32,x=a.n33,A=a.n34,S=a.n41,V=a.n42,T=a.n43,u=a.n44,R=c.n11,D=c.n12,e=c.n13,g=c.n14,n=c.n21,j=c.n22,o=c.n23,z=c.n24,k=c.n31,s=c.n32,t=c.n33,r=c.n34,l=c.n41,C=c.n42,w=c.n43,L=c.n44;this.n11=d*R+f*n+h*k+i*l;this.n12=d*D+f*j+h*s+i*C;this.n13=d*e+f*o+h*t+i*w;this.n14=d*g+f*z+h*r+i*L;this.n21=q*R+b*n+m*k+p*l;this.n22=q*D+b*j+m*s+p*C;this.n23=q*e+b*o+m*t+p*w;this.n24=q*g+b*z+m*r+p*L;this.n31=E*R+H*n+x*k+A*l;this.n32=E*D+H*j+x*s+A*C;this.n33=E*e+H*o+x*t+A*w;this.n34=E*g+H*z+x*r+A*L;this.n41=S*R+V*n+
-T*k+u*l;this.n42=S*D+V*j+T*s+u*C;this.n43=S*e+V*o+T*t+u*w;this.n44=S*g+V*z+T*r+u*L;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,f=this.n13,h=this.n14,i=this.n21,q=this.n22,b=this.n23,m=this.n24,p=this.n31,E=this.n32,H=this.n33,x=this.n34,A=this.n41,S=this.n42,V=this.n43,T=this.n44,u=a.n11,R=a.n21,D=a.n31,e=a.n41,g=a.n12,n=a.n22,j=a.n32,o=a.n42,z=a.n13,k=a.n23,s=a.n33,t=a.n43,r=a.n14,l=a.n24,C=a.n34;a=a.n44;this.n11=c*u+d*R+f*D+h*e;this.n12=c*g+d*n+f*j+h*o;this.n13=c*z+d*k+f*s+h*
-t;this.n14=c*r+d*l+f*C+h*a;this.n21=i*u+q*R+b*D+m*e;this.n22=i*g+q*n+b*j+m*o;this.n23=i*z+q*k+b*s+m*t;this.n24=i*r+q*l+b*C+m*a;this.n31=p*u+E*R+H*D+x*e;this.n32=p*g+E*n+H*j+x*o;this.n33=p*z+E*k+H*s+x*t;this.n34=p*r+E*l+H*C+x*a;this.n41=A*u+S*R+V*D+T*e;this.n42=A*g+S*n+V*j+T*o;this.n43=A*z+S*k+V*s+T*t;this.n44=A*r+S*l+V*C+T*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(c,d,f){var h=c[d];
-c[d]=c[f];c[f]=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(){this.flat[0]=this.n11;this.flat[1]=this.n21;
-this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},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,c,d){var f=new THREE.Matrix4;f.n14=a;f.n24=c;f.n34=d;return f};THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.n11=a;f.n22=c;f.n33=d;return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.n22=c.n33=Math.cos(a);c.n32=Math.sin(a);c.n23=-c.n32;return c};
-THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.n11=c.n33=Math.cos(a);c.n13=Math.sin(a);c.n31=-c.n13;return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.n11=c.n22=Math.cos(a);c.n21=Math.sin(a);c.n12=-c.n21;return c};
-THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4,f=Math.cos(c),h=Math.sin(c),i=1-f,q=a.x,b=a.y,m=a.z;d.n11=i*q*q+f;d.n12=i*q*b-h*m;d.n13=i*q*m+h*b;d.n21=i*q*b+h*m;d.n22=i*b*b+f;d.n23=i*b*m-h*q;d.n31=i*q*m-h*b;d.n32=i*b*m+h*q;d.n33=i*m*m+f;return d};
-THREE.Matrix4.makeInvert=function(a){var c=new THREE.Matrix4;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=c[10]*c[5]-c[6]*c[9],f=-c[10]*c[1]+c[2]*c[9],h=c[6]*c[1]-c[2]*c[5],i=-c[10]*c[4]+c[6]*c[8],q=c[10]*c[0]-c[2]*c[8],b=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],p=-c[9]*c[0]+c[1]*c[8],E=c[5]*c[0]-c[1]*c[4];c=c[0]*d+c[1]*i+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*d;a.m[1]=c*f;a.m[2]=c*h;a.m[3]=c*i;a.m[4]=c*q;a.m[5]=c*b;a.m[6]=c*m;a.m[7]=c*p;a.m[8]=c*E;return a};
-THREE.Matrix4.makeFrustum=function(a,c,d,f,h,i){var q,b,m;q=new THREE.Matrix4;b=2*h/(c-a);m=2*h/(f-d);a=(c+a)/(c-a);d=(f+d)/(f-d);f=-(i+h)/(i-h);h=-2*i*h/(i-h);q.n11=b;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=m;q.n23=d;q.n24=0;q.n31=0;q.n32=0;q.n33=f;q.n34=h;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,d,f){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,f)};
-THREE.Matrix4.makeOrtho=function(a,c,d,f,h,i){var q,b,m,p;q=new THREE.Matrix4;b=c-a;m=d-f;p=i-h;a=(c+a)/b;d=(d+f)/m;h=(i+h)/p;q.n11=2/b;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/m;q.n23=0;q.n24=-d;q.n31=0;q.n32=0;q.n33=-2/p;q.n34=-h;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
-THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||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,c,d,f,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,c,d,f,h,i){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||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,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,f,h,i,q,b=new THREE.Vector3,m=new THREE.Vector3;f=0;for(h=this.vertices.length;f<h;f++){i=this.vertices[f];i.normal.set(0,0,0)}f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(a&&i.vertexNormals.length){b.set(0,0,0);c=0;for(d=i.normal.length;c<d;c++)b.addSelf(i.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[i.a];d=this.vertices[i.b];q=this.vertices[i.c];b.sub(q.position,
-d.position);m.sub(c.position,d.position);b.crossSelf(m)}b.isZero()||b.normalize();i.normal.copy(b)}},computeVertexNormals:function(){var a,c,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)f[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
-new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)f[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)f[a].normalize();a=0;for(c=this.faces.length;a<
-c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function a(r,l,C,w,L,K,F){i=r.vertices[l].position;q=r.vertices[C].position;b=r.vertices[w].position;m=h[L];p=h[K];E=h[F];H=q.x-i.x;x=b.x-i.x;A=q.y-i.y;S=b.y-i.y;
-V=q.z-i.z;T=b.z-i.z;u=p.u-m.u;R=E.u-m.u;D=p.v-m.v;e=E.v-m.v;g=1/(u*e-R*D);o.set((e*H-D*x)*g,(e*A-D*S)*g,(e*V-D*T)*g);z.set((u*x-R*H)*g,(u*S-R*A)*g,(u*T-R*V)*g);n[l].addSelf(o);n[C].addSelf(o);n[w].addSelf(o);j[l].addSelf(z);j[C].addSelf(z);j[w].addSelf(z)}var c,d,f,h,i,q,b,m,p,E,H,x,A,S,V,T,u,R,D,e,g,n=[],j=[],o=new THREE.Vector3,z=new THREE.Vector3,k=new THREE.Vector3,s=new THREE.Vector3,t=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){n[c]=new THREE.Vector3;j[c]=new THREE.Vector3}c=0;
-for(d=this.faces.length;c<d;c++){f=this.faces[c];h=this.uvs[c];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2]);
-this.vertices[f.d].normal.copy(f.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){t.copy(this.vertices[c].normal);f=n[c];k.copy(f);k.subSelf(t.multiplyScalar(t.dot(f))).normalize();s.cross(this.vertices[c].normal,f);f=s.dot(j[c]);f=f<0?-1:1;this.vertices[c].tangent.set(k.x,k.y,k.z,f)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
-z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
-this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(E){var H=[];c=0;for(d=E.length;c<d;c++)E[c]==undefined?H.push("undefined"):H.push(E[c].toString());return H.join("_")}var c,d,f,h,i,q,b,m,p={};f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];
-q=i.materials;b=a(q);if(p[b]==undefined)p[b]={hash:b,counter:0};m=p[b].hash+"_"+p[b].counter;if(this.geometryChunks[m]==undefined)this.geometryChunks[m]={faces:[],materials:q,vertices:0};i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[m].vertices+i>65535){p[b].counter+=1;m=p[b].hash+"_"+p[b].counter;if(this.geometryChunks[m]==undefined)this.geometryChunks[m]={faces:[],materials:q,vertices:0}}this.geometryChunks[m].faces.push(f);this.geometryChunks[m].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
-this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
-THREE.Camera=function(a,c,d,f){this.fov=a;this.aspect=c;this.near=d;this.far=f;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
-this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
-THREE.Camera.prototype={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,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;
-THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||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.visible=this.autoUpdateMatrix=true};
-THREE.Object3D.prototype={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.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.autoUpdateMatrix=false};
-THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];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}};
-THREE.LineBasicMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
-THREE.MeshBasicMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
-THREE.MeshLambertMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
-THREE.MeshPhongMaterial.prototype={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.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.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={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}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={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}};
-THREE.MeshShaderMaterial.prototype={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}};
-THREE.ParticleBasicMaterial.prototype={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}};
-THREE.ParticleCircleMaterial.prototype={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};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
-THREE.Texture=function(a,c,d,f,h,i){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter};
-THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},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.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
-THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var c,d,f,h={};for(c in a){h[c]={};for(d in a[c]){f=a[c][d];h[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var c,d,f,h={};for(c=0;c<a.length;c++){f=this.clone(a[c]);for(d in f)h[d]=f[d]}return h}};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,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
-THREE.Projector=function(){function a(j,o){return o.z-j.z}function c(j,o){var z=0,k=1,s=j.z+j.w,t=o.z+o.w,r=-j.z+j.w,l=-o.z+o.w;if(s>=0&&t>=0&&r>=0&&l>=0)return true;else if(s<0&&t<0||r<0&&l<0)return false;else{if(s<0)z=Math.max(z,s/(s-t));else if(t<0)k=Math.min(k,s/(s-t));if(r<0)z=Math.max(z,r/(r-l));else if(l<0)k=Math.min(k,r/(r-l));if(k<z)return false;else{j.lerpSelf(o,z);o.lerpSelf(j,1-k);return true}}}var d,f,h=[],i,q,b,m=[],p,E,H=[],x,A,S=[],V=new THREE.Vector4,T=new THREE.Vector4,u=new THREE.Matrix4,
-R=new THREE.Matrix4,D=[],e=new THREE.Vector4,g=new THREE.Vector4,n;this.projectObjects=function(j,o,z){var k=[],s,t;f=0;u.multiply(o.projectionMatrix,o.matrix);D[0]=new THREE.Vector4(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);D[1]=new THREE.Vector4(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);D[2]=new THREE.Vector4(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);D[3]=new THREE.Vector4(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);D[4]=new THREE.Vector4(u.n41-u.n31,u.n42-u.n32,u.n43-
-u.n33,u.n44-u.n34);D[5]=new THREE.Vector4(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);o=0;for(s=D.length;o<s;o++){t=D[o];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}s=j.objects;j=0;for(o=s.length;j<o;j++){t=s[j];var r;if(!(r=!t.visible)){if(r=t instanceof THREE.Mesh){a:{r=void 0;for(var l=t.position,C=-t.geometry.boundingSphere.radius*Math.max(t.scale.x,Math.max(t.scale.y,t.scale.z)),w=0;w<6;w++){r=D[w].x*l.x+D[w].y*l.y+D[w].z*l.z+D[w].w;if(r<=C){r=false;break a}}r=true}r=!r}r=r}if(!r){d=
-h[f]=h[f]||new THREE.RenderableObject;V.copy(t.position);u.multiplyVector3(V);d.object=t;d.z=V.z;k.push(d);f++}}z&&k.sort(a);return k};this.projectScene=function(j,o,z){var k=[],s=o.near,t=o.far,r,l,C,w,L,K,F,W,M,G,I,U,P,v,J,N;b=E=A=0;o.autoUpdateMatrix&&o.updateMatrix();u.multiply(o.projectionMatrix,o.matrix);K=this.projectObjects(j,o,true);j=0;for(r=K.length;j<r;j++){F=K[j].object;if(F.visible){F.autoUpdateMatrix&&F.updateMatrix();W=F.matrix;M=F.rotationMatrix;G=F.materials;I=F.overdraw;if(F instanceof
-THREE.Mesh){U=F.geometry;P=U.vertices;l=0;for(C=P.length;l<C;l++){v=P[l];v.positionWorld.copy(v.position);W.multiplyVector3(v.positionWorld);w=v.positionScreen;w.copy(v.positionWorld);u.multiplyVector4(w);w.x/=w.w;w.y/=w.w;v.__visible=w.z>s&&w.z<t}U=U.faces;l=0;for(C=U.length;l<C;l++){v=U[l];if(v instanceof THREE.Face3){w=P[v.a];L=P[v.b];J=P[v.c];if(w.__visible&&L.__visible&&J.__visible)if(F.doubleSided||F.flipSided!=(J.positionScreen.x-w.positionScreen.x)*(L.positionScreen.y-w.positionScreen.y)-
-(J.positionScreen.y-w.positionScreen.y)*(L.positionScreen.x-w.positionScreen.x)<0){i=m[b]=m[b]||new THREE.RenderableFace3;i.v1.positionWorld.copy(w.positionWorld);i.v2.positionWorld.copy(L.positionWorld);i.v3.positionWorld.copy(J.positionWorld);i.v1.positionScreen.copy(w.positionScreen);i.v2.positionScreen.copy(L.positionScreen);i.v3.positionScreen.copy(J.positionScreen);i.normalWorld.copy(v.normal);M.multiplyVector3(i.normalWorld);i.centroidWorld.copy(v.centroid);W.multiplyVector3(i.centroidWorld);
-i.centroidScreen.copy(i.centroidWorld);u.multiplyVector3(i.centroidScreen);J=v.vertexNormals;n=i.vertexNormalsWorld;w=0;for(L=J.length;w<L;w++){N=n[w]=n[w]||new THREE.Vector3;N.copy(J[w]);M.multiplyVector3(N)}i.z=i.centroidScreen.z;i.meshMaterials=G;i.faceMaterials=v.materials;i.overdraw=I;if(F.geometry.uvs[l]){i.uvs[0]=F.geometry.uvs[l][0];i.uvs[1]=F.geometry.uvs[l][1];i.uvs[2]=F.geometry.uvs[l][2]}k.push(i);b++}}else if(v instanceof THREE.Face4){w=P[v.a];L=P[v.b];J=P[v.c];N=P[v.d];if(w.__visible&&
-L.__visible&&J.__visible&&N.__visible)if(F.doubleSided||F.flipSided!=((N.positionScreen.x-w.positionScreen.x)*(L.positionScreen.y-w.positionScreen.y)-(N.positionScreen.y-w.positionScreen.y)*(L.positionScreen.x-w.positionScreen.x)<0||(L.positionScreen.x-J.positionScreen.x)*(N.positionScreen.y-J.positionScreen.y)-(L.positionScreen.y-J.positionScreen.y)*(N.positionScreen.x-J.positionScreen.x)<0)){i=m[b]=m[b]||new THREE.RenderableFace3;i.v1.positionWorld.copy(w.positionWorld);i.v2.positionWorld.copy(L.positionWorld);
-i.v3.positionWorld.copy(N.positionWorld);i.v1.positionScreen.copy(w.positionScreen);i.v2.positionScreen.copy(L.positionScreen);i.v3.positionScreen.copy(N.positionScreen);i.normalWorld.copy(v.normal);M.multiplyVector3(i.normalWorld);i.centroidWorld.copy(v.centroid);W.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);u.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=G;i.faceMaterials=v.materials;i.overdraw=I;if(F.geometry.uvs[l]){i.uvs[0]=F.geometry.uvs[l][0];
-i.uvs[1]=F.geometry.uvs[l][1];i.uvs[2]=F.geometry.uvs[l][3]}k.push(i);b++;q=m[b]=m[b]||new THREE.RenderableFace3;q.v1.positionWorld.copy(L.positionWorld);q.v2.positionWorld.copy(J.positionWorld);q.v3.positionWorld.copy(N.positionWorld);q.v1.positionScreen.copy(L.positionScreen);q.v2.positionScreen.copy(J.positionScreen);q.v3.positionScreen.copy(N.positionScreen);q.normalWorld.copy(i.normalWorld);q.centroidWorld.copy(i.centroidWorld);q.centroidScreen.copy(i.centroidScreen);q.z=q.centroidScreen.z;q.meshMaterials=
-G;q.faceMaterials=v.materials;q.overdraw=I;if(F.geometry.uvs[l]){q.uvs[0]=F.geometry.uvs[l][1];q.uvs[1]=F.geometry.uvs[l][2];q.uvs[2]=F.geometry.uvs[l][3]}k.push(q);b++}}}}else if(F instanceof THREE.Line){R.multiply(u,W);P=F.geometry.vertices;v=P[0];v.positionScreen.copy(v.position);R.multiplyVector4(v.positionScreen);l=1;for(C=P.length;l<C;l++){w=P[l];w.positionScreen.copy(w.position);R.multiplyVector4(w.positionScreen);L=P[l-1];e.copy(w.positionScreen);g.copy(L.positionScreen);if(c(e,g)){e.multiplyScalar(1/
-e.w);g.multiplyScalar(1/g.w);p=H[E]=H[E]||new THREE.RenderableLine;p.v1.positionScreen.copy(e);p.v2.positionScreen.copy(g);p.z=Math.max(e.z,g.z);p.materials=F.materials;k.push(p);E++}}}else if(F instanceof THREE.Particle){T.set(F.position.x,F.position.y,F.position.z,1);u.multiplyVector4(T);T.z/=T.w;if(T.z>0&&T.z<1){x=S[A]=S[A]||new THREE.RenderableParticle;x.x=T.x/T.w;x.y=T.y/T.w;x.z=T.z;x.rotation=F.rotation.z;x.scale.x=F.scale.x*Math.abs(x.x-(T.x+o.projectionMatrix.n11)/(T.w+o.projectionMatrix.n14));
-x.scale.y=F.scale.y*Math.abs(x.y-(T.y+o.projectionMatrix.n22)/(T.w+o.projectionMatrix.n24));x.materials=F.materials;k.push(x);A++}}}}z&&k.sort(a);return k};this.unprojectVector=function(j,o){var z=new THREE.Matrix4;z.multiply(THREE.Matrix4.makeInvert(o.matrix),THREE.Matrix4.makeInvert(o.projectionMatrix));z.multiplyVector3(j);return j}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,f,h,i;this.domElement=document.createElement("div");this.setSize=function(q,b){d=q;f=b;h=d/2;i=f/2};this.render=function(q,b){var m,p,E,H,x,A,S,V;a=c.projectScene(q,b);m=0;for(p=a.length;m<p;m++){x=a[m];if(x instanceof THREE.RenderableParticle){S=x.x*h+h;V=x.y*i+i;E=0;for(H=x.material.length;E<H;E++){A=x.material[E];if(A instanceof THREE.ParticleDOMMaterial){A=A.domElement;A.style.left=S+"px";A.style.top=V+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(da){if(x!=da)p.globalAlpha=x=da}function c(da){if(A!=da){switch(da){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}A=da}}var d=null,f=new THREE.Projector,h=document.createElement("canvas"),i,q,b,m,p=h.getContext("2d"),E=null,H=null,x=1,A=0,S=null,V=null,T=1,u,R,D,e,g,n,j,o,z,k=new THREE.Color,
-s=new THREE.Color,t=new THREE.Color,r=new THREE.Color,l=new THREE.Color,C,w,L,K,F,W,M,G,I,U=new THREE.Rectangle,P=new THREE.Rectangle,v=new THREE.Rectangle,J=false,N=new THREE.Color,ea=new THREE.Color,ba=new THREE.Color,Z=new THREE.Color,ja=Math.PI*2,Y=new THREE.Vector3,qa,ka,fa,ha,sa,ua,va=16;qa=document.createElement("canvas");qa.width=qa.height=2;ka=qa.getContext("2d");ka.fillStyle="rgba(0,0,0,1)";ka.fillRect(0,0,2,2);fa=ka.getImageData(0,0,2,2);ha=fa.data;sa=document.createElement("canvas");sa.width=
-sa.height=va;ua=sa.getContext("2d");ua.translate(-va/2,-va/2);ua.scale(va,va);va--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(da,ra){i=da;q=ra;b=i/2;m=q/2;h.width=i;h.height=q;U.set(-b,-m,b,m);x=1;A=0;V=S=null;T=1};this.setClearColor=function(da,ra){E=da!==null?new THREE.Color(da):null;H=ra;P.set(-b,-m,b,m);p.setTransform(1,0,0,-1,b,m);this.clear()};this.clear=function(){if(!P.isEmpty()){P.inflate(1);P.minSelf(U);if(E!==null){c(THREE.NormalBlending);
-a(1);p.fillStyle="rgba("+Math.floor(E.r*255)+","+Math.floor(E.g*255)+","+Math.floor(E.b*255)+","+H+")";p.fillRect(P.getX(),P.getY(),P.getWidth(),P.getHeight())}else p.clearRect(P.getX(),P.getY(),P.getWidth(),P.getHeight());P.empty()}};this.render=function(da,ra){function Ma(y){var X,Q,B,O=y.lights;ea.setRGB(0,0,0);ba.setRGB(0,0,0);Z.setRGB(0,0,0);y=0;for(X=O.length;y<X;y++){Q=O[y];B=Q.color;if(Q instanceof THREE.AmbientLight){ea.r+=B.r;ea.g+=B.g;ea.b+=B.b}else if(Q instanceof THREE.DirectionalLight){ba.r+=
-B.r;ba.g+=B.g;ba.b+=B.b}else if(Q instanceof THREE.PointLight){Z.r+=B.r;Z.g+=B.g;Z.b+=B.b}}}function Aa(y,X,Q,B){var O,$,ca,ga,ia=y.lights;y=0;for(O=ia.length;y<O;y++){$=ia[y];ca=$.color;ga=$.intensity;if($ instanceof THREE.DirectionalLight){$=Q.dot($.position)*ga;if($>0){B.r+=ca.r*$;B.g+=ca.g*$;B.b+=ca.b*$}}else if($ instanceof THREE.PointLight){Y.sub($.position,X);Y.normalize();$=Q.dot(Y)*ga;if($>0){B.r+=ca.r*$;B.g+=ca.g*$;B.b+=ca.b*$}}}}function Na(y,X,Q){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);
-var B,O,$,ca,ga,ia;if(Q instanceof THREE.ParticleBasicMaterial){if(Q.map){ca=Q.map;ga=ca.width>>1;ia=ca.height>>1;O=X.scale.x*b;$=X.scale.y*m;Q=O*ga;B=$*ia;v.set(y.x-Q,y.y-B,y.x+Q,y.y+B);if(U.instersects(v)){p.save();p.translate(y.x,y.y);p.rotate(-X.rotation);p.scale(O,-$);p.translate(-ga,-ia);p.drawImage(ca,0,0);p.restore()}}}else if(Q instanceof THREE.ParticleCircleMaterial){if(J){N.r=ea.r+ba.r+Z.r;N.g=ea.g+ba.g+Z.g;N.b=ea.b+ba.b+Z.b;k.r=Q.color.r*N.r;k.g=Q.color.g*N.g;k.b=Q.color.b*N.b;k.updateStyleString()}else k.__styleString=
-Q.color.__styleString;Q=X.scale.x*b;B=X.scale.y*m;v.set(y.x-Q,y.y-B,y.x+Q,y.y+B);if(U.instersects(v)){O=k.__styleString;if(V!=O)p.fillStyle=V=O;p.save();p.translate(y.x,y.y);p.rotate(-X.rotation);p.scale(Q,B);p.beginPath();p.arc(0,0,1,0,ja,true);p.closePath();p.fill();p.restore()}}}}function Oa(y,X,Q,B){if(B.opacity!=0){a(B.opacity);c(B.blending);p.beginPath();p.moveTo(y.positionScreen.x,y.positionScreen.y);p.lineTo(X.positionScreen.x,X.positionScreen.y);p.closePath();if(B instanceof THREE.LineBasicMaterial){k.__styleString=
-B.color.__styleString;y=B.linewidth;if(T!=y)p.lineWidth=T=y;y=k.__styleString;if(S!=y)p.strokeStyle=S=y;p.stroke();v.inflate(B.linewidth*2)}}}function Ia(y,X,Q,B,O,$){if(O.opacity!=0){a(O.opacity);c(O.blending);e=y.positionScreen.x;g=y.positionScreen.y;n=X.positionScreen.x;j=X.positionScreen.y;o=Q.positionScreen.x;z=Q.positionScreen.y;p.beginPath();p.moveTo(e,g);p.lineTo(n,j);p.lineTo(o,z);p.lineTo(e,g);p.closePath();if(O instanceof THREE.MeshBasicMaterial)if(O.map)O.map.image.loaded&&O.map.mapping instanceof
-THREE.UVMapping&&xa(e,g,n,j,o,z,O.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(O.env_map){if(O.env_map.image.loaded)if(O.env_map.mapping instanceof THREE.SphericalReflectionMapping){y=ra.matrix;Y.copy(B.vertexNormalsWorld[0]);K=(Y.x*y.n11+Y.y*y.n12+Y.z*y.n13)*0.5+0.5;F=-(Y.x*y.n21+Y.y*y.n22+Y.z*y.n23)*0.5+0.5;Y.copy(B.vertexNormalsWorld[1]);W=(Y.x*y.n11+Y.y*y.n12+Y.z*y.n13)*0.5+0.5;M=-(Y.x*y.n21+Y.y*y.n22+Y.z*y.n23)*0.5+0.5;Y.copy(B.vertexNormalsWorld[2]);G=
-(Y.x*y.n11+Y.y*y.n12+Y.z*y.n13)*0.5+0.5;I=-(Y.x*y.n21+Y.y*y.n22+Y.z*y.n23)*0.5+0.5;xa(e,g,n,j,o,z,O.env_map.image,K,F,W,M,G,I)}}else O.wireframe?Ba(O.color.__styleString,O.wireframe_linewidth):Ca(O.color.__styleString);else if(O instanceof THREE.MeshLambertMaterial){if(O.map&&!O.wireframe){O.map.mapping instanceof THREE.UVMapping&&xa(e,g,n,j,o,z,O.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);c(THREE.SubtractiveBlending)}if(J)if(!O.wireframe&&O.shading==THREE.SmoothShading&&
-B.vertexNormalsWorld.length==3){s.r=t.r=r.r=ea.r;s.g=t.g=r.g=ea.g;s.b=t.b=r.b=ea.b;Aa($,B.v1.positionWorld,B.vertexNormalsWorld[0],s);Aa($,B.v2.positionWorld,B.vertexNormalsWorld[1],t);Aa($,B.v3.positionWorld,B.vertexNormalsWorld[2],r);l.r=(t.r+r.r)*0.5;l.g=(t.g+r.g)*0.5;l.b=(t.b+r.b)*0.5;L=Ja(s,t,r,l);xa(e,g,n,j,o,z,L,0,0,1,0,0,1)}else{N.r=ea.r;N.g=ea.g;N.b=ea.b;Aa($,B.centroidWorld,B.normalWorld,N);k.r=O.color.r*N.r;k.g=O.color.g*N.g;k.b=O.color.b*N.b;k.updateStyleString();O.wireframe?Ba(k.__styleString,
-O.wireframe_linewidth):Ca(k.__styleString)}else O.wireframe?Ba(O.color.__styleString,O.wireframe_linewidth):Ca(O.color.__styleString)}else if(O instanceof THREE.MeshDepthMaterial){C=ra.near;w=ra.far;s.r=s.g=s.b=1-Ea(y.positionScreen.z,C,w);t.r=t.g=t.b=1-Ea(X.positionScreen.z,C,w);r.r=r.g=r.b=1-Ea(Q.positionScreen.z,C,w);l.r=(t.r+r.r)*0.5;l.g=(t.g+r.g)*0.5;l.b=(t.b+r.b)*0.5;L=Ja(s,t,r,l);xa(e,g,n,j,o,z,L,0,0,1,0,0,1)}else if(O instanceof THREE.MeshNormalMaterial){k.r=Fa(B.normalWorld.x);k.g=Fa(B.normalWorld.y);
-k.b=Fa(B.normalWorld.z);k.updateStyleString();O.wireframe?Ba(k.__styleString,O.wireframe_linewidth):Ca(k.__styleString)}}}function Ba(y,X){if(S!=y)p.strokeStyle=S=y;if(T!=X)p.lineWidth=T=X;p.stroke();v.inflate(X*2)}function Ca(y){if(V!=y)p.fillStyle=V=y;p.fill()}function xa(y,X,Q,B,O,$,ca,ga,ia,na,la,oa,ya){var ta,pa;ta=ca.width-1;pa=ca.height-1;ga*=ta;ia*=pa;na*=ta;la*=pa;oa*=ta;ya*=pa;Q-=y;B-=X;O-=y;$-=X;na-=ga;la-=ia;oa-=ga;ya-=ia;pa=1/(na*ya-oa*la);ta=(ya*Q-la*O)*pa;la=(ya*B-la*$)*pa;Q=(na*O-
-oa*Q)*pa;B=(na*$-oa*B)*pa;y=y-ta*ga-Q*ia;X=X-la*ga-B*ia;p.save();p.transform(ta,la,Q,B,y,X);p.clip();p.drawImage(ca,0,0);p.restore()}function Ja(y,X,Q,B){var O=~~(y.r*255),$=~~(y.g*255);y=~~(y.b*255);var ca=~~(X.r*255),ga=~~(X.g*255);X=~~(X.b*255);var ia=~~(Q.r*255),na=~~(Q.g*255);Q=~~(Q.b*255);var la=~~(B.r*255),oa=~~(B.g*255);B=~~(B.b*255);ha[0]=O<0?0:O>255?255:O;ha[1]=$<0?0:$>255?255:$;ha[2]=y<0?0:y>255?255:y;ha[4]=ca<0?0:ca>255?255:ca;ha[5]=ga<0?0:ga>255?255:ga;ha[6]=X<0?0:X>255?255:X;ha[8]=ia<
-0?0:ia>255?255:ia;ha[9]=na<0?0:na>255?255:na;ha[10]=Q<0?0:Q>255?255:Q;ha[12]=la<0?0:la>255?255:la;ha[13]=oa<0?0:oa>255?255:oa;ha[14]=B<0?0:B>255?255:B;ka.putImageData(fa,0,0);ua.drawImage(qa,0,0);return sa}function Ea(y,X,Q){y=(y-X)/(Q-X);return y*y*(3-2*y)}function Fa(y){y=(y+1)*0.5;return y<0?0:y>1?1:y}function Ga(y,X){var Q=X.x-y.x,B=X.y-y.y,O=1/Math.sqrt(Q*Q+B*B);Q*=O;B*=O;X.x+=Q;X.y+=B;y.x-=Q;y.y-=B}var Da,Ka,aa,ma,wa,Ha,La,za;p.setTransform(1,0,0,-1,b,m);this.autoClear&&this.clear();d=f.projectScene(da,
-ra,this.sortElements);(J=da.lights.length>0)&&Ma(da);Da=0;for(Ka=d.length;Da<Ka;Da++){aa=d[Da];v.empty();if(aa instanceof THREE.RenderableParticle){u=aa;u.x*=b;u.y*=m;ma=0;for(wa=aa.materials.length;ma<wa;ma++)Na(u,aa,aa.materials[ma],da)}else if(aa instanceof THREE.RenderableLine){u=aa.v1;R=aa.v2;u.positionScreen.x*=b;u.positionScreen.y*=m;R.positionScreen.x*=b;R.positionScreen.y*=m;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(R.positionScreen.x,R.positionScreen.y);if(U.instersects(v)){ma=
-0;for(wa=aa.materials.length;ma<wa;)Oa(u,R,aa,aa.materials[ma++],da)}}else if(aa instanceof THREE.RenderableFace3){u=aa.v1;R=aa.v2;D=aa.v3;u.positionScreen.x*=b;u.positionScreen.y*=m;R.positionScreen.x*=b;R.positionScreen.y*=m;D.positionScreen.x*=b;D.positionScreen.y*=m;if(aa.overdraw){Ga(u.positionScreen,R.positionScreen);Ga(R.positionScreen,D.positionScreen);Ga(D.positionScreen,u.positionScreen)}v.add3Points(u.positionScreen.x,u.positionScreen.y,R.positionScreen.x,R.positionScreen.y,D.positionScreen.x,
-D.positionScreen.y);if(U.instersects(v)){ma=0;for(wa=aa.meshMaterials.length;ma<wa;){za=aa.meshMaterials[ma++];if(za instanceof THREE.MeshFaceMaterial){Ha=0;for(La=aa.faceMaterials.length;Ha<La;)(za=aa.faceMaterials[Ha++])&&Ia(u,R,D,aa,za,da)}else Ia(u,R,D,aa,za,da)}}}P.addRectangle(v)}p.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(K,F,W){var M,G,I,U;M=0;for(G=K.lights.length;M<G;M++){I=K.lights[M];if(I instanceof THREE.DirectionalLight){U=F.normalWorld.dot(I.position)*I.intensity;if(U>0){W.r+=I.color.r*U;W.g+=I.color.g*U;W.b+=I.color.b*U}}else if(I instanceof THREE.PointLight){z.sub(I.position,F.centroidWorld);z.normalize();U=F.normalWorld.dot(z)*I.intensity;if(U>0){W.r+=I.color.r*U;W.g+=I.color.g*U;W.b+=I.color.b*U}}}}function c(K,F,W,M,G,I){r=f(l++);r.setAttribute("d","M "+K.positionScreen.x+
-" "+K.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(G instanceof THREE.MeshBasicMaterial)D.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshLambertMaterial)if(R){e.r=g.r;e.g=g.g;e.b=g.b;a(I,M,e);D.r=G.color.r*e.r;D.g=G.color.g*e.g;D.b=G.color.b*e.b;D.updateStyleString()}else D.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshDepthMaterial){o=1-G.__2near/(G.__farPlusNear-M.z*G.__farMinusNear);
-D.setRGB(o,o,o)}else G instanceof THREE.MeshNormalMaterial&&D.setRGB(h(M.normalWorld.x),h(M.normalWorld.y),h(M.normalWorld.z));G.wireframe?r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+G.wireframe_linewidth+"; stroke-opacity: "+G.opacity+"; stroke-linecap: "+G.wireframe_linecap+"; stroke-linejoin: "+G.wireframe_linejoin):r.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+G.opacity);b.appendChild(r)}function d(K,F,W,M,G,I,U){r=f(l++);r.setAttribute("d",
-"M "+K.positionScreen.x+" "+K.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)D.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(R){e.r=g.r;e.g=g.g;e.b=g.b;a(U,G,e);D.r=I.color.r*e.r;D.g=I.color.g*e.g;D.b=I.color.b*e.b;D.updateStyleString()}else D.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){o=
-1-I.__2near/(I.__farPlusNear-G.z*I.__farMinusNear);D.setRGB(o,o,o)}else I instanceof THREE.MeshNormalMaterial&&D.setRGB(h(G.normalWorld.x),h(G.normalWorld.y),h(G.normalWorld.z));I.wireframe?r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):r.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+I.opacity);b.appendChild(r)}
-function f(K){if(k[K]==null){k[K]=document.createElementNS("http://www.w3.org/2000/svg","path");L==0&&k[K].setAttribute("shape-rendering","crispEdges");return k[K]}return k[K]}function h(K){return K<0?Math.min((1+K)*0.5,0.5):0.5+Math.min(K*0.5,0.5)}var i=null,q=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,p,E,H,x,A,S,V,T=new THREE.Rectangle,u=new THREE.Rectangle,R=false,D=new THREE.Color(16777215),e=new THREE.Color(16777215),g=new THREE.Color(0),n=new THREE.Color(0),
-j=new THREE.Color(0),o,z=new THREE.Vector3,k=[],s=[],t=[],r,l,C,w,L=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(K){switch(K){case "high":L=1;break;case "low":L=0}};this.setSize=function(K,F){m=K;p=F;E=m/2;H=p/2;b.setAttribute("viewBox",-E+" "+-H+" "+m+" "+p);b.setAttribute("width",m);b.setAttribute("height",p);T.set(-E,-H,E,H)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(K,F){var W,M,
-G,I,U,P,v,J;this.autoClear&&this.clear();i=q.projectScene(K,F,this.sortElements);w=C=l=0;if(R=K.lights.length>0){v=K.lights;g.setRGB(0,0,0);n.setRGB(0,0,0);j.setRGB(0,0,0);W=0;for(M=v.length;W<M;W++){G=v[W];I=G.color;if(G instanceof THREE.AmbientLight){g.r+=I.r;g.g+=I.g;g.b+=I.b}else if(G instanceof THREE.DirectionalLight){n.r+=I.r;n.g+=I.g;n.b+=I.b}else if(G instanceof THREE.PointLight){j.r+=I.r;j.g+=I.g;j.b+=I.b}}}W=0;for(M=i.length;W<M;W++){v=i[W];u.empty();if(v instanceof THREE.RenderableParticle){x=
-v;x.x*=E;x.y*=-H;G=0;for(I=v.materials.length;G<I;G++)if(J=v.materials[G]){U=x;P=v;J=J;var N=C++;if(s[N]==null){s[N]=document.createElementNS("http://www.w3.org/2000/svg","circle");L==0&&s[N].setAttribute("shape-rendering","crispEdges")}r=s[N];r.setAttribute("cx",U.x);r.setAttribute("cy",U.y);r.setAttribute("r",P.scale.x*E);if(J instanceof THREE.ParticleCircleMaterial){if(R){e.r=g.r+n.r+j.r;e.g=g.g+n.g+j.g;e.b=g.b+n.b+j.b;D.r=J.color.r*e.r;D.g=J.color.g*e.g;D.b=J.color.b*e.b;D.updateStyleString()}else D=
-J.color;r.setAttribute("style","fill: "+D.__styleString)}b.appendChild(r)}}else if(v instanceof THREE.RenderableLine){x=v.v1;A=v.v2;x.positionScreen.x*=E;x.positionScreen.y*=-H;A.positionScreen.x*=E;A.positionScreen.y*=-H;u.addPoint(x.positionScreen.x,x.positionScreen.y);u.addPoint(A.positionScreen.x,A.positionScreen.y);if(T.instersects(u)){G=0;for(I=v.materials.length;G<I;)if(J=v.materials[G++]){U=x;P=A;J=J;N=w++;if(t[N]==null){t[N]=document.createElementNS("http://www.w3.org/2000/svg","line");L==
-0&&t[N].setAttribute("shape-rendering","crispEdges")}r=t[N];r.setAttribute("x1",U.positionScreen.x);r.setAttribute("y1",U.positionScreen.y);r.setAttribute("x2",P.positionScreen.x);r.setAttribute("y2",P.positionScreen.y);if(J instanceof THREE.LineBasicMaterial){D.__styleString=J.color.__styleString;r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+J.linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.linecap+"; stroke-linejoin: "+J.linejoin);b.appendChild(r)}}}}else if(v instanceof
-THREE.RenderableFace3){x=v.v1;A=v.v2;S=v.v3;x.positionScreen.x*=E;x.positionScreen.y*=-H;A.positionScreen.x*=E;A.positionScreen.y*=-H;S.positionScreen.x*=E;S.positionScreen.y*=-H;u.addPoint(x.positionScreen.x,x.positionScreen.y);u.addPoint(A.positionScreen.x,A.positionScreen.y);u.addPoint(S.positionScreen.x,S.positionScreen.y);if(T.instersects(u)){G=0;for(I=v.meshMaterials.length;G<I;){J=v.meshMaterials[G++];if(J instanceof THREE.MeshFaceMaterial){U=0;for(P=v.faceMaterials.length;U<P;)(J=v.faceMaterials[U++])&&
-c(x,A,S,v,J,K)}else J&&c(x,A,S,v,J,K)}}}else if(v instanceof THREE.RenderableFace4){x=v.v1;A=v.v2;S=v.v3;V=v.v4;x.positionScreen.x*=E;x.positionScreen.y*=-H;A.positionScreen.x*=E;A.positionScreen.y*=-H;S.positionScreen.x*=E;S.positionScreen.y*=-H;V.positionScreen.x*=E;V.positionScreen.y*=-H;u.addPoint(x.positionScreen.x,x.positionScreen.y);u.addPoint(A.positionScreen.x,A.positionScreen.y);u.addPoint(S.positionScreen.x,S.positionScreen.y);u.addPoint(V.positionScreen.x,V.positionScreen.y);if(T.instersects(u)){G=
-0;for(I=v.meshMaterials.length;G<I;){J=v.meshMaterials[G++];if(J instanceof THREE.MeshFaceMaterial){U=0;for(P=v.faceMaterials.length;U<P;)(J=v.faceMaterials[U++])&&d(x,A,S,V,v,J,K)}else J&&d(x,A,S,V,v,J,K)}}}}}};
-THREE.WebGLRenderer=function(a){function c(e,g){e.fragment_shader=g.fragment_shader;e.vertex_shader=g.vertex_shader;e.uniforms=Uniforms.clone(g.uniforms)}function d(e,g){e.uniforms.color.value.setRGB(e.color.r*e.opacity,e.color.g*e.opacity,e.color.b*e.opacity);e.uniforms.opacity.value=e.opacity;e.uniforms.map.texture=e.map;e.uniforms.env_map.texture=e.env_map;e.uniforms.reflectivity.value=e.reflectivity;e.uniforms.refraction_ratio.value=e.refraction_ratio;e.uniforms.combine.value=e.combine;e.uniforms.useRefract.value=
-e.env_map&&e.env_map.mapping instanceof THREE.CubeRefractionMapping;if(g){e.uniforms.fogColor.value.setHex(g.color.hex);if(g instanceof THREE.Fog){e.uniforms.fogNear.value=g.near;e.uniforms.fogFar.value=g.far}else if(g instanceof THREE.FogExp2)e.uniforms.fogDensity.value=g.density}}function f(e,g){e.uniforms.color.value.setRGB(e.color.r*e.opacity,e.color.g*e.opacity,e.color.b*e.opacity);e.uniforms.opacity.value=e.opacity;if(g){e.uniforms.fogColor.value.setHex(g.color.hex);if(g instanceof THREE.Fog){e.uniforms.fogNear.value=
-g.near;e.uniforms.fogFar.value=g.far}else if(g instanceof THREE.FogExp2)e.uniforms.fogDensity.value=g.density}}function h(e,g){var n;if(e=="fragment")n=b.createShader(b.FRAGMENT_SHADER);else if(e=="vertex")n=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,g);b.compileShader(n);if(!b.getShaderParameter(n,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(n));return null}return n}function i(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;
-case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;
-case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var q=document.createElement("canvas"),b,m=null,p=null,E=new THREE.Matrix4,H,x=new Float32Array(16),A=new Float32Array(16),S=new Float32Array(16),V=new Float32Array(9),
-T=new Float32Array(16),u=true,R=new THREE.Color(0),D=0;if(a){if(a.antialias!==undefined)u=a.antialias;a.clearColor!==undefined&&R.setHex(a.clearColor);if(a.clearAlpha!==undefined)D=a.clearAlpha}this.domElement=q;this.autoClear=true;(function(e,g,n){try{b=q.getContext("experimental-webgl",{antialias:e})}catch(j){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);
-b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(g.r,g.g,g.b,n)})(u,R,D);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(e,g){q.width=e;q.height=g;b.viewport(0,0,q.width,q.height)};this.setClearColor=function(e,g){var n=new THREE.Color(e);b.clearColor(n.r,n.g,n.b,g)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=
-function(e,g){var n,j,o,z=0,k=0,s=0,t,r,l,C=this.lights,w=C.directional.colors,L=C.directional.positions,K=C.point.colors,F=C.point.positions,W=0,M=0;n=0;for(j=g.length;n<j;n++){o=g[n];t=o.color;r=o.position;l=o.intensity;if(o instanceof THREE.AmbientLight){z+=t.r;k+=t.g;s+=t.b}else if(o instanceof THREE.DirectionalLight){w[W*3]=t.r*l;w[W*3+1]=t.g*l;w[W*3+2]=t.b*l;L[W*3]=r.x;L[W*3+1]=r.y;L[W*3+2]=r.z;W+=1}else if(o instanceof THREE.PointLight){K[M*3]=t.r*l;K[M*3+1]=t.g*l;K[M*3+2]=t.b*l;F[M*3]=r.x;
-F[M*3+1]=r.y;F[M*3+2]=r.z;M+=1}}C.point.length=M;C.directional.length=W;C.ambient[0]=z;C.ambient[1]=k;C.ambient[2]=s};this.createParticleBuffers=function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLNormalBuffer=b.createBuffer();e.__webGLTangentBuffer=b.createBuffer();e.__webGLUVBuffer=
-b.createBuffer();e.__webGLFaceBuffer=b.createBuffer();e.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(e){var g=e.vertices.length;e.__vertexArray=new Float32Array(g*3);e.__lineArray=new Uint16Array(g);e.__webGLLineCount=g};this.initMeshBuffers=function(e,g){var n,j,o=0,z=0,k=0,s=g.geometry.faces,t=e.faces;n=0;for(j=t.length;n<j;n++){fi=t[n];face=s[fi];if(face instanceof THREE.Face3){o+=3;z+=1;k+=3}else if(face instanceof THREE.Face4){o+=4;z+=2;k+=4}}e.__vertexArray=new Float32Array(o*
-3);e.__normalArray=new Float32Array(o*3);e.__tangentArray=new Float32Array(o*4);e.__uvArray=new Float32Array(o*2);e.__faceArray=new Uint16Array(z*3);e.__lineArray=new Uint16Array(k*2);o=false;n=0;for(j=g.materials.length;n<j;n++){s=g.materials[n];if(s instanceof THREE.MeshFaceMaterial){s=0;for(t=e.materials.length;s<t;s++)if(e.materials[s]&&e.materials[s].shading!=undefined&&e.materials[s].shading==THREE.SmoothShading){o=true;break}}else if(s&&s.shading!=undefined&&s.shading==THREE.SmoothShading){o=
-true;break}if(o)break}e.__needsSmoothNormals=o;e.__webGLFaceCount=z*3;e.__webGLLineCount=k*2};this.setMeshBuffers=function(e,g,n,j,o,z,k,s){var t,r,l,C,w,L,K,F,W,M=0,G=0,I=0,U=0,P=0,v=0,J=0,N=e.__vertexArray,ea=e.__uvArray,ba=e.__normalArray,Z=e.__tangentArray,ja=e.__faceArray,Y=e.__lineArray,qa=e.__needsSmoothNormals,ka=g.geometry,fa=ka.vertices,ha=e.faces,sa=ka.faces,ua=ka.uvs;g=0;for(t=ha.length;g<t;g++){r=ha[g];l=sa[r];r=ua[r];C=l.vertexNormals;w=l.normal;if(l instanceof THREE.Face3){if(j){L=
-fa[l.a].position;K=fa[l.b].position;F=fa[l.c].position;N[G]=L.x;N[G+1]=L.y;N[G+2]=L.z;N[G+3]=K.x;N[G+4]=K.y;N[G+5]=K.z;N[G+6]=F.x;N[G+7]=F.y;N[G+8]=F.z;G+=9}if(s&&ka.hasTangents){L=fa[l.a].tangent;K=fa[l.b].tangent;F=fa[l.c].tangent;Z[v]=L.x;Z[v+1]=L.y;Z[v+2]=L.z;Z[v+3]=L.w;Z[v+4]=K.x;Z[v+5]=K.y;Z[v+6]=K.z;Z[v+7]=K.w;Z[v+8]=F.x;Z[v+9]=F.y;Z[v+10]=F.z;Z[v+11]=F.w;v+=12}if(k)if(C.length==3&&qa)for(l=0;l<3;l++){w=C[l];ba[P]=w.x;ba[P+1]=w.y;ba[P+2]=w.z;P+=3}else for(l=0;l<3;l++){ba[P]=w.x;ba[P+1]=w.y;
-ba[P+2]=w.z;P+=3}if(z&&r)for(l=0;l<3;l++){C=r[l];ea[I]=C.u;ea[I+1]=C.v;I+=2}if(o){ja[U]=M;ja[U+1]=M+1;ja[U+2]=M+2;U+=3;Y[J]=M;Y[J+1]=M+1;Y[J+2]=M;Y[J+3]=M+2;Y[J+4]=M+1;Y[J+5]=M+2;J+=6;M+=3}}else if(l instanceof THREE.Face4){if(j){L=fa[l.a].position;K=fa[l.b].position;F=fa[l.c].position;W=fa[l.d].position;N[G]=L.x;N[G+1]=L.y;N[G+2]=L.z;N[G+3]=K.x;N[G+4]=K.y;N[G+5]=K.z;N[G+6]=F.x;N[G+7]=F.y;N[G+8]=F.z;N[G+9]=W.x;N[G+10]=W.y;N[G+11]=W.z;G+=12}if(s&&ka.hasTangents){L=fa[l.a].tangent;K=fa[l.b].tangent;
-F=fa[l.c].tangent;l=fa[l.d].tangent;Z[v]=L.x;Z[v+1]=L.y;Z[v+2]=L.z;Z[v+3]=L.w;Z[v+4]=K.x;Z[v+5]=K.y;Z[v+6]=K.z;Z[v+7]=K.w;Z[v+8]=F.x;Z[v+9]=F.y;Z[v+10]=F.z;Z[v+11]=F.w;Z[v+12]=l.x;Z[v+13]=l.y;Z[v+14]=l.z;Z[v+15]=l.w;v+=16}if(k)if(C.length==4&&qa)for(l=0;l<4;l++){w=C[l];ba[P]=w.x;ba[P+1]=w.y;ba[P+2]=w.z;P+=3}else for(l=0;l<4;l++){ba[P]=w.x;ba[P+1]=w.y;ba[P+2]=w.z;P+=3}if(z&&r)for(l=0;l<4;l++){C=r[l];ea[I]=C.u;ea[I+1]=C.v;I+=2}if(o){ja[U]=M;ja[U+1]=M+1;ja[U+2]=M+2;ja[U+3]=M;ja[U+4]=M+2;ja[U+5]=M+3;
-U+=6;Y[J]=M;Y[J+1]=M+1;Y[J+2]=M;Y[J+3]=M+3;Y[J+4]=M+1;Y[J+5]=M+2;Y[J+6]=M+2;Y[J+7]=M+3;J+=8;M+=4}}}if(j){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,N,n)}if(k){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,ba,n)}if(s&&ka.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,Z,n)}if(z&&I>0){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,ea,n)}if(o){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-e.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ja,n);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Y,n)}};this.setLineBuffers=function(e,g,n,j){var o,z,k=e.vertices,s=k.length,t=e.__vertexArray,r=e.__lineArray;if(n)for(n=0;n<s;n++){o=k[n].position;z=n*3;t[z]=o.x;t[z+1]=o.y;t[z+2]=o.z}if(j)for(n=0;n<s;n++)r[n]=n;b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,t,g);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.__webGLLineBuffer);
-b.bufferData(b.ELEMENT_ARRAY_BUFFER,r,g)};this.setParticleBuffers=function(){};this.renderBuffer=function(e,g,n,j,o,z){var k,s,t,r;if(!j.program){if(j instanceof THREE.MeshDepthMaterial){c(j,THREE.ShaderLib.depth);j.uniforms.mNear.value=e.near;j.uniforms.mFar.value=e.far}else if(j instanceof THREE.MeshNormalMaterial)c(j,THREE.ShaderLib.normal);else if(j instanceof THREE.MeshBasicMaterial){c(j,THREE.ShaderLib.basic);d(j,n)}else if(j instanceof THREE.MeshLambertMaterial){c(j,THREE.ShaderLib.lambert);
-d(j,n)}else if(j instanceof THREE.MeshPhongMaterial){c(j,THREE.ShaderLib.phong);d(j,n)}else if(j instanceof THREE.LineBasicMaterial){c(j,THREE.ShaderLib.basic);f(j,n)}var l,C,w;l=r=s=0;for(C=g.length;l<C;l++){w=g[l];w instanceof THREE.DirectionalLight&&r++;w instanceof THREE.PointLight&&s++}if(s+r<=4){l=r;s=s}else{l=Math.ceil(4*r/(s+r));s=4-l}s={directional:l,point:s};r={fog:n,map:j.map,env_map:j.env_map,maxDirLights:s.directional,maxPointLights:s.point};s=j.fragment_shader;l=j.vertex_shader;C=b.createProgram();
-w=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");r=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,
-r.map?"#define USE_MAP":"",r.env_map?"#define USE_ENVMAP":"","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");b.attachShader(C,h("fragment",w+s));b.attachShader(C,h("vertex",r+l));b.linkProgram(C);b.getProgramParameter(C,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+
-b.getProgramParameter(C,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");C.uniforms={};C.attributes={};j.program=C;s=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(k in j.uniforms)s.push(k);k=j.program;l=0;for(C=s.length;l<C;l++){w=s[l];k.uniforms[w]=b.getUniformLocation(k,w)}k=j.program;s=["position","normal","uv","tangent"];l=0;for(C=s.length;l<C;l++){w=s[l];k.attributes[w]=b.getAttribLocation(k,w)}}k=j.program;if(k!=m){b.useProgram(k);
-m=k}this.loadCamera(k,e);this.loadMatrices(k);if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){this.setupLights(k,g);e=this.lights;j.uniforms.enableLighting.value=e.directional.length+e.point.length;j.uniforms.ambientLightColor.value=e.ambient;j.uniforms.directionalLightColor.value=e.directional.colors;j.uniforms.directionalLightDirection.value=e.directional.positions;j.uniforms.pointLightColor.value=e.point.colors;j.uniforms.pointLightPosition.value=e.point.positions}if(j instanceof
-THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial)d(j,n);j instanceof THREE.LineBasicMaterial&&f(j,n);if(j instanceof THREE.MeshPhongMaterial){j.uniforms.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);j.uniforms.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);j.uniforms.shininess.value=j.shininess}n=j.uniforms;for(t in n)if(l=k.uniforms[t]){g=n[t];s=g.type;e=g.value;if(s=="i")b.uniform1i(l,e);else if(s=="f")b.uniform1f(l,
-e);else if(s=="fv1")b.uniform1fv(l,e);else if(s=="fv")b.uniform3fv(l,e);else if(s=="v2")b.uniform2f(l,e.x,e.y);else if(s=="v3")b.uniform3f(l,e.x,e.y,e.z);else if(s=="c")b.uniform3f(l,e.r,e.g,e.b);else if(s=="t"){b.uniform1i(l,e);if(g=g.texture)if(g.image instanceof Array&&g.image.length==6){g=g;e=e;if(g.image.length==6){if(!g.image.__webGLTextureCube&&!g.image.__cubeMapInitialized&&g.image.loadCount==6){g.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,g.image.__webGLTextureCube);
-b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(s=0;s<6;++s)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,g.image[s]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);g.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+
-e);b.bindTexture(b.TEXTURE_CUBE_MAP,g.image.__webGLTextureCube)}}else{g=g;e=e;if(!g.__webGLTexture&&g.image.loaded){g.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,g.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,g.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(g.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(g.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,i(g.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,i(g.min_filter));
-b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+e);b.bindTexture(b.TEXTURE_2D,g.__webGLTexture)}}}t=k.attributes;b.bindBuffer(b.ARRAY_BUFFER,o.__webGLVertexBuffer);b.vertexAttribPointer(t.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(t.position);if(t.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLNormalBuffer);b.vertexAttribPointer(t.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(t.normal)}if(t.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLTangentBuffer);
-b.vertexAttribPointer(t.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(t.tangent)}if(t.uv>=0)if(o.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUVBuffer);b.vertexAttribPointer(t.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(t.uv)}else b.disableVertexAttribArray(t.uv);if(j.wireframe||j instanceof THREE.LineBasicMaterial){t=j.wireframe_linewidth!==undefined?j.wireframe_linewidth:j.linewidth!==undefined?j.linewidth:1;j=j instanceof THREE.LineBasicMaterial&&z.type==THREE.LineStrip?
-b.LINE_STRIP:b.LINES;b.lineWidth(t);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);b.drawElements(j,o.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,o.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(e,g,n,j,o,z,k){var s,t,r,l,C;r=0;for(l=j.materials.length;r<l;r++){s=j.materials[r];if(s instanceof THREE.MeshFaceMaterial){s=0;for(t=o.materials.length;s<t;s++)if((C=o.materials[s])&&C.blending==z&&
-C.opacity<1==k){this.setBlending(C.blending);this.renderBuffer(e,g,n,C,o,j)}}else if((C=s)&&C.blending==z&&C.opacity<1==k){this.setBlending(C.blending);this.renderBuffer(e,g,n,C,o,j)}}};this.render=function(e,g,n,j){var o,z,k,s=e.lights,t=e.fog;this.initWebGLObjects(e);j=j!==undefined?j:true;if(n&&!n.__webGLFramebuffer){n.__webGLFramebuffer=b.createFramebuffer();n.__webGLRenderbuffer=b.createRenderbuffer();n.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,n.__webGLRenderbuffer);
-b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,n.width,n.height);b.bindTexture(b.TEXTURE_2D,n.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(n.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(n.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,i(n.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,i(n.min_filter));b.texImage2D(b.TEXTURE_2D,0,i(n.format),n.width,n.height,0,i(n.format),i(n.type),null);b.bindFramebuffer(b.FRAMEBUFFER,n.__webGLFramebuffer);
-b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,n.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,n.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(n){o=n.__webGLFramebuffer;k=n.width;z=n.height}else{o=null;k=q.width;z=q.height}if(o!=p){b.bindFramebuffer(b.FRAMEBUFFER,o);b.viewport(0,0,k,z);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);p=o}this.autoClear&&
-this.clear();g.autoUpdateMatrix&&g.updateMatrix();x.set(g.matrix.flatten());S.set(g.projectionMatrix.flatten());j=0;for(o=e.__webGLObjects.length;j<o;j++){z=e.__webGLObjects[j];k=z.object;z=z.buffer;if(k.visible){this.setupMatrices(k,g);this.renderPass(g,s,t,k,z,THREE.NormalBlending,false)}}j=0;for(o=e.__webGLObjects.length;j<o;j++){z=e.__webGLObjects[j];k=z.object;z=z.buffer;if(k.visible){this.setupMatrices(k,g);if(k.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);k.flipSided?b.frontFace(b.CW):
-b.frontFace(b.CCW)}this.renderPass(g,s,t,k,z,THREE.AdditiveBlending,false);this.renderPass(g,s,t,k,z,THREE.SubtractiveBlending,false);this.renderPass(g,s,t,k,z,THREE.AdditiveBlending,true);this.renderPass(g,s,t,k,z,THREE.SubtractiveBlending,true);this.renderPass(g,s,t,k,z,THREE.NormalBlending,true)}}if(n&&n.min_filter!==THREE.NearestFilter&&n.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,n.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=
-function(e){function g(r,l,C,w){if(r[l]==undefined){e.__webGLObjects.push({buffer:C,object:w});r[l]=1}}var n,j,o,z,k,s,t;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap={}}n=0;for(j=e.objects.length;n<j;n++){o=e.objects[n];k=o.geometry;if(e.__webGLObjectsMap[o.id]==undefined)e.__webGLObjectsMap[o.id]={};t=e.__webGLObjectsMap[o.id];if(o instanceof THREE.Mesh){for(z in k.geometryChunks){s=k.geometryChunks[z];if(!s.__webGLVertexBuffer){this.createMeshBuffers(s);this.initMeshBuffers(s,o);
-k.__dirtyVertices=true;k.__dirtyElements=true;k.__dirtyUvs=true;k.__dirtyNormals=true;k.__dirtyTangents=true}if(k.__dirtyVertices||k.__dirtyElements||k.__dirtyUvs)this.setMeshBuffers(s,o,b.DYNAMIC_DRAW,k.__dirtyVertices,k.__dirtyElements,k.__dirtyUvs,k.__dirtyNormals,k.__dirtyTangents);g(t,z,s,o)}k.__dirtyVertices=false;k.__dirtyElements=false;k.__dirtyUvs=false;k.__dirtyNormals=false;k.__dirtyTangents=false}else if(o instanceof THREE.Line){if(!k.__webGLVertexBuffer){this.createLineBuffers(k);this.initLineBuffers(k);
-k.__dirtyVertices=true;k.__dirtyElements=true}k.__dirtyVertices&&this.setLineBuffers(k,b.DYNAMIC_DRAW,k.__dirtyVertices,k.__dirtyElements);g(t,0,k,o);k.__dirtyVertices=false;k.__dirtyElements=false}else if(o instanceof THREE.ParticleSystem){k.__webGLVertexBuffer||this.createParticleBuffers(k);g(t,0,k,o)}}};this.removeObject=function(e,g){var n,j;for(n=e.__webGLObjects.length-1;n>=0;n--){j=e.__webGLObjects[n].object;g==j&&e.__webGLObjects.splice(n,1)}};this.setupMatrices=function(e,g){e.autoUpdateMatrix&&
-e.updateMatrix();E.multiply(g.matrix,e.matrix);A.set(E.flatten());H=THREE.Matrix4.makeInvert3x3(E).transpose();V.set(H.m);T.set(e.matrix.flatten())};this.loadMatrices=function(e){b.uniformMatrix4fv(e.uniforms.viewMatrix,false,x);b.uniformMatrix4fv(e.uniforms.modelViewMatrix,false,A);b.uniformMatrix4fv(e.uniforms.projectionMatrix,false,S);b.uniformMatrix3fv(e.uniforms.normalMatrix,false,V);b.uniformMatrix4fv(e.uniforms.objectMatrix,false,T)};this.loadCamera=function(e,g){b.uniform3f(e.uniforms.cameraPosition,
-g.position.x,g.position.y,g.position.z)};this.setBlending=function(e){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(e,g){if(e){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);
-b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
-THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
-envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
-map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
-lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
-lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"};
-THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",
-value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}}};
-THREE.ShaderLib={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}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
-THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
-THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,"gl_FragColor =  mColor * mapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,
-THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},
-shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,
-"gl_FragColor =  mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
-THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\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.faceMaterials=this.meshMaterials=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.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
+// Three.js r32 - 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,d,e){this.r=a;this.g=d;this.b=e;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)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,d){this.x=a||0;this.y=d||0};
+THREE.Vector2.prototype={set:function(a,d){this.x=a;this.y=d;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,d){this.x=a.x+d.x;this.y=a.y+d.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,d){this.x=a.x-d.x;this.y=a.y-d.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,d,e){this.x=a||0;this.y=d||0;this.z=e||0};
+THREE.Vector3.prototype={set:function(a,d,e){this.x=a;this.y=d;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,d){this.x=a.x+d.x;this.y=a.y+d.y;this.z=a.z+d.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,d){this.x=a.x-d.x;this.y=a.y-d.y;this.z=a.z-d.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
+cross:function(a,d){this.x=a.y*d.z-a.z*d.y;this.y=a.z*d.x-a.x*d.z;this.z=a.x*d.y-a.y*d.x;return this},crossSelf:function(a){var d=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-d*a.z;this.z=d*a.y-e*a.x;return this},multiply:function(a,d){this.x=a.x*d.x;this.y=a.y*d.y;this.z=a.z*d.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},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
+a.z;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 d=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(d*d+e*e+a*a)},distanceToSquared:function(a){var d=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return d*d+e*e+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,d,e,f){this.x=a||0;this.y=d||0;this.z=e||0;this.w=f||1};
+THREE.Vector4.prototype={set:function(a,d,e,f){this.x=a;this.y=d;this.z=e;this.w=f;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,d){this.x=a.x+d.x;this.y=a.y+d.y;this.z=a.z+d.z;this.w=a.w+d.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,d){this.x=a.x-d.x;this.y=a.y-d.y;this.z=a.z-d.z;this.w=a.w-d.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,d){this.x+=(a.x-this.x)*d;this.y+=(a.y-this.y)*d;this.z+=(a.z-this.z)*d;this.w+=(a.w-this.w)*d},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,d){this.origin=a||new THREE.Vector3;this.direction=d||new THREE.Vector3};
+THREE.Ray.prototype={intersectScene:function(a){var d,e,f=a.objects,h=[];a=0;for(d=f.length;a<d;a++){e=f[a];if(e instanceof THREE.Mesh)h=h.concat(this.intersectObject(e))}h.sort(function(i,p){return i.distance-p.distance});return h},intersectObject:function(a){function d(Q,q,$,L){L=L.clone().subSelf(q);$=$.clone().subSelf(q);var g=Q.clone().subSelf(q);Q=L.dot(L);q=L.dot($);L=L.dot(g);var k=$.dot($);$=$.dot(g);g=1/(Q*k-q*q);k=(k*L-q*$)*g;Q=(Q*$-q*L)*g;return k>0&&Q>0&&k+Q<1}var e,f,h,i,p,b,j,l,C,F,
+A,E=a.geometry,N=E.vertices,P=[];e=0;for(f=E.faces.length;e<f;e++){h=E.faces[e];F=this.origin.clone();A=this.direction.clone();i=a.matrix.multiplyVector3(N[h.a].position.clone());p=a.matrix.multiplyVector3(N[h.b].position.clone());b=a.matrix.multiplyVector3(N[h.c].position.clone());j=h instanceof THREE.Face4?a.matrix.multiplyVector3(N[h.d].position.clone()):null;l=a.rotationMatrix.multiplyVector3(h.normal.clone());C=A.dot(l);if(C<0){l=l.dot((new THREE.Vector3).sub(i,F))/C;F=F.addSelf(A.multiplyScalar(l));
+if(h instanceof THREE.Face3){if(d(F,i,p,b)){h={distance:this.origin.distanceTo(F),point:F,face:h,object:a};P.push(h)}}else if(h instanceof THREE.Face4)if(d(F,i,p,j)||d(F,p,b,j)){h={distance:this.origin.distanceTo(F),point:F,face:h,object:a};P.push(h)}}}return P}};
+THREE.Rectangle=function(){function a(){i=f-d;p=h-e}var d,e,f,h,i,p,b=true;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return p};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(j,l,C,F){b=false;d=j;e=l;f=C;h=F;a()};this.addPoint=function(j,l){if(b){b=false;d=j;e=l;f=j;h=l}else{d=d<j?d:j;e=e<l?e:l;f=f>j?f:j;h=h>l?
+h:l}a()};this.add3Points=function(j,l,C,F,A,E){if(b){b=false;d=j<C?j<A?j:A:C<A?C:A;e=l<F?l<E?l:E:F<E?F:E;f=j>C?j>A?j:A:C>A?C:A;h=l>F?l>E?l:E:F>E?F:E}else{d=j<C?j<A?j<d?j:d:A<d?A:d:C<A?C<d?C:d:A<d?A:d;e=l<F?l<E?l<e?l:e:E<e?E:e:F<E?F<e?F:e:E<e?E:e;f=j>C?j>A?j>f?j:f:A>f?A:f:C>A?C>f?C:f:A>f?A:f;h=l>F?l>E?l>h?l:h:E>h?E:h:F>E?F>h?F:h:E>h?E:h}a()};this.addRectangle=function(j){if(b){b=false;d=j.getLeft();e=j.getTop();f=j.getRight();h=j.getBottom()}else{d=d<j.getLeft()?d:j.getLeft();e=e<j.getTop()?e:j.getTop();
+f=f>j.getRight()?f:j.getRight();h=h>j.getBottom()?h:j.getBottom()}a()};this.inflate=function(j){d-=j;e-=j;f+=j;h+=j;a()};this.minSelf=function(j){d=d>j.getLeft()?d:j.getLeft();e=e>j.getTop()?e:j.getTop();f=f<j.getRight()?f:j.getRight();h=h<j.getBottom()?h:j.getBottom();a()};this.instersects=function(j){return Math.min(f,j.getRight())-Math.max(d,j.getLeft())>=0&&Math.min(h,j.getBottom())-Math.max(e,j.getTop())>=0};this.empty=function(){b=true;h=f=e=d=0;a()};this.isEmpty=function(){return b};this.toString=
+function(){return"THREE.Rectangle ( left: "+d+", right: "+f+", top: "+e+", bottom: "+h+", width: "+i+", height: "+p+" )"}};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,d,e,f,h,i,p,b,j,l,C,F,A,E,N,P){this.n11=a||1;this.n12=d||0;this.n13=e||0;this.n14=f||0;this.n21=h||0;this.n22=i||1;this.n23=p||0;this.n24=b||0;this.n31=j||0;this.n32=l||0;this.n33=C||1;this.n34=F||0;this.n41=A||0;this.n42=E||0;this.n43=N||0;this.n44=P||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
+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,d,e,f,h,i,p,b,j,l,C,F,A,E,N,P){this.n11=a;this.n12=d;this.n13=e;this.n14=f;this.n21=h;this.n22=i;this.n23=p;this.n24=b;this.n31=j;this.n32=l;this.n33=C;this.n34=F;this.n41=A;this.n42=E;this.n43=N;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,d,e){var f=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,d).normalize();f.cross(e,i).normalize();h.cross(i,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);
+this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var d=a.x,e=a.y,f=a.z,h=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);a.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*h;a.y=(this.n21*d+this.n22*e+this.n23*f+this.n24)*h;a.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*h;return a},multiplyVector4:function(a){var d=a.x,e=a.y,f=a.z,h=a.w;a.x=this.n11*d+this.n12*e+this.n13*f+this.n14*h;a.y=this.n21*d+this.n22*e+this.n23*
+f+this.n24*h;a.z=this.n31*d+this.n32*e+this.n33*f+this.n34*h;a.w=this.n41*d+this.n42*e+this.n43*f+this.n44*h;return a},crossVector:function(a){var d=new THREE.Vector4;d.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;d.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;d.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;d.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return d},multiply:function(a,d){var e=a.n11,f=a.n12,h=a.n13,i=a.n14,p=a.n21,b=a.n22,j=a.n23,l=a.n24,C=a.n31,
+F=a.n32,A=a.n33,E=a.n34,N=a.n41,P=a.n42,Q=a.n43,q=a.n44,$=d.n11,L=d.n12,g=d.n13,k=d.n14,r=d.n21,m=d.n22,u=d.n23,I=d.n24,n=d.n31,w=d.n32,B=d.n33,v=d.n34,o=d.n41,K=d.n42,G=d.n43,U=d.n44;this.n11=e*$+f*r+h*n+i*o;this.n12=e*L+f*m+h*w+i*K;this.n13=e*g+f*u+h*B+i*G;this.n14=e*k+f*I+h*v+i*U;this.n21=p*$+b*r+j*n+l*o;this.n22=p*L+b*m+j*w+l*K;this.n23=p*g+b*u+j*B+l*G;this.n24=p*k+b*I+j*v+l*U;this.n31=C*$+F*r+A*n+E*o;this.n32=C*L+F*m+A*w+E*K;this.n33=C*g+F*u+A*B+E*G;this.n34=C*k+F*I+A*v+E*U;this.n41=N*$+P*r+
+Q*n+q*o;this.n42=N*L+P*m+Q*w+q*K;this.n43=N*g+P*u+Q*B+q*G;this.n44=N*k+P*I+Q*v+q*U;return this},multiplySelf:function(a){var d=this.n11,e=this.n12,f=this.n13,h=this.n14,i=this.n21,p=this.n22,b=this.n23,j=this.n24,l=this.n31,C=this.n32,F=this.n33,A=this.n34,E=this.n41,N=this.n42,P=this.n43,Q=this.n44,q=a.n11,$=a.n21,L=a.n31,g=a.n41,k=a.n12,r=a.n22,m=a.n32,u=a.n42,I=a.n13,n=a.n23,w=a.n33,B=a.n43,v=a.n14,o=a.n24,K=a.n34;a=a.n44;this.n11=d*q+e*$+f*L+h*g;this.n12=d*k+e*r+f*m+h*u;this.n13=d*I+e*n+f*w+h*
+B;this.n14=d*v+e*o+f*K+h*a;this.n21=i*q+p*$+b*L+j*g;this.n22=i*k+p*r+b*m+j*u;this.n23=i*I+p*n+b*w+j*B;this.n24=i*v+p*o+b*K+j*a;this.n31=l*q+C*$+F*L+A*g;this.n32=l*k+C*r+F*m+A*u;this.n33=l*I+C*n+F*w+A*B;this.n34=l*v+C*o+F*K+A*a;this.n41=E*q+N*$+P*L+Q*g;this.n42=E*k+N*r+P*m+Q*u;this.n43=E*I+N*n+P*w+Q*B;this.n44=E*v+N*o+P*K+Q*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(){var a=this.n11,d=this.n12,e=this.n13,f=this.n14,h=this.n21,i=this.n22,p=this.n23,b=this.n24,j=this.n31,l=this.n32,C=this.n33,F=this.n34,A=this.n41,E=this.n42,N=this.n43,P=this.n44;return f*p*l*A-e*b*l*A-f*i*C*A+d*b*C*A+e*i*F*A-d*p*F*A-f*p*j*E+e*b*j*E+f*h*C*E-a*b*C*E-e*h*F*E+a*p*F*E+f*i*j*N-d*b*j*N-f*h*l*N+a*b*l*N+d*h*F*N-a*i*F*N-e*i*j*P+d*p*j*P+e*h*l*P-a*p*l*P-d*h*C*P+a*i*C*P},transpose:function(){function a(d,e,
+f){var h=d[e];d[e]=d[f];d[f]=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(){this.flat[0]=this.n11;this.flat[1]=
+this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},setTranslation:function(a,d,e){this.set(1,0,0,a,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(a,d,e){this.set(a,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},
+setRotX:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,d,-a,0,0,a,d,0,0,0,0,1);return this},setRotY:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(d,0,a,0,0,1,0,0,-a,0,d,0,0,0,0,1);return this},setRotZ:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(d,-a,0,0,a,d,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,d){c=Math.cos(d);s=Math.sin(d);t=1-c;x=a.x;y=a.y;z=a.z;tx=t*x;ty=t*y;this.set(tx*x+c,tx*y-s*z,tx*z+s*y,0,tx*y+s*z,ty*y+c,ty*z-s*x,0,tx*z-s*y,ty*z+s*x,t*z*z+
+c,0,0,0,0,1);return this},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,d,e){var f=new THREE.Matrix4;f.n14=a;f.n24=d;f.n34=e;return f};THREE.Matrix4.scaleMatrix=function(a,d,e){var f=new THREE.Matrix4;f.n11=a;f.n22=d;f.n33=e;return f};
+THREE.Matrix4.rotationXMatrix=function(a){var d=new THREE.Matrix4;d.n22=d.n33=Math.cos(a);d.n32=Math.sin(a);d.n23=-d.n32;return d};THREE.Matrix4.rotationYMatrix=function(a){var d=new THREE.Matrix4;d.n11=d.n33=Math.cos(a);d.n13=Math.sin(a);d.n31=-d.n13;return d};THREE.Matrix4.rotationZMatrix=function(a){var d=new THREE.Matrix4;d.n11=d.n22=Math.cos(a);d.n21=Math.sin(a);d.n12=-d.n21;return d};
+THREE.Matrix4.rotationAxisAngleMatrix=function(a,d){var e=new THREE.Matrix4,f=Math.cos(d),h=Math.sin(d),i=1-f,p=a.x,b=a.y,j=a.z,l=i*p,C=i*b;e.n11=l*p+f;e.n12=l*b-h*j;e.n13=l*j+h*b;e.n21=l*b+h*j;e.n22=C*b+f;e.n23=C*j-h*p;e.n31=l*j-h*b;e.n32=C*j+h*p;e.n33=i*j*j+f;return e};
+THREE.Matrix4.makeInvert=function(a){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,p=a.n22,b=a.n23,j=a.n24,l=a.n31,C=a.n32,F=a.n33,A=a.n34,E=a.n41,N=a.n42,P=a.n43,Q=a.n44,q=new THREE.Matrix4;q.n11=b*A*N-j*F*N+j*C*P-p*A*P-b*C*Q+p*F*Q;q.n12=h*F*N-f*A*N-h*C*P+e*A*P+f*C*Q-e*F*Q;q.n13=f*j*N-h*b*N+h*p*P-e*j*P-f*p*Q+e*b*Q;q.n14=h*b*C-f*j*C-h*p*F+e*j*F+f*p*A-e*b*A;q.n21=j*F*E-b*A*E-j*l*P+i*A*P+b*l*Q-i*F*Q;q.n22=f*A*E-h*F*E+h*l*P-d*A*P-f*l*Q+d*F*Q;q.n23=h*b*E-f*j*E-h*i*P+d*j*P+f*i*Q-d*b*Q;q.n24=f*j*l-h*b*l+
+h*i*F-d*j*F-f*i*A+d*b*A;q.n31=p*A*E-j*C*E+j*l*N-i*A*N-p*l*Q+i*C*Q;q.n32=h*C*E-e*A*E-h*l*N+d*A*N+e*l*Q-d*C*Q;q.n33=f*j*E-h*p*E+h*i*N-d*j*N-e*i*Q+d*p*Q;q.n34=h*p*l-e*j*l-h*i*C+d*j*C+e*i*A-d*p*A;q.n41=b*C*E-p*F*E-b*l*N+i*F*N+p*l*P-i*C*P;q.n42=e*F*E-f*C*E+f*l*N-d*F*N-e*l*P+d*C*P;q.n43=f*p*E-e*b*E-f*i*N+d*b*N+e*i*P-d*p*P;q.n44=e*b*l-f*p*l+f*i*C-d*b*C-e*i*F+d*p*F;q.multiplyScalar(1/a.determinant());return q};
+THREE.Matrix4.makeInvert3x3=function(a){var d=a.flatten();a=a.m33;var e=d[10]*d[5]-d[6]*d[9],f=-d[10]*d[1]+d[2]*d[9],h=d[6]*d[1]-d[2]*d[5],i=-d[10]*d[4]+d[6]*d[8],p=d[10]*d[0]-d[2]*d[8],b=-d[6]*d[0]+d[2]*d[4],j=d[9]*d[4]-d[5]*d[8],l=-d[9]*d[0]+d[1]*d[8],C=d[5]*d[0]-d[1]*d[4];d=d[0]*e+d[1]*i+d[2]*j;if(d==0)throw"matrix not invertible";d=1/d;a.m[0]=d*e;a.m[1]=d*f;a.m[2]=d*h;a.m[3]=d*i;a.m[4]=d*p;a.m[5]=d*b;a.m[6]=d*j;a.m[7]=d*l;a.m[8]=d*C;return a};
+THREE.Matrix4.makeFrustum=function(a,d,e,f,h,i){var p,b,j;p=new THREE.Matrix4;b=2*h/(d-a);j=2*h/(f-e);a=(d+a)/(d-a);e=(f+e)/(f-e);f=-(i+h)/(i-h);h=-2*i*h/(i-h);p.n11=b;p.n12=0;p.n13=a;p.n14=0;p.n21=0;p.n22=j;p.n23=e;p.n24=0;p.n31=0;p.n32=0;p.n33=f;p.n34=h;p.n41=0;p.n42=0;p.n43=-1;p.n44=0;return p};THREE.Matrix4.makePerspective=function(a,d,e,f){var h;a=e*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*d,a*d,h,a,e,f)};
+THREE.Matrix4.makeOrtho=function(a,d,e,f,h,i){var p,b,j,l;p=new THREE.Matrix4;b=d-a;j=e-f;l=i-h;a=(d+a)/b;e=(e+f)/j;h=(i+h)/l;p.n11=2/b;p.n12=0;p.n13=0;p.n14=-a;p.n21=0;p.n22=2/j;p.n23=0;p.n24=-e;p.n31=0;p.n32=0;p.n33=-2/l;p.n34=-h;p.n41=0;p.n42=0;p.n43=0;p.n44=1;return p};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
+THREE.Vertex=function(a,d){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=d||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,d,e,f,h){this.a=a;this.b=d;this.c=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,d,e,f,h,i){this.a=a;this.b=d;this.c=e;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,d){this.u=a||0;this.v=d||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,d,e;a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];e.centroid.set(0,0,0);if(e instanceof THREE.Face3){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);e.centroid.divideScalar(3)}else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);
+e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var d,e,f,h,i,p,b=new THREE.Vector3,j=new THREE.Vector3;f=0;for(h=this.vertices.length;f<h;f++){i=this.vertices[f];i.normal.set(0,0,0)}f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(a&&i.vertexNormals.length){b.set(0,0,0);d=0;for(e=i.normal.length;d<e;d++)b.addSelf(i.vertexNormals[d]);b.divideScalar(3)}else{d=this.vertices[i.a];e=this.vertices[i.b];p=this.vertices[i.c];b.sub(p.position,
+e.position);j.sub(d.position,e.position);b.crossSelf(j)}b.isZero()||b.normalize();i.normal.copy(b)}},computeVertexNormals:function(){var a,d,e,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(d=this.vertices.length;a<d;a++)f[a]=new THREE.Vector3;a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,
+new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=this.__tmpVertices;a=0;for(d=this.vertices.length;a<d;a++)f[a].set(0,0,0)}a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3){f[e.a].addSelf(e.normal);f[e.b].addSelf(e.normal);f[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){f[e.a].addSelf(e.normal);f[e.b].addSelf(e.normal);f[e.c].addSelf(e.normal);f[e.d].addSelf(e.normal)}}a=0;for(d=this.vertices.length;a<d;a++)f[a].normalize();a=0;for(d=this.faces.length;a<
+d;a++){e=this.faces[a];if(e instanceof THREE.Face3){e.vertexNormals[0].copy(f[e.a]);e.vertexNormals[1].copy(f[e.b]);e.vertexNormals[2].copy(f[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(f[e.a]);e.vertexNormals[1].copy(f[e.b]);e.vertexNormals[2].copy(f[e.c]);e.vertexNormals[3].copy(f[e.d])}}},computeTangents:function(){function a(v,o,K,G,U,T,M){i=v.vertices[o].position;p=v.vertices[K].position;b=v.vertices[G].position;j=h[U];l=h[T];C=h[M];F=p.x-i.x;A=b.x-i.x;E=p.y-i.y;N=b.y-i.y;
+P=p.z-i.z;Q=b.z-i.z;q=l.u-j.u;$=C.u-j.u;L=l.v-j.v;g=C.v-j.v;k=1/(q*g-$*L);u.set((g*F-L*A)*k,(g*E-L*N)*k,(g*P-L*Q)*k);I.set((q*A-$*F)*k,(q*N-$*E)*k,(q*Q-$*P)*k);r[o].addSelf(u);r[K].addSelf(u);r[G].addSelf(u);m[o].addSelf(I);m[K].addSelf(I);m[G].addSelf(I)}var d,e,f,h,i,p,b,j,l,C,F,A,E,N,P,Q,q,$,L,g,k,r=[],m=[],u=new THREE.Vector3,I=new THREE.Vector3,n=new THREE.Vector3,w=new THREE.Vector3,B=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){r[d]=new THREE.Vector3;m[d]=new THREE.Vector3}d=0;
+for(e=this.faces.length;d<e;d++){f=this.faces[d];h=this.uvs[d];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2]);
+this.vertices[f.d].normal.copy(f.vertexNormals[3])}}d=0;for(e=this.vertices.length;d<e;d++){B.copy(this.vertices[d].normal);f=r[d];n.copy(f);n.subSelf(B.multiplyScalar(B.dot(f))).normalize();w.cross(this.vertices[d].normal,f);f=w.dot(m[d]);f=f<0?-1:1;this.vertices[d].tangent.set(n.x,n.y,n.z,f)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
+this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d<e;d++)a=Math.max(a,this.vertices[d].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(C){var F=[];d=0;for(e=C.length;d<e;d++)C[d]==undefined?F.push("undefined"):F.push(C[d].toString());return F.join("_")}var d,e,f,h,i,p,b,j,l={};f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];
+p=i.materials;b=a(p);if(l[b]==undefined)l[b]={hash:b,counter:0};j=l[b].hash+"_"+l[b].counter;if(this.geometryChunks[j]==undefined)this.geometryChunks[j]={faces:[],materials:p,vertices:0};i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[j].vertices+i>65535){l[b].counter+=1;j=l[b].hash+"_"+l[b].counter;if(this.geometryChunks[j]==undefined)this.geometryChunks[j]={faces:[],materials:p,vertices:0}}this.geometryChunks[j].faces.push(f);this.geometryChunks[j].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
+THREE.Camera=function(a,d,e,f){this.fov=a;this.aspect=d;this.near=e;this.far=f;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
+this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
+THREE.Camera.prototype={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,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1};THREE.DirectionalLight.prototype=new THREE.Light;
+THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,d){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=d||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.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
+THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,d=this.rotation,e=this.scale,f=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);if(d.x!=0){f.setRotX(d.x);this.matrix.multiplySelf(f)}if(d.y!=0){f.setRotY(d.y);this.matrix.multiplySelf(f)}if(d.z!=0){f.setRotZ(d.z);this.matrix.multiplySelf(f)}if(e.x!=0||e.y!=0||e.z!=0){f.setScale(e.x,e.y,e.z);this.matrix.multiplySelf(f)}}};THREE.Object3DCounter={value:0};
+THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,d){THREE.Object3D.call(this);this.geometry=a;this.materials=d instanceof Array?d:[d];this.autoUpdateMatrix=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
+THREE.Line=function(a,d,e){THREE.Object3D.call(this);this.geometry=a;this.materials=d instanceof Array?d:[d];this.type=e!=undefined?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,d){THREE.Object3D.call(this);this.geometry=a;this.materials=d instanceof Array?d:[d];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}};
+THREE.LineBasicMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
+THREE.MeshBasicMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
+THREE.MeshLambertMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
+THREE.MeshPhongMaterial.prototype={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.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.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={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}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={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}};
+THREE.MeshShaderMaterial.prototype={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}};
+THREE.ParticleBasicMaterial.prototype={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}};
+THREE.ParticleCircleMaterial.prototype={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};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
+THREE.Texture=function(a,d,e,f,h,i){this.image=a;this.mapping=d!==undefined?d:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter};
+THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},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.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
+THREE.RenderTarget=function(a,d,e){this.width=a;this.height=d;e=e||{};this.wrap_s=e.wrap_s!==undefined?e.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=e.wrap_t!==undefined?e.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=e.mag_filter!==undefined?e.mag_filter:THREE.LinearFilter;this.min_filter=e.min_filter!==undefined?e.min_filter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType};
+var Uniforms={clone:function(a){var d,e,f,h={};for(d in a){h[d]={};for(e in a[d]){f=a[d][e];h[d][e]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var d,e,f,h={};for(d=0;d<a.length;d++){f=this.clone(a[d]);for(e in f)h[e]=f[e]}return h}};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,d,e){this.color=new THREE.Color(a);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(a,d){this.color=new THREE.Color(a);this.density=d||2.5E-4};
+THREE.Projector=function(){function a(m,u){return u.z-m.z}function d(m,u){var I=0,n=1,w=m.z+m.w,B=u.z+u.w,v=-m.z+m.w,o=-u.z+u.w;if(w>=0&&B>=0&&v>=0&&o>=0)return true;else if(w<0&&B<0||v<0&&o<0)return false;else{if(w<0)I=Math.max(I,w/(w-B));else if(B<0)n=Math.min(n,w/(w-B));if(v<0)I=Math.max(I,v/(v-o));else if(o<0)n=Math.min(n,v/(v-o));if(n<I)return false;else{m.lerpSelf(u,I);u.lerpSelf(m,1-n);return true}}}var e,f,h=[],i,p,b,j=[],l,C,F=[],A,E,N=[],P=new THREE.Vector4,Q=new THREE.Vector4,q=new THREE.Matrix4,
+$=new THREE.Matrix4,L=[],g=new THREE.Vector4,k=new THREE.Vector4,r;this.projectObjects=function(m,u,I){var n=[],w,B;f=0;q.multiply(u.projectionMatrix,u.matrix);L[0]=new THREE.Vector4(q.n41-q.n11,q.n42-q.n12,q.n43-q.n13,q.n44-q.n14);L[1]=new THREE.Vector4(q.n41+q.n11,q.n42+q.n12,q.n43+q.n13,q.n44+q.n14);L[2]=new THREE.Vector4(q.n41+q.n21,q.n42+q.n22,q.n43+q.n23,q.n44+q.n24);L[3]=new THREE.Vector4(q.n41-q.n21,q.n42-q.n22,q.n43-q.n23,q.n44-q.n24);L[4]=new THREE.Vector4(q.n41-q.n31,q.n42-q.n32,q.n43-
+q.n33,q.n44-q.n34);L[5]=new THREE.Vector4(q.n41+q.n31,q.n42+q.n32,q.n43+q.n33,q.n44+q.n34);u=0;for(w=L.length;u<w;u++){B=L[u];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}w=m.objects;m=0;for(u=w.length;m<u;m++){B=w[m];var v;if(!(v=!B.visible)){if(v=B instanceof THREE.Mesh){a:{v=void 0;for(var o=B.position,K=-B.geometry.boundingSphere.radius*Math.max(B.scale.x,Math.max(B.scale.y,B.scale.z)),G=0;G<6;G++){v=L[G].x*o.x+L[G].y*o.y+L[G].z*o.z+L[G].w;if(v<=K){v=false;break a}}v=true}v=!v}v=v}if(!v){e=
+h[f]=h[f]||new THREE.RenderableObject;P.copy(B.position);q.multiplyVector3(P);e.object=B;e.z=P.z;n.push(e);f++}}I&&n.sort(a);return n};this.projectScene=function(m,u,I){var n=[],w=u.near,B=u.far,v,o,K,G,U,T,M,ba,V,O,R,aa,Y,D,S,W;b=C=E=0;u.autoUpdateMatrix&&u.updateMatrix();q.multiply(u.projectionMatrix,u.matrix);T=this.projectObjects(m,u,true);m=0;for(v=T.length;m<v;m++){M=T[m].object;if(M.visible){M.autoUpdateMatrix&&M.updateMatrix();ba=M.matrix;V=M.rotationMatrix;O=M.materials;R=M.overdraw;if(M instanceof
+THREE.Mesh){aa=M.geometry;Y=aa.vertices;o=0;for(K=Y.length;o<K;o++){D=Y[o];D.positionWorld.copy(D.position);ba.multiplyVector3(D.positionWorld);G=D.positionScreen;G.copy(D.positionWorld);q.multiplyVector4(G);G.x/=G.w;G.y/=G.w;D.__visible=G.z>w&&G.z<B}aa=aa.faces;o=0;for(K=aa.length;o<K;o++){D=aa[o];if(D instanceof THREE.Face3){G=Y[D.a];U=Y[D.b];S=Y[D.c];if(G.__visible&&U.__visible&&S.__visible)if(M.doubleSided||M.flipSided!=(S.positionScreen.x-G.positionScreen.x)*(U.positionScreen.y-G.positionScreen.y)-
+(S.positionScreen.y-G.positionScreen.y)*(U.positionScreen.x-G.positionScreen.x)<0){i=j[b]=j[b]||new THREE.RenderableFace3;i.v1.positionWorld.copy(G.positionWorld);i.v2.positionWorld.copy(U.positionWorld);i.v3.positionWorld.copy(S.positionWorld);i.v1.positionScreen.copy(G.positionScreen);i.v2.positionScreen.copy(U.positionScreen);i.v3.positionScreen.copy(S.positionScreen);i.normalWorld.copy(D.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(D.centroid);ba.multiplyVector3(i.centroidWorld);
+i.centroidScreen.copy(i.centroidWorld);q.multiplyVector3(i.centroidScreen);S=D.vertexNormals;r=i.vertexNormalsWorld;G=0;for(U=S.length;G<U;G++){W=r[G]=r[G]||new THREE.Vector3;W.copy(S[G]);V.multiplyVector3(W)}i.z=i.centroidScreen.z;i.meshMaterials=O;i.faceMaterials=D.materials;i.overdraw=R;if(M.geometry.uvs[o]){i.uvs[0]=M.geometry.uvs[o][0];i.uvs[1]=M.geometry.uvs[o][1];i.uvs[2]=M.geometry.uvs[o][2]}n.push(i);b++}}else if(D instanceof THREE.Face4){G=Y[D.a];U=Y[D.b];S=Y[D.c];W=Y[D.d];if(G.__visible&&
+U.__visible&&S.__visible&&W.__visible)if(M.doubleSided||M.flipSided!=((W.positionScreen.x-G.positionScreen.x)*(U.positionScreen.y-G.positionScreen.y)-(W.positionScreen.y-G.positionScreen.y)*(U.positionScreen.x-G.positionScreen.x)<0||(U.positionScreen.x-S.positionScreen.x)*(W.positionScreen.y-S.positionScreen.y)-(U.positionScreen.y-S.positionScreen.y)*(W.positionScreen.x-S.positionScreen.x)<0)){i=j[b]=j[b]||new THREE.RenderableFace3;i.v1.positionWorld.copy(G.positionWorld);i.v2.positionWorld.copy(U.positionWorld);
+i.v3.positionWorld.copy(W.positionWorld);i.v1.positionScreen.copy(G.positionScreen);i.v2.positionScreen.copy(U.positionScreen);i.v3.positionScreen.copy(W.positionScreen);i.normalWorld.copy(D.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(D.centroid);ba.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);q.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=O;i.faceMaterials=D.materials;i.overdraw=R;if(M.geometry.uvs[o]){i.uvs[0]=M.geometry.uvs[o][0];
+i.uvs[1]=M.geometry.uvs[o][1];i.uvs[2]=M.geometry.uvs[o][3]}n.push(i);b++;p=j[b]=j[b]||new THREE.RenderableFace3;p.v1.positionWorld.copy(U.positionWorld);p.v2.positionWorld.copy(S.positionWorld);p.v3.positionWorld.copy(W.positionWorld);p.v1.positionScreen.copy(U.positionScreen);p.v2.positionScreen.copy(S.positionScreen);p.v3.positionScreen.copy(W.positionScreen);p.normalWorld.copy(i.normalWorld);p.centroidWorld.copy(i.centroidWorld);p.centroidScreen.copy(i.centroidScreen);p.z=p.centroidScreen.z;p.meshMaterials=
+O;p.faceMaterials=D.materials;p.overdraw=R;if(M.geometry.uvs[o]){p.uvs[0]=M.geometry.uvs[o][1];p.uvs[1]=M.geometry.uvs[o][2];p.uvs[2]=M.geometry.uvs[o][3]}n.push(p);b++}}}}else if(M instanceof THREE.Line){$.multiply(q,ba);Y=M.geometry.vertices;D=Y[0];D.positionScreen.copy(D.position);$.multiplyVector4(D.positionScreen);o=1;for(K=Y.length;o<K;o++){G=Y[o];G.positionScreen.copy(G.position);$.multiplyVector4(G.positionScreen);U=Y[o-1];g.copy(G.positionScreen);k.copy(U.positionScreen);if(d(g,k)){g.multiplyScalar(1/
+g.w);k.multiplyScalar(1/k.w);l=F[C]=F[C]||new THREE.RenderableLine;l.v1.positionScreen.copy(g);l.v2.positionScreen.copy(k);l.z=Math.max(g.z,k.z);l.materials=M.materials;n.push(l);C++}}}else if(M instanceof THREE.Particle){Q.set(M.position.x,M.position.y,M.position.z,1);q.multiplyVector4(Q);Q.z/=Q.w;if(Q.z>0&&Q.z<1){A=N[E]=N[E]||new THREE.RenderableParticle;A.x=Q.x/Q.w;A.y=Q.y/Q.w;A.z=Q.z;A.rotation=M.rotation.z;A.scale.x=M.scale.x*Math.abs(A.x-(Q.x+u.projectionMatrix.n11)/(Q.w+u.projectionMatrix.n14));
+A.scale.y=M.scale.y*Math.abs(A.y-(Q.y+u.projectionMatrix.n22)/(Q.w+u.projectionMatrix.n24));A.materials=M.materials;n.push(A);E++}}}}I&&n.sort(a);return n};this.unprojectVector=function(m,u){var I=new THREE.Matrix4;I.multiply(THREE.Matrix4.makeInvert(u.matrix),THREE.Matrix4.makeInvert(u.projectionMatrix));I.multiplyVector3(m);return m}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,d=new THREE.Projector,e,f,h,i;this.domElement=document.createElement("div");this.setSize=function(p,b){e=p;f=b;h=e/2;i=f/2};this.render=function(p,b){var j,l,C,F,A,E,N,P;a=d.projectScene(p,b);j=0;for(l=a.length;j<l;j++){A=a[j];if(A instanceof THREE.RenderableParticle){N=A.x*h+h;P=A.y*i+i;C=0;for(F=A.material.length;C<F;C++){E=A.material[C];if(E instanceof THREE.ParticleDOMMaterial){E=E.domElement;E.style.left=N+"px";E.style.top=P+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ja){if(A!=ja)l.globalAlpha=A=ja}function d(ja){if(E!=ja){switch(ja){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}E=ja}}var e=null,f=new THREE.Projector,h=document.createElement("canvas"),i,p,b,j,l=h.getContext("2d"),C=null,F=null,A=1,E=0,N=null,P=null,Q=1,q,$,L,g,k,r,m,u,I,n=new THREE.Color,
+w=new THREE.Color,B=new THREE.Color,v=new THREE.Color,o=new THREE.Color,K,G,U,T,M,ba,V,O,R,aa=new THREE.Rectangle,Y=new THREE.Rectangle,D=new THREE.Rectangle,S=false,W=new THREE.Color,ka=new THREE.Color,ha=new THREE.Color,ea=new THREE.Color,pa=Math.PI*2,da=new THREE.Vector3,wa,qa,la,na,ya,Aa,Ba=16;wa=document.createElement("canvas");wa.width=wa.height=2;qa=wa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);la=qa.getImageData(0,0,2,2);na=la.data;ya=document.createElement("canvas");
+ya.width=ya.height=Ba;Aa=ya.getContext("2d");Aa.translate(-Ba/2,-Ba/2);Aa.scale(Ba,Ba);Ba--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ja,xa){i=ja;p=xa;b=i/2;j=p/2;h.width=i;h.height=p;aa.set(-b,-j,b,j);A=1;E=0;P=N=null;Q=1};this.setClearColor=function(ja,xa){C=ja!==null?new THREE.Color(ja):null;F=xa;Y.set(-b,-j,b,j);l.setTransform(1,0,0,-1,b,j);this.clear()};this.clear=function(){if(!Y.isEmpty()){Y.inflate(1);Y.minSelf(aa);if(C!==null){d(THREE.NormalBlending);
+a(1);l.fillStyle="rgba("+Math.floor(C.r*255)+","+Math.floor(C.g*255)+","+Math.floor(C.b*255)+","+F+")";l.fillRect(Y.getX(),Y.getY(),Y.getWidth(),Y.getHeight())}else l.clearRect(Y.getX(),Y.getY(),Y.getWidth(),Y.getHeight());Y.empty()}};this.render=function(ja,xa){function Sa(H){var ca,Z,J,X=H.lights;ka.setRGB(0,0,0);ha.setRGB(0,0,0);ea.setRGB(0,0,0);H=0;for(ca=X.length;H<ca;H++){Z=X[H];J=Z.color;if(Z instanceof THREE.AmbientLight){ka.r+=J.r;ka.g+=J.g;ka.b+=J.b}else if(Z instanceof THREE.DirectionalLight){ha.r+=
+J.r;ha.g+=J.g;ha.b+=J.b}else if(Z instanceof THREE.PointLight){ea.r+=J.r;ea.g+=J.g;ea.b+=J.b}}}function Ga(H,ca,Z,J){var X,fa,ia,ma,oa=H.lights;H=0;for(X=oa.length;H<X;H++){fa=oa[H];ia=fa.color;ma=fa.intensity;if(fa instanceof THREE.DirectionalLight){fa=Z.dot(fa.position)*ma;if(fa>0){J.r+=ia.r*fa;J.g+=ia.g*fa;J.b+=ia.b*fa}}else if(fa instanceof THREE.PointLight){da.sub(fa.position,ca);da.normalize();fa=Z.dot(da)*ma;if(fa>0){J.r+=ia.r*fa;J.g+=ia.g*fa;J.b+=ia.b*fa}}}}function Ta(H,ca,Z){if(Z.opacity!=
+0){a(Z.opacity);d(Z.blending);var J,X,fa,ia,ma,oa;if(Z instanceof THREE.ParticleBasicMaterial){if(Z.map){ia=Z.map;ma=ia.width>>1;oa=ia.height>>1;X=ca.scale.x*b;fa=ca.scale.y*j;Z=X*ma;J=fa*oa;D.set(H.x-Z,H.y-J,H.x+Z,H.y+J);if(aa.instersects(D)){l.save();l.translate(H.x,H.y);l.rotate(-ca.rotation);l.scale(X,-fa);l.translate(-ma,-oa);l.drawImage(ia,0,0);l.restore()}}}else if(Z instanceof THREE.ParticleCircleMaterial){if(S){W.r=ka.r+ha.r+ea.r;W.g=ka.g+ha.g+ea.g;W.b=ka.b+ha.b+ea.b;n.r=Z.color.r*W.r;n.g=
+Z.color.g*W.g;n.b=Z.color.b*W.b;n.updateStyleString()}else n.__styleString=Z.color.__styleString;Z=ca.scale.x*b;J=ca.scale.y*j;D.set(H.x-Z,H.y-J,H.x+Z,H.y+J);if(aa.instersects(D)){X=n.__styleString;if(P!=X)l.fillStyle=P=X;l.save();l.translate(H.x,H.y);l.rotate(-ca.rotation);l.scale(Z,J);l.beginPath();l.arc(0,0,1,0,pa,true);l.closePath();l.fill();l.restore()}}}}function Ua(H,ca,Z,J){if(J.opacity!=0){a(J.opacity);d(J.blending);l.beginPath();l.moveTo(H.positionScreen.x,H.positionScreen.y);l.lineTo(ca.positionScreen.x,
+ca.positionScreen.y);l.closePath();if(J instanceof THREE.LineBasicMaterial){n.__styleString=J.color.__styleString;H=J.linewidth;if(Q!=H)l.lineWidth=Q=H;H=n.__styleString;if(N!=H)l.strokeStyle=N=H;l.stroke();D.inflate(J.linewidth*2)}}}function Oa(H,ca,Z,J,X,fa){if(X.opacity!=0){a(X.opacity);d(X.blending);g=H.positionScreen.x;k=H.positionScreen.y;r=ca.positionScreen.x;m=ca.positionScreen.y;u=Z.positionScreen.x;I=Z.positionScreen.y;l.beginPath();l.moveTo(g,k);l.lineTo(r,m);l.lineTo(u,I);l.lineTo(g,k);
+l.closePath();if(X instanceof THREE.MeshBasicMaterial)if(X.map)X.map.image.loaded&&X.map.mapping instanceof THREE.UVMapping&&Da(g,k,r,m,u,I,X.map.image,J.uvs[0].u,J.uvs[0].v,J.uvs[1].u,J.uvs[1].v,J.uvs[2].u,J.uvs[2].v);else if(X.env_map){if(X.env_map.image.loaded)if(X.env_map.mapping instanceof THREE.SphericalReflectionMapping){H=xa.matrix;da.copy(J.vertexNormalsWorld[0]);T=(da.x*H.n11+da.y*H.n12+da.z*H.n13)*0.5+0.5;M=-(da.x*H.n21+da.y*H.n22+da.z*H.n23)*0.5+0.5;da.copy(J.vertexNormalsWorld[1]);ba=
+(da.x*H.n11+da.y*H.n12+da.z*H.n13)*0.5+0.5;V=-(da.x*H.n21+da.y*H.n22+da.z*H.n23)*0.5+0.5;da.copy(J.vertexNormalsWorld[2]);O=(da.x*H.n11+da.y*H.n12+da.z*H.n13)*0.5+0.5;R=-(da.x*H.n21+da.y*H.n22+da.z*H.n23)*0.5+0.5;Da(g,k,r,m,u,I,X.env_map.image,T,M,ba,V,O,R)}}else X.wireframe?Ha(X.color.__styleString,X.wireframe_linewidth):Ia(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){X.map.mapping instanceof THREE.UVMapping&&Da(g,k,r,m,u,I,X.map.image,J.uvs[0].u,
+J.uvs[0].v,J.uvs[1].u,J.uvs[1].v,J.uvs[2].u,J.uvs[2].v);d(THREE.SubtractiveBlending)}if(S)if(!X.wireframe&&X.shading==THREE.SmoothShading&&J.vertexNormalsWorld.length==3){w.r=B.r=v.r=ka.r;w.g=B.g=v.g=ka.g;w.b=B.b=v.b=ka.b;Ga(fa,J.v1.positionWorld,J.vertexNormalsWorld[0],w);Ga(fa,J.v2.positionWorld,J.vertexNormalsWorld[1],B);Ga(fa,J.v3.positionWorld,J.vertexNormalsWorld[2],v);o.r=(B.r+v.r)*0.5;o.g=(B.g+v.g)*0.5;o.b=(B.b+v.b)*0.5;U=Pa(w,B,v,o);Da(g,k,r,m,u,I,U,0,0,1,0,0,1)}else{W.r=ka.r;W.g=ka.g;W.b=
+ka.b;Ga(fa,J.centroidWorld,J.normalWorld,W);n.r=X.color.r*W.r;n.g=X.color.g*W.g;n.b=X.color.b*W.b;n.updateStyleString();X.wireframe?Ha(n.__styleString,X.wireframe_linewidth):Ia(n.__styleString)}else X.wireframe?Ha(X.color.__styleString,X.wireframe_linewidth):Ia(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){K=xa.near;G=xa.far;w.r=w.g=w.b=1-Ka(H.positionScreen.z,K,G);B.r=B.g=B.b=1-Ka(ca.positionScreen.z,K,G);v.r=v.g=v.b=1-Ka(Z.positionScreen.z,K,G);o.r=(B.r+v.r)*0.5;o.g=(B.g+
+v.g)*0.5;o.b=(B.b+v.b)*0.5;U=Pa(w,B,v,o);Da(g,k,r,m,u,I,U,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){n.r=La(J.normalWorld.x);n.g=La(J.normalWorld.y);n.b=La(J.normalWorld.z);n.updateStyleString();X.wireframe?Ha(n.__styleString,X.wireframe_linewidth):Ia(n.__styleString)}}}function Ha(H,ca){if(N!=H)l.strokeStyle=N=H;if(Q!=ca)l.lineWidth=Q=ca;l.stroke();D.inflate(ca*2)}function Ia(H){if(P!=H)l.fillStyle=P=H;l.fill()}function Da(H,ca,Z,J,X,fa,ia,ma,oa,ta,ra,ua,Ea){var za,va;za=ia.width-
+1;va=ia.height-1;ma*=za;oa*=va;ta*=za;ra*=va;ua*=za;Ea*=va;Z-=H;J-=ca;X-=H;fa-=ca;ta-=ma;ra-=oa;ua-=ma;Ea-=oa;va=1/(ta*Ea-ua*ra);za=(Ea*Z-ra*X)*va;ra=(Ea*J-ra*fa)*va;Z=(ta*X-ua*Z)*va;J=(ta*fa-ua*J)*va;H=H-za*ma-Z*oa;ca=ca-ra*ma-J*oa;l.save();l.transform(za,ra,Z,J,H,ca);l.clip();l.drawImage(ia,0,0);l.restore()}function Pa(H,ca,Z,J){var X=~~(H.r*255),fa=~~(H.g*255);H=~~(H.b*255);var ia=~~(ca.r*255),ma=~~(ca.g*255);ca=~~(ca.b*255);var oa=~~(Z.r*255),ta=~~(Z.g*255);Z=~~(Z.b*255);var ra=~~(J.r*255),ua=
+~~(J.g*255);J=~~(J.b*255);na[0]=X<0?0:X>255?255:X;na[1]=fa<0?0:fa>255?255:fa;na[2]=H<0?0:H>255?255:H;na[4]=ia<0?0:ia>255?255:ia;na[5]=ma<0?0:ma>255?255:ma;na[6]=ca<0?0:ca>255?255:ca;na[8]=oa<0?0:oa>255?255:oa;na[9]=ta<0?0:ta>255?255:ta;na[10]=Z<0?0:Z>255?255:Z;na[12]=ra<0?0:ra>255?255:ra;na[13]=ua<0?0:ua>255?255:ua;na[14]=J<0?0:J>255?255:J;qa.putImageData(la,0,0);Aa.drawImage(wa,0,0);return ya}function Ka(H,ca,Z){H=(H-ca)/(Z-ca);return H*H*(3-2*H)}function La(H){H=(H+1)*0.5;return H<0?0:H>1?1:H}function Ma(H,
+ca){var Z=ca.x-H.x,J=ca.y-H.y,X=1/Math.sqrt(Z*Z+J*J);Z*=X;J*=X;ca.x+=Z;ca.y+=J;H.x-=Z;H.y-=J}var Ja,Qa,ga,sa,Ca,Na,Ra,Fa;l.setTransform(1,0,0,-1,b,j);this.autoClear&&this.clear();e=f.projectScene(ja,xa,this.sortElements);(S=ja.lights.length>0)&&Sa(ja);Ja=0;for(Qa=e.length;Ja<Qa;Ja++){ga=e[Ja];D.empty();if(ga instanceof THREE.RenderableParticle){q=ga;q.x*=b;q.y*=j;sa=0;for(Ca=ga.materials.length;sa<Ca;sa++)Ta(q,ga,ga.materials[sa],ja)}else if(ga instanceof THREE.RenderableLine){q=ga.v1;$=ga.v2;q.positionScreen.x*=
+b;q.positionScreen.y*=j;$.positionScreen.x*=b;$.positionScreen.y*=j;D.addPoint(q.positionScreen.x,q.positionScreen.y);D.addPoint($.positionScreen.x,$.positionScreen.y);if(aa.instersects(D)){sa=0;for(Ca=ga.materials.length;sa<Ca;)Ua(q,$,ga,ga.materials[sa++],ja)}}else if(ga instanceof THREE.RenderableFace3){q=ga.v1;$=ga.v2;L=ga.v3;q.positionScreen.x*=b;q.positionScreen.y*=j;$.positionScreen.x*=b;$.positionScreen.y*=j;L.positionScreen.x*=b;L.positionScreen.y*=j;if(ga.overdraw){Ma(q.positionScreen,$.positionScreen);
+Ma($.positionScreen,L.positionScreen);Ma(L.positionScreen,q.positionScreen)}D.add3Points(q.positionScreen.x,q.positionScreen.y,$.positionScreen.x,$.positionScreen.y,L.positionScreen.x,L.positionScreen.y);if(aa.instersects(D)){sa=0;for(Ca=ga.meshMaterials.length;sa<Ca;){Fa=ga.meshMaterials[sa++];if(Fa instanceof THREE.MeshFaceMaterial){Na=0;for(Ra=ga.faceMaterials.length;Na<Ra;)(Fa=ga.faceMaterials[Na++])&&Oa(q,$,L,ga,Fa,ja)}else Oa(q,$,L,ga,Fa,ja)}}}Y.addRectangle(D)}l.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(T,M,ba){var V,O,R,aa;V=0;for(O=T.lights.length;V<O;V++){R=T.lights[V];if(R instanceof THREE.DirectionalLight){aa=M.normalWorld.dot(R.position)*R.intensity;if(aa>0){ba.r+=R.color.r*aa;ba.g+=R.color.g*aa;ba.b+=R.color.b*aa}}else if(R instanceof THREE.PointLight){I.sub(R.position,M.centroidWorld);I.normalize();aa=M.normalWorld.dot(I)*R.intensity;if(aa>0){ba.r+=R.color.r*aa;ba.g+=R.color.g*aa;ba.b+=R.color.b*aa}}}}function d(T,M,ba,V,O,R){v=f(o++);v.setAttribute("d",
+"M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(O instanceof THREE.MeshBasicMaterial)L.__styleString=O.color.__styleString;else if(O instanceof THREE.MeshLambertMaterial)if($){g.r=k.r;g.g=k.g;g.b=k.b;a(R,V,g);L.r=O.color.r*g.r;L.g=O.color.g*g.g;L.b=O.color.b*g.b;L.updateStyleString()}else L.__styleString=O.color.__styleString;else if(O instanceof THREE.MeshDepthMaterial){u=1-O.__2near/(O.__farPlusNear-
+V.z*O.__farMinusNear);L.setRGB(u,u,u)}else O instanceof THREE.MeshNormalMaterial&&L.setRGB(h(V.normalWorld.x),h(V.normalWorld.y),h(V.normalWorld.z));O.wireframe?v.setAttribute("style","fill: none; stroke: "+L.__styleString+"; stroke-width: "+O.wireframe_linewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.wireframe_linecap+"; stroke-linejoin: "+O.wireframe_linejoin):v.setAttribute("style","fill: "+L.__styleString+"; fill-opacity: "+O.opacity);b.appendChild(v)}function e(T,M,ba,V,O,R,aa){v=
+f(o++);v.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)L.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if($){g.r=k.r;g.g=k.g;g.b=k.b;a(aa,O,g);L.r=R.color.r*g.r;L.g=R.color.g*g.g;L.b=R.color.b*g.b;L.updateStyleString()}else L.__styleString=R.color.__styleString;
+else if(R instanceof THREE.MeshDepthMaterial){u=1-R.__2near/(R.__farPlusNear-O.z*R.__farMinusNear);L.setRGB(u,u,u)}else R instanceof THREE.MeshNormalMaterial&&L.setRGB(h(O.normalWorld.x),h(O.normalWorld.y),h(O.normalWorld.z));R.wireframe?v.setAttribute("style","fill: none; stroke: "+L.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):v.setAttribute("style","fill: "+L.__styleString+
+"; fill-opacity: "+R.opacity);b.appendChild(v)}function f(T){if(n[T]==null){n[T]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&n[T].setAttribute("shape-rendering","crispEdges");return n[T]}return n[T]}function h(T){return T<0?Math.min((1+T)*0.5,0.5):0.5+Math.min(T*0.5,0.5)}var i=null,p=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,l,C,F,A,E,N,P,Q=new THREE.Rectangle,q=new THREE.Rectangle,$=false,L=new THREE.Color(16777215),g=new THREE.Color(16777215),
+k=new THREE.Color(0),r=new THREE.Color(0),m=new THREE.Color(0),u,I=new THREE.Vector3,n=[],w=[],B=[],v,o,K,G,U=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(T){switch(T){case "high":U=1;break;case "low":U=0}};this.setSize=function(T,M){j=T;l=M;C=j/2;F=l/2;b.setAttribute("viewBox",-C+" "+-F+" "+j+" "+l);b.setAttribute("width",j);b.setAttribute("height",l);Q.set(-C,-F,C,F)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};
+this.render=function(T,M){var ba,V,O,R,aa,Y,D,S;this.autoClear&&this.clear();i=p.projectScene(T,M,this.sortElements);G=K=o=0;if($=T.lights.length>0){D=T.lights;k.setRGB(0,0,0);r.setRGB(0,0,0);m.setRGB(0,0,0);ba=0;for(V=D.length;ba<V;ba++){O=D[ba];R=O.color;if(O instanceof THREE.AmbientLight){k.r+=R.r;k.g+=R.g;k.b+=R.b}else if(O instanceof THREE.DirectionalLight){r.r+=R.r;r.g+=R.g;r.b+=R.b}else if(O instanceof THREE.PointLight){m.r+=R.r;m.g+=R.g;m.b+=R.b}}}ba=0;for(V=i.length;ba<V;ba++){D=i[ba];q.empty();
+if(D instanceof THREE.RenderableParticle){A=D;A.x*=C;A.y*=-F;O=0;for(R=D.materials.length;O<R;O++)if(S=D.materials[O]){aa=A;Y=D;S=S;var W=K++;if(w[W]==null){w[W]=document.createElementNS("http://www.w3.org/2000/svg","circle");U==0&&w[W].setAttribute("shape-rendering","crispEdges")}v=w[W];v.setAttribute("cx",aa.x);v.setAttribute("cy",aa.y);v.setAttribute("r",Y.scale.x*C);if(S instanceof THREE.ParticleCircleMaterial){if($){g.r=k.r+r.r+m.r;g.g=k.g+r.g+m.g;g.b=k.b+r.b+m.b;L.r=S.color.r*g.r;L.g=S.color.g*
+g.g;L.b=S.color.b*g.b;L.updateStyleString()}else L=S.color;v.setAttribute("style","fill: "+L.__styleString)}b.appendChild(v)}}else if(D instanceof THREE.RenderableLine){A=D.v1;E=D.v2;A.positionScreen.x*=C;A.positionScreen.y*=-F;E.positionScreen.x*=C;E.positionScreen.y*=-F;q.addPoint(A.positionScreen.x,A.positionScreen.y);q.addPoint(E.positionScreen.x,E.positionScreen.y);if(Q.instersects(q)){O=0;for(R=D.materials.length;O<R;)if(S=D.materials[O++]){aa=A;Y=E;S=S;W=G++;if(B[W]==null){B[W]=document.createElementNS("http://www.w3.org/2000/svg",
+"line");U==0&&B[W].setAttribute("shape-rendering","crispEdges")}v=B[W];v.setAttribute("x1",aa.positionScreen.x);v.setAttribute("y1",aa.positionScreen.y);v.setAttribute("x2",Y.positionScreen.x);v.setAttribute("y2",Y.positionScreen.y);if(S instanceof THREE.LineBasicMaterial){L.__styleString=S.color.__styleString;v.setAttribute("style","fill: none; stroke: "+L.__styleString+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin);
+b.appendChild(v)}}}}else if(D instanceof THREE.RenderableFace3){A=D.v1;E=D.v2;N=D.v3;A.positionScreen.x*=C;A.positionScreen.y*=-F;E.positionScreen.x*=C;E.positionScreen.y*=-F;N.positionScreen.x*=C;N.positionScreen.y*=-F;q.addPoint(A.positionScreen.x,A.positionScreen.y);q.addPoint(E.positionScreen.x,E.positionScreen.y);q.addPoint(N.positionScreen.x,N.positionScreen.y);if(Q.instersects(q)){O=0;for(R=D.meshMaterials.length;O<R;){S=D.meshMaterials[O++];if(S instanceof THREE.MeshFaceMaterial){aa=0;for(Y=
+D.faceMaterials.length;aa<Y;)(S=D.faceMaterials[aa++])&&d(A,E,N,D,S,T)}else S&&d(A,E,N,D,S,T)}}}else if(D instanceof THREE.RenderableFace4){A=D.v1;E=D.v2;N=D.v3;P=D.v4;A.positionScreen.x*=C;A.positionScreen.y*=-F;E.positionScreen.x*=C;E.positionScreen.y*=-F;N.positionScreen.x*=C;N.positionScreen.y*=-F;P.positionScreen.x*=C;P.positionScreen.y*=-F;q.addPoint(A.positionScreen.x,A.positionScreen.y);q.addPoint(E.positionScreen.x,E.positionScreen.y);q.addPoint(N.positionScreen.x,N.positionScreen.y);q.addPoint(P.positionScreen.x,
+P.positionScreen.y);if(Q.instersects(q)){O=0;for(R=D.meshMaterials.length;O<R;){S=D.meshMaterials[O++];if(S instanceof THREE.MeshFaceMaterial){aa=0;for(Y=D.faceMaterials.length;aa<Y;)(S=D.faceMaterials[aa++])&&e(A,E,N,P,D,S,T)}else S&&e(A,E,N,P,D,S,T)}}}}}};
+THREE.WebGLRenderer=function(a){function d(g,k){g.fragment_shader=k.fragment_shader;g.vertex_shader=k.vertex_shader;g.uniforms=Uniforms.clone(k.uniforms)}function e(g,k){g.uniforms.color.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);g.uniforms.opacity.value=g.opacity;g.uniforms.map.texture=g.map;g.uniforms.env_map.texture=g.env_map;g.uniforms.reflectivity.value=g.reflectivity;g.uniforms.refraction_ratio.value=g.refraction_ratio;g.uniforms.combine.value=g.combine;g.uniforms.useRefract.value=
+g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping;if(k){g.uniforms.fogColor.value.setHex(k.color.hex);if(k instanceof THREE.Fog){g.uniforms.fogNear.value=k.near;g.uniforms.fogFar.value=k.far}else if(k instanceof THREE.FogExp2)g.uniforms.fogDensity.value=k.density}}function f(g,k){g.uniforms.color.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);g.uniforms.opacity.value=g.opacity;if(k){g.uniforms.fogColor.value.setHex(k.color.hex);if(k instanceof THREE.Fog){g.uniforms.fogNear.value=
+k.near;g.uniforms.fogFar.value=k.far}else if(k instanceof THREE.FogExp2)g.uniforms.fogDensity.value=k.density}}function h(g,k){var r;if(g=="fragment")r=b.createShader(b.FRAGMENT_SHADER);else if(g=="vertex")r=b.createShader(b.VERTEX_SHADER);b.shaderSource(r,k);b.compileShader(r);if(!b.getShaderParameter(r,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(r));return null}return r}function i(g){switch(g){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;
+case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;
+case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var p=document.createElement("canvas"),b,j=null,l=null,C=new THREE.Matrix4,F,A=new Float32Array(16),E=new Float32Array(16),N=new Float32Array(16),P=new Float32Array(9),
+Q=new Float32Array(16),q=true,$=new THREE.Color(0),L=0;if(a){if(a.antialias!==undefined)q=a.antialias;a.clearColor!==undefined&&$.setHex(a.clearColor);if(a.clearAlpha!==undefined)L=a.clearAlpha}this.domElement=p;this.autoClear=true;(function(g,k,r){try{b=p.getContext("experimental-webgl",{antialias:g})}catch(m){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);
+b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(k.r,k.g,k.b,r)})(q,$,L);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(g,k){p.width=g;p.height=k;b.viewport(0,0,p.width,p.height)};this.setClearColor=function(g,k){var r=new THREE.Color(g);b.clearColor(r.r,r.g,r.b,k)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=
+function(g,k){var r,m,u,I=0,n=0,w=0,B,v,o,K=this.lights,G=K.directional.colors,U=K.directional.positions,T=K.point.colors,M=K.point.positions,ba=0,V=0;r=0;for(m=k.length;r<m;r++){u=k[r];B=u.color;v=u.position;o=u.intensity;if(u instanceof THREE.AmbientLight){I+=B.r;n+=B.g;w+=B.b}else if(u instanceof THREE.DirectionalLight){G[ba*3]=B.r*o;G[ba*3+1]=B.g*o;G[ba*3+2]=B.b*o;U[ba*3]=v.x;U[ba*3+1]=v.y;U[ba*3+2]=v.z;ba+=1}else if(u instanceof THREE.PointLight){T[V*3]=B.r*o;T[V*3+1]=B.g*o;T[V*3+2]=B.b*o;M[V*
+3]=v.x;M[V*3+1]=v.y;M[V*3+2]=v.z;V+=1}}K.point.length=V;K.directional.length=ba;K.ambient[0]=I;K.ambient[1]=n;K.ambient[2]=w};this.createParticleBuffers=function(g){g.__webGLVertexBuffer=b.createBuffer();g.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(g){g.__webGLVertexBuffer=b.createBuffer();g.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(g){g.__webGLVertexBuffer=b.createBuffer();g.__webGLNormalBuffer=b.createBuffer();g.__webGLTangentBuffer=b.createBuffer();
+g.__webGLUVBuffer=b.createBuffer();g.__webGLFaceBuffer=b.createBuffer();g.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(g){var k=g.vertices.length;g.__vertexArray=new Float32Array(k*3);g.__lineArray=new Uint16Array(k);g.__webGLLineCount=k};this.initMeshBuffers=function(g,k){var r,m,u=0,I=0,n=0,w=k.geometry.faces,B=g.faces;r=0;for(m=B.length;r<m;r++){fi=B[r];face=w[fi];if(face instanceof THREE.Face3){u+=3;I+=1;n+=3}else if(face instanceof THREE.Face4){u+=4;I+=2;n+=4}}g.__vertexArray=
+new Float32Array(u*3);g.__normalArray=new Float32Array(u*3);g.__tangentArray=new Float32Array(u*4);g.__uvArray=new Float32Array(u*2);g.__faceArray=new Uint16Array(I*3);g.__lineArray=new Uint16Array(n*2);u=false;r=0;for(m=k.materials.length;r<m;r++){w=k.materials[r];if(w instanceof THREE.MeshFaceMaterial){w=0;for(B=g.materials.length;w<B;w++)if(g.materials[w]&&g.materials[w].shading!=undefined&&g.materials[w].shading==THREE.SmoothShading){u=true;break}}else if(w&&w.shading!=undefined&&w.shading==THREE.SmoothShading){u=
+true;break}if(u)break}g.__needsSmoothNormals=u;g.__webGLFaceCount=I*3;g.__webGLLineCount=n*2};this.setMeshBuffers=function(g,k,r,m,u,I,n,w){var B,v,o,K,G,U,T,M,ba,V=0,O=0,R=0,aa=0,Y=0,D=0,S=0,W=g.__vertexArray,ka=g.__uvArray,ha=g.__normalArray,ea=g.__tangentArray,pa=g.__faceArray,da=g.__lineArray,wa=g.__needsSmoothNormals,qa=k.geometry,la=qa.vertices,na=g.faces,ya=qa.faces,Aa=qa.uvs;k=0;for(B=na.length;k<B;k++){v=na[k];o=ya[v];v=Aa[v];K=o.vertexNormals;G=o.normal;if(o instanceof THREE.Face3){if(m){U=
+la[o.a].position;T=la[o.b].position;M=la[o.c].position;W[O]=U.x;W[O+1]=U.y;W[O+2]=U.z;W[O+3]=T.x;W[O+4]=T.y;W[O+5]=T.z;W[O+6]=M.x;W[O+7]=M.y;W[O+8]=M.z;O+=9}if(w&&qa.hasTangents){U=la[o.a].tangent;T=la[o.b].tangent;M=la[o.c].tangent;ea[D]=U.x;ea[D+1]=U.y;ea[D+2]=U.z;ea[D+3]=U.w;ea[D+4]=T.x;ea[D+5]=T.y;ea[D+6]=T.z;ea[D+7]=T.w;ea[D+8]=M.x;ea[D+9]=M.y;ea[D+10]=M.z;ea[D+11]=M.w;D+=12}if(n)if(K.length==3&&wa)for(o=0;o<3;o++){G=K[o];ha[Y]=G.x;ha[Y+1]=G.y;ha[Y+2]=G.z;Y+=3}else for(o=0;o<3;o++){ha[Y]=G.x;
+ha[Y+1]=G.y;ha[Y+2]=G.z;Y+=3}if(I&&v)for(o=0;o<3;o++){K=v[o];ka[R]=K.u;ka[R+1]=K.v;R+=2}if(u){pa[aa]=V;pa[aa+1]=V+1;pa[aa+2]=V+2;aa+=3;da[S]=V;da[S+1]=V+1;da[S+2]=V;da[S+3]=V+2;da[S+4]=V+1;da[S+5]=V+2;S+=6;V+=3}}else if(o instanceof THREE.Face4){if(m){U=la[o.a].position;T=la[o.b].position;M=la[o.c].position;ba=la[o.d].position;W[O]=U.x;W[O+1]=U.y;W[O+2]=U.z;W[O+3]=T.x;W[O+4]=T.y;W[O+5]=T.z;W[O+6]=M.x;W[O+7]=M.y;W[O+8]=M.z;W[O+9]=ba.x;W[O+10]=ba.y;W[O+11]=ba.z;O+=12}if(w&&qa.hasTangents){U=la[o.a].tangent;
+T=la[o.b].tangent;M=la[o.c].tangent;o=la[o.d].tangent;ea[D]=U.x;ea[D+1]=U.y;ea[D+2]=U.z;ea[D+3]=U.w;ea[D+4]=T.x;ea[D+5]=T.y;ea[D+6]=T.z;ea[D+7]=T.w;ea[D+8]=M.x;ea[D+9]=M.y;ea[D+10]=M.z;ea[D+11]=M.w;ea[D+12]=o.x;ea[D+13]=o.y;ea[D+14]=o.z;ea[D+15]=o.w;D+=16}if(n)if(K.length==4&&wa)for(o=0;o<4;o++){G=K[o];ha[Y]=G.x;ha[Y+1]=G.y;ha[Y+2]=G.z;Y+=3}else for(o=0;o<4;o++){ha[Y]=G.x;ha[Y+1]=G.y;ha[Y+2]=G.z;Y+=3}if(I&&v)for(o=0;o<4;o++){K=v[o];ka[R]=K.u;ka[R+1]=K.v;R+=2}if(u){pa[aa]=V;pa[aa+1]=V+1;pa[aa+2]=V+
+2;pa[aa+3]=V;pa[aa+4]=V+2;pa[aa+5]=V+3;aa+=6;da[S]=V;da[S+1]=V+1;da[S+2]=V;da[S+3]=V+3;da[S+4]=V+1;da[S+5]=V+2;da[S+6]=V+2;da[S+7]=V+3;S+=8;V+=4}}}if(m){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,W,r)}if(n){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,ha,r)}if(w&&qa.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,ea,r)}if(I&&R>0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,
+ka,r)}if(u){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,pa,r);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,da,r)}};this.setLineBuffers=function(g,k,r,m){var u,I,n=g.vertices,w=n.length,B=g.__vertexArray,v=g.__lineArray;if(r)for(r=0;r<w;r++){u=n[r].position;I=r*3;B[I]=u.x;B[I+1]=u.y;B[I+2]=u.z}if(m)for(r=0;r<w;r++)v[r]=r;b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,B,k);
+b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,v,k)};this.setParticleBuffers=function(){};this.renderBuffer=function(g,k,r,m,u,I){var n,w,B,v;if(!m.program){if(m instanceof THREE.MeshDepthMaterial){d(m,THREE.ShaderLib.depth);m.uniforms.mNear.value=g.near;m.uniforms.mFar.value=g.far}else if(m instanceof THREE.MeshNormalMaterial)d(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial){d(m,THREE.ShaderLib.basic);e(m,r)}else if(m instanceof
+THREE.MeshLambertMaterial){d(m,THREE.ShaderLib.lambert);e(m,r)}else if(m instanceof THREE.MeshPhongMaterial){d(m,THREE.ShaderLib.phong);e(m,r)}else if(m instanceof THREE.LineBasicMaterial){d(m,THREE.ShaderLib.basic);f(m,r)}var o,K,G;o=v=w=0;for(K=k.length;o<K;o++){G=k[o];G instanceof THREE.DirectionalLight&&v++;G instanceof THREE.PointLight&&w++}if(w+v<=4){o=v;w=w}else{o=Math.ceil(4*v/(w+v));w=4-o}w={directional:o,point:w};v={fog:r,map:m.map,env_map:m.env_map,maxDirLights:w.directional,maxPointLights:w.point};
+w=m.fragment_shader;o=m.vertex_shader;K=b.createProgram();G=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+
+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"","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");b.attachShader(K,h("fragment",G+w));b.attachShader(K,h("vertex",v+o));b.linkProgram(K);b.getProgramParameter(K,b.LINK_STATUS)||
+alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(K,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");K.uniforms={};K.attributes={};m.program=K;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(n in m.uniforms)w.push(n);n=m.program;o=0;for(K=w.length;o<K;o++){G=w[o];n.uniforms[G]=b.getUniformLocation(n,G)}n=m.program;w=["position","normal","uv","tangent"];o=0;for(K=w.length;o<K;o++){G=w[o];n.attributes[G]=b.getAttribLocation(n,
+G)}}n=m.program;if(n!=j){b.useProgram(n);j=n}this.loadCamera(n,g);this.loadMatrices(n);if(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial){this.setupLights(n,k);g=this.lights;m.uniforms.enableLighting.value=g.directional.length+g.point.length;m.uniforms.ambientLightColor.value=g.ambient;m.uniforms.directionalLightColor.value=g.directional.colors;m.uniforms.directionalLightDirection.value=g.directional.positions;m.uniforms.pointLightColor.value=g.point.colors;m.uniforms.pointLightPosition.value=
+g.point.positions}if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial)e(m,r);m instanceof THREE.LineBasicMaterial&&f(m,r);if(m instanceof THREE.MeshPhongMaterial){m.uniforms.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);m.uniforms.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);m.uniforms.shininess.value=m.shininess}r=m.uniforms;for(B in r)if(o=n.uniforms[B]){k=r[B];w=k.type;g=k.value;if(w=="i")b.uniform1i(o,
+g);else if(w=="f")b.uniform1f(o,g);else if(w=="fv1")b.uniform1fv(o,g);else if(w=="fv")b.uniform3fv(o,g);else if(w=="v2")b.uniform2f(o,g.x,g.y);else if(w=="v3")b.uniform3f(o,g.x,g.y,g.z);else if(w=="c")b.uniform3f(o,g.r,g.g,g.b);else if(w=="t"){b.uniform1i(o,g);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){k=k;g=g;if(k.image.length==6){if(!k.image.__webGLTextureCube&&!k.image.__cubeMapInitialized&&k.image.loadCount==6){k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,
+k.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(w=0;w<6;++w)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+w,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[w]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.image.__cubeMapInitialized=
+true}b.activeTexture(b.TEXTURE0+g);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{k=k;g=g;if(!k.__webGLTexture&&k.image.loaded){k.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(k.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(k.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,i(k.mag_filter));b.texParameteri(b.TEXTURE_2D,
+b.TEXTURE_MIN_FILTER,i(k.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+g);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}B=n.attributes;b.bindBuffer(b.ARRAY_BUFFER,u.__webGLVertexBuffer);b.vertexAttribPointer(B.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.position);if(B.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLNormalBuffer);b.vertexAttribPointer(B.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.normal)}if(B.tangent>=
+0){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLTangentBuffer);b.vertexAttribPointer(B.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.tangent)}if(B.uv>=0)if(u.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLUVBuffer);b.vertexAttribPointer(B.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.uv)}else b.disableVertexAttribArray(B.uv);if(m.wireframe||m instanceof THREE.LineBasicMaterial){B=m.wireframe_linewidth!==undefined?m.wireframe_linewidth:m.linewidth!==undefined?m.linewidth:1;m=m instanceof
+THREE.LineBasicMaterial&&I.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(B);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,u.__webGLLineBuffer);b.drawElements(m,u.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,u.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,u.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(g,k,r,m,u,I,n){var w,B,v,o,K;v=0;for(o=m.materials.length;v<o;v++){w=m.materials[v];if(w instanceof THREE.MeshFaceMaterial){w=0;for(B=u.materials.length;w<
+B;w++)if((K=u.materials[w])&&K.blending==I&&K.opacity<1==n){this.setBlending(K.blending);this.renderBuffer(g,k,r,K,u,m)}}else if((K=w)&&K.blending==I&&K.opacity<1==n){this.setBlending(K.blending);this.renderBuffer(g,k,r,K,u,m)}}};this.render=function(g,k,r,m){var u,I,n,w=g.lights,B=g.fog;this.initWebGLObjects(g);m=m!==undefined?m:true;if(r&&!r.__webGLFramebuffer){r.__webGLFramebuffer=b.createFramebuffer();r.__webGLRenderbuffer=b.createRenderbuffer();r.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,
+r.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,r.width,r.height);b.bindTexture(b.TEXTURE_2D,r.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(r.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(r.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,i(r.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,i(r.min_filter));b.texImage2D(b.TEXTURE_2D,0,i(r.format),r.width,r.height,0,i(r.format),i(r.type),null);b.bindFramebuffer(b.FRAMEBUFFER,
+r.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,r.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,r.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(r){u=r.__webGLFramebuffer;n=r.width;I=r.height}else{u=null;n=p.width;I=p.height}if(u!=l){b.bindFramebuffer(b.FRAMEBUFFER,u);b.viewport(0,0,n,I);m&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);
+l=u}this.autoClear&&this.clear();k.autoUpdateMatrix&&k.updateMatrix();A.set(k.matrix.flatten());N.set(k.projectionMatrix.flatten());m=0;for(u=g.__webGLObjects.length;m<u;m++){I=g.__webGLObjects[m];n=I.object;I=I.buffer;if(n.visible){this.setupMatrices(n,k);this.renderPass(k,w,B,n,I,THREE.NormalBlending,false)}}m=0;for(u=g.__webGLObjects.length;m<u;m++){I=g.__webGLObjects[m];n=I.object;I=I.buffer;if(n.visible){this.setupMatrices(n,k);if(n.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);
+n.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}this.renderPass(k,w,B,n,I,THREE.AdditiveBlending,false);this.renderPass(k,w,B,n,I,THREE.SubtractiveBlending,false);this.renderPass(k,w,B,n,I,THREE.AdditiveBlending,true);this.renderPass(k,w,B,n,I,THREE.SubtractiveBlending,true);this.renderPass(k,w,B,n,I,THREE.NormalBlending,true)}}if(r&&r.min_filter!==THREE.NearestFilter&&r.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,r.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,
+null)}};this.initWebGLObjects=function(g){function k(v,o,K,G){if(v[o]==undefined){g.__webGLObjects.push({buffer:K,object:G});v[o]=1}}var r,m,u,I,n,w,B;if(!g.__webGLObjects){g.__webGLObjects=[];g.__webGLObjectsMap={}}r=0;for(m=g.objects.length;r<m;r++){u=g.objects[r];n=u.geometry;if(g.__webGLObjectsMap[u.id]==undefined)g.__webGLObjectsMap[u.id]={};B=g.__webGLObjectsMap[u.id];if(u instanceof THREE.Mesh){for(I in n.geometryChunks){w=n.geometryChunks[I];if(!w.__webGLVertexBuffer){this.createMeshBuffers(w);
+this.initMeshBuffers(w,u);n.__dirtyVertices=true;n.__dirtyElements=true;n.__dirtyUvs=true;n.__dirtyNormals=true;n.__dirtyTangents=true}if(n.__dirtyVertices||n.__dirtyElements||n.__dirtyUvs)this.setMeshBuffers(w,u,b.DYNAMIC_DRAW,n.__dirtyVertices,n.__dirtyElements,n.__dirtyUvs,n.__dirtyNormals,n.__dirtyTangents);k(B,I,w,u)}n.__dirtyVertices=false;n.__dirtyElements=false;n.__dirtyUvs=false;n.__dirtyNormals=false;n.__dirtyTangents=false}else if(u instanceof THREE.Line){if(!n.__webGLVertexBuffer){this.createLineBuffers(n);
+this.initLineBuffers(n);n.__dirtyVertices=true;n.__dirtyElements=true}n.__dirtyVertices&&this.setLineBuffers(n,b.DYNAMIC_DRAW,n.__dirtyVertices,n.__dirtyElements);k(B,0,n,u);n.__dirtyVertices=false;n.__dirtyElements=false}else if(u instanceof THREE.ParticleSystem){n.__webGLVertexBuffer||this.createParticleBuffers(n);k(B,0,n,u)}}};this.removeObject=function(g,k){var r,m;for(r=g.__webGLObjects.length-1;r>=0;r--){m=g.__webGLObjects[r].object;k==m&&g.__webGLObjects.splice(r,1)}};this.setupMatrices=function(g,
+k){g.autoUpdateMatrix&&g.updateMatrix();C.multiply(k.matrix,g.matrix);E.set(C.flatten());F=THREE.Matrix4.makeInvert3x3(C).transpose();P.set(F.m);Q.set(g.matrix.flatten())};this.loadMatrices=function(g){b.uniformMatrix4fv(g.uniforms.viewMatrix,false,A);b.uniformMatrix4fv(g.uniforms.modelViewMatrix,false,E);b.uniformMatrix4fv(g.uniforms.projectionMatrix,false,N);b.uniformMatrix3fv(g.uniforms.normalMatrix,false,P);b.uniformMatrix4fv(g.uniforms.objectMatrix,false,Q)};this.loadCamera=function(g,k){b.uniform3f(g.uniforms.cameraPosition,
+k.position.x,k.position.y,k.position.z)};this.setBlending=function(g){switch(g){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(g,k){if(g){!k||k=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(g=="back")b.cullFace(b.BACK);else g=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);
+b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
+envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
+map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
+lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
+lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"};
+THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",
+value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}}};
+THREE.ShaderLib={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}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
+THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
+THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,"gl_FragColor =  mColor * mapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,
+THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},
+shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,
+"gl_FragColor =  mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
+THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\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.faceMaterials=this.meshMaterials=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.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};

+ 204 - 206
build/ThreeDebug.js

@@ -1,206 +1,204 @@
-// ThreeDebug.js r32 - 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,c,d){this.r=a;this.g=c;this.b=d;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)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
-THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;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,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.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,c,d){this.x=a||0;this.y=c||0;this.z=d||0};
-THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
-cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,f=this.z;this.x=d*a.z-f*a.y;this.y=f*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.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},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
-a.z;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 c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+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,c,d,f){this.x=a||0;this.y=c||0;this.z=d||0;this.w=f||1};
-THREE.Vector4.prototype={set:function(a,c,d,f){this.x=a;this.y=c;this.z=d;this.w=f;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,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.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,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},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,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,d,f=a.objects,h=[];a=0;for(c=f.length;a<c;a++){d=f[a];if(d instanceof THREE.Mesh)h=h.concat(this.intersectObject(d))}h.sort(function(i,q){return i.distance-q.distance});return h},intersectObject:function(a){function c(U,u,S,D){D=D.clone().subSelf(u);S=S.clone().subSelf(u);var e=U.clone().subSelf(u);U=D.dot(D);u=D.dot(S);D=D.dot(e);var g=S.dot(S);S=S.dot(e);e=1/(U*g-u*u);g=(g*D-u*S)*e;U=(U*S-u*D)*e;return g>0&&U>0&&g+U<1}var d,f,h,i,q,b,m,n,E,H,
-y,A=a.geometry,T=A.vertices,V=[];d=0;for(f=A.faces.length;d<f;d++){h=A.faces[d];H=this.origin.clone();y=this.direction.clone();i=a.matrix.multiplyVector3(T[h.a].position.clone());q=a.matrix.multiplyVector3(T[h.b].position.clone());b=a.matrix.multiplyVector3(T[h.c].position.clone());m=h instanceof THREE.Face4?a.matrix.multiplyVector3(T[h.d].position.clone()):null;n=a.rotationMatrix.multiplyVector3(h.normal.clone());E=y.dot(n);if(E<0){n=n.dot((new THREE.Vector3).sub(i,H))/E;H=H.addSelf(y.multiplyScalar(n));
-if(h instanceof THREE.Face3){if(c(H,i,q,b)){h={distance:this.origin.distanceTo(H),point:H,face:h,object:a};V.push(h)}}else if(h instanceof THREE.Face4)if(c(H,i,q,m)||c(H,q,b,m)){h={distance:this.origin.distanceTo(H),point:H,face:h,object:a};V.push(h)}}}return V}};
-THREE.Rectangle=function(){function a(){i=f-c;q=h-d}var c,d,f,h,i,q,b=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return q};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(m,n,E,H){b=false;c=m;d=n;f=E;h=H;a()};this.addPoint=function(m,n){if(b){b=false;c=m;d=n;f=m;h=n}else{c=c<m?c:m;d=d<n?d:n;f=f>m?f:m;h=h>n?
-h:n}a()};this.add3Points=function(m,n,E,H,y,A){if(b){b=false;c=m<E?m<y?m:y:E<y?E:y;d=n<H?n<A?n:A:H<A?H:A;f=m>E?m>y?m:y:E>y?E:y;h=n>H?n>A?n:A:H>A?H:A}else{c=m<E?m<y?m<c?m:c:y<c?y:c:E<y?E<c?E:c:y<c?y:c;d=n<H?n<A?n<d?n:d:A<d?A:d:H<A?H<d?H:d:A<d?A:d;f=m>E?m>y?m>f?m:f:y>f?y:f:E>y?E>f?E:f:y>f?y:f;h=n>H?n>A?n>h?n:h:A>h?A:h:H>A?H>h?H:h:A>h?A:h}a()};this.addRectangle=function(m){if(b){b=false;c=m.getLeft();d=m.getTop();f=m.getRight();h=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();d=d<m.getTop()?d:m.getTop();
-f=f>m.getRight()?f:m.getRight();h=h>m.getBottom()?h:m.getBottom()}a()};this.inflate=function(m){c-=m;d-=m;f+=m;h+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();d=d>m.getTop()?d:m.getTop();f=f<m.getRight()?f:m.getRight();h=h<m.getBottom()?h:m.getBottom();a()};this.instersects=function(m){return Math.min(f,m.getRight())-Math.max(c,m.getLeft())>=0&&Math.min(h,m.getBottom())-Math.max(d,m.getTop())>=0};this.empty=function(){b=true;h=f=d=c=0;a()};this.isEmpty=function(){return b};this.toString=
-function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+d+", bottom: "+h+", width: "+i+", 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,c,d,f,h,i,q,b,m,n,E,H,y,A,T,V){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=h||0;this.n22=i||1;this.n23=q||0;this.n24=b||0;this.n31=m||0;this.n32=n||0;this.n33=E||1;this.n34=H||0;this.n41=y||0;this.n42=A||0;this.n43=T||0;this.n44=V||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
-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,c,d,f,h,i,q,b,m,n,E,H,y,A,T,V){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=h;this.n22=i;this.n23=q;this.n24=b;this.n31=m;this.n32=n;this.n33=E;this.n34=H;this.n41=y;this.n42=A;this.n43=T;this.n44=V;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,c,d){var f=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,c).normalize();f.cross(d,i).normalize();h.cross(i,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);
-this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,f=a.z,h=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*h;return a},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23*
-f+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*f+this.n44*h;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,f=a.n12,h=a.n13,i=a.n14,q=a.n21,b=a.n22,m=a.n23,n=a.n24,E=a.n31,
-H=a.n32,y=a.n33,A=a.n34,T=a.n41,V=a.n42,U=a.n43,u=a.n44,S=c.n11,D=c.n12,e=c.n13,g=c.n14,o=c.n21,j=c.n22,p=c.n23,z=c.n24,k=c.n31,s=c.n32,t=c.n33,r=c.n34,l=c.n41,C=c.n42,x=c.n43,L=c.n44;this.n11=d*S+f*o+h*k+i*l;this.n12=d*D+f*j+h*s+i*C;this.n13=d*e+f*p+h*t+i*x;this.n14=d*g+f*z+h*r+i*L;this.n21=q*S+b*o+m*k+n*l;this.n22=q*D+b*j+m*s+n*C;this.n23=q*e+b*p+m*t+n*x;this.n24=q*g+b*z+m*r+n*L;this.n31=E*S+H*o+y*k+A*l;this.n32=E*D+H*j+y*s+A*C;this.n33=E*e+H*p+y*t+A*x;this.n34=E*g+H*z+y*r+A*L;this.n41=T*S+V*o+
-U*k+u*l;this.n42=T*D+V*j+U*s+u*C;this.n43=T*e+V*p+U*t+u*x;this.n44=T*g+V*z+U*r+u*L;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,f=this.n13,h=this.n14,i=this.n21,q=this.n22,b=this.n23,m=this.n24,n=this.n31,E=this.n32,H=this.n33,y=this.n34,A=this.n41,T=this.n42,V=this.n43,U=this.n44,u=a.n11,S=a.n21,D=a.n31,e=a.n41,g=a.n12,o=a.n22,j=a.n32,p=a.n42,z=a.n13,k=a.n23,s=a.n33,t=a.n43,r=a.n14,l=a.n24,C=a.n34;a=a.n44;this.n11=c*u+d*S+f*D+h*e;this.n12=c*g+d*o+f*j+h*p;this.n13=c*z+d*k+f*s+h*
-t;this.n14=c*r+d*l+f*C+h*a;this.n21=i*u+q*S+b*D+m*e;this.n22=i*g+q*o+b*j+m*p;this.n23=i*z+q*k+b*s+m*t;this.n24=i*r+q*l+b*C+m*a;this.n31=n*u+E*S+H*D+y*e;this.n32=n*g+E*o+H*j+y*p;this.n33=n*z+E*k+H*s+y*t;this.n34=n*r+E*l+H*C+y*a;this.n41=A*u+T*S+V*D+U*e;this.n42=A*g+T*o+V*j+U*p;this.n43=A*z+T*k+V*s+U*t;this.n44=A*r+T*l+V*C+U*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(c,d,f){var h=c[d];
-c[d]=c[f];c[f]=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(){this.flat[0]=this.n11;this.flat[1]=this.n21;
-this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},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,c,d){var f=new THREE.Matrix4;f.n14=a;f.n24=c;f.n34=d;return f};THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.n11=a;f.n22=c;f.n33=d;return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.n22=c.n33=Math.cos(a);c.n32=Math.sin(a);c.n23=-c.n32;return c};
-THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.n11=c.n33=Math.cos(a);c.n13=Math.sin(a);c.n31=-c.n13;return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.n11=c.n22=Math.cos(a);c.n21=Math.sin(a);c.n12=-c.n21;return c};
-THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4,f=Math.cos(c),h=Math.sin(c),i=1-f,q=a.x,b=a.y,m=a.z;d.n11=i*q*q+f;d.n12=i*q*b-h*m;d.n13=i*q*m+h*b;d.n21=i*q*b+h*m;d.n22=i*b*b+f;d.n23=i*b*m-h*q;d.n31=i*q*m-h*b;d.n32=i*b*m+h*q;d.n33=i*m*m+f;return d};
-THREE.Matrix4.makeInvert=function(a){var c=new THREE.Matrix4;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.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;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=c[10]*c[5]-c[6]*c[9],f=-c[10]*c[1]+c[2]*c[9],h=c[6]*c[1]-c[2]*c[5],i=-c[10]*c[4]+c[6]*c[8],q=c[10]*c[0]-c[2]*c[8],b=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],n=-c[9]*c[0]+c[1]*c[8],E=c[5]*c[0]-c[1]*c[4];c=c[0]*d+c[1]*i+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*d;a.m[1]=c*f;a.m[2]=c*h;a.m[3]=c*i;a.m[4]=c*q;a.m[5]=c*b;a.m[6]=c*m;a.m[7]=c*n;a.m[8]=c*E;return a};
-THREE.Matrix4.makeFrustum=function(a,c,d,f,h,i){var q,b,m;q=new THREE.Matrix4;b=2*h/(c-a);m=2*h/(f-d);a=(c+a)/(c-a);d=(f+d)/(f-d);f=-(i+h)/(i-h);h=-2*i*h/(i-h);q.n11=b;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=m;q.n23=d;q.n24=0;q.n31=0;q.n32=0;q.n33=f;q.n34=h;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,d,f){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,f)};
-THREE.Matrix4.makeOrtho=function(a,c,d,f,h,i){var q,b,m,n;q=new THREE.Matrix4;b=c-a;m=d-f;n=i-h;a=(c+a)/b;d=(d+f)/m;h=(i+h)/n;q.n11=2/b;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/m;q.n23=0;q.n24=-d;q.n31=0;q.n32=0;q.n33=-2/n;q.n34=-h;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
-THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||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,c,d,f,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,c,d,f,h,i){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||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,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,f,h,i,q,b=new THREE.Vector3,m=new THREE.Vector3;f=0;for(h=this.vertices.length;f<h;f++){i=this.vertices[f];i.normal.set(0,0,0)}f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(a&&i.vertexNormals.length){b.set(0,0,0);c=0;for(d=i.normal.length;c<d;c++)b.addSelf(i.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[i.a];d=this.vertices[i.b];q=this.vertices[i.c];b.sub(q.position,
-d.position);m.sub(c.position,d.position);b.crossSelf(m)}b.isZero()||b.normalize();i.normal.copy(b)}},computeVertexNormals:function(){var a,c,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)f[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
-new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)f[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)f[a].normalize();a=0;for(c=this.faces.length;a<
-c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function a(r,l,C,x,L,K,F){i=r.vertices[l].position;q=r.vertices[C].position;b=r.vertices[x].position;m=h[L];n=h[K];E=h[F];H=q.x-i.x;y=b.x-i.x;A=q.y-i.y;T=b.y-i.y;
-V=q.z-i.z;U=b.z-i.z;u=n.u-m.u;S=E.u-m.u;D=n.v-m.v;e=E.v-m.v;g=1/(u*e-S*D);p.set((e*H-D*y)*g,(e*A-D*T)*g,(e*V-D*U)*g);z.set((u*y-S*H)*g,(u*T-S*A)*g,(u*U-S*V)*g);o[l].addSelf(p);o[C].addSelf(p);o[x].addSelf(p);j[l].addSelf(z);j[C].addSelf(z);j[x].addSelf(z)}var c,d,f,h,i,q,b,m,n,E,H,y,A,T,V,U,u,S,D,e,g,o=[],j=[],p=new THREE.Vector3,z=new THREE.Vector3,k=new THREE.Vector3,s=new THREE.Vector3,t=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){o[c]=new THREE.Vector3;j[c]=new THREE.Vector3}c=0;
-for(d=this.faces.length;c<d;c++){f=this.faces[c];h=this.uvs[c];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2]);
-this.vertices[f.d].normal.copy(f.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){t.copy(this.vertices[c].normal);f=o[c];k.copy(f);k.subSelf(t.multiplyScalar(t.dot(f))).normalize();s.cross(this.vertices[c].normal,f);f=s.dot(j[c]);f=f<0?-1:1;this.vertices[c].tangent.set(k.x,k.y,k.z,f)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
-z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
-this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(E){var H=[];c=0;for(d=E.length;c<d;c++)E[c]==undefined?H.push("undefined"):H.push(E[c].toString());return H.join("_")}var c,d,f,h,i,q,b,m,n={};f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];
-q=i.materials;b=a(q);if(n[b]==undefined)n[b]={hash:b,counter:0};m=n[b].hash+"_"+n[b].counter;if(this.geometryChunks[m]==undefined)this.geometryChunks[m]={faces:[],materials:q,vertices:0};i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[m].vertices+i>65535){n[b].counter+=1;m=n[b].hash+"_"+n[b].counter;if(this.geometryChunks[m]==undefined)this.geometryChunks[m]={faces:[],materials:q,vertices:0}}this.geometryChunks[m].faces.push(f);this.geometryChunks[m].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
-this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
-THREE.Camera=function(a,c,d,f){this.fov=a;this.aspect=c;this.near=d;this.far=f;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
-this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
-THREE.Camera.prototype={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,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;
-THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||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.visible=this.autoUpdateMatrix=true};
-THREE.Object3D.prototype={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.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.autoUpdateMatrix=false};
-THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];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}};
-THREE.LineBasicMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
-THREE.MeshBasicMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
-THREE.MeshLambertMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
-THREE.MeshPhongMaterial.prototype={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.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.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={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}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={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}};
-THREE.MeshShaderMaterial.prototype={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}};
-THREE.ParticleBasicMaterial.prototype={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}};
-THREE.ParticleCircleMaterial.prototype={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};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
-THREE.Texture=function(a,c,d,f,h,i){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter};
-THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},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.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
-THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var c,d,f,h={};for(c in a){h[c]={};for(d in a[c]){f=a[c][d];h[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var c,d,f,h={};for(c=0;c<a.length;c++){f=this.clone(a[c]);for(d in f)h[d]=f[d]}return h}};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,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
-THREE.Projector=function(){function a(j,p){return p.z-j.z}function c(j,p){var z=0,k=1,s=j.z+j.w,t=p.z+p.w,r=-j.z+j.w,l=-p.z+p.w;if(s>=0&&t>=0&&r>=0&&l>=0)return true;else if(s<0&&t<0||r<0&&l<0)return false;else{if(s<0)z=Math.max(z,s/(s-t));else if(t<0)k=Math.min(k,s/(s-t));if(r<0)z=Math.max(z,r/(r-l));else if(l<0)k=Math.min(k,r/(r-l));if(k<z)return false;else{j.lerpSelf(p,z);p.lerpSelf(j,1-k);return true}}}var d,f,h=[],i,q,b,m=[],n,E,H=[],y,A,T=[],V=new THREE.Vector4,U=new THREE.Vector4,u=new THREE.Matrix4,
-S=new THREE.Matrix4,D=[],e=new THREE.Vector4,g=new THREE.Vector4,o;this.projectObjects=function(j,p,z){var k=[],s,t;f=0;u.multiply(p.projectionMatrix,p.matrix);D[0]=new THREE.Vector4(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);D[1]=new THREE.Vector4(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);D[2]=new THREE.Vector4(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);D[3]=new THREE.Vector4(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);D[4]=new THREE.Vector4(u.n41-u.n31,u.n42-u.n32,u.n43-
-u.n33,u.n44-u.n34);D[5]=new THREE.Vector4(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);p=0;for(s=D.length;p<s;p++){t=D[p];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}s=j.objects;j=0;for(p=s.length;j<p;j++){t=s[j];var r;if(!(r=!t.visible)){if(r=t instanceof THREE.Mesh){a:{r=void 0;for(var l=t.position,C=-t.geometry.boundingSphere.radius*Math.max(t.scale.x,Math.max(t.scale.y,t.scale.z)),x=0;x<6;x++){r=D[x].x*l.x+D[x].y*l.y+D[x].z*l.z+D[x].w;if(r<=C){r=false;break a}}r=true}r=!r}r=r}if(!r){d=
-h[f]=h[f]||new THREE.RenderableObject;V.copy(t.position);u.multiplyVector3(V);d.object=t;d.z=V.z;k.push(d);f++}}z&&k.sort(a);return k};this.projectScene=function(j,p,z){var k=[],s=p.near,t=p.far,r,l,C,x,L,K,F,W,M,G,I,Q,N,v,J,O;b=E=A=0;p.autoUpdateMatrix&&p.updateMatrix();u.multiply(p.projectionMatrix,p.matrix);K=this.projectObjects(j,p,true);j=0;for(r=K.length;j<r;j++){F=K[j].object;if(F.visible){F.autoUpdateMatrix&&F.updateMatrix();W=F.matrix;M=F.rotationMatrix;G=F.materials;I=F.overdraw;if(F instanceof
-THREE.Mesh){Q=F.geometry;N=Q.vertices;l=0;for(C=N.length;l<C;l++){v=N[l];v.positionWorld.copy(v.position);W.multiplyVector3(v.positionWorld);x=v.positionScreen;x.copy(v.positionWorld);u.multiplyVector4(x);x.x/=x.w;x.y/=x.w;v.__visible=x.z>s&&x.z<t}Q=Q.faces;l=0;for(C=Q.length;l<C;l++){v=Q[l];if(v instanceof THREE.Face3){x=N[v.a];L=N[v.b];J=N[v.c];if(x.__visible&&L.__visible&&J.__visible)if(F.doubleSided||F.flipSided!=(J.positionScreen.x-x.positionScreen.x)*(L.positionScreen.y-x.positionScreen.y)-
-(J.positionScreen.y-x.positionScreen.y)*(L.positionScreen.x-x.positionScreen.x)<0){i=m[b]=m[b]||new THREE.RenderableFace3;i.v1.positionWorld.copy(x.positionWorld);i.v2.positionWorld.copy(L.positionWorld);i.v3.positionWorld.copy(J.positionWorld);i.v1.positionScreen.copy(x.positionScreen);i.v2.positionScreen.copy(L.positionScreen);i.v3.positionScreen.copy(J.positionScreen);i.normalWorld.copy(v.normal);M.multiplyVector3(i.normalWorld);i.centroidWorld.copy(v.centroid);W.multiplyVector3(i.centroidWorld);
-i.centroidScreen.copy(i.centroidWorld);u.multiplyVector3(i.centroidScreen);J=v.vertexNormals;o=i.vertexNormalsWorld;x=0;for(L=J.length;x<L;x++){O=o[x]=o[x]||new THREE.Vector3;O.copy(J[x]);M.multiplyVector3(O)}i.z=i.centroidScreen.z;i.meshMaterials=G;i.faceMaterials=v.materials;i.overdraw=I;if(F.geometry.uvs[l]){i.uvs[0]=F.geometry.uvs[l][0];i.uvs[1]=F.geometry.uvs[l][1];i.uvs[2]=F.geometry.uvs[l][2]}k.push(i);b++}}else if(v instanceof THREE.Face4){x=N[v.a];L=N[v.b];J=N[v.c];O=N[v.d];if(x.__visible&&
-L.__visible&&J.__visible&&O.__visible)if(F.doubleSided||F.flipSided!=((O.positionScreen.x-x.positionScreen.x)*(L.positionScreen.y-x.positionScreen.y)-(O.positionScreen.y-x.positionScreen.y)*(L.positionScreen.x-x.positionScreen.x)<0||(L.positionScreen.x-J.positionScreen.x)*(O.positionScreen.y-J.positionScreen.y)-(L.positionScreen.y-J.positionScreen.y)*(O.positionScreen.x-J.positionScreen.x)<0)){i=m[b]=m[b]||new THREE.RenderableFace3;i.v1.positionWorld.copy(x.positionWorld);i.v2.positionWorld.copy(L.positionWorld);
-i.v3.positionWorld.copy(O.positionWorld);i.v1.positionScreen.copy(x.positionScreen);i.v2.positionScreen.copy(L.positionScreen);i.v3.positionScreen.copy(O.positionScreen);i.normalWorld.copy(v.normal);M.multiplyVector3(i.normalWorld);i.centroidWorld.copy(v.centroid);W.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);u.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=G;i.faceMaterials=v.materials;i.overdraw=I;if(F.geometry.uvs[l]){i.uvs[0]=F.geometry.uvs[l][0];
-i.uvs[1]=F.geometry.uvs[l][1];i.uvs[2]=F.geometry.uvs[l][3]}k.push(i);b++;q=m[b]=m[b]||new THREE.RenderableFace3;q.v1.positionWorld.copy(L.positionWorld);q.v2.positionWorld.copy(J.positionWorld);q.v3.positionWorld.copy(O.positionWorld);q.v1.positionScreen.copy(L.positionScreen);q.v2.positionScreen.copy(J.positionScreen);q.v3.positionScreen.copy(O.positionScreen);q.normalWorld.copy(i.normalWorld);q.centroidWorld.copy(i.centroidWorld);q.centroidScreen.copy(i.centroidScreen);q.z=q.centroidScreen.z;q.meshMaterials=
-G;q.faceMaterials=v.materials;q.overdraw=I;if(F.geometry.uvs[l]){q.uvs[0]=F.geometry.uvs[l][1];q.uvs[1]=F.geometry.uvs[l][2];q.uvs[2]=F.geometry.uvs[l][3]}k.push(q);b++}}}}else if(F instanceof THREE.Line){S.multiply(u,W);N=F.geometry.vertices;v=N[0];v.positionScreen.copy(v.position);S.multiplyVector4(v.positionScreen);l=1;for(C=N.length;l<C;l++){x=N[l];x.positionScreen.copy(x.position);S.multiplyVector4(x.positionScreen);L=N[l-1];e.copy(x.positionScreen);g.copy(L.positionScreen);if(c(e,g)){e.multiplyScalar(1/
-e.w);g.multiplyScalar(1/g.w);n=H[E]=H[E]||new THREE.RenderableLine;n.v1.positionScreen.copy(e);n.v2.positionScreen.copy(g);n.z=Math.max(e.z,g.z);n.materials=F.materials;k.push(n);E++}}}else if(F instanceof THREE.Particle){U.set(F.position.x,F.position.y,F.position.z,1);u.multiplyVector4(U);U.z/=U.w;if(U.z>0&&U.z<1){y=T[A]=T[A]||new THREE.RenderableParticle;y.x=U.x/U.w;y.y=U.y/U.w;y.z=U.z;y.rotation=F.rotation.z;y.scale.x=F.scale.x*Math.abs(y.x-(U.x+p.projectionMatrix.n11)/(U.w+p.projectionMatrix.n14));
-y.scale.y=F.scale.y*Math.abs(y.y-(U.y+p.projectionMatrix.n22)/(U.w+p.projectionMatrix.n24));y.materials=F.materials;k.push(y);A++}}}}z&&k.sort(a);return k};this.unprojectVector=function(j,p){var z=new THREE.Matrix4;z.multiply(THREE.Matrix4.makeInvert(p.matrix),THREE.Matrix4.makeInvert(p.projectionMatrix));z.multiplyVector3(j);return j}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,f,h,i;this.domElement=document.createElement("div");this.setSize=function(q,b){d=q;f=b;h=d/2;i=f/2};this.render=function(q,b){var m,n,E,H,y,A,T,V;a=c.projectScene(q,b);m=0;for(n=a.length;m<n;m++){y=a[m];if(y instanceof THREE.RenderableParticle){T=y.x*h+h;V=y.y*i+i;E=0;for(H=y.material.length;E<H;E++){A=y.material[E];if(A instanceof THREE.ParticleDOMMaterial){A=A.domElement;A.style.left=T+"px";A.style.top=V+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(da){if(y!=da)n.globalAlpha=y=da}function c(da){if(A!=da){switch(da){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}A=da}}var d=null,f=new THREE.Projector,h=document.createElement("canvas"),i,q,b,m,n=h.getContext("2d"),E=null,H=null,y=1,A=0,T=null,V=null,U=1,u,S,D,e,g,o,j,p,z,k=new THREE.Color,
-s=new THREE.Color,t=new THREE.Color,r=new THREE.Color,l=new THREE.Color,C,x,L,K,F,W,M,G,I,Q=new THREE.Rectangle,N=new THREE.Rectangle,v=new THREE.Rectangle,J=false,O=new THREE.Color,ea=new THREE.Color,ba=new THREE.Color,Z=new THREE.Color,ja=Math.PI*2,Y=new THREE.Vector3,qa,ka,fa,ha,sa,ua,va=16;qa=document.createElement("canvas");qa.width=qa.height=2;ka=qa.getContext("2d");ka.fillStyle="rgba(0,0,0,1)";ka.fillRect(0,0,2,2);fa=ka.getImageData(0,0,2,2);ha=fa.data;sa=document.createElement("canvas");sa.width=
-sa.height=va;ua=sa.getContext("2d");ua.translate(-va/2,-va/2);ua.scale(va,va);va--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(da,ra){i=da;q=ra;b=i/2;m=q/2;h.width=i;h.height=q;Q.set(-b,-m,b,m);y=1;A=0;V=T=null;U=1};this.setClearColor=function(da,ra){E=da!==null?new THREE.Color(da):null;H=ra;N.set(-b,-m,b,m);n.setTransform(1,0,0,-1,b,m);this.clear()};this.clear=function(){if(!N.isEmpty()){N.inflate(1);N.minSelf(Q);if(E!==null){c(THREE.NormalBlending);
-a(1);n.fillStyle="rgba("+Math.floor(E.r*255)+","+Math.floor(E.g*255)+","+Math.floor(E.b*255)+","+H+")";n.fillRect(N.getX(),N.getY(),N.getWidth(),N.getHeight())}else n.clearRect(N.getX(),N.getY(),N.getWidth(),N.getHeight());N.empty()}};this.render=function(da,ra){function Ma(w){var X,R,B,P=w.lights;ea.setRGB(0,0,0);ba.setRGB(0,0,0);Z.setRGB(0,0,0);w=0;for(X=P.length;w<X;w++){R=P[w];B=R.color;if(R instanceof THREE.AmbientLight){ea.r+=B.r;ea.g+=B.g;ea.b+=B.b}else if(R instanceof THREE.DirectionalLight){ba.r+=
-B.r;ba.g+=B.g;ba.b+=B.b}else if(R instanceof THREE.PointLight){Z.r+=B.r;Z.g+=B.g;Z.b+=B.b}}}function Aa(w,X,R,B){var P,$,ca,ga,ia=w.lights;w=0;for(P=ia.length;w<P;w++){$=ia[w];ca=$.color;ga=$.intensity;if($ instanceof THREE.DirectionalLight){$=R.dot($.position)*ga;if($>0){B.r+=ca.r*$;B.g+=ca.g*$;B.b+=ca.b*$}}else if($ instanceof THREE.PointLight){Y.sub($.position,X);Y.normalize();$=R.dot(Y)*ga;if($>0){B.r+=ca.r*$;B.g+=ca.g*$;B.b+=ca.b*$}}}}function Na(w,X,R){if(R.opacity!=0){a(R.opacity);c(R.blending);
-var B,P,$,ca,ga,ia;if(R instanceof THREE.ParticleBasicMaterial){if(R.map){ca=R.map;ga=ca.width>>1;ia=ca.height>>1;P=X.scale.x*b;$=X.scale.y*m;R=P*ga;B=$*ia;v.set(w.x-R,w.y-B,w.x+R,w.y+B);if(!Q.instersects(v))return;n.save();n.translate(w.x,w.y);n.rotate(-X.rotation);n.scale(P,-$);n.translate(-ga,-ia);n.drawImage(ca,0,0);n.restore()}n.beginPath();n.moveTo(w.x-10,w.y);n.lineTo(w.x+10,w.y);n.moveTo(w.x,w.y-10);n.lineTo(w.x,w.y+10);n.closePath();n.strokeStyle="rgb(255,255,0)";n.stroke()}else if(R instanceof
-THREE.ParticleCircleMaterial){if(J){O.r=ea.r+ba.r+Z.r;O.g=ea.g+ba.g+Z.g;O.b=ea.b+ba.b+Z.b;k.r=R.color.r*O.r;k.g=R.color.g*O.g;k.b=R.color.b*O.b;k.updateStyleString()}else k.__styleString=R.color.__styleString;R=X.scale.x*b;B=X.scale.y*m;v.set(w.x-R,w.y-B,w.x+R,w.y+B);if(Q.instersects(v)){P=k.__styleString;if(V!=P)n.fillStyle=V=P;n.save();n.translate(w.x,w.y);n.rotate(-X.rotation);n.scale(R,B);n.beginPath();n.arc(0,0,1,0,ja,true);n.closePath();n.fill();n.restore()}}}}function Oa(w,X,R,B){if(B.opacity!=
-0){a(B.opacity);c(B.blending);n.beginPath();n.moveTo(w.positionScreen.x,w.positionScreen.y);n.lineTo(X.positionScreen.x,X.positionScreen.y);n.closePath();if(B instanceof THREE.LineBasicMaterial){k.__styleString=B.color.__styleString;w=B.linewidth;if(U!=w)n.lineWidth=U=w;w=k.__styleString;if(T!=w)n.strokeStyle=T=w;n.stroke();v.inflate(B.linewidth*2)}}}function Ia(w,X,R,B,P,$){if(P.opacity!=0){a(P.opacity);c(P.blending);e=w.positionScreen.x;g=w.positionScreen.y;o=X.positionScreen.x;j=X.positionScreen.y;
-p=R.positionScreen.x;z=R.positionScreen.y;n.beginPath();n.moveTo(e,g);n.lineTo(o,j);n.lineTo(p,z);n.lineTo(e,g);n.closePath();if(P instanceof THREE.MeshBasicMaterial)if(P.map)P.map.image.loaded&&P.map.mapping instanceof THREE.UVMapping&&xa(e,g,o,j,p,z,P.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(P.env_map){if(P.env_map.image.loaded)if(P.env_map.mapping instanceof THREE.SphericalReflectionMapping){w=ra.matrix;Y.copy(B.vertexNormalsWorld[0]);K=(Y.x*w.n11+Y.y*
-w.n12+Y.z*w.n13)*0.5+0.5;F=-(Y.x*w.n21+Y.y*w.n22+Y.z*w.n23)*0.5+0.5;Y.copy(B.vertexNormalsWorld[1]);W=(Y.x*w.n11+Y.y*w.n12+Y.z*w.n13)*0.5+0.5;M=-(Y.x*w.n21+Y.y*w.n22+Y.z*w.n23)*0.5+0.5;Y.copy(B.vertexNormalsWorld[2]);G=(Y.x*w.n11+Y.y*w.n12+Y.z*w.n13)*0.5+0.5;I=-(Y.x*w.n21+Y.y*w.n22+Y.z*w.n23)*0.5+0.5;xa(e,g,o,j,p,z,P.env_map.image,K,F,W,M,G,I)}}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString);else if(P instanceof THREE.MeshLambertMaterial){if(P.map&&!P.wireframe){P.map.mapping instanceof
-THREE.UVMapping&&xa(e,g,o,j,p,z,P.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);c(THREE.SubtractiveBlending)}if(J)if(!P.wireframe&&P.shading==THREE.SmoothShading&&B.vertexNormalsWorld.length==3){s.r=t.r=r.r=ea.r;s.g=t.g=r.g=ea.g;s.b=t.b=r.b=ea.b;Aa($,B.v1.positionWorld,B.vertexNormalsWorld[0],s);Aa($,B.v2.positionWorld,B.vertexNormalsWorld[1],t);Aa($,B.v3.positionWorld,B.vertexNormalsWorld[2],r);l.r=(t.r+r.r)*0.5;l.g=(t.g+r.g)*0.5;l.b=(t.b+r.b)*0.5;L=Ja(s,t,r,l);xa(e,
-g,o,j,p,z,L,0,0,1,0,0,1)}else{O.r=ea.r;O.g=ea.g;O.b=ea.b;Aa($,B.centroidWorld,B.normalWorld,O);k.r=P.color.r*O.r;k.g=P.color.g*O.g;k.b=P.color.b*O.b;k.updateStyleString();P.wireframe?Ba(k.__styleString,P.wireframe_linewidth):Ca(k.__styleString)}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString)}else if(P instanceof THREE.MeshDepthMaterial){C=ra.near;x=ra.far;s.r=s.g=s.b=1-Ea(w.positionScreen.z,C,x);t.r=t.g=t.b=1-Ea(X.positionScreen.z,C,x);r.r=r.g=r.b=1-Ea(R.positionScreen.z,
-C,x);l.r=(t.r+r.r)*0.5;l.g=(t.g+r.g)*0.5;l.b=(t.b+r.b)*0.5;L=Ja(s,t,r,l);xa(e,g,o,j,p,z,L,0,0,1,0,0,1)}else if(P instanceof THREE.MeshNormalMaterial){k.r=Fa(B.normalWorld.x);k.g=Fa(B.normalWorld.y);k.b=Fa(B.normalWorld.z);k.updateStyleString();P.wireframe?Ba(k.__styleString,P.wireframe_linewidth):Ca(k.__styleString)}}}function Ba(w,X){if(T!=w)n.strokeStyle=T=w;if(U!=X)n.lineWidth=U=X;n.stroke();v.inflate(X*2)}function Ca(w){if(V!=w)n.fillStyle=V=w;n.fill()}function xa(w,X,R,B,P,$,ca,ga,ia,na,la,oa,
-ya){var ta,pa;ta=ca.width-1;pa=ca.height-1;ga*=ta;ia*=pa;na*=ta;la*=pa;oa*=ta;ya*=pa;R-=w;B-=X;P-=w;$-=X;na-=ga;la-=ia;oa-=ga;ya-=ia;pa=1/(na*ya-oa*la);ta=(ya*R-la*P)*pa;la=(ya*B-la*$)*pa;R=(na*P-oa*R)*pa;B=(na*$-oa*B)*pa;w=w-ta*ga-R*ia;X=X-la*ga-B*ia;n.save();n.transform(ta,la,R,B,w,X);n.clip();n.drawImage(ca,0,0);n.restore()}function Ja(w,X,R,B){var P=~~(w.r*255),$=~~(w.g*255);w=~~(w.b*255);var ca=~~(X.r*255),ga=~~(X.g*255);X=~~(X.b*255);var ia=~~(R.r*255),na=~~(R.g*255);R=~~(R.b*255);var la=~~(B.r*
-255),oa=~~(B.g*255);B=~~(B.b*255);ha[0]=P<0?0:P>255?255:P;ha[1]=$<0?0:$>255?255:$;ha[2]=w<0?0:w>255?255:w;ha[4]=ca<0?0:ca>255?255:ca;ha[5]=ga<0?0:ga>255?255:ga;ha[6]=X<0?0:X>255?255:X;ha[8]=ia<0?0:ia>255?255:ia;ha[9]=na<0?0:na>255?255:na;ha[10]=R<0?0:R>255?255:R;ha[12]=la<0?0:la>255?255:la;ha[13]=oa<0?0:oa>255?255:oa;ha[14]=B<0?0:B>255?255:B;ka.putImageData(fa,0,0);ua.drawImage(qa,0,0);return sa}function Ea(w,X,R){w=(w-X)/(R-X);return w*w*(3-2*w)}function Fa(w){w=(w+1)*0.5;return w<0?0:w>1?1:w}function Ga(w,
-X){var R=X.x-w.x,B=X.y-w.y,P=1/Math.sqrt(R*R+B*B);R*=P;B*=P;X.x+=R;X.y+=B;w.x-=R;w.y-=B}var Da,Ka,aa,ma,wa,Ha,La,za;n.setTransform(1,0,0,-1,b,m);this.autoClear&&this.clear();d=f.projectScene(da,ra,this.sortElements);n.fillStyle="rgba( 0, 255, 255, 0.5 )";n.fillRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight());(J=da.lights.length>0)&&Ma(da);Da=0;for(Ka=d.length;Da<Ka;Da++){aa=d[Da];v.empty();if(aa instanceof THREE.RenderableParticle){u=aa;u.x*=b;u.y*=m;ma=0;for(wa=aa.materials.length;ma<wa;ma++)Na(u,
-aa,aa.materials[ma],da)}else if(aa instanceof THREE.RenderableLine){u=aa.v1;S=aa.v2;u.positionScreen.x*=b;u.positionScreen.y*=m;S.positionScreen.x*=b;S.positionScreen.y*=m;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(S.positionScreen.x,S.positionScreen.y);if(Q.instersects(v)){ma=0;for(wa=aa.materials.length;ma<wa;)Oa(u,S,aa,aa.materials[ma++],da)}}else if(aa instanceof THREE.RenderableFace3){u=aa.v1;S=aa.v2;D=aa.v3;u.positionScreen.x*=b;u.positionScreen.y*=m;S.positionScreen.x*=b;
-S.positionScreen.y*=m;D.positionScreen.x*=b;D.positionScreen.y*=m;if(aa.overdraw){Ga(u.positionScreen,S.positionScreen);Ga(S.positionScreen,D.positionScreen);Ga(D.positionScreen,u.positionScreen)}v.add3Points(u.positionScreen.x,u.positionScreen.y,S.positionScreen.x,S.positionScreen.y,D.positionScreen.x,D.positionScreen.y);if(Q.instersects(v)){ma=0;for(wa=aa.meshMaterials.length;ma<wa;){za=aa.meshMaterials[ma++];if(za instanceof THREE.MeshFaceMaterial){Ha=0;for(La=aa.faceMaterials.length;Ha<La;)(za=
-aa.faceMaterials[Ha++])&&Ia(u,S,D,aa,za,da)}else Ia(u,S,D,aa,za,da)}}}N.addRectangle(v)}n.lineWidth=1;n.strokeStyle="rgba( 255, 0, 0, 0.5 )";n.strokeRect(N.getX(),N.getY(),N.getWidth(),N.getHeight());n.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(K,F,W){var M,G,I,Q;M=0;for(G=K.lights.length;M<G;M++){I=K.lights[M];if(I instanceof THREE.DirectionalLight){Q=F.normalWorld.dot(I.position)*I.intensity;if(Q>0){W.r+=I.color.r*Q;W.g+=I.color.g*Q;W.b+=I.color.b*Q}}else if(I instanceof THREE.PointLight){z.sub(I.position,F.centroidWorld);z.normalize();Q=F.normalWorld.dot(z)*I.intensity;if(Q>0){W.r+=I.color.r*Q;W.g+=I.color.g*Q;W.b+=I.color.b*Q}}}}function c(K,F,W,M,G,I){r=f(l++);r.setAttribute("d","M "+K.positionScreen.x+
-" "+K.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(G instanceof THREE.MeshBasicMaterial)D.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshLambertMaterial)if(S){e.r=g.r;e.g=g.g;e.b=g.b;a(I,M,e);D.r=G.color.r*e.r;D.g=G.color.g*e.g;D.b=G.color.b*e.b;D.updateStyleString()}else D.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshDepthMaterial){p=1-G.__2near/(G.__farPlusNear-M.z*G.__farMinusNear);
-D.setRGB(p,p,p)}else G instanceof THREE.MeshNormalMaterial&&D.setRGB(h(M.normalWorld.x),h(M.normalWorld.y),h(M.normalWorld.z));G.wireframe?r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+G.wireframe_linewidth+"; stroke-opacity: "+G.opacity+"; stroke-linecap: "+G.wireframe_linecap+"; stroke-linejoin: "+G.wireframe_linejoin):r.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+G.opacity);b.appendChild(r)}function d(K,F,W,M,G,I,Q){r=f(l++);r.setAttribute("d",
-"M "+K.positionScreen.x+" "+K.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)D.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(S){e.r=g.r;e.g=g.g;e.b=g.b;a(Q,G,e);D.r=I.color.r*e.r;D.g=I.color.g*e.g;D.b=I.color.b*e.b;D.updateStyleString()}else D.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){p=
-1-I.__2near/(I.__farPlusNear-G.z*I.__farMinusNear);D.setRGB(p,p,p)}else I instanceof THREE.MeshNormalMaterial&&D.setRGB(h(G.normalWorld.x),h(G.normalWorld.y),h(G.normalWorld.z));I.wireframe?r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):r.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+I.opacity);b.appendChild(r)}
-function f(K){if(k[K]==null){k[K]=document.createElementNS("http://www.w3.org/2000/svg","path");L==0&&k[K].setAttribute("shape-rendering","crispEdges");return k[K]}return k[K]}function h(K){return K<0?Math.min((1+K)*0.5,0.5):0.5+Math.min(K*0.5,0.5)}var i=null,q=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,n,E,H,y,A,T,V,U=new THREE.Rectangle,u=new THREE.Rectangle,S=false,D=new THREE.Color(16777215),e=new THREE.Color(16777215),g=new THREE.Color(0),o=new THREE.Color(0),
-j=new THREE.Color(0),p,z=new THREE.Vector3,k=[],s=[],t=[],r,l,C,x,L=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(K){switch(K){case "high":L=1;break;case "low":L=0}};this.setSize=function(K,F){m=K;n=F;E=m/2;H=n/2;b.setAttribute("viewBox",-E+" "+-H+" "+m+" "+n);b.setAttribute("width",m);b.setAttribute("height",n);U.set(-E,-H,E,H)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(K,F){var W,M,
-G,I,Q,N,v,J;this.autoClear&&this.clear();i=q.projectScene(K,F,this.sortElements);x=C=l=0;if(S=K.lights.length>0){v=K.lights;g.setRGB(0,0,0);o.setRGB(0,0,0);j.setRGB(0,0,0);W=0;for(M=v.length;W<M;W++){G=v[W];I=G.color;if(G instanceof THREE.AmbientLight){g.r+=I.r;g.g+=I.g;g.b+=I.b}else if(G instanceof THREE.DirectionalLight){o.r+=I.r;o.g+=I.g;o.b+=I.b}else if(G instanceof THREE.PointLight){j.r+=I.r;j.g+=I.g;j.b+=I.b}}}W=0;for(M=i.length;W<M;W++){v=i[W];u.empty();if(v instanceof THREE.RenderableParticle){y=
-v;y.x*=E;y.y*=-H;G=0;for(I=v.materials.length;G<I;G++)if(J=v.materials[G]){Q=y;N=v;J=J;var O=C++;if(s[O]==null){s[O]=document.createElementNS("http://www.w3.org/2000/svg","circle");L==0&&s[O].setAttribute("shape-rendering","crispEdges")}r=s[O];r.setAttribute("cx",Q.x);r.setAttribute("cy",Q.y);r.setAttribute("r",N.scale.x*E);if(J instanceof THREE.ParticleCircleMaterial){if(S){e.r=g.r+o.r+j.r;e.g=g.g+o.g+j.g;e.b=g.b+o.b+j.b;D.r=J.color.r*e.r;D.g=J.color.g*e.g;D.b=J.color.b*e.b;D.updateStyleString()}else D=
-J.color;r.setAttribute("style","fill: "+D.__styleString)}b.appendChild(r)}}else if(v instanceof THREE.RenderableLine){y=v.v1;A=v.v2;y.positionScreen.x*=E;y.positionScreen.y*=-H;A.positionScreen.x*=E;A.positionScreen.y*=-H;u.addPoint(y.positionScreen.x,y.positionScreen.y);u.addPoint(A.positionScreen.x,A.positionScreen.y);if(U.instersects(u)){G=0;for(I=v.materials.length;G<I;)if(J=v.materials[G++]){Q=y;N=A;J=J;O=x++;if(t[O]==null){t[O]=document.createElementNS("http://www.w3.org/2000/svg","line");L==
-0&&t[O].setAttribute("shape-rendering","crispEdges")}r=t[O];r.setAttribute("x1",Q.positionScreen.x);r.setAttribute("y1",Q.positionScreen.y);r.setAttribute("x2",N.positionScreen.x);r.setAttribute("y2",N.positionScreen.y);if(J instanceof THREE.LineBasicMaterial){D.__styleString=J.color.__styleString;r.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+J.linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.linecap+"; stroke-linejoin: "+J.linejoin);b.appendChild(r)}}}}else if(v instanceof
-THREE.RenderableFace3){y=v.v1;A=v.v2;T=v.v3;y.positionScreen.x*=E;y.positionScreen.y*=-H;A.positionScreen.x*=E;A.positionScreen.y*=-H;T.positionScreen.x*=E;T.positionScreen.y*=-H;u.addPoint(y.positionScreen.x,y.positionScreen.y);u.addPoint(A.positionScreen.x,A.positionScreen.y);u.addPoint(T.positionScreen.x,T.positionScreen.y);if(U.instersects(u)){G=0;for(I=v.meshMaterials.length;G<I;){J=v.meshMaterials[G++];if(J instanceof THREE.MeshFaceMaterial){Q=0;for(N=v.faceMaterials.length;Q<N;)(J=v.faceMaterials[Q++])&&
-c(y,A,T,v,J,K)}else J&&c(y,A,T,v,J,K)}}}else if(v instanceof THREE.RenderableFace4){y=v.v1;A=v.v2;T=v.v3;V=v.v4;y.positionScreen.x*=E;y.positionScreen.y*=-H;A.positionScreen.x*=E;A.positionScreen.y*=-H;T.positionScreen.x*=E;T.positionScreen.y*=-H;V.positionScreen.x*=E;V.positionScreen.y*=-H;u.addPoint(y.positionScreen.x,y.positionScreen.y);u.addPoint(A.positionScreen.x,A.positionScreen.y);u.addPoint(T.positionScreen.x,T.positionScreen.y);u.addPoint(V.positionScreen.x,V.positionScreen.y);if(U.instersects(u)){G=
-0;for(I=v.meshMaterials.length;G<I;){J=v.meshMaterials[G++];if(J instanceof THREE.MeshFaceMaterial){Q=0;for(N=v.faceMaterials.length;Q<N;)(J=v.faceMaterials[Q++])&&d(y,A,T,V,v,J,K)}else J&&d(y,A,T,V,v,J,K)}}}}}};
-THREE.WebGLRenderer=function(a){function c(e,g){e.fragment_shader=g.fragment_shader;e.vertex_shader=g.vertex_shader;e.uniforms=Uniforms.clone(g.uniforms)}function d(e,g){e.uniforms.color.value.setRGB(e.color.r*e.opacity,e.color.g*e.opacity,e.color.b*e.opacity);e.uniforms.opacity.value=e.opacity;e.uniforms.map.texture=e.map;e.uniforms.env_map.texture=e.env_map;e.uniforms.reflectivity.value=e.reflectivity;e.uniforms.refraction_ratio.value=e.refraction_ratio;e.uniforms.combine.value=e.combine;e.uniforms.useRefract.value=
-e.env_map&&e.env_map.mapping instanceof THREE.CubeRefractionMapping;if(g){e.uniforms.fogColor.value.setHex(g.color.hex);if(g instanceof THREE.Fog){e.uniforms.fogNear.value=g.near;e.uniforms.fogFar.value=g.far}else if(g instanceof THREE.FogExp2)e.uniforms.fogDensity.value=g.density}}function f(e,g){e.uniforms.color.value.setRGB(e.color.r*e.opacity,e.color.g*e.opacity,e.color.b*e.opacity);e.uniforms.opacity.value=e.opacity;if(g){e.uniforms.fogColor.value.setHex(g.color.hex);if(g instanceof THREE.Fog){e.uniforms.fogNear.value=
-g.near;e.uniforms.fogFar.value=g.far}else if(g instanceof THREE.FogExp2)e.uniforms.fogDensity.value=g.density}}function h(e,g){var o;if(e=="fragment")o=b.createShader(b.FRAGMENT_SHADER);else if(e=="vertex")o=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,g);b.compileShader(o);if(!b.getShaderParameter(o,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(o));return null}return o}function i(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;
-case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;
-case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var q=document.createElement("canvas"),b,m=null,n=null,E=new THREE.Matrix4,H,y=new Float32Array(16),A=new Float32Array(16),T=new Float32Array(16),V=new Float32Array(9),
-U=new Float32Array(16),u=true,S=new THREE.Color(0),D=0;if(a){if(a.antialias!==undefined)u=a.antialias;a.clearColor!==undefined&&S.setHex(a.clearColor);if(a.clearAlpha!==undefined)D=a.clearAlpha}this.domElement=q;this.autoClear=true;(function(e,g,o){try{b=q.getContext("experimental-webgl",{antialias:e})}catch(j){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);
-b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(g.r,g.g,g.b,o)})(u,S,D);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(e,g){q.width=e;q.height=g;b.viewport(0,0,q.width,q.height)};this.setClearColor=function(e,g){var o=new THREE.Color(e);b.clearColor(o.r,o.g,o.b,g)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=
-function(e,g){var o,j,p,z=0,k=0,s=0,t,r,l,C=this.lights,x=C.directional.colors,L=C.directional.positions,K=C.point.colors,F=C.point.positions,W=0,M=0;o=0;for(j=g.length;o<j;o++){p=g[o];t=p.color;r=p.position;l=p.intensity;if(p instanceof THREE.AmbientLight){z+=t.r;k+=t.g;s+=t.b}else if(p instanceof THREE.DirectionalLight){x[W*3]=t.r*l;x[W*3+1]=t.g*l;x[W*3+2]=t.b*l;L[W*3]=r.x;L[W*3+1]=r.y;L[W*3+2]=r.z;W+=1}else if(p instanceof THREE.PointLight){K[M*3]=t.r*l;K[M*3+1]=t.g*l;K[M*3+2]=t.b*l;F[M*3]=r.x;
-F[M*3+1]=r.y;F[M*3+2]=r.z;M+=1}}C.point.length=M;C.directional.length=W;C.ambient[0]=z;C.ambient[1]=k;C.ambient[2]=s};this.createParticleBuffers=function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLNormalBuffer=b.createBuffer();e.__webGLTangentBuffer=b.createBuffer();e.__webGLUVBuffer=
-b.createBuffer();e.__webGLFaceBuffer=b.createBuffer();e.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(e){var g=e.vertices.length;e.__vertexArray=new Float32Array(g*3);e.__lineArray=new Uint16Array(g);e.__webGLLineCount=g};this.initMeshBuffers=function(e,g){var o,j,p=0,z=0,k=0,s=g.geometry.faces,t=e.faces;o=0;for(j=t.length;o<j;o++){fi=t[o];face=s[fi];if(face instanceof THREE.Face3){p+=3;z+=1;k+=3}else if(face instanceof THREE.Face4){p+=4;z+=2;k+=4}}e.__vertexArray=new Float32Array(p*
-3);e.__normalArray=new Float32Array(p*3);e.__tangentArray=new Float32Array(p*4);e.__uvArray=new Float32Array(p*2);e.__faceArray=new Uint16Array(z*3);e.__lineArray=new Uint16Array(k*2);p=false;o=0;for(j=g.materials.length;o<j;o++){s=g.materials[o];if(s instanceof THREE.MeshFaceMaterial){s=0;for(t=e.materials.length;s<t;s++)if(e.materials[s]&&e.materials[s].shading!=undefined&&e.materials[s].shading==THREE.SmoothShading){p=true;break}}else if(s&&s.shading!=undefined&&s.shading==THREE.SmoothShading){p=
-true;break}if(p)break}e.__needsSmoothNormals=p;e.__webGLFaceCount=z*3;e.__webGLLineCount=k*2};this.setMeshBuffers=function(e,g,o,j,p,z,k,s){var t,r,l,C,x,L,K,F,W,M=0,G=0,I=0,Q=0,N=0,v=0,J=0,O=e.__vertexArray,ea=e.__uvArray,ba=e.__normalArray,Z=e.__tangentArray,ja=e.__faceArray,Y=e.__lineArray,qa=e.__needsSmoothNormals,ka=g.geometry,fa=ka.vertices,ha=e.faces,sa=ka.faces,ua=ka.uvs;g=0;for(t=ha.length;g<t;g++){r=ha[g];l=sa[r];r=ua[r];C=l.vertexNormals;x=l.normal;if(l instanceof THREE.Face3){if(j){L=
-fa[l.a].position;K=fa[l.b].position;F=fa[l.c].position;O[G]=L.x;O[G+1]=L.y;O[G+2]=L.z;O[G+3]=K.x;O[G+4]=K.y;O[G+5]=K.z;O[G+6]=F.x;O[G+7]=F.y;O[G+8]=F.z;G+=9}if(s&&ka.hasTangents){L=fa[l.a].tangent;K=fa[l.b].tangent;F=fa[l.c].tangent;Z[v]=L.x;Z[v+1]=L.y;Z[v+2]=L.z;Z[v+3]=L.w;Z[v+4]=K.x;Z[v+5]=K.y;Z[v+6]=K.z;Z[v+7]=K.w;Z[v+8]=F.x;Z[v+9]=F.y;Z[v+10]=F.z;Z[v+11]=F.w;v+=12}if(k)if(C.length==3&&qa)for(l=0;l<3;l++){x=C[l];ba[N]=x.x;ba[N+1]=x.y;ba[N+2]=x.z;N+=3}else for(l=0;l<3;l++){ba[N]=x.x;ba[N+1]=x.y;
-ba[N+2]=x.z;N+=3}if(z&&r)for(l=0;l<3;l++){C=r[l];ea[I]=C.u;ea[I+1]=C.v;I+=2}if(p){ja[Q]=M;ja[Q+1]=M+1;ja[Q+2]=M+2;Q+=3;Y[J]=M;Y[J+1]=M+1;Y[J+2]=M;Y[J+3]=M+2;Y[J+4]=M+1;Y[J+5]=M+2;J+=6;M+=3}}else if(l instanceof THREE.Face4){if(j){L=fa[l.a].position;K=fa[l.b].position;F=fa[l.c].position;W=fa[l.d].position;O[G]=L.x;O[G+1]=L.y;O[G+2]=L.z;O[G+3]=K.x;O[G+4]=K.y;O[G+5]=K.z;O[G+6]=F.x;O[G+7]=F.y;O[G+8]=F.z;O[G+9]=W.x;O[G+10]=W.y;O[G+11]=W.z;G+=12}if(s&&ka.hasTangents){L=fa[l.a].tangent;K=fa[l.b].tangent;
-F=fa[l.c].tangent;l=fa[l.d].tangent;Z[v]=L.x;Z[v+1]=L.y;Z[v+2]=L.z;Z[v+3]=L.w;Z[v+4]=K.x;Z[v+5]=K.y;Z[v+6]=K.z;Z[v+7]=K.w;Z[v+8]=F.x;Z[v+9]=F.y;Z[v+10]=F.z;Z[v+11]=F.w;Z[v+12]=l.x;Z[v+13]=l.y;Z[v+14]=l.z;Z[v+15]=l.w;v+=16}if(k)if(C.length==4&&qa)for(l=0;l<4;l++){x=C[l];ba[N]=x.x;ba[N+1]=x.y;ba[N+2]=x.z;N+=3}else for(l=0;l<4;l++){ba[N]=x.x;ba[N+1]=x.y;ba[N+2]=x.z;N+=3}if(z&&r)for(l=0;l<4;l++){C=r[l];ea[I]=C.u;ea[I+1]=C.v;I+=2}if(p){ja[Q]=M;ja[Q+1]=M+1;ja[Q+2]=M+2;ja[Q+3]=M;ja[Q+4]=M+2;ja[Q+5]=M+3;
-Q+=6;Y[J]=M;Y[J+1]=M+1;Y[J+2]=M;Y[J+3]=M+3;Y[J+4]=M+1;Y[J+5]=M+2;Y[J+6]=M+2;Y[J+7]=M+3;J+=8;M+=4}}}if(j){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,O,o)}if(k){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,ba,o)}if(s&&ka.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,Z,o)}if(z&&I>0){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,ea,o)}if(p){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-e.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ja,o);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Y,o)}};this.setLineBuffers=function(e,g,o,j){var p,z,k=e.vertices,s=k.length,t=e.__vertexArray,r=e.__lineArray;if(o)for(o=0;o<s;o++){p=k[o].position;z=o*3;t[z]=p.x;t[z+1]=p.y;t[z+2]=p.z}if(j)for(o=0;o<s;o++)r[o]=o;b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,t,g);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.__webGLLineBuffer);
-b.bufferData(b.ELEMENT_ARRAY_BUFFER,r,g)};this.setParticleBuffers=function(){};this.renderBuffer=function(e,g,o,j,p,z){var k,s,t,r;if(!j.program){if(j instanceof THREE.MeshDepthMaterial){c(j,THREE.ShaderLib.depth);j.uniforms.mNear.value=e.near;j.uniforms.mFar.value=e.far}else if(j instanceof THREE.MeshNormalMaterial)c(j,THREE.ShaderLib.normal);else if(j instanceof THREE.MeshBasicMaterial){c(j,THREE.ShaderLib.basic);d(j,o)}else if(j instanceof THREE.MeshLambertMaterial){c(j,THREE.ShaderLib.lambert);
-d(j,o)}else if(j instanceof THREE.MeshPhongMaterial){c(j,THREE.ShaderLib.phong);d(j,o)}else if(j instanceof THREE.LineBasicMaterial){c(j,THREE.ShaderLib.basic);f(j,o)}var l,C,x;l=r=s=0;for(C=g.length;l<C;l++){x=g[l];x instanceof THREE.DirectionalLight&&r++;x instanceof THREE.PointLight&&s++}if(s+r<=4){l=r;s=s}else{l=Math.ceil(4*r/(s+r));s=4-l}s={directional:l,point:s};r={fog:o,map:j.map,env_map:j.env_map,maxDirLights:s.directional,maxPointLights:s.point};s=j.fragment_shader;l=j.vertex_shader;C=b.createProgram();
-x=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");r=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,
-r.map?"#define USE_MAP":"",r.env_map?"#define USE_ENVMAP":"","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");b.attachShader(C,h("fragment",x+s));b.attachShader(C,h("vertex",r+l));b.linkProgram(C);b.getProgramParameter(C,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+
-b.getProgramParameter(C,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");C.uniforms={};C.attributes={};j.program=C;s=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(k in j.uniforms)s.push(k);k=j.program;l=0;for(C=s.length;l<C;l++){x=s[l];k.uniforms[x]=b.getUniformLocation(k,x)}k=j.program;s=["position","normal","uv","tangent"];l=0;for(C=s.length;l<C;l++){x=s[l];k.attributes[x]=b.getAttribLocation(k,x)}}k=j.program;if(k!=m){b.useProgram(k);
-m=k}this.loadCamera(k,e);this.loadMatrices(k);if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){this.setupLights(k,g);e=this.lights;j.uniforms.enableLighting.value=e.directional.length+e.point.length;j.uniforms.ambientLightColor.value=e.ambient;j.uniforms.directionalLightColor.value=e.directional.colors;j.uniforms.directionalLightDirection.value=e.directional.positions;j.uniforms.pointLightColor.value=e.point.colors;j.uniforms.pointLightPosition.value=e.point.positions}if(j instanceof
-THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial)d(j,o);j instanceof THREE.LineBasicMaterial&&f(j,o);if(j instanceof THREE.MeshPhongMaterial){j.uniforms.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);j.uniforms.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);j.uniforms.shininess.value=j.shininess}o=j.uniforms;for(t in o)if(l=k.uniforms[t]){g=o[t];s=g.type;e=g.value;if(s=="i")b.uniform1i(l,e);else if(s=="f")b.uniform1f(l,
-e);else if(s=="fv1")b.uniform1fv(l,e);else if(s=="fv")b.uniform3fv(l,e);else if(s=="v2")b.uniform2f(l,e.x,e.y);else if(s=="v3")b.uniform3f(l,e.x,e.y,e.z);else if(s=="c")b.uniform3f(l,e.r,e.g,e.b);else if(s=="t"){b.uniform1i(l,e);if(g=g.texture)if(g.image instanceof Array&&g.image.length==6){g=g;e=e;if(g.image.length==6){if(!g.image.__webGLTextureCube&&!g.image.__cubeMapInitialized&&g.image.loadCount==6){g.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,g.image.__webGLTextureCube);
-b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(s=0;s<6;++s)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,g.image[s]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);g.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+
-e);b.bindTexture(b.TEXTURE_CUBE_MAP,g.image.__webGLTextureCube)}}else{g=g;e=e;if(!g.__webGLTexture&&g.image.loaded){g.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,g.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,g.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(g.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(g.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,i(g.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,i(g.min_filter));
-b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+e);b.bindTexture(b.TEXTURE_2D,g.__webGLTexture)}}}t=k.attributes;b.bindBuffer(b.ARRAY_BUFFER,p.__webGLVertexBuffer);b.vertexAttribPointer(t.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(t.position);if(t.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,p.__webGLNormalBuffer);b.vertexAttribPointer(t.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(t.normal)}if(t.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,p.__webGLTangentBuffer);
-b.vertexAttribPointer(t.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(t.tangent)}if(t.uv>=0)if(p.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUVBuffer);b.vertexAttribPointer(t.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(t.uv)}else b.disableVertexAttribArray(t.uv);if(j.wireframe||j instanceof THREE.LineBasicMaterial){t=j.wireframe_linewidth!==undefined?j.wireframe_linewidth:j.linewidth!==undefined?j.linewidth:1;j=j instanceof THREE.LineBasicMaterial&&z.type==THREE.LineStrip?
-b.LINE_STRIP:b.LINES;b.lineWidth(t);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);b.drawElements(j,p.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,p.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(e,g,o,j,p,z,k){var s,t,r,l,C;r=0;for(l=j.materials.length;r<l;r++){s=j.materials[r];if(s instanceof THREE.MeshFaceMaterial){s=0;for(t=p.materials.length;s<t;s++)if((C=p.materials[s])&&C.blending==z&&
-C.opacity<1==k){this.setBlending(C.blending);this.renderBuffer(e,g,o,C,p,j)}}else if((C=s)&&C.blending==z&&C.opacity<1==k){this.setBlending(C.blending);this.renderBuffer(e,g,o,C,p,j)}}};this.render=function(e,g,o,j){var p,z,k,s=e.lights,t=e.fog;this.initWebGLObjects(e);j=j!==undefined?j:true;if(o&&!o.__webGLFramebuffer){o.__webGLFramebuffer=b.createFramebuffer();o.__webGLRenderbuffer=b.createRenderbuffer();o.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,o.__webGLRenderbuffer);
-b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,o.width,o.height);b.bindTexture(b.TEXTURE_2D,o.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(o.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(o.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,i(o.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,i(o.min_filter));b.texImage2D(b.TEXTURE_2D,0,i(o.format),o.width,o.height,0,i(o.format),i(o.type),null);b.bindFramebuffer(b.FRAMEBUFFER,o.__webGLFramebuffer);
-b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,o.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,o.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(o){p=o.__webGLFramebuffer;k=o.width;z=o.height}else{p=null;k=q.width;z=q.height}if(p!=n){b.bindFramebuffer(b.FRAMEBUFFER,p);b.viewport(0,0,k,z);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);n=p}this.autoClear&&
-this.clear();g.autoUpdateMatrix&&g.updateMatrix();y.set(g.matrix.flatten());T.set(g.projectionMatrix.flatten());j=0;for(p=e.__webGLObjects.length;j<p;j++){z=e.__webGLObjects[j];k=z.object;z=z.buffer;if(k.visible){this.setupMatrices(k,g);this.renderPass(g,s,t,k,z,THREE.NormalBlending,false)}}j=0;for(p=e.__webGLObjects.length;j<p;j++){z=e.__webGLObjects[j];k=z.object;z=z.buffer;if(k.visible){this.setupMatrices(k,g);if(k.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);k.flipSided?b.frontFace(b.CW):
-b.frontFace(b.CCW)}this.renderPass(g,s,t,k,z,THREE.AdditiveBlending,false);this.renderPass(g,s,t,k,z,THREE.SubtractiveBlending,false);this.renderPass(g,s,t,k,z,THREE.AdditiveBlending,true);this.renderPass(g,s,t,k,z,THREE.SubtractiveBlending,true);this.renderPass(g,s,t,k,z,THREE.NormalBlending,true)}}if(o&&o.min_filter!==THREE.NearestFilter&&o.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,o.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=
-function(e){function g(r,l,C,x){if(r[l]==undefined){e.__webGLObjects.push({buffer:C,object:x});r[l]=1}}var o,j,p,z,k,s,t;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap={}}o=0;for(j=e.objects.length;o<j;o++){p=e.objects[o];k=p.geometry;if(e.__webGLObjectsMap[p.id]==undefined)e.__webGLObjectsMap[p.id]={};t=e.__webGLObjectsMap[p.id];if(p instanceof THREE.Mesh){for(z in k.geometryChunks){s=k.geometryChunks[z];if(!s.__webGLVertexBuffer){this.createMeshBuffers(s);this.initMeshBuffers(s,p);
-k.__dirtyVertices=true;k.__dirtyElements=true;k.__dirtyUvs=true;k.__dirtyNormals=true;k.__dirtyTangents=true}if(k.__dirtyVertices||k.__dirtyElements||k.__dirtyUvs)this.setMeshBuffers(s,p,b.DYNAMIC_DRAW,k.__dirtyVertices,k.__dirtyElements,k.__dirtyUvs,k.__dirtyNormals,k.__dirtyTangents);g(t,z,s,p)}k.__dirtyVertices=false;k.__dirtyElements=false;k.__dirtyUvs=false;k.__dirtyNormals=false;k.__dirtyTangents=false}else if(p instanceof THREE.Line){if(!k.__webGLVertexBuffer){this.createLineBuffers(k);this.initLineBuffers(k);
-k.__dirtyVertices=true;k.__dirtyElements=true}k.__dirtyVertices&&this.setLineBuffers(k,b.DYNAMIC_DRAW,k.__dirtyVertices,k.__dirtyElements);g(t,0,k,p);k.__dirtyVertices=false;k.__dirtyElements=false}else if(p instanceof THREE.ParticleSystem){k.__webGLVertexBuffer||this.createParticleBuffers(k);g(t,0,k,p)}}};this.removeObject=function(e,g){var o,j;for(o=e.__webGLObjects.length-1;o>=0;o--){j=e.__webGLObjects[o].object;g==j&&e.__webGLObjects.splice(o,1)}};this.setupMatrices=function(e,g){e.autoUpdateMatrix&&
-e.updateMatrix();E.multiply(g.matrix,e.matrix);A.set(E.flatten());H=THREE.Matrix4.makeInvert3x3(E).transpose();V.set(H.m);U.set(e.matrix.flatten())};this.loadMatrices=function(e){b.uniformMatrix4fv(e.uniforms.viewMatrix,false,y);b.uniformMatrix4fv(e.uniforms.modelViewMatrix,false,A);b.uniformMatrix4fv(e.uniforms.projectionMatrix,false,T);b.uniformMatrix3fv(e.uniforms.normalMatrix,false,V);b.uniformMatrix4fv(e.uniforms.objectMatrix,false,U)};this.loadCamera=function(e,g){b.uniform3f(e.uniforms.cameraPosition,
-g.position.x,g.position.y,g.position.z)};this.setBlending=function(e){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(e,g){if(e){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);
-b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
-THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
-envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
-map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
-lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
-lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"};
-THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",
-value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}}};
-THREE.ShaderLib={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}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
-THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
-THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,"gl_FragColor =  mColor * mapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,
-THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},
-shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,
-"gl_FragColor =  mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
-THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\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.faceMaterials=this.meshMaterials=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.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
+// ThreeDebug.js r32 - 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,d,e){this.r=a;this.g=d;this.b=e;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)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,d){this.x=a||0;this.y=d||0};
+THREE.Vector2.prototype={set:function(a,d){this.x=a;this.y=d;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,d){this.x=a.x+d.x;this.y=a.y+d.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,d){this.x=a.x-d.x;this.y=a.y-d.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,d,e){this.x=a||0;this.y=d||0;this.z=e||0};
+THREE.Vector3.prototype={set:function(a,d,e){this.x=a;this.y=d;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,d){this.x=a.x+d.x;this.y=a.y+d.y;this.z=a.z+d.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,d){this.x=a.x-d.x;this.y=a.y-d.y;this.z=a.z-d.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
+cross:function(a,d){this.x=a.y*d.z-a.z*d.y;this.y=a.z*d.x-a.x*d.z;this.z=a.x*d.y-a.y*d.x;return this},crossSelf:function(a){var d=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-d*a.z;this.z=d*a.y-e*a.x;return this},multiply:function(a,d){this.x=a.x*d.x;this.y=a.y*d.y;this.z=a.z*d.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},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
+a.z;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 d=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(d*d+e*e+a*a)},distanceToSquared:function(a){var d=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return d*d+e*e+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,d,e,f){this.x=a||0;this.y=d||0;this.z=e||0;this.w=f||1};
+THREE.Vector4.prototype={set:function(a,d,e,f){this.x=a;this.y=d;this.z=e;this.w=f;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,d){this.x=a.x+d.x;this.y=a.y+d.y;this.z=a.z+d.z;this.w=a.w+d.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,d){this.x=a.x-d.x;this.y=a.y-d.y;this.z=a.z-d.z;this.w=a.w-d.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,d){this.x+=(a.x-this.x)*d;this.y+=(a.y-this.y)*d;this.z+=(a.z-this.z)*d;this.w+=(a.w-this.w)*d},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,d){this.origin=a||new THREE.Vector3;this.direction=d||new THREE.Vector3};
+THREE.Ray.prototype={intersectScene:function(a){var d,e,f=a.objects,h=[];a=0;for(d=f.length;a<d;a++){e=f[a];if(e instanceof THREE.Mesh)h=h.concat(this.intersectObject(e))}h.sort(function(i,p){return i.distance-p.distance});return h},intersectObject:function(a){function d(Q,q,aa,L){L=L.clone().subSelf(q);aa=aa.clone().subSelf(q);var g=Q.clone().subSelf(q);Q=L.dot(L);q=L.dot(aa);L=L.dot(g);var l=aa.dot(aa);aa=aa.dot(g);g=1/(Q*l-q*q);l=(l*L-q*aa)*g;Q=(Q*aa-q*L)*g;return l>0&&Q>0&&l+Q<1}var e,f,h,i,p,
+b,k,j,C,F,A,E=a.geometry,N=E.vertices,P=[];e=0;for(f=E.faces.length;e<f;e++){h=E.faces[e];F=this.origin.clone();A=this.direction.clone();i=a.matrix.multiplyVector3(N[h.a].position.clone());p=a.matrix.multiplyVector3(N[h.b].position.clone());b=a.matrix.multiplyVector3(N[h.c].position.clone());k=h instanceof THREE.Face4?a.matrix.multiplyVector3(N[h.d].position.clone()):null;j=a.rotationMatrix.multiplyVector3(h.normal.clone());C=A.dot(j);if(C<0){j=j.dot((new THREE.Vector3).sub(i,F))/C;F=F.addSelf(A.multiplyScalar(j));
+if(h instanceof THREE.Face3){if(d(F,i,p,b)){h={distance:this.origin.distanceTo(F),point:F,face:h,object:a};P.push(h)}}else if(h instanceof THREE.Face4)if(d(F,i,p,k)||d(F,p,b,k)){h={distance:this.origin.distanceTo(F),point:F,face:h,object:a};P.push(h)}}}return P}};
+THREE.Rectangle=function(){function a(){i=f-d;p=h-e}var d,e,f,h,i,p,b=true;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return p};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,j,C,F){b=false;d=k;e=j;f=C;h=F;a()};this.addPoint=function(k,j){if(b){b=false;d=k;e=j;f=k;h=j}else{d=d<k?d:k;e=e<j?e:j;f=f>k?f:k;h=h>j?
+h:j}a()};this.add3Points=function(k,j,C,F,A,E){if(b){b=false;d=k<C?k<A?k:A:C<A?C:A;e=j<F?j<E?j:E:F<E?F:E;f=k>C?k>A?k:A:C>A?C:A;h=j>F?j>E?j:E:F>E?F:E}else{d=k<C?k<A?k<d?k:d:A<d?A:d:C<A?C<d?C:d:A<d?A:d;e=j<F?j<E?j<e?j:e:E<e?E:e:F<E?F<e?F:e:E<e?E:e;f=k>C?k>A?k>f?k:f:A>f?A:f:C>A?C>f?C:f:A>f?A:f;h=j>F?j>E?j>h?j:h:E>h?E:h:F>E?F>h?F:h:E>h?E:h}a()};this.addRectangle=function(k){if(b){b=false;d=k.getLeft();e=k.getTop();f=k.getRight();h=k.getBottom()}else{d=d<k.getLeft()?d:k.getLeft();e=e<k.getTop()?e:k.getTop();
+f=f>k.getRight()?f:k.getRight();h=h>k.getBottom()?h:k.getBottom()}a()};this.inflate=function(k){d-=k;e-=k;f+=k;h+=k;a()};this.minSelf=function(k){d=d>k.getLeft()?d:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f<k.getRight()?f:k.getRight();h=h<k.getBottom()?h:k.getBottom();a()};this.instersects=function(k){return Math.min(f,k.getRight())-Math.max(d,k.getLeft())>=0&&Math.min(h,k.getBottom())-Math.max(e,k.getTop())>=0};this.empty=function(){b=true;h=f=e=d=0;a()};this.isEmpty=function(){return b};this.toString=
+function(){return"THREE.Rectangle ( left: "+d+", right: "+f+", top: "+e+", bottom: "+h+", width: "+i+", height: "+p+" )"}};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,d,e,f,h,i,p,b,k,j,C,F,A,E,N,P){this.n11=a||1;this.n12=d||0;this.n13=e||0;this.n14=f||0;this.n21=h||0;this.n22=i||1;this.n23=p||0;this.n24=b||0;this.n31=k||0;this.n32=j||0;this.n33=C||1;this.n34=F||0;this.n41=A||0;this.n42=E||0;this.n43=N||0;this.n44=P||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
+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,d,e,f,h,i,p,b,k,j,C,F,A,E,N,P){this.n11=a;this.n12=d;this.n13=e;this.n14=f;this.n21=h;this.n22=i;this.n23=p;this.n24=b;this.n31=k;this.n32=j;this.n33=C;this.n34=F;this.n41=A;this.n42=E;this.n43=N;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,d,e){var f=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,d).normalize();f.cross(e,i).normalize();h.cross(i,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);
+this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var d=a.x,e=a.y,f=a.z,h=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);a.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*h;a.y=(this.n21*d+this.n22*e+this.n23*f+this.n24)*h;a.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*h;return a},multiplyVector4:function(a){var d=a.x,e=a.y,f=a.z,h=a.w;a.x=this.n11*d+this.n12*e+this.n13*f+this.n14*h;a.y=this.n21*d+this.n22*e+this.n23*
+f+this.n24*h;a.z=this.n31*d+this.n32*e+this.n33*f+this.n34*h;a.w=this.n41*d+this.n42*e+this.n43*f+this.n44*h;return a},crossVector:function(a){var d=new THREE.Vector4;d.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;d.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;d.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;d.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return d},multiply:function(a,d){var e=a.n11,f=a.n12,h=a.n13,i=a.n14,p=a.n21,b=a.n22,k=a.n23,j=a.n24,C=a.n31,
+F=a.n32,A=a.n33,E=a.n34,N=a.n41,P=a.n42,Q=a.n43,q=a.n44,aa=d.n11,L=d.n12,g=d.n13,l=d.n14,r=d.n21,m=d.n22,u=d.n23,I=d.n24,n=d.n31,w=d.n32,B=d.n33,v=d.n34,o=d.n41,K=d.n42,H=d.n43,U=d.n44;this.n11=e*aa+f*r+h*n+i*o;this.n12=e*L+f*m+h*w+i*K;this.n13=e*g+f*u+h*B+i*H;this.n14=e*l+f*I+h*v+i*U;this.n21=p*aa+b*r+k*n+j*o;this.n22=p*L+b*m+k*w+j*K;this.n23=p*g+b*u+k*B+j*H;this.n24=p*l+b*I+k*v+j*U;this.n31=C*aa+F*r+A*n+E*o;this.n32=C*L+F*m+A*w+E*K;this.n33=C*g+F*u+A*B+E*H;this.n34=C*l+F*I+A*v+E*U;this.n41=N*aa+
+P*r+Q*n+q*o;this.n42=N*L+P*m+Q*w+q*K;this.n43=N*g+P*u+Q*B+q*H;this.n44=N*l+P*I+Q*v+q*U;return this},multiplySelf:function(a){var d=this.n11,e=this.n12,f=this.n13,h=this.n14,i=this.n21,p=this.n22,b=this.n23,k=this.n24,j=this.n31,C=this.n32,F=this.n33,A=this.n34,E=this.n41,N=this.n42,P=this.n43,Q=this.n44,q=a.n11,aa=a.n21,L=a.n31,g=a.n41,l=a.n12,r=a.n22,m=a.n32,u=a.n42,I=a.n13,n=a.n23,w=a.n33,B=a.n43,v=a.n14,o=a.n24,K=a.n34;a=a.n44;this.n11=d*q+e*aa+f*L+h*g;this.n12=d*l+e*r+f*m+h*u;this.n13=d*I+e*n+
+f*w+h*B;this.n14=d*v+e*o+f*K+h*a;this.n21=i*q+p*aa+b*L+k*g;this.n22=i*l+p*r+b*m+k*u;this.n23=i*I+p*n+b*w+k*B;this.n24=i*v+p*o+b*K+k*a;this.n31=j*q+C*aa+F*L+A*g;this.n32=j*l+C*r+F*m+A*u;this.n33=j*I+C*n+F*w+A*B;this.n34=j*v+C*o+F*K+A*a;this.n41=E*q+N*aa+P*L+Q*g;this.n42=E*l+N*r+P*m+Q*u;this.n43=E*I+N*n+P*w+Q*B;this.n44=E*v+N*o+P*K+Q*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(){var a=this.n11,d=this.n12,e=this.n13,f=this.n14,h=this.n21,i=this.n22,p=this.n23,b=this.n24,k=this.n31,j=this.n32,C=this.n33,F=this.n34,A=this.n41,E=this.n42,N=this.n43,P=this.n44;return f*p*j*A-e*b*j*A-f*i*C*A+d*b*C*A+e*i*F*A-d*p*F*A-f*p*k*E+e*b*k*E+f*h*C*E-a*b*C*E-e*h*F*E+a*p*F*E+f*i*k*N-d*b*k*N-f*h*j*N+a*b*j*N+d*h*F*N-a*i*F*N-e*i*k*P+d*p*k*P+e*h*j*P-a*p*j*P-d*h*C*P+a*i*C*P},transpose:function(){function a(d,
+e,f){var h=d[e];d[e]=d[f];d[f]=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(){this.flat[0]=this.n11;this.flat[1]=
+this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},setTranslation:function(a,d,e){this.set(1,0,0,a,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(a,d,e){this.set(a,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},
+setRotX:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,d,-a,0,0,a,d,0,0,0,0,1);return this},setRotY:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(d,0,a,0,0,1,0,0,-a,0,d,0,0,0,0,1);return this},setRotZ:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(d,-a,0,0,a,d,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,d){c=Math.cos(d);s=Math.sin(d);t=1-c;x=a.x;y=a.y;z=a.z;tx=t*x;ty=t*y;this.set(tx*x+c,tx*y-s*z,tx*z+s*y,0,tx*y+s*z,ty*y+c,ty*z-s*x,0,tx*z-s*y,ty*z+s*x,t*z*z+
+c,0,0,0,0,1);return this},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,d,e){var f=new THREE.Matrix4;f.n14=a;f.n24=d;f.n34=e;return f};THREE.Matrix4.scaleMatrix=function(a,d,e){var f=new THREE.Matrix4;f.n11=a;f.n22=d;f.n33=e;return f};
+THREE.Matrix4.rotationXMatrix=function(a){var d=new THREE.Matrix4;d.n22=d.n33=Math.cos(a);d.n32=Math.sin(a);d.n23=-d.n32;return d};THREE.Matrix4.rotationYMatrix=function(a){var d=new THREE.Matrix4;d.n11=d.n33=Math.cos(a);d.n13=Math.sin(a);d.n31=-d.n13;return d};THREE.Matrix4.rotationZMatrix=function(a){var d=new THREE.Matrix4;d.n11=d.n22=Math.cos(a);d.n21=Math.sin(a);d.n12=-d.n21;return d};
+THREE.Matrix4.rotationAxisAngleMatrix=function(a,d){var e=new THREE.Matrix4,f=Math.cos(d),h=Math.sin(d),i=1-f,p=a.x,b=a.y,k=a.z,j=i*p,C=i*b;e.n11=j*p+f;e.n12=j*b-h*k;e.n13=j*k+h*b;e.n21=j*b+h*k;e.n22=C*b+f;e.n23=C*k-h*p;e.n31=j*k-h*b;e.n32=C*k+h*p;e.n33=i*k*k+f;return e};
+THREE.Matrix4.makeInvert=function(a){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,p=a.n22,b=a.n23,k=a.n24,j=a.n31,C=a.n32,F=a.n33,A=a.n34,E=a.n41,N=a.n42,P=a.n43,Q=a.n44,q=new THREE.Matrix4;q.n11=b*A*N-k*F*N+k*C*P-p*A*P-b*C*Q+p*F*Q;q.n12=h*F*N-f*A*N-h*C*P+e*A*P+f*C*Q-e*F*Q;q.n13=f*k*N-h*b*N+h*p*P-e*k*P-f*p*Q+e*b*Q;q.n14=h*b*C-f*k*C-h*p*F+e*k*F+f*p*A-e*b*A;q.n21=k*F*E-b*A*E-k*j*P+i*A*P+b*j*Q-i*F*Q;q.n22=f*A*E-h*F*E+h*j*P-d*A*P-f*j*Q+d*F*Q;q.n23=h*b*E-f*k*E-h*i*P+d*k*P+f*i*Q-d*b*Q;q.n24=f*k*j-h*b*j+
+h*i*F-d*k*F-f*i*A+d*b*A;q.n31=p*A*E-k*C*E+k*j*N-i*A*N-p*j*Q+i*C*Q;q.n32=h*C*E-e*A*E-h*j*N+d*A*N+e*j*Q-d*C*Q;q.n33=f*k*E-h*p*E+h*i*N-d*k*N-e*i*Q+d*p*Q;q.n34=h*p*j-e*k*j-h*i*C+d*k*C+e*i*A-d*p*A;q.n41=b*C*E-p*F*E-b*j*N+i*F*N+p*j*P-i*C*P;q.n42=e*F*E-f*C*E+f*j*N-d*F*N-e*j*P+d*C*P;q.n43=f*p*E-e*b*E-f*i*N+d*b*N+e*i*P-d*p*P;q.n44=e*b*j-f*p*j+f*i*C-d*b*C-e*i*F+d*p*F;q.multiplyScalar(1/a.determinant());return q};
+THREE.Matrix4.makeInvert3x3=function(a){var d=a.flatten();a=a.m33;var e=d[10]*d[5]-d[6]*d[9],f=-d[10]*d[1]+d[2]*d[9],h=d[6]*d[1]-d[2]*d[5],i=-d[10]*d[4]+d[6]*d[8],p=d[10]*d[0]-d[2]*d[8],b=-d[6]*d[0]+d[2]*d[4],k=d[9]*d[4]-d[5]*d[8],j=-d[9]*d[0]+d[1]*d[8],C=d[5]*d[0]-d[1]*d[4];d=d[0]*e+d[1]*i+d[2]*k;if(d==0)throw"matrix not invertible";d=1/d;a.m[0]=d*e;a.m[1]=d*f;a.m[2]=d*h;a.m[3]=d*i;a.m[4]=d*p;a.m[5]=d*b;a.m[6]=d*k;a.m[7]=d*j;a.m[8]=d*C;return a};
+THREE.Matrix4.makeFrustum=function(a,d,e,f,h,i){var p,b,k;p=new THREE.Matrix4;b=2*h/(d-a);k=2*h/(f-e);a=(d+a)/(d-a);e=(f+e)/(f-e);f=-(i+h)/(i-h);h=-2*i*h/(i-h);p.n11=b;p.n12=0;p.n13=a;p.n14=0;p.n21=0;p.n22=k;p.n23=e;p.n24=0;p.n31=0;p.n32=0;p.n33=f;p.n34=h;p.n41=0;p.n42=0;p.n43=-1;p.n44=0;return p};THREE.Matrix4.makePerspective=function(a,d,e,f){var h;a=e*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*d,a*d,h,a,e,f)};
+THREE.Matrix4.makeOrtho=function(a,d,e,f,h,i){var p,b,k,j;p=new THREE.Matrix4;b=d-a;k=e-f;j=i-h;a=(d+a)/b;e=(e+f)/k;h=(i+h)/j;p.n11=2/b;p.n12=0;p.n13=0;p.n14=-a;p.n21=0;p.n22=2/k;p.n23=0;p.n24=-e;p.n31=0;p.n32=0;p.n33=-2/j;p.n34=-h;p.n41=0;p.n42=0;p.n43=0;p.n44=1;return p};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
+THREE.Vertex=function(a,d){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=d||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,d,e,f,h){this.a=a;this.b=d;this.c=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,d,e,f,h,i){this.a=a;this.b=d;this.c=e;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,d){this.u=a||0;this.v=d||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,d,e;a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];e.centroid.set(0,0,0);if(e instanceof THREE.Face3){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);e.centroid.divideScalar(3)}else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);
+e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var d,e,f,h,i,p,b=new THREE.Vector3,k=new THREE.Vector3;f=0;for(h=this.vertices.length;f<h;f++){i=this.vertices[f];i.normal.set(0,0,0)}f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(a&&i.vertexNormals.length){b.set(0,0,0);d=0;for(e=i.normal.length;d<e;d++)b.addSelf(i.vertexNormals[d]);b.divideScalar(3)}else{d=this.vertices[i.a];e=this.vertices[i.b];p=this.vertices[i.c];b.sub(p.position,
+e.position);k.sub(d.position,e.position);b.crossSelf(k)}b.isZero()||b.normalize();i.normal.copy(b)}},computeVertexNormals:function(){var a,d,e,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(d=this.vertices.length;a<d;a++)f[a]=new THREE.Vector3;a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,
+new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=this.__tmpVertices;a=0;for(d=this.vertices.length;a<d;a++)f[a].set(0,0,0)}a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3){f[e.a].addSelf(e.normal);f[e.b].addSelf(e.normal);f[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){f[e.a].addSelf(e.normal);f[e.b].addSelf(e.normal);f[e.c].addSelf(e.normal);f[e.d].addSelf(e.normal)}}a=0;for(d=this.vertices.length;a<d;a++)f[a].normalize();a=0;for(d=this.faces.length;a<
+d;a++){e=this.faces[a];if(e instanceof THREE.Face3){e.vertexNormals[0].copy(f[e.a]);e.vertexNormals[1].copy(f[e.b]);e.vertexNormals[2].copy(f[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(f[e.a]);e.vertexNormals[1].copy(f[e.b]);e.vertexNormals[2].copy(f[e.c]);e.vertexNormals[3].copy(f[e.d])}}},computeTangents:function(){function a(v,o,K,H,U,T,M){i=v.vertices[o].position;p=v.vertices[K].position;b=v.vertices[H].position;k=h[U];j=h[T];C=h[M];F=p.x-i.x;A=b.x-i.x;E=p.y-i.y;N=b.y-i.y;
+P=p.z-i.z;Q=b.z-i.z;q=j.u-k.u;aa=C.u-k.u;L=j.v-k.v;g=C.v-k.v;l=1/(q*g-aa*L);u.set((g*F-L*A)*l,(g*E-L*N)*l,(g*P-L*Q)*l);I.set((q*A-aa*F)*l,(q*N-aa*E)*l,(q*Q-aa*P)*l);r[o].addSelf(u);r[K].addSelf(u);r[H].addSelf(u);m[o].addSelf(I);m[K].addSelf(I);m[H].addSelf(I)}var d,e,f,h,i,p,b,k,j,C,F,A,E,N,P,Q,q,aa,L,g,l,r=[],m=[],u=new THREE.Vector3,I=new THREE.Vector3,n=new THREE.Vector3,w=new THREE.Vector3,B=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){r[d]=new THREE.Vector3;m[d]=new THREE.Vector3}d=
+0;for(e=this.faces.length;d<e;d++){f=this.faces[d];h=this.uvs[d];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2]);
+this.vertices[f.d].normal.copy(f.vertexNormals[3])}}d=0;for(e=this.vertices.length;d<e;d++){B.copy(this.vertices[d].normal);f=r[d];n.copy(f);n.subSelf(B.multiplyScalar(B.dot(f))).normalize();w.cross(this.vertices[d].normal,f);f=w.dot(m[d]);f=f<0?-1:1;this.vertices[d].tangent.set(n.x,n.y,n.z,f)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
+this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d<e;d++)a=Math.max(a,this.vertices[d].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(C){var F=[];d=0;for(e=C.length;d<e;d++)C[d]==undefined?F.push("undefined"):F.push(C[d].toString());return F.join("_")}var d,e,f,h,i,p,b,k,j={};f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];
+p=i.materials;b=a(p);if(j[b]==undefined)j[b]={hash:b,counter:0};k=j[b].hash+"_"+j[b].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:p,vertices:0};i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+i>65535){j[b].counter+=1;k=j[b].hash+"_"+j[b].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:p,vertices:0}}this.geometryChunks[k].faces.push(f);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
+THREE.Camera=function(a,d,e,f){this.fov=a;this.aspect=d;this.near=e;this.far=f;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
+this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
+THREE.Camera.prototype={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,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1};THREE.DirectionalLight.prototype=new THREE.Light;
+THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,d){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=d||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.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
+THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,d=this.rotation,e=this.scale,f=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);if(d.x!=0){f.setRotX(d.x);this.matrix.multiplySelf(f)}if(d.y!=0){f.setRotY(d.y);this.matrix.multiplySelf(f)}if(d.z!=0){f.setRotZ(d.z);this.matrix.multiplySelf(f)}if(e.x!=0||e.y!=0||e.z!=0){f.setScale(e.x,e.y,e.z);this.matrix.multiplySelf(f)}}};THREE.Object3DCounter={value:0};
+THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,d){THREE.Object3D.call(this);this.geometry=a;this.materials=d instanceof Array?d:[d];this.autoUpdateMatrix=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
+THREE.Line=function(a,d,e){THREE.Object3D.call(this);this.geometry=a;this.materials=d instanceof Array?d:[d];this.type=e!=undefined?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,d){THREE.Object3D.call(this);this.geometry=a;this.materials=d instanceof Array?d:[d];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}};
+THREE.LineBasicMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
+THREE.MeshBasicMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
+THREE.MeshLambertMaterial.prototype={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.fog=true;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.fog!==undefined)this.fog=a.fog;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}};
+THREE.MeshPhongMaterial.prototype={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.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.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={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}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={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}};
+THREE.MeshShaderMaterial.prototype={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}};
+THREE.ParticleBasicMaterial.prototype={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}};
+THREE.ParticleCircleMaterial.prototype={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};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
+THREE.Texture=function(a,d,e,f,h,i){this.image=a;this.mapping=d!==undefined?d:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter};
+THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},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.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
+THREE.RenderTarget=function(a,d,e){this.width=a;this.height=d;e=e||{};this.wrap_s=e.wrap_s!==undefined?e.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=e.wrap_t!==undefined?e.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=e.mag_filter!==undefined?e.mag_filter:THREE.LinearFilter;this.min_filter=e.min_filter!==undefined?e.min_filter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType};
+var Uniforms={clone:function(a){var d,e,f,h={};for(d in a){h[d]={};for(e in a[d]){f=a[d][e];h[d][e]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var d,e,f,h={};for(d=0;d<a.length;d++){f=this.clone(a[d]);for(e in f)h[e]=f[e]}return h}};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,d,e){this.color=new THREE.Color(a);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(a,d){this.color=new THREE.Color(a);this.density=d||2.5E-4};
+THREE.Projector=function(){function a(m,u){return u.z-m.z}function d(m,u){var I=0,n=1,w=m.z+m.w,B=u.z+u.w,v=-m.z+m.w,o=-u.z+u.w;if(w>=0&&B>=0&&v>=0&&o>=0)return true;else if(w<0&&B<0||v<0&&o<0)return false;else{if(w<0)I=Math.max(I,w/(w-B));else if(B<0)n=Math.min(n,w/(w-B));if(v<0)I=Math.max(I,v/(v-o));else if(o<0)n=Math.min(n,v/(v-o));if(n<I)return false;else{m.lerpSelf(u,I);u.lerpSelf(m,1-n);return true}}}var e,f,h=[],i,p,b,k=[],j,C,F=[],A,E,N=[],P=new THREE.Vector4,Q=new THREE.Vector4,q=new THREE.Matrix4,
+aa=new THREE.Matrix4,L=[],g=new THREE.Vector4,l=new THREE.Vector4,r;this.projectObjects=function(m,u,I){var n=[],w,B;f=0;q.multiply(u.projectionMatrix,u.matrix);L[0]=new THREE.Vector4(q.n41-q.n11,q.n42-q.n12,q.n43-q.n13,q.n44-q.n14);L[1]=new THREE.Vector4(q.n41+q.n11,q.n42+q.n12,q.n43+q.n13,q.n44+q.n14);L[2]=new THREE.Vector4(q.n41+q.n21,q.n42+q.n22,q.n43+q.n23,q.n44+q.n24);L[3]=new THREE.Vector4(q.n41-q.n21,q.n42-q.n22,q.n43-q.n23,q.n44-q.n24);L[4]=new THREE.Vector4(q.n41-q.n31,q.n42-q.n32,q.n43-
+q.n33,q.n44-q.n34);L[5]=new THREE.Vector4(q.n41+q.n31,q.n42+q.n32,q.n43+q.n33,q.n44+q.n34);u=0;for(w=L.length;u<w;u++){B=L[u];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}w=m.objects;m=0;for(u=w.length;m<u;m++){B=w[m];var v;if(!(v=!B.visible)){if(v=B instanceof THREE.Mesh){a:{v=void 0;for(var o=B.position,K=-B.geometry.boundingSphere.radius*Math.max(B.scale.x,Math.max(B.scale.y,B.scale.z)),H=0;H<6;H++){v=L[H].x*o.x+L[H].y*o.y+L[H].z*o.z+L[H].w;if(v<=K){v=false;break a}}v=true}v=!v}v=v}if(!v){e=
+h[f]=h[f]||new THREE.RenderableObject;P.copy(B.position);q.multiplyVector3(P);e.object=B;e.z=P.z;n.push(e);f++}}I&&n.sort(a);return n};this.projectScene=function(m,u,I){var n=[],w=u.near,B=u.far,v,o,K,H,U,T,M,ba,V,O,R,Z,W,D,S,X;b=C=E=0;u.autoUpdateMatrix&&u.updateMatrix();q.multiply(u.projectionMatrix,u.matrix);T=this.projectObjects(m,u,true);m=0;for(v=T.length;m<v;m++){M=T[m].object;if(M.visible){M.autoUpdateMatrix&&M.updateMatrix();ba=M.matrix;V=M.rotationMatrix;O=M.materials;R=M.overdraw;if(M instanceof
+THREE.Mesh){Z=M.geometry;W=Z.vertices;o=0;for(K=W.length;o<K;o++){D=W[o];D.positionWorld.copy(D.position);ba.multiplyVector3(D.positionWorld);H=D.positionScreen;H.copy(D.positionWorld);q.multiplyVector4(H);H.x/=H.w;H.y/=H.w;D.__visible=H.z>w&&H.z<B}Z=Z.faces;o=0;for(K=Z.length;o<K;o++){D=Z[o];if(D instanceof THREE.Face3){H=W[D.a];U=W[D.b];S=W[D.c];if(H.__visible&&U.__visible&&S.__visible)if(M.doubleSided||M.flipSided!=(S.positionScreen.x-H.positionScreen.x)*(U.positionScreen.y-H.positionScreen.y)-
+(S.positionScreen.y-H.positionScreen.y)*(U.positionScreen.x-H.positionScreen.x)<0){i=k[b]=k[b]||new THREE.RenderableFace3;i.v1.positionWorld.copy(H.positionWorld);i.v2.positionWorld.copy(U.positionWorld);i.v3.positionWorld.copy(S.positionWorld);i.v1.positionScreen.copy(H.positionScreen);i.v2.positionScreen.copy(U.positionScreen);i.v3.positionScreen.copy(S.positionScreen);i.normalWorld.copy(D.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(D.centroid);ba.multiplyVector3(i.centroidWorld);
+i.centroidScreen.copy(i.centroidWorld);q.multiplyVector3(i.centroidScreen);S=D.vertexNormals;r=i.vertexNormalsWorld;H=0;for(U=S.length;H<U;H++){X=r[H]=r[H]||new THREE.Vector3;X.copy(S[H]);V.multiplyVector3(X)}i.z=i.centroidScreen.z;i.meshMaterials=O;i.faceMaterials=D.materials;i.overdraw=R;if(M.geometry.uvs[o]){i.uvs[0]=M.geometry.uvs[o][0];i.uvs[1]=M.geometry.uvs[o][1];i.uvs[2]=M.geometry.uvs[o][2]}n.push(i);b++}}else if(D instanceof THREE.Face4){H=W[D.a];U=W[D.b];S=W[D.c];X=W[D.d];if(H.__visible&&
+U.__visible&&S.__visible&&X.__visible)if(M.doubleSided||M.flipSided!=((X.positionScreen.x-H.positionScreen.x)*(U.positionScreen.y-H.positionScreen.y)-(X.positionScreen.y-H.positionScreen.y)*(U.positionScreen.x-H.positionScreen.x)<0||(U.positionScreen.x-S.positionScreen.x)*(X.positionScreen.y-S.positionScreen.y)-(U.positionScreen.y-S.positionScreen.y)*(X.positionScreen.x-S.positionScreen.x)<0)){i=k[b]=k[b]||new THREE.RenderableFace3;i.v1.positionWorld.copy(H.positionWorld);i.v2.positionWorld.copy(U.positionWorld);
+i.v3.positionWorld.copy(X.positionWorld);i.v1.positionScreen.copy(H.positionScreen);i.v2.positionScreen.copy(U.positionScreen);i.v3.positionScreen.copy(X.positionScreen);i.normalWorld.copy(D.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(D.centroid);ba.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);q.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=O;i.faceMaterials=D.materials;i.overdraw=R;if(M.geometry.uvs[o]){i.uvs[0]=M.geometry.uvs[o][0];
+i.uvs[1]=M.geometry.uvs[o][1];i.uvs[2]=M.geometry.uvs[o][3]}n.push(i);b++;p=k[b]=k[b]||new THREE.RenderableFace3;p.v1.positionWorld.copy(U.positionWorld);p.v2.positionWorld.copy(S.positionWorld);p.v3.positionWorld.copy(X.positionWorld);p.v1.positionScreen.copy(U.positionScreen);p.v2.positionScreen.copy(S.positionScreen);p.v3.positionScreen.copy(X.positionScreen);p.normalWorld.copy(i.normalWorld);p.centroidWorld.copy(i.centroidWorld);p.centroidScreen.copy(i.centroidScreen);p.z=p.centroidScreen.z;p.meshMaterials=
+O;p.faceMaterials=D.materials;p.overdraw=R;if(M.geometry.uvs[o]){p.uvs[0]=M.geometry.uvs[o][1];p.uvs[1]=M.geometry.uvs[o][2];p.uvs[2]=M.geometry.uvs[o][3]}n.push(p);b++}}}}else if(M instanceof THREE.Line){aa.multiply(q,ba);W=M.geometry.vertices;D=W[0];D.positionScreen.copy(D.position);aa.multiplyVector4(D.positionScreen);o=1;for(K=W.length;o<K;o++){H=W[o];H.positionScreen.copy(H.position);aa.multiplyVector4(H.positionScreen);U=W[o-1];g.copy(H.positionScreen);l.copy(U.positionScreen);if(d(g,l)){g.multiplyScalar(1/
+g.w);l.multiplyScalar(1/l.w);j=F[C]=F[C]||new THREE.RenderableLine;j.v1.positionScreen.copy(g);j.v2.positionScreen.copy(l);j.z=Math.max(g.z,l.z);j.materials=M.materials;n.push(j);C++}}}else if(M instanceof THREE.Particle){Q.set(M.position.x,M.position.y,M.position.z,1);q.multiplyVector4(Q);Q.z/=Q.w;if(Q.z>0&&Q.z<1){A=N[E]=N[E]||new THREE.RenderableParticle;A.x=Q.x/Q.w;A.y=Q.y/Q.w;A.z=Q.z;A.rotation=M.rotation.z;A.scale.x=M.scale.x*Math.abs(A.x-(Q.x+u.projectionMatrix.n11)/(Q.w+u.projectionMatrix.n14));
+A.scale.y=M.scale.y*Math.abs(A.y-(Q.y+u.projectionMatrix.n22)/(Q.w+u.projectionMatrix.n24));A.materials=M.materials;n.push(A);E++}}}}I&&n.sort(a);return n};this.unprojectVector=function(m,u){var I=new THREE.Matrix4;I.multiply(THREE.Matrix4.makeInvert(u.matrix),THREE.Matrix4.makeInvert(u.projectionMatrix));I.multiplyVector3(m);return m}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,d=new THREE.Projector,e,f,h,i;this.domElement=document.createElement("div");this.setSize=function(p,b){e=p;f=b;h=e/2;i=f/2};this.render=function(p,b){var k,j,C,F,A,E,N,P;a=d.projectScene(p,b);k=0;for(j=a.length;k<j;k++){A=a[k];if(A instanceof THREE.RenderableParticle){N=A.x*h+h;P=A.y*i+i;C=0;for(F=A.material.length;C<F;C++){E=A.material[C];if(E instanceof THREE.ParticleDOMMaterial){E=E.domElement;E.style.left=N+"px";E.style.top=P+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ja){if(A!=ja)j.globalAlpha=A=ja}function d(ja){if(E!=ja){switch(ja){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}E=ja}}var e=null,f=new THREE.Projector,h=document.createElement("canvas"),i,p,b,k,j=h.getContext("2d"),C=null,F=null,A=1,E=0,N=null,P=null,Q=1,q,aa,L,g,l,r,m,u,I,n=new THREE.Color,
+w=new THREE.Color,B=new THREE.Color,v=new THREE.Color,o=new THREE.Color,K,H,U,T,M,ba,V,O,R,Z=new THREE.Rectangle,W=new THREE.Rectangle,D=new THREE.Rectangle,S=false,X=new THREE.Color,ka=new THREE.Color,ha=new THREE.Color,ea=new THREE.Color,pa=Math.PI*2,da=new THREE.Vector3,wa,qa,la,na,ya,Aa,Ba=16;wa=document.createElement("canvas");wa.width=wa.height=2;qa=wa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);la=qa.getImageData(0,0,2,2);na=la.data;ya=document.createElement("canvas");
+ya.width=ya.height=Ba;Aa=ya.getContext("2d");Aa.translate(-Ba/2,-Ba/2);Aa.scale(Ba,Ba);Ba--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ja,xa){i=ja;p=xa;b=i/2;k=p/2;h.width=i;h.height=p;Z.set(-b,-k,b,k);A=1;E=0;P=N=null;Q=1};this.setClearColor=function(ja,xa){C=ja!==null?new THREE.Color(ja):null;F=xa;W.set(-b,-k,b,k);j.setTransform(1,0,0,-1,b,k);this.clear()};this.clear=function(){if(!W.isEmpty()){W.inflate(1);W.minSelf(Z);if(C!==null){d(THREE.NormalBlending);
+a(1);j.fillStyle="rgba("+Math.floor(C.r*255)+","+Math.floor(C.g*255)+","+Math.floor(C.b*255)+","+F+")";j.fillRect(W.getX(),W.getY(),W.getWidth(),W.getHeight())}else j.clearRect(W.getX(),W.getY(),W.getWidth(),W.getHeight());W.empty()}};this.render=function(ja,xa){function Sa(G){var ca,$,J,Y=G.lights;ka.setRGB(0,0,0);ha.setRGB(0,0,0);ea.setRGB(0,0,0);G=0;for(ca=Y.length;G<ca;G++){$=Y[G];J=$.color;if($ instanceof THREE.AmbientLight){ka.r+=J.r;ka.g+=J.g;ka.b+=J.b}else if($ instanceof THREE.DirectionalLight){ha.r+=
+J.r;ha.g+=J.g;ha.b+=J.b}else if($ instanceof THREE.PointLight){ea.r+=J.r;ea.g+=J.g;ea.b+=J.b}}}function Ga(G,ca,$,J){var Y,fa,ia,ma,oa=G.lights;G=0;for(Y=oa.length;G<Y;G++){fa=oa[G];ia=fa.color;ma=fa.intensity;if(fa instanceof THREE.DirectionalLight){fa=$.dot(fa.position)*ma;if(fa>0){J.r+=ia.r*fa;J.g+=ia.g*fa;J.b+=ia.b*fa}}else if(fa instanceof THREE.PointLight){da.sub(fa.position,ca);da.normalize();fa=$.dot(da)*ma;if(fa>0){J.r+=ia.r*fa;J.g+=ia.g*fa;J.b+=ia.b*fa}}}}function Ta(G,ca,$){if($.opacity!=
+0){a($.opacity);d($.blending);var J,Y,fa,ia,ma,oa;if($ instanceof THREE.ParticleBasicMaterial){if($.map){ia=$.map;ma=ia.width>>1;oa=ia.height>>1;Y=ca.scale.x*b;fa=ca.scale.y*k;$=Y*ma;J=fa*oa;D.set(G.x-$,G.y-J,G.x+$,G.y+J);if(!Z.instersects(D))return;j.save();j.translate(G.x,G.y);j.rotate(-ca.rotation);j.scale(Y,-fa);j.translate(-ma,-oa);j.drawImage(ia,0,0);j.restore()}j.beginPath();j.moveTo(G.x-10,G.y);j.lineTo(G.x+10,G.y);j.moveTo(G.x,G.y-10);j.lineTo(G.x,G.y+10);j.closePath();j.strokeStyle="rgb(255,255,0)";
+j.stroke()}else if($ instanceof THREE.ParticleCircleMaterial){if(S){X.r=ka.r+ha.r+ea.r;X.g=ka.g+ha.g+ea.g;X.b=ka.b+ha.b+ea.b;n.r=$.color.r*X.r;n.g=$.color.g*X.g;n.b=$.color.b*X.b;n.updateStyleString()}else n.__styleString=$.color.__styleString;$=ca.scale.x*b;J=ca.scale.y*k;D.set(G.x-$,G.y-J,G.x+$,G.y+J);if(Z.instersects(D)){Y=n.__styleString;if(P!=Y)j.fillStyle=P=Y;j.save();j.translate(G.x,G.y);j.rotate(-ca.rotation);j.scale($,J);j.beginPath();j.arc(0,0,1,0,pa,true);j.closePath();j.fill();j.restore()}}}}
+function Ua(G,ca,$,J){if(J.opacity!=0){a(J.opacity);d(J.blending);j.beginPath();j.moveTo(G.positionScreen.x,G.positionScreen.y);j.lineTo(ca.positionScreen.x,ca.positionScreen.y);j.closePath();if(J instanceof THREE.LineBasicMaterial){n.__styleString=J.color.__styleString;G=J.linewidth;if(Q!=G)j.lineWidth=Q=G;G=n.__styleString;if(N!=G)j.strokeStyle=N=G;j.stroke();D.inflate(J.linewidth*2)}}}function Oa(G,ca,$,J,Y,fa){if(Y.opacity!=0){a(Y.opacity);d(Y.blending);g=G.positionScreen.x;l=G.positionScreen.y;
+r=ca.positionScreen.x;m=ca.positionScreen.y;u=$.positionScreen.x;I=$.positionScreen.y;j.beginPath();j.moveTo(g,l);j.lineTo(r,m);j.lineTo(u,I);j.lineTo(g,l);j.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Da(g,l,r,m,u,I,Y.map.image,J.uvs[0].u,J.uvs[0].v,J.uvs[1].u,J.uvs[1].v,J.uvs[2].u,J.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){G=xa.matrix;da.copy(J.vertexNormalsWorld[0]);
+T=(da.x*G.n11+da.y*G.n12+da.z*G.n13)*0.5+0.5;M=-(da.x*G.n21+da.y*G.n22+da.z*G.n23)*0.5+0.5;da.copy(J.vertexNormalsWorld[1]);ba=(da.x*G.n11+da.y*G.n12+da.z*G.n13)*0.5+0.5;V=-(da.x*G.n21+da.y*G.n22+da.z*G.n23)*0.5+0.5;da.copy(J.vertexNormalsWorld[2]);O=(da.x*G.n11+da.y*G.n12+da.z*G.n13)*0.5+0.5;R=-(da.x*G.n21+da.y*G.n22+da.z*G.n23)*0.5+0.5;Da(g,l,r,m,u,I,Y.env_map.image,T,M,ba,V,O,R)}}else Y.wireframe?Ha(Y.color.__styleString,Y.wireframe_linewidth):Ia(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&
+!Y.wireframe){Y.map.mapping instanceof THREE.UVMapping&&Da(g,l,r,m,u,I,Y.map.image,J.uvs[0].u,J.uvs[0].v,J.uvs[1].u,J.uvs[1].v,J.uvs[2].u,J.uvs[2].v);d(THREE.SubtractiveBlending)}if(S)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&J.vertexNormalsWorld.length==3){w.r=B.r=v.r=ka.r;w.g=B.g=v.g=ka.g;w.b=B.b=v.b=ka.b;Ga(fa,J.v1.positionWorld,J.vertexNormalsWorld[0],w);Ga(fa,J.v2.positionWorld,J.vertexNormalsWorld[1],B);Ga(fa,J.v3.positionWorld,J.vertexNormalsWorld[2],v);o.r=(B.r+v.r)*0.5;o.g=(B.g+v.g)*
+0.5;o.b=(B.b+v.b)*0.5;U=Pa(w,B,v,o);Da(g,l,r,m,u,I,U,0,0,1,0,0,1)}else{X.r=ka.r;X.g=ka.g;X.b=ka.b;Ga(fa,J.centroidWorld,J.normalWorld,X);n.r=Y.color.r*X.r;n.g=Y.color.g*X.g;n.b=Y.color.b*X.b;n.updateStyleString();Y.wireframe?Ha(n.__styleString,Y.wireframe_linewidth):Ia(n.__styleString)}else Y.wireframe?Ha(Y.color.__styleString,Y.wireframe_linewidth):Ia(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){K=xa.near;H=xa.far;w.r=w.g=w.b=1-Ka(G.positionScreen.z,K,H);B.r=B.g=B.b=1-Ka(ca.positionScreen.z,
+K,H);v.r=v.g=v.b=1-Ka($.positionScreen.z,K,H);o.r=(B.r+v.r)*0.5;o.g=(B.g+v.g)*0.5;o.b=(B.b+v.b)*0.5;U=Pa(w,B,v,o);Da(g,l,r,m,u,I,U,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){n.r=La(J.normalWorld.x);n.g=La(J.normalWorld.y);n.b=La(J.normalWorld.z);n.updateStyleString();Y.wireframe?Ha(n.__styleString,Y.wireframe_linewidth):Ia(n.__styleString)}}}function Ha(G,ca){if(N!=G)j.strokeStyle=N=G;if(Q!=ca)j.lineWidth=Q=ca;j.stroke();D.inflate(ca*2)}function Ia(G){if(P!=G)j.fillStyle=P=G;j.fill()}
+function Da(G,ca,$,J,Y,fa,ia,ma,oa,ta,ra,ua,Ea){var za,va;za=ia.width-1;va=ia.height-1;ma*=za;oa*=va;ta*=za;ra*=va;ua*=za;Ea*=va;$-=G;J-=ca;Y-=G;fa-=ca;ta-=ma;ra-=oa;ua-=ma;Ea-=oa;va=1/(ta*Ea-ua*ra);za=(Ea*$-ra*Y)*va;ra=(Ea*J-ra*fa)*va;$=(ta*Y-ua*$)*va;J=(ta*fa-ua*J)*va;G=G-za*ma-$*oa;ca=ca-ra*ma-J*oa;j.save();j.transform(za,ra,$,J,G,ca);j.clip();j.drawImage(ia,0,0);j.restore()}function Pa(G,ca,$,J){var Y=~~(G.r*255),fa=~~(G.g*255);G=~~(G.b*255);var ia=~~(ca.r*255),ma=~~(ca.g*255);ca=~~(ca.b*255);
+var oa=~~($.r*255),ta=~~($.g*255);$=~~($.b*255);var ra=~~(J.r*255),ua=~~(J.g*255);J=~~(J.b*255);na[0]=Y<0?0:Y>255?255:Y;na[1]=fa<0?0:fa>255?255:fa;na[2]=G<0?0:G>255?255:G;na[4]=ia<0?0:ia>255?255:ia;na[5]=ma<0?0:ma>255?255:ma;na[6]=ca<0?0:ca>255?255:ca;na[8]=oa<0?0:oa>255?255:oa;na[9]=ta<0?0:ta>255?255:ta;na[10]=$<0?0:$>255?255:$;na[12]=ra<0?0:ra>255?255:ra;na[13]=ua<0?0:ua>255?255:ua;na[14]=J<0?0:J>255?255:J;qa.putImageData(la,0,0);Aa.drawImage(wa,0,0);return ya}function Ka(G,ca,$){G=(G-ca)/($-ca);
+return G*G*(3-2*G)}function La(G){G=(G+1)*0.5;return G<0?0:G>1?1:G}function Ma(G,ca){var $=ca.x-G.x,J=ca.y-G.y,Y=1/Math.sqrt($*$+J*J);$*=Y;J*=Y;ca.x+=$;ca.y+=J;G.x-=$;G.y-=J}var Ja,Qa,ga,sa,Ca,Na,Ra,Fa;j.setTransform(1,0,0,-1,b,k);this.autoClear&&this.clear();e=f.projectScene(ja,xa,this.sortElements);j.fillStyle="rgba( 0, 255, 255, 0.5 )";j.fillRect(Z.getX(),Z.getY(),Z.getWidth(),Z.getHeight());(S=ja.lights.length>0)&&Sa(ja);Ja=0;for(Qa=e.length;Ja<Qa;Ja++){ga=e[Ja];D.empty();if(ga instanceof THREE.RenderableParticle){q=
+ga;q.x*=b;q.y*=k;sa=0;for(Ca=ga.materials.length;sa<Ca;sa++)Ta(q,ga,ga.materials[sa],ja)}else if(ga instanceof THREE.RenderableLine){q=ga.v1;aa=ga.v2;q.positionScreen.x*=b;q.positionScreen.y*=k;aa.positionScreen.x*=b;aa.positionScreen.y*=k;D.addPoint(q.positionScreen.x,q.positionScreen.y);D.addPoint(aa.positionScreen.x,aa.positionScreen.y);if(Z.instersects(D)){sa=0;for(Ca=ga.materials.length;sa<Ca;)Ua(q,aa,ga,ga.materials[sa++],ja)}}else if(ga instanceof THREE.RenderableFace3){q=ga.v1;aa=ga.v2;L=
+ga.v3;q.positionScreen.x*=b;q.positionScreen.y*=k;aa.positionScreen.x*=b;aa.positionScreen.y*=k;L.positionScreen.x*=b;L.positionScreen.y*=k;if(ga.overdraw){Ma(q.positionScreen,aa.positionScreen);Ma(aa.positionScreen,L.positionScreen);Ma(L.positionScreen,q.positionScreen)}D.add3Points(q.positionScreen.x,q.positionScreen.y,aa.positionScreen.x,aa.positionScreen.y,L.positionScreen.x,L.positionScreen.y);if(Z.instersects(D)){sa=0;for(Ca=ga.meshMaterials.length;sa<Ca;){Fa=ga.meshMaterials[sa++];if(Fa instanceof
+THREE.MeshFaceMaterial){Na=0;for(Ra=ga.faceMaterials.length;Na<Ra;)(Fa=ga.faceMaterials[Na++])&&Oa(q,aa,L,ga,Fa,ja)}else Oa(q,aa,L,ga,Fa,ja)}}}W.addRectangle(D)}j.lineWidth=1;j.strokeStyle="rgba( 255, 0, 0, 0.5 )";j.strokeRect(W.getX(),W.getY(),W.getWidth(),W.getHeight());j.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(T,M,ba){var V,O,R,Z;V=0;for(O=T.lights.length;V<O;V++){R=T.lights[V];if(R instanceof THREE.DirectionalLight){Z=M.normalWorld.dot(R.position)*R.intensity;if(Z>0){ba.r+=R.color.r*Z;ba.g+=R.color.g*Z;ba.b+=R.color.b*Z}}else if(R instanceof THREE.PointLight){I.sub(R.position,M.centroidWorld);I.normalize();Z=M.normalWorld.dot(I)*R.intensity;if(Z>0){ba.r+=R.color.r*Z;ba.g+=R.color.g*Z;ba.b+=R.color.b*Z}}}}function d(T,M,ba,V,O,R){v=f(o++);v.setAttribute("d","M "+
+T.positionScreen.x+" "+T.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(O instanceof THREE.MeshBasicMaterial)L.__styleString=O.color.__styleString;else if(O instanceof THREE.MeshLambertMaterial)if(aa){g.r=l.r;g.g=l.g;g.b=l.b;a(R,V,g);L.r=O.color.r*g.r;L.g=O.color.g*g.g;L.b=O.color.b*g.b;L.updateStyleString()}else L.__styleString=O.color.__styleString;else if(O instanceof THREE.MeshDepthMaterial){u=1-O.__2near/(O.__farPlusNear-
+V.z*O.__farMinusNear);L.setRGB(u,u,u)}else O instanceof THREE.MeshNormalMaterial&&L.setRGB(h(V.normalWorld.x),h(V.normalWorld.y),h(V.normalWorld.z));O.wireframe?v.setAttribute("style","fill: none; stroke: "+L.__styleString+"; stroke-width: "+O.wireframe_linewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.wireframe_linecap+"; stroke-linejoin: "+O.wireframe_linejoin):v.setAttribute("style","fill: "+L.__styleString+"; fill-opacity: "+O.opacity);b.appendChild(v)}function e(T,M,ba,V,O,R,Z){v=
+f(o++);v.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)L.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(aa){g.r=l.r;g.g=l.g;g.b=l.b;a(Z,O,g);L.r=R.color.r*g.r;L.g=R.color.g*g.g;L.b=R.color.b*g.b;L.updateStyleString()}else L.__styleString=R.color.__styleString;
+else if(R instanceof THREE.MeshDepthMaterial){u=1-R.__2near/(R.__farPlusNear-O.z*R.__farMinusNear);L.setRGB(u,u,u)}else R instanceof THREE.MeshNormalMaterial&&L.setRGB(h(O.normalWorld.x),h(O.normalWorld.y),h(O.normalWorld.z));R.wireframe?v.setAttribute("style","fill: none; stroke: "+L.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):v.setAttribute("style","fill: "+L.__styleString+
+"; fill-opacity: "+R.opacity);b.appendChild(v)}function f(T){if(n[T]==null){n[T]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&n[T].setAttribute("shape-rendering","crispEdges");return n[T]}return n[T]}function h(T){return T<0?Math.min((1+T)*0.5,0.5):0.5+Math.min(T*0.5,0.5)}var i=null,p=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,j,C,F,A,E,N,P,Q=new THREE.Rectangle,q=new THREE.Rectangle,aa=false,L=new THREE.Color(16777215),g=new THREE.Color(16777215),
+l=new THREE.Color(0),r=new THREE.Color(0),m=new THREE.Color(0),u,I=new THREE.Vector3,n=[],w=[],B=[],v,o,K,H,U=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(T){switch(T){case "high":U=1;break;case "low":U=0}};this.setSize=function(T,M){k=T;j=M;C=k/2;F=j/2;b.setAttribute("viewBox",-C+" "+-F+" "+k+" "+j);b.setAttribute("width",k);b.setAttribute("height",j);Q.set(-C,-F,C,F)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};
+this.render=function(T,M){var ba,V,O,R,Z,W,D,S;this.autoClear&&this.clear();i=p.projectScene(T,M,this.sortElements);H=K=o=0;if(aa=T.lights.length>0){D=T.lights;l.setRGB(0,0,0);r.setRGB(0,0,0);m.setRGB(0,0,0);ba=0;for(V=D.length;ba<V;ba++){O=D[ba];R=O.color;if(O instanceof THREE.AmbientLight){l.r+=R.r;l.g+=R.g;l.b+=R.b}else if(O instanceof THREE.DirectionalLight){r.r+=R.r;r.g+=R.g;r.b+=R.b}else if(O instanceof THREE.PointLight){m.r+=R.r;m.g+=R.g;m.b+=R.b}}}ba=0;for(V=i.length;ba<V;ba++){D=i[ba];q.empty();
+if(D instanceof THREE.RenderableParticle){A=D;A.x*=C;A.y*=-F;O=0;for(R=D.materials.length;O<R;O++)if(S=D.materials[O]){Z=A;W=D;S=S;var X=K++;if(w[X]==null){w[X]=document.createElementNS("http://www.w3.org/2000/svg","circle");U==0&&w[X].setAttribute("shape-rendering","crispEdges")}v=w[X];v.setAttribute("cx",Z.x);v.setAttribute("cy",Z.y);v.setAttribute("r",W.scale.x*C);if(S instanceof THREE.ParticleCircleMaterial){if(aa){g.r=l.r+r.r+m.r;g.g=l.g+r.g+m.g;g.b=l.b+r.b+m.b;L.r=S.color.r*g.r;L.g=S.color.g*
+g.g;L.b=S.color.b*g.b;L.updateStyleString()}else L=S.color;v.setAttribute("style","fill: "+L.__styleString)}b.appendChild(v)}}else if(D instanceof THREE.RenderableLine){A=D.v1;E=D.v2;A.positionScreen.x*=C;A.positionScreen.y*=-F;E.positionScreen.x*=C;E.positionScreen.y*=-F;q.addPoint(A.positionScreen.x,A.positionScreen.y);q.addPoint(E.positionScreen.x,E.positionScreen.y);if(Q.instersects(q)){O=0;for(R=D.materials.length;O<R;)if(S=D.materials[O++]){Z=A;W=E;S=S;X=H++;if(B[X]==null){B[X]=document.createElementNS("http://www.w3.org/2000/svg",
+"line");U==0&&B[X].setAttribute("shape-rendering","crispEdges")}v=B[X];v.setAttribute("x1",Z.positionScreen.x);v.setAttribute("y1",Z.positionScreen.y);v.setAttribute("x2",W.positionScreen.x);v.setAttribute("y2",W.positionScreen.y);if(S instanceof THREE.LineBasicMaterial){L.__styleString=S.color.__styleString;v.setAttribute("style","fill: none; stroke: "+L.__styleString+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin);b.appendChild(v)}}}}else if(D instanceof
+THREE.RenderableFace3){A=D.v1;E=D.v2;N=D.v3;A.positionScreen.x*=C;A.positionScreen.y*=-F;E.positionScreen.x*=C;E.positionScreen.y*=-F;N.positionScreen.x*=C;N.positionScreen.y*=-F;q.addPoint(A.positionScreen.x,A.positionScreen.y);q.addPoint(E.positionScreen.x,E.positionScreen.y);q.addPoint(N.positionScreen.x,N.positionScreen.y);if(Q.instersects(q)){O=0;for(R=D.meshMaterials.length;O<R;){S=D.meshMaterials[O++];if(S instanceof THREE.MeshFaceMaterial){Z=0;for(W=D.faceMaterials.length;Z<W;)(S=D.faceMaterials[Z++])&&
+d(A,E,N,D,S,T)}else S&&d(A,E,N,D,S,T)}}}else if(D instanceof THREE.RenderableFace4){A=D.v1;E=D.v2;N=D.v3;P=D.v4;A.positionScreen.x*=C;A.positionScreen.y*=-F;E.positionScreen.x*=C;E.positionScreen.y*=-F;N.positionScreen.x*=C;N.positionScreen.y*=-F;P.positionScreen.x*=C;P.positionScreen.y*=-F;q.addPoint(A.positionScreen.x,A.positionScreen.y);q.addPoint(E.positionScreen.x,E.positionScreen.y);q.addPoint(N.positionScreen.x,N.positionScreen.y);q.addPoint(P.positionScreen.x,P.positionScreen.y);if(Q.instersects(q)){O=
+0;for(R=D.meshMaterials.length;O<R;){S=D.meshMaterials[O++];if(S instanceof THREE.MeshFaceMaterial){Z=0;for(W=D.faceMaterials.length;Z<W;)(S=D.faceMaterials[Z++])&&e(A,E,N,P,D,S,T)}else S&&e(A,E,N,P,D,S,T)}}}}}};
+THREE.WebGLRenderer=function(a){function d(g,l){g.fragment_shader=l.fragment_shader;g.vertex_shader=l.vertex_shader;g.uniforms=Uniforms.clone(l.uniforms)}function e(g,l){g.uniforms.color.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);g.uniforms.opacity.value=g.opacity;g.uniforms.map.texture=g.map;g.uniforms.env_map.texture=g.env_map;g.uniforms.reflectivity.value=g.reflectivity;g.uniforms.refraction_ratio.value=g.refraction_ratio;g.uniforms.combine.value=g.combine;g.uniforms.useRefract.value=
+g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping;if(l){g.uniforms.fogColor.value.setHex(l.color.hex);if(l instanceof THREE.Fog){g.uniforms.fogNear.value=l.near;g.uniforms.fogFar.value=l.far}else if(l instanceof THREE.FogExp2)g.uniforms.fogDensity.value=l.density}}function f(g,l){g.uniforms.color.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);g.uniforms.opacity.value=g.opacity;if(l){g.uniforms.fogColor.value.setHex(l.color.hex);if(l instanceof THREE.Fog){g.uniforms.fogNear.value=
+l.near;g.uniforms.fogFar.value=l.far}else if(l instanceof THREE.FogExp2)g.uniforms.fogDensity.value=l.density}}function h(g,l){var r;if(g=="fragment")r=b.createShader(b.FRAGMENT_SHADER);else if(g=="vertex")r=b.createShader(b.VERTEX_SHADER);b.shaderSource(r,l);b.compileShader(r);if(!b.getShaderParameter(r,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(r));return null}return r}function i(g){switch(g){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;
+case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;
+case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var p=document.createElement("canvas"),b,k=null,j=null,C=new THREE.Matrix4,F,A=new Float32Array(16),E=new Float32Array(16),N=new Float32Array(16),P=new Float32Array(9),
+Q=new Float32Array(16),q=true,aa=new THREE.Color(0),L=0;if(a){if(a.antialias!==undefined)q=a.antialias;a.clearColor!==undefined&&aa.setHex(a.clearColor);if(a.clearAlpha!==undefined)L=a.clearAlpha}this.domElement=p;this.autoClear=true;(function(g,l,r){try{b=p.getContext("experimental-webgl",{antialias:g})}catch(m){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);
+b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(l.r,l.g,l.b,r)})(q,aa,L);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(g,l){p.width=g;p.height=l;b.viewport(0,0,p.width,p.height)};this.setClearColor=function(g,l){var r=new THREE.Color(g);b.clearColor(r.r,r.g,r.b,l)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=
+function(g,l){var r,m,u,I=0,n=0,w=0,B,v,o,K=this.lights,H=K.directional.colors,U=K.directional.positions,T=K.point.colors,M=K.point.positions,ba=0,V=0;r=0;for(m=l.length;r<m;r++){u=l[r];B=u.color;v=u.position;o=u.intensity;if(u instanceof THREE.AmbientLight){I+=B.r;n+=B.g;w+=B.b}else if(u instanceof THREE.DirectionalLight){H[ba*3]=B.r*o;H[ba*3+1]=B.g*o;H[ba*3+2]=B.b*o;U[ba*3]=v.x;U[ba*3+1]=v.y;U[ba*3+2]=v.z;ba+=1}else if(u instanceof THREE.PointLight){T[V*3]=B.r*o;T[V*3+1]=B.g*o;T[V*3+2]=B.b*o;M[V*
+3]=v.x;M[V*3+1]=v.y;M[V*3+2]=v.z;V+=1}}K.point.length=V;K.directional.length=ba;K.ambient[0]=I;K.ambient[1]=n;K.ambient[2]=w};this.createParticleBuffers=function(g){g.__webGLVertexBuffer=b.createBuffer();g.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(g){g.__webGLVertexBuffer=b.createBuffer();g.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(g){g.__webGLVertexBuffer=b.createBuffer();g.__webGLNormalBuffer=b.createBuffer();g.__webGLTangentBuffer=b.createBuffer();
+g.__webGLUVBuffer=b.createBuffer();g.__webGLFaceBuffer=b.createBuffer();g.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(g){var l=g.vertices.length;g.__vertexArray=new Float32Array(l*3);g.__lineArray=new Uint16Array(l);g.__webGLLineCount=l};this.initMeshBuffers=function(g,l){var r,m,u=0,I=0,n=0,w=l.geometry.faces,B=g.faces;r=0;for(m=B.length;r<m;r++){fi=B[r];face=w[fi];if(face instanceof THREE.Face3){u+=3;I+=1;n+=3}else if(face instanceof THREE.Face4){u+=4;I+=2;n+=4}}g.__vertexArray=
+new Float32Array(u*3);g.__normalArray=new Float32Array(u*3);g.__tangentArray=new Float32Array(u*4);g.__uvArray=new Float32Array(u*2);g.__faceArray=new Uint16Array(I*3);g.__lineArray=new Uint16Array(n*2);u=false;r=0;for(m=l.materials.length;r<m;r++){w=l.materials[r];if(w instanceof THREE.MeshFaceMaterial){w=0;for(B=g.materials.length;w<B;w++)if(g.materials[w]&&g.materials[w].shading!=undefined&&g.materials[w].shading==THREE.SmoothShading){u=true;break}}else if(w&&w.shading!=undefined&&w.shading==THREE.SmoothShading){u=
+true;break}if(u)break}g.__needsSmoothNormals=u;g.__webGLFaceCount=I*3;g.__webGLLineCount=n*2};this.setMeshBuffers=function(g,l,r,m,u,I,n,w){var B,v,o,K,H,U,T,M,ba,V=0,O=0,R=0,Z=0,W=0,D=0,S=0,X=g.__vertexArray,ka=g.__uvArray,ha=g.__normalArray,ea=g.__tangentArray,pa=g.__faceArray,da=g.__lineArray,wa=g.__needsSmoothNormals,qa=l.geometry,la=qa.vertices,na=g.faces,ya=qa.faces,Aa=qa.uvs;l=0;for(B=na.length;l<B;l++){v=na[l];o=ya[v];v=Aa[v];K=o.vertexNormals;H=o.normal;if(o instanceof THREE.Face3){if(m){U=
+la[o.a].position;T=la[o.b].position;M=la[o.c].position;X[O]=U.x;X[O+1]=U.y;X[O+2]=U.z;X[O+3]=T.x;X[O+4]=T.y;X[O+5]=T.z;X[O+6]=M.x;X[O+7]=M.y;X[O+8]=M.z;O+=9}if(w&&qa.hasTangents){U=la[o.a].tangent;T=la[o.b].tangent;M=la[o.c].tangent;ea[D]=U.x;ea[D+1]=U.y;ea[D+2]=U.z;ea[D+3]=U.w;ea[D+4]=T.x;ea[D+5]=T.y;ea[D+6]=T.z;ea[D+7]=T.w;ea[D+8]=M.x;ea[D+9]=M.y;ea[D+10]=M.z;ea[D+11]=M.w;D+=12}if(n)if(K.length==3&&wa)for(o=0;o<3;o++){H=K[o];ha[W]=H.x;ha[W+1]=H.y;ha[W+2]=H.z;W+=3}else for(o=0;o<3;o++){ha[W]=H.x;
+ha[W+1]=H.y;ha[W+2]=H.z;W+=3}if(I&&v)for(o=0;o<3;o++){K=v[o];ka[R]=K.u;ka[R+1]=K.v;R+=2}if(u){pa[Z]=V;pa[Z+1]=V+1;pa[Z+2]=V+2;Z+=3;da[S]=V;da[S+1]=V+1;da[S+2]=V;da[S+3]=V+2;da[S+4]=V+1;da[S+5]=V+2;S+=6;V+=3}}else if(o instanceof THREE.Face4){if(m){U=la[o.a].position;T=la[o.b].position;M=la[o.c].position;ba=la[o.d].position;X[O]=U.x;X[O+1]=U.y;X[O+2]=U.z;X[O+3]=T.x;X[O+4]=T.y;X[O+5]=T.z;X[O+6]=M.x;X[O+7]=M.y;X[O+8]=M.z;X[O+9]=ba.x;X[O+10]=ba.y;X[O+11]=ba.z;O+=12}if(w&&qa.hasTangents){U=la[o.a].tangent;
+T=la[o.b].tangent;M=la[o.c].tangent;o=la[o.d].tangent;ea[D]=U.x;ea[D+1]=U.y;ea[D+2]=U.z;ea[D+3]=U.w;ea[D+4]=T.x;ea[D+5]=T.y;ea[D+6]=T.z;ea[D+7]=T.w;ea[D+8]=M.x;ea[D+9]=M.y;ea[D+10]=M.z;ea[D+11]=M.w;ea[D+12]=o.x;ea[D+13]=o.y;ea[D+14]=o.z;ea[D+15]=o.w;D+=16}if(n)if(K.length==4&&wa)for(o=0;o<4;o++){H=K[o];ha[W]=H.x;ha[W+1]=H.y;ha[W+2]=H.z;W+=3}else for(o=0;o<4;o++){ha[W]=H.x;ha[W+1]=H.y;ha[W+2]=H.z;W+=3}if(I&&v)for(o=0;o<4;o++){K=v[o];ka[R]=K.u;ka[R+1]=K.v;R+=2}if(u){pa[Z]=V;pa[Z+1]=V+1;pa[Z+2]=V+2;
+pa[Z+3]=V;pa[Z+4]=V+2;pa[Z+5]=V+3;Z+=6;da[S]=V;da[S+1]=V+1;da[S+2]=V;da[S+3]=V+3;da[S+4]=V+1;da[S+5]=V+2;da[S+6]=V+2;da[S+7]=V+3;S+=8;V+=4}}}if(m){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,X,r)}if(n){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,ha,r)}if(w&&qa.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,ea,r)}if(I&&R>0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,
+ka,r)}if(u){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,pa,r);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,da,r)}};this.setLineBuffers=function(g,l,r,m){var u,I,n=g.vertices,w=n.length,B=g.__vertexArray,v=g.__lineArray;if(r)for(r=0;r<w;r++){u=n[r].position;I=r*3;B[I]=u.x;B[I+1]=u.y;B[I+2]=u.z}if(m)for(r=0;r<w;r++)v[r]=r;b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,B,l);
+b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,v,l)};this.setParticleBuffers=function(){};this.renderBuffer=function(g,l,r,m,u,I){var n,w,B,v;if(!m.program){if(m instanceof THREE.MeshDepthMaterial){d(m,THREE.ShaderLib.depth);m.uniforms.mNear.value=g.near;m.uniforms.mFar.value=g.far}else if(m instanceof THREE.MeshNormalMaterial)d(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial){d(m,THREE.ShaderLib.basic);e(m,r)}else if(m instanceof
+THREE.MeshLambertMaterial){d(m,THREE.ShaderLib.lambert);e(m,r)}else if(m instanceof THREE.MeshPhongMaterial){d(m,THREE.ShaderLib.phong);e(m,r)}else if(m instanceof THREE.LineBasicMaterial){d(m,THREE.ShaderLib.basic);f(m,r)}var o,K,H;o=v=w=0;for(K=l.length;o<K;o++){H=l[o];H instanceof THREE.DirectionalLight&&v++;H instanceof THREE.PointLight&&w++}if(w+v<=4){o=v;w=w}else{o=Math.ceil(4*v/(w+v));w=4-o}w={directional:o,point:w};v={fog:r,map:m.map,env_map:m.env_map,maxDirLights:w.directional,maxPointLights:w.point};
+w=m.fragment_shader;o=m.vertex_shader;K=b.createProgram();H=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+
+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"","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");b.attachShader(K,h("fragment",H+w));b.attachShader(K,h("vertex",v+o));b.linkProgram(K);b.getProgramParameter(K,b.LINK_STATUS)||
+alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(K,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");K.uniforms={};K.attributes={};m.program=K;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(n in m.uniforms)w.push(n);n=m.program;o=0;for(K=w.length;o<K;o++){H=w[o];n.uniforms[H]=b.getUniformLocation(n,H)}n=m.program;w=["position","normal","uv","tangent"];o=0;for(K=w.length;o<K;o++){H=w[o];n.attributes[H]=b.getAttribLocation(n,
+H)}}n=m.program;if(n!=k){b.useProgram(n);k=n}this.loadCamera(n,g);this.loadMatrices(n);if(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial){this.setupLights(n,l);g=this.lights;m.uniforms.enableLighting.value=g.directional.length+g.point.length;m.uniforms.ambientLightColor.value=g.ambient;m.uniforms.directionalLightColor.value=g.directional.colors;m.uniforms.directionalLightDirection.value=g.directional.positions;m.uniforms.pointLightColor.value=g.point.colors;m.uniforms.pointLightPosition.value=
+g.point.positions}if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial)e(m,r);m instanceof THREE.LineBasicMaterial&&f(m,r);if(m instanceof THREE.MeshPhongMaterial){m.uniforms.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);m.uniforms.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);m.uniforms.shininess.value=m.shininess}r=m.uniforms;for(B in r)if(o=n.uniforms[B]){l=r[B];w=l.type;g=l.value;if(w=="i")b.uniform1i(o,
+g);else if(w=="f")b.uniform1f(o,g);else if(w=="fv1")b.uniform1fv(o,g);else if(w=="fv")b.uniform3fv(o,g);else if(w=="v2")b.uniform2f(o,g.x,g.y);else if(w=="v3")b.uniform3f(o,g.x,g.y,g.z);else if(w=="c")b.uniform3f(o,g.r,g.g,g.b);else if(w=="t"){b.uniform1i(o,g);if(l=l.texture)if(l.image instanceof Array&&l.image.length==6){l=l;g=g;if(l.image.length==6){if(!l.image.__webGLTextureCube&&!l.image.__cubeMapInitialized&&l.image.loadCount==6){l.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,
+l.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(w=0;w<6;++w)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+w,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,l.image[w]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);l.image.__cubeMapInitialized=
+true}b.activeTexture(b.TEXTURE0+g);b.bindTexture(b.TEXTURE_CUBE_MAP,l.image.__webGLTextureCube)}}else{l=l;g=g;if(!l.__webGLTexture&&l.image.loaded){l.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,l.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,l.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(l.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(l.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,i(l.mag_filter));b.texParameteri(b.TEXTURE_2D,
+b.TEXTURE_MIN_FILTER,i(l.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+g);b.bindTexture(b.TEXTURE_2D,l.__webGLTexture)}}}B=n.attributes;b.bindBuffer(b.ARRAY_BUFFER,u.__webGLVertexBuffer);b.vertexAttribPointer(B.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.position);if(B.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLNormalBuffer);b.vertexAttribPointer(B.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.normal)}if(B.tangent>=
+0){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLTangentBuffer);b.vertexAttribPointer(B.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.tangent)}if(B.uv>=0)if(u.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLUVBuffer);b.vertexAttribPointer(B.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.uv)}else b.disableVertexAttribArray(B.uv);if(m.wireframe||m instanceof THREE.LineBasicMaterial){B=m.wireframe_linewidth!==undefined?m.wireframe_linewidth:m.linewidth!==undefined?m.linewidth:1;m=m instanceof
+THREE.LineBasicMaterial&&I.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(B);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,u.__webGLLineBuffer);b.drawElements(m,u.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,u.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,u.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(g,l,r,m,u,I,n){var w,B,v,o,K;v=0;for(o=m.materials.length;v<o;v++){w=m.materials[v];if(w instanceof THREE.MeshFaceMaterial){w=0;for(B=u.materials.length;w<
+B;w++)if((K=u.materials[w])&&K.blending==I&&K.opacity<1==n){this.setBlending(K.blending);this.renderBuffer(g,l,r,K,u,m)}}else if((K=w)&&K.blending==I&&K.opacity<1==n){this.setBlending(K.blending);this.renderBuffer(g,l,r,K,u,m)}}};this.render=function(g,l,r,m){var u,I,n,w=g.lights,B=g.fog;this.initWebGLObjects(g);m=m!==undefined?m:true;if(r&&!r.__webGLFramebuffer){r.__webGLFramebuffer=b.createFramebuffer();r.__webGLRenderbuffer=b.createRenderbuffer();r.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,
+r.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,r.width,r.height);b.bindTexture(b.TEXTURE_2D,r.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(r.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(r.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,i(r.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,i(r.min_filter));b.texImage2D(b.TEXTURE_2D,0,i(r.format),r.width,r.height,0,i(r.format),i(r.type),null);b.bindFramebuffer(b.FRAMEBUFFER,
+r.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,r.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,r.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(r){u=r.__webGLFramebuffer;n=r.width;I=r.height}else{u=null;n=p.width;I=p.height}if(u!=j){b.bindFramebuffer(b.FRAMEBUFFER,u);b.viewport(0,0,n,I);m&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);
+j=u}this.autoClear&&this.clear();l.autoUpdateMatrix&&l.updateMatrix();A.set(l.matrix.flatten());N.set(l.projectionMatrix.flatten());m=0;for(u=g.__webGLObjects.length;m<u;m++){I=g.__webGLObjects[m];n=I.object;I=I.buffer;if(n.visible){this.setupMatrices(n,l);this.renderPass(l,w,B,n,I,THREE.NormalBlending,false)}}m=0;for(u=g.__webGLObjects.length;m<u;m++){I=g.__webGLObjects[m];n=I.object;I=I.buffer;if(n.visible){this.setupMatrices(n,l);if(n.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);
+n.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}this.renderPass(l,w,B,n,I,THREE.AdditiveBlending,false);this.renderPass(l,w,B,n,I,THREE.SubtractiveBlending,false);this.renderPass(l,w,B,n,I,THREE.AdditiveBlending,true);this.renderPass(l,w,B,n,I,THREE.SubtractiveBlending,true);this.renderPass(l,w,B,n,I,THREE.NormalBlending,true)}}if(r&&r.min_filter!==THREE.NearestFilter&&r.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,r.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,
+null)}};this.initWebGLObjects=function(g){function l(v,o,K,H){if(v[o]==undefined){g.__webGLObjects.push({buffer:K,object:H});v[o]=1}}var r,m,u,I,n,w,B;if(!g.__webGLObjects){g.__webGLObjects=[];g.__webGLObjectsMap={}}r=0;for(m=g.objects.length;r<m;r++){u=g.objects[r];n=u.geometry;if(g.__webGLObjectsMap[u.id]==undefined)g.__webGLObjectsMap[u.id]={};B=g.__webGLObjectsMap[u.id];if(u instanceof THREE.Mesh){for(I in n.geometryChunks){w=n.geometryChunks[I];if(!w.__webGLVertexBuffer){this.createMeshBuffers(w);
+this.initMeshBuffers(w,u);n.__dirtyVertices=true;n.__dirtyElements=true;n.__dirtyUvs=true;n.__dirtyNormals=true;n.__dirtyTangents=true}if(n.__dirtyVertices||n.__dirtyElements||n.__dirtyUvs)this.setMeshBuffers(w,u,b.DYNAMIC_DRAW,n.__dirtyVertices,n.__dirtyElements,n.__dirtyUvs,n.__dirtyNormals,n.__dirtyTangents);l(B,I,w,u)}n.__dirtyVertices=false;n.__dirtyElements=false;n.__dirtyUvs=false;n.__dirtyNormals=false;n.__dirtyTangents=false}else if(u instanceof THREE.Line){if(!n.__webGLVertexBuffer){this.createLineBuffers(n);
+this.initLineBuffers(n);n.__dirtyVertices=true;n.__dirtyElements=true}n.__dirtyVertices&&this.setLineBuffers(n,b.DYNAMIC_DRAW,n.__dirtyVertices,n.__dirtyElements);l(B,0,n,u);n.__dirtyVertices=false;n.__dirtyElements=false}else if(u instanceof THREE.ParticleSystem){n.__webGLVertexBuffer||this.createParticleBuffers(n);l(B,0,n,u)}}};this.removeObject=function(g,l){var r,m;for(r=g.__webGLObjects.length-1;r>=0;r--){m=g.__webGLObjects[r].object;l==m&&g.__webGLObjects.splice(r,1)}};this.setupMatrices=function(g,
+l){g.autoUpdateMatrix&&g.updateMatrix();C.multiply(l.matrix,g.matrix);E.set(C.flatten());F=THREE.Matrix4.makeInvert3x3(C).transpose();P.set(F.m);Q.set(g.matrix.flatten())};this.loadMatrices=function(g){b.uniformMatrix4fv(g.uniforms.viewMatrix,false,A);b.uniformMatrix4fv(g.uniforms.modelViewMatrix,false,E);b.uniformMatrix4fv(g.uniforms.projectionMatrix,false,N);b.uniformMatrix3fv(g.uniforms.normalMatrix,false,P);b.uniformMatrix4fv(g.uniforms.objectMatrix,false,Q)};this.loadCamera=function(g,l){b.uniform3f(g.uniforms.cameraPosition,
+l.position.x,l.position.y,l.position.z)};this.setBlending=function(g){switch(g){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(g,l){if(g){!l||l=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(g=="back")b.cullFace(b.BACK);else g=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);
+b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
+envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
+map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
+lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
+lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"};
+THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",
+value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}}};
+THREE.ShaderLib={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}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
+THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
+THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,"gl_FragColor =  mColor * mapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,
+THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},
+shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,
+"gl_FragColor =  mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
+THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\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.faceMaterials=this.meshMaterials=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.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};

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


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