Browse Source

Yet some more tweaks to CanvasRenderer::clear()

Mr.doob 14 years ago
parent
commit
c6cec3ca6b
4 changed files with 407 additions and 626 deletions
  1. 202 202
      build/Three.js
  2. 203 203
      build/ThreeDebug.js
  3. 0 219
      build/ThreeExtras.js
  4. 2 2
      src/renderers/CanvasRenderer.js

+ 202 - 202
build/Three.js

@@ -1,202 +1,202 @@
-// 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,e=this.z;this.x=d*a.z-e*a.y;this.y=e*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,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1};
-THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;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,e=a.objects,i=[];a=0;for(c=e.length;a<c;a++){d=e[a];if(d instanceof THREE.Mesh)i=i.concat(this.intersectObject(d))}i.sort(function(b,n){return b.distance-n.distance});return i},intersectObject:function(a){function c(K,p,h,g){g=g.clone().subSelf(p);h=h.clone().subSelf(p);var f=K.clone().subSelf(p);K=g.dot(g);p=g.dot(h);g=g.dot(f);var j=h.dot(h);h=h.dot(f);f=1/(K*j-p*p);j=(j*g-p*h)*f;K=(K*h-p*g)*f;return j>0&&K>0&&j+K<1}var d,e,i,b,n,o,k,m,y,x,
-s,w=a.geometry,H=w.vertices,J=[];d=0;for(e=w.faces.length;d<e;d++){i=w.faces[d];x=this.origin.clone();s=this.direction.clone();b=a.matrix.multiplyVector3(H[i.a].position.clone());n=a.matrix.multiplyVector3(H[i.b].position.clone());o=a.matrix.multiplyVector3(H[i.c].position.clone());k=i instanceof THREE.Face4?a.matrix.multiplyVector3(H[i.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(i.normal.clone());y=s.dot(m);if(y<0){m=m.dot((new THREE.Vector3).sub(b,x))/y;x=x.addSelf(s.multiplyScalar(m));
-if(i instanceof THREE.Face3){if(c(x,b,n,o)){i={distance:this.origin.distanceTo(x),point:x,face:i,object:a};J.push(i)}}else if(i instanceof THREE.Face4)if(c(x,b,n,k)||c(x,n,o,k)){i={distance:this.origin.distanceTo(x),point:x,face:i,object:a};J.push(i)}}}return J}};
-THREE.Rectangle=function(){function a(){b=e-c;n=i-d}var c,d,e,i,b,n,o=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return b};this.getHeight=function(){return n};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return i};this.set=function(k,m,y,x){o=false;c=k;d=m;e=y;i=x;a()};this.addPoint=function(k,m){if(o){o=false;c=k;d=m;e=k;i=m}else{c=c<k?c:k;d=d<m?d:m;e=e>k?e:k;i=i>m?
-i:m}a()};this.add3Points=function(k,m,y,x,s,w){if(o){o=false;c=k<y?k<s?k:s:y<s?y:s;d=m<x?m<w?m:w:x<w?x:w;e=k>y?k>s?k:s:y>s?y:s;i=m>x?m>w?m:w:x>w?x:w}else{c=k<y?k<s?k<c?k:c:s<c?s:c:y<s?y<c?y:c:s<c?s:c;d=m<x?m<w?m<d?m:d:w<d?w:d:x<w?x<d?x:d:w<d?w:d;e=k>y?k>s?k>e?k:e:s>e?s:e:y>s?y>e?y:e:s>e?s:e;i=m>x?m>w?m>i?m:i:w>i?w:i:x>w?x>i?x:i:w>i?w:i}a()};this.addRectangle=function(k){if(o){o=false;c=k.getLeft();d=k.getTop();e=k.getRight();i=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();d=d<k.getTop()?d:k.getTop();
-e=e>k.getRight()?e:k.getRight();i=i>k.getBottom()?i:k.getBottom()}a()};this.inflate=function(k){c-=k;d-=k;e+=k;i+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e<k.getRight()?e:k.getRight();i=i<k.getBottom()?i:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(c,k.getLeft())>=0&&Math.min(i,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){o=true;i=e=d=c=0;a()};this.isEmpty=function(){return o};this.toString=
-function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+i+", width: "+b+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}};
-THREE.Matrix4=function(a,c,d,e,i,b,n,o,k,m,y,x,s,w,H,J){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=i||0;this.n22=b||1;this.n23=n||0;this.n24=o||0;this.n31=k||0;this.n32=m||0;this.n33=y||1;this.n34=x||0;this.n41=s||0;this.n42=w||0;this.n43=H||0;this.n44=J||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,e,i,b,n,o,k,m,y,x,s,w,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=i;this.n22=b;this.n23=n;this.n24=o;this.n31=k;this.n32=m;this.n33=y;this.n34=x;this.n41=s;this.n42=w;this.n43=H;this.n44=J;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 e=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();i.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a);
-this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,i=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*i;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*i;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,i=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*i;a.y=this.n21*c+this.n22*d+this.n23*
-e+this.n24*i;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*i;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*i;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,e=a.n12,i=a.n13,b=a.n14,n=a.n21,o=a.n22,k=a.n23,m=a.n24,y=a.n31,
-x=a.n32,s=a.n33,w=a.n34,H=a.n41,J=a.n42,K=a.n43,p=a.n44,h=c.n11,g=c.n12,f=c.n13,j=c.n14,t=c.n21,u=c.n22,l=c.n23,A=c.n24,q=c.n31,G=c.n32,r=c.n33,v=c.n34,D=c.n41,T=c.n42,E=c.n43,N=c.n44;this.n11=d*h+e*t+i*q+b*D;this.n12=d*g+e*u+i*G+b*T;this.n13=d*f+e*l+i*r+b*E;this.n14=d*j+e*A+i*v+b*N;this.n21=n*h+o*t+k*q+m*D;this.n22=n*g+o*u+k*G+m*T;this.n23=n*f+o*l+k*r+m*E;this.n24=n*j+o*A+k*v+m*N;this.n31=y*h+x*t+s*q+w*D;this.n32=y*g+x*u+s*G+w*T;this.n33=y*f+x*l+s*r+w*E;this.n34=y*j+x*A+s*v+w*N;this.n41=H*h+J*t+
-K*q+p*D;this.n42=H*g+J*u+K*G+p*T;this.n43=H*f+J*l+K*r+p*E;this.n44=H*j+J*A+K*v+p*N;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,i=this.n14,b=this.n21,n=this.n22,o=this.n23,k=this.n24,m=this.n31,y=this.n32,x=this.n33,s=this.n34,w=this.n41,H=this.n42,J=this.n43,K=this.n44,p=a.n11,h=a.n21,g=a.n31,f=a.n41,j=a.n12,t=a.n22,u=a.n32,l=a.n42,A=a.n13,q=a.n23,G=a.n33,r=a.n43,v=a.n14,D=a.n24,T=a.n34;a=a.n44;this.n11=c*p+d*h+e*g+i*f;this.n12=c*j+d*t+e*u+i*l;this.n13=c*A+d*q+e*G+i*
-r;this.n14=c*v+d*D+e*T+i*a;this.n21=b*p+n*h+o*g+k*f;this.n22=b*j+n*t+o*u+k*l;this.n23=b*A+n*q+o*G+k*r;this.n24=b*v+n*D+o*T+k*a;this.n31=m*p+y*h+x*g+s*f;this.n32=m*j+y*t+x*u+s*l;this.n33=m*A+y*q+x*G+s*r;this.n34=m*v+y*D+x*T+s*a;this.n41=w*p+H*h+J*g+K*f;this.n42=w*j+H*t+J*u+K*l;this.n43=w*A+H*q+J*G+K*r;this.n44=w*v+H*D+J*T+K*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,c=this.n12,d=this.n13,e=this.n14,i=this.n21,b=this.n22,n=this.n23,o=this.n24,k=this.n31,m=this.n32,y=this.n33,x=this.n34,s=this.n41,w=this.n42,H=this.n43,J=this.n44;return e*n*m*s-d*o*m*s-e*b*y*s+c*o*y*s+d*b*x*s-c*n*x*s-e*n*k*w+d*o*k*w+e*i*y*w-a*o*y*w-d*i*x*w+a*n*x*w+e*b*k*H-c*o*k*H-e*i*m*H+a*o*m*H+c*i*x*H-a*b*x*H-d*b*k*J+c*n*k*J+d*i*m*J-a*n*m*J-c*i*y*J+a*b*y*J},transpose:function(){function a(c,d,
-e){var i=c[d];c[d]=c[e];c[e]=i}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(){var a=this.flat;a[0]=this.n11;
-a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=
-Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),i=1-d,b=a.x,n=a.y,o=a.z,k=i*b,m=i*n;this.set(k*b+d,k*n-e*o,k*o+e*n,0,k*n+e*o,m*n+d,m*o-e*b,0,k*o-e*n,m*o+e*b,i*o*o+d,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,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};
-THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d};
-THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,i=a.n14,b=a.n21,n=a.n22,o=a.n23,k=a.n24,m=a.n31,y=a.n32,x=a.n33,s=a.n34,w=a.n41,H=a.n42,J=a.n43,K=a.n44,p=new THREE.Matrix4;p.n11=o*s*H-k*x*H+k*y*J-n*s*J-o*y*K+n*x*K;p.n12=i*x*H-e*s*H-i*y*J+d*s*J+e*y*K-d*x*K;p.n13=e*k*H-i*o*H+i*n*J-d*k*J-e*n*K+d*o*K;p.n14=i*o*y-e*k*y-i*n*x+d*k*x+e*n*s-d*o*s;p.n21=k*x*w-o*s*w-k*m*J+b*s*J+o*m*K-b*x*K;p.n22=e*s*w-i*x*w+i*m*J-c*s*J-e*m*K+c*x*K;p.n23=i*o*w-e*k*w-i*b*J+c*k*J+e*b*K-c*o*K;p.n24=e*k*m-i*o*m+
-i*b*x-c*k*x-e*b*s+c*o*s;p.n31=n*s*w-k*y*w+k*m*H-b*s*H-n*m*K+b*y*K;p.n32=i*y*w-d*s*w-i*m*H+c*s*H+d*m*K-c*y*K;p.n33=e*k*w-i*n*w+i*b*H-c*k*H-d*b*K+c*n*K;p.n34=i*n*m-d*k*m-i*b*y+c*k*y+d*b*s-c*n*s;p.n41=o*y*w-n*x*w-o*m*H+b*x*H+n*m*J-b*y*J;p.n42=d*x*w-e*y*w+e*m*H-c*x*H-d*m*J+c*y*J;p.n43=e*n*w-d*o*w-e*b*H+c*o*H+d*b*J-c*n*J;p.n44=d*o*m-e*n*m+e*b*y-c*o*y-d*b*x+c*n*x;p.multiplyScalar(1/a.determinant());return p};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],n=-c[10]*c[4]+c[6]*c[8],o=c[10]*c[0]-c[2]*c[8],k=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*n+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*i;d[2]=c*b;d[3]=c*n;d[4]=c*o;d[5]=c*k;d[6]=c*m;d[7]=c*y;d[8]=c*x;return a};
-THREE.Matrix4.makeFrustum=function(a,c,d,e,i,b){var n,o,k;n=new THREE.Matrix4;o=2*i/(c-a);k=2*i/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+i)/(b-i);i=-2*b*i/(b-i);n.n11=o;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=k;n.n23=d;n.n24=0;n.n31=0;n.n32=0;n.n33=e;n.n34=i;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,d,e){var i;a=d*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,d,e)};
-THREE.Matrix4.makeOrtho=function(a,c,d,e,i,b){var n,o,k,m;n=new THREE.Matrix4;o=c-a;k=d-e;m=b-i;a=(c+a)/o;d=(d+e)/k;i=(b+i)/m;n.n11=2/o;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/k;n.n23=0;n.n24=-d;n.n31=0;n.n32=0;n.n33=-2/m;n.n34=-i;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};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,e,i){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,c,d,e,i,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=b instanceof Array?b:[b]};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,e,i,b,n,o=new THREE.Vector3,k=new THREE.Vector3;e=0;for(i=this.vertices.length;e<i;e++){b=this.vertices[e];b.normal.set(0,0,0)}e=0;for(i=this.faces.length;e<i;e++){b=this.faces[e];if(a&&b.vertexNormals.length){o.set(0,0,0);c=0;for(d=b.normal.length;c<d;c++)o.addSelf(b.vertexNormals[c]);o.divideScalar(3)}else{c=this.vertices[b.a];d=this.vertices[b.b];n=this.vertices[b.c];o.sub(n.position,
-d.position);k.sub(c.position,d.position);o.crossSelf(k)}o.isZero()||o.normalize();b.normal.copy(o)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[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{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[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(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(v,D,T,E,N,U,C){b=v.vertices[D].position;n=v.vertices[T].position;o=v.vertices[E].position;k=i[N];m=i[U];y=i[C];x=n.x-b.x;s=o.x-b.x;w=n.y-b.y;H=o.y-b.y;
-J=n.z-b.z;K=o.z-b.z;p=m.u-k.u;h=y.u-k.u;g=m.v-k.v;f=y.v-k.v;j=1/(p*f-h*g);l.set((f*x-g*s)*j,(f*w-g*H)*j,(f*J-g*K)*j);A.set((p*s-h*x)*j,(p*H-h*w)*j,(p*K-h*J)*j);t[D].addSelf(l);t[T].addSelf(l);t[E].addSelf(l);u[D].addSelf(A);u[T].addSelf(A);u[E].addSelf(A)}var c,d,e,i,b,n,o,k,m,y,x,s,w,H,J,K,p,h,g,f,j,t=[],u=[],l=new THREE.Vector3,A=new THREE.Vector3,q=new THREE.Vector3,G=new THREE.Vector3,r=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){t[c]=new THREE.Vector3;u[c]=new THREE.Vector3}c=0;
-for(d=this.faces.length;c<d;c++){e=this.faces[c];i=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){r.copy(this.vertices[c].normal);e=t[c];q.copy(e);q.subSelf(r.multiplyScalar(r.dot(e))).normalize();G.cross(this.vertices[c].normal,e);e=G.dot(u[c]);e=e<0?-1:1;this.vertices[c].tangent.set(q.x,q.y,q.z,e)}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(y){var x=[];c=0;for(d=y.length;c<d;c++)y[c]==undefined?x.push("undefined"):x.push(y[c].toString());return x.join("_")}var c,d,e,i,b,n,o,k,m={};e=0;for(i=this.faces.length;e<i;e++){b=this.faces[e];
-n=b.materials;o=a(n);if(m[o]==undefined)m[o]={hash:o,counter:0};k=m[o].hash+"_"+m[o].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:n,vertices:0};b=b instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+b>65535){m[o].counter+=1;k=m[o].hash+"_"+m[o].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:n,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+
-this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
-THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;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(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
-this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);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.PointLight.prototype=new THREE.Light;THREE.PointLight.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.rotationMatrix=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,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};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,e,i,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=b!==undefined?b: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,e,i={};for(c in a){i[c]={};for(d in a[c]){e=a[c][d];i[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return i},merge:function(a){var c,d,e,i={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(d in e)i[d]=e[d]}return i}};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(u,l){return l.z-u.z}function c(u,l){var A=0,q=1,G=u.z+u.w,r=l.z+l.w,v=-u.z+u.w,D=-l.z+l.w;if(G>=0&&r>=0&&v>=0&&D>=0)return true;else if(G<0&&r<0||v<0&&D<0)return false;else{if(G<0)A=Math.max(A,G/(G-r));else if(r<0)q=Math.min(q,G/(G-r));if(v<0)A=Math.max(A,v/(v-D));else if(D<0)q=Math.min(q,v/(v-D));if(q<A)return false;else{u.lerpSelf(l,A);l.lerpSelf(u,1-q);return true}}}var d,e,i=[],b,n,o,k=[],m,y,x=[],s,w,H=[],J=new THREE.Vector4,K=new THREE.Vector4,p=new THREE.Matrix4,
-h=new THREE.Matrix4,g=[],f=new THREE.Vector4,j=new THREE.Vector4,t;this.projectObjects=function(u,l,A){var q=[],G,r;e=0;p.multiply(l.projectionMatrix,l.matrix);g[0]=new THREE.Vector4(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);g[1]=new THREE.Vector4(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);g[2]=new THREE.Vector4(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);g[3]=new THREE.Vector4(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);g[4]=new THREE.Vector4(p.n41-p.n31,p.n42-p.n32,p.n43-
-p.n33,p.n44-p.n34);g[5]=new THREE.Vector4(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);l=0;for(G=g.length;l<G;l++){r=g[l];r.divideScalar(Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z))}G=u.objects;u=0;for(l=G.length;u<l;u++){r=G[u];var v;if(!(v=!r.visible)){if(v=r instanceof THREE.Mesh){a:{v=void 0;for(var D=r.position,T=-r.geometry.boundingSphere.radius*Math.max(r.scale.x,Math.max(r.scale.y,r.scale.z)),E=0;E<6;E++){v=g[E].x*D.x+g[E].y*D.y+g[E].z*D.z+g[E].w;if(v<=T){v=false;break a}}v=true}v=!v}v=v}if(!v){d=
-i[e]=i[e]||new THREE.RenderableObject;J.copy(r.position);p.multiplyVector3(J);d.object=r;d.z=J.z;q.push(d);e++}}A&&q.sort(a);return q};this.projectScene=function(u,l,A){var q=[],G=l.near,r=l.far,v,D,T,E,N,U,C,S,Y,M,I,L,P,z,Q,V;o=y=w=0;l.autoUpdateMatrix&&l.updateMatrix();p.multiply(l.projectionMatrix,l.matrix);U=this.projectObjects(u,l,true);u=0;for(v=U.length;u<v;u++){C=U[u].object;if(C.visible){C.autoUpdateMatrix&&C.updateMatrix();S=C.matrix;Y=C.rotationMatrix;M=C.materials;I=C.overdraw;if(C instanceof
-THREE.Mesh){L=C.geometry;P=L.vertices;D=0;for(T=P.length;D<T;D++){z=P[D];z.positionWorld.copy(z.position);S.multiplyVector3(z.positionWorld);E=z.positionScreen;E.copy(z.positionWorld);p.multiplyVector4(E);E.x/=E.w;E.y/=E.w;z.__visible=E.z>G&&E.z<r}L=L.faces;D=0;for(T=L.length;D<T;D++){z=L[D];if(z instanceof THREE.Face3){E=P[z.a];N=P[z.b];Q=P[z.c];if(E.__visible&&N.__visible&&Q.__visible)if(C.doubleSided||C.flipSided!=(Q.positionScreen.x-E.positionScreen.x)*(N.positionScreen.y-E.positionScreen.y)-
-(Q.positionScreen.y-E.positionScreen.y)*(N.positionScreen.x-E.positionScreen.x)<0){b=k[o]=k[o]||new THREE.RenderableFace3;b.v1.positionWorld.copy(E.positionWorld);b.v2.positionWorld.copy(N.positionWorld);b.v3.positionWorld.copy(Q.positionWorld);b.v1.positionScreen.copy(E.positionScreen);b.v2.positionScreen.copy(N.positionScreen);b.v3.positionScreen.copy(Q.positionScreen);b.normalWorld.copy(z.normal);Y.multiplyVector3(b.normalWorld);b.centroidWorld.copy(z.centroid);S.multiplyVector3(b.centroidWorld);
-b.centroidScreen.copy(b.centroidWorld);p.multiplyVector3(b.centroidScreen);Q=z.vertexNormals;t=b.vertexNormalsWorld;E=0;for(N=Q.length;E<N;E++){V=t[E]=t[E]||new THREE.Vector3;V.copy(Q[E]);Y.multiplyVector3(V)}b.z=b.centroidScreen.z;b.meshMaterials=M;b.faceMaterials=z.materials;b.overdraw=I;if(C.geometry.uvs[D]){b.uvs[0]=C.geometry.uvs[D][0];b.uvs[1]=C.geometry.uvs[D][1];b.uvs[2]=C.geometry.uvs[D][2]}q.push(b);o++}}else if(z instanceof THREE.Face4){E=P[z.a];N=P[z.b];Q=P[z.c];V=P[z.d];if(E.__visible&&
-N.__visible&&Q.__visible&&V.__visible)if(C.doubleSided||C.flipSided!=((V.positionScreen.x-E.positionScreen.x)*(N.positionScreen.y-E.positionScreen.y)-(V.positionScreen.y-E.positionScreen.y)*(N.positionScreen.x-E.positionScreen.x)<0||(N.positionScreen.x-Q.positionScreen.x)*(V.positionScreen.y-Q.positionScreen.y)-(N.positionScreen.y-Q.positionScreen.y)*(V.positionScreen.x-Q.positionScreen.x)<0)){b=k[o]=k[o]||new THREE.RenderableFace3;b.v1.positionWorld.copy(E.positionWorld);b.v2.positionWorld.copy(N.positionWorld);
-b.v3.positionWorld.copy(V.positionWorld);b.v1.positionScreen.copy(E.positionScreen);b.v2.positionScreen.copy(N.positionScreen);b.v3.positionScreen.copy(V.positionScreen);b.normalWorld.copy(z.normal);Y.multiplyVector3(b.normalWorld);b.centroidWorld.copy(z.centroid);S.multiplyVector3(b.centroidWorld);b.centroidScreen.copy(b.centroidWorld);p.multiplyVector3(b.centroidScreen);b.z=b.centroidScreen.z;b.meshMaterials=M;b.faceMaterials=z.materials;b.overdraw=I;if(C.geometry.uvs[D]){b.uvs[0]=C.geometry.uvs[D][0];
-b.uvs[1]=C.geometry.uvs[D][1];b.uvs[2]=C.geometry.uvs[D][3]}q.push(b);o++;n=k[o]=k[o]||new THREE.RenderableFace3;n.v1.positionWorld.copy(N.positionWorld);n.v2.positionWorld.copy(Q.positionWorld);n.v3.positionWorld.copy(V.positionWorld);n.v1.positionScreen.copy(N.positionScreen);n.v2.positionScreen.copy(Q.positionScreen);n.v3.positionScreen.copy(V.positionScreen);n.normalWorld.copy(b.normalWorld);n.centroidWorld.copy(b.centroidWorld);n.centroidScreen.copy(b.centroidScreen);n.z=n.centroidScreen.z;n.meshMaterials=
-M;n.faceMaterials=z.materials;n.overdraw=I;if(C.geometry.uvs[D]){n.uvs[0]=C.geometry.uvs[D][1];n.uvs[1]=C.geometry.uvs[D][2];n.uvs[2]=C.geometry.uvs[D][3]}q.push(n);o++}}}}else if(C instanceof THREE.Line){h.multiply(p,S);P=C.geometry.vertices;z=P[0];z.positionScreen.copy(z.position);h.multiplyVector4(z.positionScreen);D=1;for(T=P.length;D<T;D++){E=P[D];E.positionScreen.copy(E.position);h.multiplyVector4(E.positionScreen);N=P[D-1];f.copy(E.positionScreen);j.copy(N.positionScreen);if(c(f,j)){f.multiplyScalar(1/
-f.w);j.multiplyScalar(1/j.w);m=x[y]=x[y]||new THREE.RenderableLine;m.v1.positionScreen.copy(f);m.v2.positionScreen.copy(j);m.z=Math.max(f.z,j.z);m.materials=C.materials;q.push(m);y++}}}else if(C instanceof THREE.Particle){K.set(C.position.x,C.position.y,C.position.z,1);p.multiplyVector4(K);K.z/=K.w;if(K.z>0&&K.z<1){s=H[w]=H[w]||new THREE.RenderableParticle;s.x=K.x/K.w;s.y=K.y/K.w;s.z=K.z;s.rotation=C.rotation.z;s.scale.x=C.scale.x*Math.abs(s.x-(K.x+l.projectionMatrix.n11)/(K.w+l.projectionMatrix.n14));
-s.scale.y=C.scale.y*Math.abs(s.y-(K.y+l.projectionMatrix.n22)/(K.w+l.projectionMatrix.n24));s.materials=C.materials;q.push(s);w++}}}}A&&q.sort(a);return q};this.unprojectVector=function(u,l){var A=THREE.Matrix4.makeInvert(l.matrix);A.multiplySelf(THREE.Matrix4.makeInvert(l.projectionMatrix));A.multiplyVector3(u);return u}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,i,b;this.domElement=document.createElement("div");this.setSize=function(n,o){d=n;e=o;i=d/2;b=e/2};this.render=function(n,o){var k,m,y,x,s,w,H,J;a=c.projectScene(n,o);k=0;for(m=a.length;k<m;k++){s=a[k];if(s instanceof THREE.RenderableParticle){H=s.x*i+i;J=s.y*b+b;y=0;for(x=s.material.length;y<x;y++){w=s.material[y];if(w instanceof THREE.ParticleDOMMaterial){w=w.domElement;w.style.left=H+"px";w.style.top=J+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(ea){if(s!=ea)m.globalAlpha=s=ea}function c(ea){if(w!=ea){switch(ea){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}w=ea}}var d=null,e=new THREE.Projector,i=document.createElement("canvas"),b,n,o,k,m=i.getContext("2d"),y=new THREE.Color(0),x=0,s=1,w=0,H=null,J=null,K=1,p,h,g,f,j,t,u,l,A,q=new THREE.Color,
-G=new THREE.Color,r=new THREE.Color,v=new THREE.Color,D=new THREE.Color,T,E,N,U,C,S,Y,M,I,L=new THREE.Rectangle,P=new THREE.Rectangle,z=new THREE.Rectangle,Q=false,V=new THREE.Color,X=new THREE.Color,fa=new THREE.Color,aa=new THREE.Color,ya=Math.PI*2,$=new THREE.Vector3,ca,oa,ta,ia,ua,za,ra=16;ca=document.createElement("canvas");ca.width=ca.height=2;oa=ca.getContext("2d");oa.fillStyle="rgba(0,0,0,1)";oa.fillRect(0,0,2,2);ta=oa.getImageData(0,0,2,2);ia=ta.data;ua=document.createElement("canvas");ua.width=
-ua.height=ra;za=ua.getContext("2d");za.translate(-ra/2,-ra/2);za.scale(ra,ra);ra--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ea,pa){b=ea;n=pa;o=b/2;k=n/2;i.width=b;i.height=n;L.set(-o,-k,o,k);s=1;w=0;J=H=null;K=1};this.setClearColor=function(ea,pa){y.setHex(ea);x=pa;P.set(-o,-k,o,k);m.setTransform(1,0,0,-1,o,k);this.clear()};this.clear=function(){if(!P.isEmpty()){P.inflate(1);P.minSelf(L);if(y.hex==0&&x==0)m.clearRect(P.getX(),P.getY(),P.getWidth(),
-P.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+x+")";m.fillRect(P.getX(),P.getY(),P.getWidth(),P.getHeight())}P.empty()}};this.render=function(ea,pa){function Ma(B){var W,R,F,O=B.lights;X.setRGB(0,0,0);fa.setRGB(0,0,0);aa.setRGB(0,0,0);B=0;for(W=O.length;B<W;B++){R=O[B];F=R.color;if(R instanceof THREE.AmbientLight){X.r+=F.r;X.g+=F.g;X.b+=F.b}else if(R instanceof THREE.DirectionalLight){fa.r+=F.r;fa.g+=F.g;
-fa.b+=F.b}else if(R instanceof THREE.PointLight){aa.r+=F.r;aa.g+=F.g;aa.b+=F.b}}}function Aa(B,W,R,F){var O,Z,da,ga,ha=B.lights;B=0;for(O=ha.length;B<O;B++){Z=ha[B];da=Z.color;ga=Z.intensity;if(Z instanceof THREE.DirectionalLight){Z=R.dot(Z.position)*ga;if(Z>0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}else if(Z instanceof THREE.PointLight){$.sub(Z.position,W);$.normalize();Z=R.dot($)*ga;if(Z>0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}}}function Na(B,W,R){if(R.opacity!=0){a(R.opacity);c(R.blending);var F,
-O,Z,da,ga,ha;if(R instanceof THREE.ParticleBasicMaterial){if(R.map){da=R.map;ga=da.width>>1;ha=da.height>>1;O=W.scale.x*o;Z=W.scale.y*k;R=O*ga;F=Z*ha;z.set(B.x-R,B.y-F,B.x+R,B.y+F);if(L.instersects(z)){m.save();m.translate(B.x,B.y);m.rotate(-W.rotation);m.scale(O,-Z);m.translate(-ga,-ha);m.drawImage(da,0,0);m.restore()}}}else if(R instanceof THREE.ParticleCircleMaterial){if(Q){V.r=X.r+fa.r+aa.r;V.g=X.g+fa.g+aa.g;V.b=X.b+fa.b+aa.b;q.r=R.color.r*V.r;q.g=R.color.g*V.g;q.b=R.color.b*V.b;q.updateStyleString()}else q.__styleString=
-R.color.__styleString;R=W.scale.x*o;F=W.scale.y*k;z.set(B.x-R,B.y-F,B.x+R,B.y+F);if(L.instersects(z)){O=q.__styleString;if(J!=O)m.fillStyle=J=O;m.save();m.translate(B.x,B.y);m.rotate(-W.rotation);m.scale(R,F);m.beginPath();m.arc(0,0,1,0,ya,true);m.closePath();m.fill();m.restore()}}}}function Oa(B,W,R,F){if(F.opacity!=0){a(F.opacity);c(F.blending);m.beginPath();m.moveTo(B.positionScreen.x,B.positionScreen.y);m.lineTo(W.positionScreen.x,W.positionScreen.y);m.closePath();if(F instanceof THREE.LineBasicMaterial){q.__styleString=
-F.color.__styleString;B=F.linewidth;if(K!=B)m.lineWidth=K=B;B=q.__styleString;if(H!=B)m.strokeStyle=H=B;m.stroke();z.inflate(F.linewidth*2)}}}function Ia(B,W,R,F,O,Z){if(O.opacity!=0){a(O.opacity);c(O.blending);f=B.positionScreen.x;j=B.positionScreen.y;t=W.positionScreen.x;u=W.positionScreen.y;l=R.positionScreen.x;A=R.positionScreen.y;m.beginPath();m.moveTo(f,j);m.lineTo(t,u);m.lineTo(l,A);m.lineTo(f,j);m.closePath();if(O instanceof THREE.MeshBasicMaterial)if(O.map)O.map.image.loaded&&O.map.mapping instanceof
-THREE.UVMapping&&va(f,j,t,u,l,A,O.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);else if(O.env_map){if(O.env_map.image.loaded)if(O.env_map.mapping instanceof THREE.SphericalReflectionMapping){B=pa.matrix;$.copy(F.vertexNormalsWorld[0]);U=($.x*B.n11+$.y*B.n12+$.z*B.n13)*0.5+0.5;C=-($.x*B.n21+$.y*B.n22+$.z*B.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[1]);S=($.x*B.n11+$.y*B.n12+$.z*B.n13)*0.5+0.5;Y=-($.x*B.n21+$.y*B.n22+$.z*B.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[2]);M=
-($.x*B.n11+$.y*B.n12+$.z*B.n13)*0.5+0.5;I=-($.x*B.n21+$.y*B.n22+$.z*B.n23)*0.5+0.5;va(f,j,t,u,l,A,O.env_map.image,U,C,S,Y,M,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&&va(f,j,t,u,l,A,O.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);c(THREE.SubtractiveBlending)}if(Q)if(!O.wireframe&&O.shading==THREE.SmoothShading&&
-F.vertexNormalsWorld.length==3){G.r=r.r=v.r=X.r;G.g=r.g=v.g=X.g;G.b=r.b=v.b=X.b;Aa(Z,F.v1.positionWorld,F.vertexNormalsWorld[0],G);Aa(Z,F.v2.positionWorld,F.vertexNormalsWorld[1],r);Aa(Z,F.v3.positionWorld,F.vertexNormalsWorld[2],v);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,t,u,l,A,N,0,0,1,0,0,1)}else{V.r=X.r;V.g=X.g;V.b=X.b;Aa(Z,F.centroidWorld,F.normalWorld,V);q.r=O.color.r*V.r;q.g=O.color.g*V.g;q.b=O.color.b*V.b;q.updateStyleString();O.wireframe?Ba(q.__styleString,
-O.wireframe_linewidth):Ca(q.__styleString)}else O.wireframe?Ba(O.color.__styleString,O.wireframe_linewidth):Ca(O.color.__styleString)}else if(O instanceof THREE.MeshDepthMaterial){T=pa.near;E=pa.far;G.r=G.g=G.b=1-Ea(B.positionScreen.z,T,E);r.r=r.g=r.b=1-Ea(W.positionScreen.z,T,E);v.r=v.g=v.b=1-Ea(R.positionScreen.z,T,E);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,t,u,l,A,N,0,0,1,0,0,1)}else if(O instanceof THREE.MeshNormalMaterial){q.r=Fa(F.normalWorld.x);q.g=Fa(F.normalWorld.y);
-q.b=Fa(F.normalWorld.z);q.updateStyleString();O.wireframe?Ba(q.__styleString,O.wireframe_linewidth):Ca(q.__styleString)}}}function Ba(B,W){if(H!=B)m.strokeStyle=H=B;if(K!=W)m.lineWidth=K=W;m.stroke();z.inflate(W*2)}function Ca(B){if(J!=B)m.fillStyle=J=B;m.fill()}function va(B,W,R,F,O,Z,da,ga,ha,la,ja,ma,wa){var qa,na;qa=da.width-1;na=da.height-1;ga*=qa;ha*=na;la*=qa;ja*=na;ma*=qa;wa*=na;R-=B;F-=W;O-=B;Z-=W;la-=ga;ja-=ha;ma-=ga;wa-=ha;na=1/(la*wa-ma*ja);qa=(wa*R-ja*O)*na;ja=(wa*F-ja*Z)*na;R=(la*O-
-ma*R)*na;F=(la*Z-ma*F)*na;B=B-qa*ga-R*ha;W=W-ja*ga-F*ha;m.save();m.transform(qa,ja,R,F,B,W);m.clip();m.drawImage(da,0,0);m.restore()}function Ja(B,W,R,F){var O=~~(B.r*255),Z=~~(B.g*255);B=~~(B.b*255);var da=~~(W.r*255),ga=~~(W.g*255);W=~~(W.b*255);var ha=~~(R.r*255),la=~~(R.g*255);R=~~(R.b*255);var ja=~~(F.r*255),ma=~~(F.g*255);F=~~(F.b*255);ia[0]=O<0?0:O>255?255:O;ia[1]=Z<0?0:Z>255?255:Z;ia[2]=B<0?0:B>255?255:B;ia[4]=da<0?0:da>255?255:da;ia[5]=ga<0?0:ga>255?255:ga;ia[6]=W<0?0:W>255?255:W;ia[8]=ha<
-0?0:ha>255?255:ha;ia[9]=la<0?0:la>255?255:la;ia[10]=R<0?0:R>255?255:R;ia[12]=ja<0?0:ja>255?255:ja;ia[13]=ma<0?0:ma>255?255:ma;ia[14]=F<0?0:F>255?255:F;oa.putImageData(ta,0,0);za.drawImage(ca,0,0);return ua}function Ea(B,W,R){B=(B-W)/(R-W);return B*B*(3-2*B)}function Fa(B){B=(B+1)*0.5;return B<0?0:B>1?1:B}function Ga(B,W){var R=W.x-B.x,F=W.y-B.y,O=1/Math.sqrt(R*R+F*F);R*=O;F*=O;W.x+=R;W.y+=F;B.x-=R;B.y-=F}var Da,Ka,ba,ka,sa,Ha,La,xa;m.setTransform(1,0,0,-1,o,k);this.autoClear&&this.clear();d=e.projectScene(ea,
-pa,this.sortElements);(Q=ea.lights.length>0)&&Ma(ea);Da=0;for(Ka=d.length;Da<Ka;Da++){ba=d[Da];z.empty();if(ba instanceof THREE.RenderableParticle){p=ba;p.x*=o;p.y*=k;ka=0;for(sa=ba.materials.length;ka<sa;ka++)Na(p,ba,ba.materials[ka],ea)}else if(ba instanceof THREE.RenderableLine){p=ba.v1;h=ba.v2;p.positionScreen.x*=o;p.positionScreen.y*=k;h.positionScreen.x*=o;h.positionScreen.y*=k;z.addPoint(p.positionScreen.x,p.positionScreen.y);z.addPoint(h.positionScreen.x,h.positionScreen.y);if(L.instersects(z)){ka=
-0;for(sa=ba.materials.length;ka<sa;)Oa(p,h,ba,ba.materials[ka++],ea)}}else if(ba instanceof THREE.RenderableFace3){p=ba.v1;h=ba.v2;g=ba.v3;p.positionScreen.x*=o;p.positionScreen.y*=k;h.positionScreen.x*=o;h.positionScreen.y*=k;g.positionScreen.x*=o;g.positionScreen.y*=k;if(ba.overdraw){Ga(p.positionScreen,h.positionScreen);Ga(h.positionScreen,g.positionScreen);Ga(g.positionScreen,p.positionScreen)}z.add3Points(p.positionScreen.x,p.positionScreen.y,h.positionScreen.x,h.positionScreen.y,g.positionScreen.x,
-g.positionScreen.y);if(L.instersects(z)){ka=0;for(sa=ba.meshMaterials.length;ka<sa;){xa=ba.meshMaterials[ka++];if(xa instanceof THREE.MeshFaceMaterial){Ha=0;for(La=ba.faceMaterials.length;Ha<La;)(xa=ba.faceMaterials[Ha++])&&Ia(p,h,g,ba,xa,ea)}else Ia(p,h,g,ba,xa,ea)}}}P.addRectangle(z)}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(U,C,S){var Y,M,I,L;Y=0;for(M=U.lights.length;Y<M;Y++){I=U.lights[Y];if(I instanceof THREE.DirectionalLight){L=C.normalWorld.dot(I.position)*I.intensity;if(L>0){S.r+=I.color.r*L;S.g+=I.color.g*L;S.b+=I.color.b*L}}else if(I instanceof THREE.PointLight){A.sub(I.position,C.centroidWorld);A.normalize();L=C.normalWorld.dot(A)*I.intensity;if(L>0){S.r+=I.color.r*L;S.g+=I.color.g*L;S.b+=I.color.b*L}}}}function c(U,C,S,Y,M,I){v=e(D++);v.setAttribute("d","M "+U.positionScreen.x+
-" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(I,Y,f);g.r=M.color.r*f.r;g.g=M.color.g*f.g;g.b=M.color.b*f.b;g.updateStyleString()}else g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){l=1-M.__2near/(M.__farPlusNear-Y.z*M.__farMinusNear);
-g.setRGB(l,l,l)}else M instanceof THREE.MeshNormalMaterial&&g.setRGB(i(Y.normalWorld.x),i(Y.normalWorld.y),i(Y.normalWorld.z));M.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+M.opacity);o.appendChild(v)}function d(U,C,S,Y,M,I,L){v=e(D++);v.setAttribute("d",
-"M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(L,M,f);g.r=I.color.r*f.r;g.g=I.color.g*f.g;g.b=I.color.b*f.b;g.updateStyleString()}else g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){l=
-1-I.__2near/(I.__farPlusNear-M.z*I.__farMinusNear);g.setRGB(l,l,l)}else I instanceof THREE.MeshNormalMaterial&&g.setRGB(i(M.normalWorld.x),i(M.normalWorld.y),i(M.normalWorld.z));I.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+I.opacity);o.appendChild(v)}
-function e(U){if(q[U]==null){q[U]=document.createElementNS("http://www.w3.org/2000/svg","path");N==0&&q[U].setAttribute("shape-rendering","crispEdges");return q[U]}return q[U]}function i(U){return U<0?Math.min((1+U)*0.5,0.5):0.5+Math.min(U*0.5,0.5)}var b=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,y,x,s,w,H,J,K=new THREE.Rectangle,p=new THREE.Rectangle,h=false,g=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),t=new THREE.Color(0),
-u=new THREE.Color(0),l,A=new THREE.Vector3,q=[],G=[],r=[],v,D,T,E,N=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(U){switch(U){case "high":N=1;break;case "low":N=0}};this.setSize=function(U,C){k=U;m=C;y=k/2;x=m/2;o.setAttribute("viewBox",-y+" "+-x+" "+k+" "+m);o.setAttribute("width",k);o.setAttribute("height",m);K.set(-y,-x,y,x)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(U,C){var S,Y,
-M,I,L,P,z,Q;this.autoClear&&this.clear();b=n.projectScene(U,C,this.sortElements);E=T=D=0;if(h=U.lights.length>0){z=U.lights;j.setRGB(0,0,0);t.setRGB(0,0,0);u.setRGB(0,0,0);S=0;for(Y=z.length;S<Y;S++){M=z[S];I=M.color;if(M instanceof THREE.AmbientLight){j.r+=I.r;j.g+=I.g;j.b+=I.b}else if(M instanceof THREE.DirectionalLight){t.r+=I.r;t.g+=I.g;t.b+=I.b}else if(M instanceof THREE.PointLight){u.r+=I.r;u.g+=I.g;u.b+=I.b}}}S=0;for(Y=b.length;S<Y;S++){z=b[S];p.empty();if(z instanceof THREE.RenderableParticle){s=
-z;s.x*=y;s.y*=-x;M=0;for(I=z.materials.length;M<I;M++)if(Q=z.materials[M]){L=s;P=z;Q=Q;var V=T++;if(G[V]==null){G[V]=document.createElementNS("http://www.w3.org/2000/svg","circle");N==0&&G[V].setAttribute("shape-rendering","crispEdges")}v=G[V];v.setAttribute("cx",L.x);v.setAttribute("cy",L.y);v.setAttribute("r",P.scale.x*y);if(Q instanceof THREE.ParticleCircleMaterial){if(h){f.r=j.r+t.r+u.r;f.g=j.g+t.g+u.g;f.b=j.b+t.b+u.b;g.r=Q.color.r*f.r;g.g=Q.color.g*f.g;g.b=Q.color.b*f.b;g.updateStyleString()}else g=
-Q.color;v.setAttribute("style","fill: "+g.__styleString)}o.appendChild(v)}}else if(z instanceof THREE.RenderableLine){s=z.v1;w=z.v2;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);if(K.instersects(p)){M=0;for(I=z.materials.length;M<I;)if(Q=z.materials[M++]){L=s;P=w;Q=Q;V=E++;if(r[V]==null){r[V]=document.createElementNS("http://www.w3.org/2000/svg","line");N==
-0&&r[V].setAttribute("shape-rendering","crispEdges")}v=r[V];v.setAttribute("x1",L.positionScreen.x);v.setAttribute("y1",L.positionScreen.y);v.setAttribute("x2",P.positionScreen.x);v.setAttribute("y2",P.positionScreen.y);if(Q instanceof THREE.LineBasicMaterial){g.__styleString=Q.color.__styleString;v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+Q.linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.linecap+"; stroke-linejoin: "+Q.linejoin);o.appendChild(v)}}}}else if(z instanceof
-THREE.RenderableFace3){s=z.v1;w=z.v2;H=z.v3;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;H.positionScreen.x*=y;H.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);if(K.instersects(p)){M=0;for(I=z.meshMaterials.length;M<I;){Q=z.meshMaterials[M++];if(Q instanceof THREE.MeshFaceMaterial){L=0;for(P=z.faceMaterials.length;L<P;)(Q=z.faceMaterials[L++])&&
-c(s,w,H,z,Q,U)}else Q&&c(s,w,H,z,Q,U)}}}else if(z instanceof THREE.RenderableFace4){s=z.v1;w=z.v2;H=z.v3;J=z.v4;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;H.positionScreen.x*=y;H.positionScreen.y*=-x;J.positionScreen.x*=y;J.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);p.addPoint(J.positionScreen.x,J.positionScreen.y);if(K.instersects(p)){M=
-0;for(I=z.meshMaterials.length;M<I;){Q=z.meshMaterials[M++];if(Q instanceof THREE.MeshFaceMaterial){L=0;for(P=z.faceMaterials.length;L<P;)(Q=z.faceMaterials[L++])&&d(s,w,H,J,z,Q,U)}else Q&&d(s,w,H,J,z,Q,U)}}}}}};
-THREE.WebGLRenderer=function(a){function c(h,g){h.fragment_shader=g.fragment_shader;h.vertex_shader=g.vertex_shader;h.uniforms=Uniforms.clone(g.uniforms)}function d(h,g){var f;if(h=="fragment")f=b.createShader(b.FRAGMENT_SHADER);else if(h=="vertex")f=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,g);b.compileShader(f);if(!b.getShaderParameter(f,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(f));return null}return f}function e(h){switch(h){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 i=document.createElement("canvas"),b,n=null,o=null,k=new THREE.Matrix4,m,y=new Float32Array(16),x=new Float32Array(16),
-s=new Float32Array(16),w=new Float32Array(9),H=new Float32Array(16),J=true,K=new THREE.Color(0),p=0;if(a){if(a.antialias!==undefined)J=a.antialias;a.clearColor!==undefined&&K.setHex(a.clearColor);if(a.clearAlpha!==undefined)p=a.clearAlpha}this.domElement=i;this.autoClear=true;(function(h,g,f){try{b=i.getContext("experimental-webgl",{antialias:h})}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,f)})(J,K,p);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(h,g){i.width=h;i.height=g;b.viewport(0,0,i.width,i.height)};this.setClearColor=function(h,g){var f=new THREE.Color(h);b.clearColor(f.r,f.g,f.b,g)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|
-b.DEPTH_BUFFER_BIT)};this.setupLights=function(h,g){var f,j,t,u=0,l=0,A=0,q,G,r,v=this.lights,D=v.directional.colors,T=v.directional.positions,E=v.point.colors,N=v.point.positions,U=0,C=0;f=0;for(j=g.length;f<j;f++){t=g[f];q=t.color;G=t.position;r=t.intensity;if(t instanceof THREE.AmbientLight){u+=q.r;l+=q.g;A+=q.b}else if(t instanceof THREE.DirectionalLight){D[U*3]=q.r*r;D[U*3+1]=q.g*r;D[U*3+2]=q.b*r;T[U*3]=G.x;T[U*3+1]=G.y;T[U*3+2]=G.z;U+=1}else if(t instanceof THREE.PointLight){E[C*3]=q.r*r;E[C*
-3+1]=q.g*r;E[C*3+2]=q.b*r;N[C*3]=G.x;N[C*3+1]=G.y;N[C*3+2]=G.z;C+=1}}v.point.length=C;v.directional.length=U;v.ambient[0]=u;v.ambient[1]=l;v.ambient[2]=A};this.createParticleBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLNormalBuffer=b.createBuffer();h.__webGLTangentBuffer=
-b.createBuffer();h.__webGLUVBuffer=b.createBuffer();h.__webGLFaceBuffer=b.createBuffer();h.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(h){var g=h.vertices.length;h.__vertexArray=new Float32Array(g*3);h.__lineArray=new Uint16Array(g);h.__webGLLineCount=g};this.initMeshBuffers=function(h,g){var f,j,t=0,u=0,l=0,A=g.geometry.faces,q=h.faces;f=0;for(j=q.length;f<j;f++){fi=q[f];face=A[fi];if(face instanceof THREE.Face3){t+=3;u+=1;l+=3}else if(face instanceof THREE.Face4){t+=4;u+=2;
-l+=4}}h.__vertexArray=new Float32Array(t*3);h.__normalArray=new Float32Array(t*3);h.__tangentArray=new Float32Array(t*4);h.__uvArray=new Float32Array(t*2);h.__faceArray=new Uint16Array(u*3);h.__lineArray=new Uint16Array(l*2);t=false;f=0;for(j=g.materials.length;f<j;f++){A=g.materials[f];if(A instanceof THREE.MeshFaceMaterial){A=0;for(q=h.materials.length;A<q;A++)if(h.materials[A]&&h.materials[A].shading!=undefined&&h.materials[A].shading==THREE.SmoothShading){t=true;break}}else if(A&&A.shading!=undefined&&
-A.shading==THREE.SmoothShading){t=true;break}if(t)break}h.__needsSmoothNormals=t;h.__webGLFaceCount=u*3;h.__webGLLineCount=l*2};this.setMeshBuffers=function(h,g,f,j,t,u,l,A){var q,G,r,v,D,T,E,N,U,C=0,S=0,Y=0,M=0,I=0,L=0,P=0,z=h.__vertexArray,Q=h.__uvArray,V=h.__normalArray,X=h.__tangentArray,fa=h.__faceArray,aa=h.__lineArray,ya=h.__needsSmoothNormals,$=g.geometry,ca=$.vertices,oa=h.faces,ta=$.faces,ia=$.uvs;g=0;for(q=oa.length;g<q;g++){G=oa[g];r=ta[G];G=ia[G];v=r.vertexNormals;D=r.normal;if(r instanceof
-THREE.Face3){if(j){T=ca[r.a].position;E=ca[r.b].position;N=ca[r.c].position;z[S]=T.x;z[S+1]=T.y;z[S+2]=T.z;z[S+3]=E.x;z[S+4]=E.y;z[S+5]=E.z;z[S+6]=N.x;z[S+7]=N.y;z[S+8]=N.z;S+=9}if(A&&$.hasTangents){T=ca[r.a].tangent;E=ca[r.b].tangent;N=ca[r.c].tangent;X[L]=T.x;X[L+1]=T.y;X[L+2]=T.z;X[L+3]=T.w;X[L+4]=E.x;X[L+5]=E.y;X[L+6]=E.z;X[L+7]=E.w;X[L+8]=N.x;X[L+9]=N.y;X[L+10]=N.z;X[L+11]=N.w;L+=12}if(l)if(v.length==3&&ya)for(r=0;r<3;r++){D=v[r];V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}else for(r=0;r<3;r++){V[I]=
-D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}if(u&&G)for(r=0;r<3;r++){v=G[r];Q[Y]=v.u;Q[Y+1]=v.v;Y+=2}if(t){fa[M]=C;fa[M+1]=C+1;fa[M+2]=C+2;M+=3;aa[P]=C;aa[P+1]=C+1;aa[P+2]=C;aa[P+3]=C+2;aa[P+4]=C+1;aa[P+5]=C+2;P+=6;C+=3}}else if(r instanceof THREE.Face4){if(j){T=ca[r.a].position;E=ca[r.b].position;N=ca[r.c].position;U=ca[r.d].position;z[S]=T.x;z[S+1]=T.y;z[S+2]=T.z;z[S+3]=E.x;z[S+4]=E.y;z[S+5]=E.z;z[S+6]=N.x;z[S+7]=N.y;z[S+8]=N.z;z[S+9]=U.x;z[S+10]=U.y;z[S+11]=U.z;S+=12}if(A&&$.hasTangents){T=ca[r.a].tangent;
-E=ca[r.b].tangent;N=ca[r.c].tangent;r=ca[r.d].tangent;X[L]=T.x;X[L+1]=T.y;X[L+2]=T.z;X[L+3]=T.w;X[L+4]=E.x;X[L+5]=E.y;X[L+6]=E.z;X[L+7]=E.w;X[L+8]=N.x;X[L+9]=N.y;X[L+10]=N.z;X[L+11]=N.w;X[L+12]=r.x;X[L+13]=r.y;X[L+14]=r.z;X[L+15]=r.w;L+=16}if(l)if(v.length==4&&ya)for(r=0;r<4;r++){D=v[r];V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}else for(r=0;r<4;r++){V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}if(u&&G)for(r=0;r<4;r++){v=G[r];Q[Y]=v.u;Q[Y+1]=v.v;Y+=2}if(t){fa[M]=C;fa[M+1]=C+1;fa[M+2]=C+2;fa[M+3]=C;fa[M+4]=C+2;fa[M+
-5]=C+3;M+=6;aa[P]=C;aa[P+1]=C+1;aa[P+2]=C;aa[P+3]=C+3;aa[P+4]=C+1;aa[P+5]=C+2;aa[P+6]=C+2;aa[P+7]=C+3;P+=8;C+=4}}}if(j){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,z,f)}if(l){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,V,f)}if(A&&$.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,X,f)}if(u&&Y>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Q,f)}if(t){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-h.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,f);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,f)}};this.setLineBuffers=function(h,g,f,j){var t,u,l=h.vertices,A=l.length,q=h.__vertexArray,G=h.__lineArray;if(f)for(f=0;f<A;f++){t=l[f].position;u=f*3;q[u]=t.x;q[u+1]=t.y;q[u+2]=t.z}if(j)for(f=0;f<A;f++)G[f]=f;b.bindBuffer(b.ARRAY_BUFFER,h.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,q,g);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);
-b.bufferData(b.ELEMENT_ARRAY_BUFFER,G,g)};this.setParticleBuffers=function(){};this.initMaterial=function(h,g,f){if(!h.program){var j,t;if(h instanceof THREE.MeshDepthMaterial)c(h,THREE.ShaderLib.depth);else if(h instanceof THREE.MeshNormalMaterial)c(h,THREE.ShaderLib.normal);else if(h instanceof THREE.MeshBasicMaterial)c(h,THREE.ShaderLib.basic);else if(h instanceof THREE.MeshLambertMaterial)c(h,THREE.ShaderLib.lambert);else if(h instanceof THREE.MeshPhongMaterial)c(h,THREE.ShaderLib.phong);else h instanceof
-THREE.LineBasicMaterial&&c(h,THREE.ShaderLib.basic);var u,l,A,q;t=A=q=0;for(u=g.length;t<u;t++){l=g[t];l instanceof THREE.DirectionalLight&&A++;l instanceof THREE.PointLight&&q++}if(q+A<=4){g=A;q=q}else{g=Math.ceil(4*A/(q+A));q=4-g}t={directional:g,point:q};q=h.fragment_shader;g=h.vertex_shader;u={fog:f,map:h.map,env_map:h.env_map,maxDirLights:t.directional,maxPointLights:t.point};f=b.createProgram();t=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+
-u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.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(f,d("fragment",t+q));b.attachShader(f,d("vertex",u+g));b.linkProgram(f);b.getProgramParameter(f,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(f,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");f.uniforms={};f.attributes={};h.program=f;f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(j in h.uniforms)f.push(j);j=h.program;q=0;for(g=f.length;q<g;q++){t=f[q];j.uniforms[t]=b.getUniformLocation(j,
-t)}h=h.program;j=["position","normal","uv","tangent"];f=0;for(q=j.length;f<q;f++){g=j[f];h.attributes[g]=b.getAttribLocation(h,g)}}};this.renderBuffer=function(h,g,f,j,t,u){var l;this.initMaterial(j,g,f);l=j.program;if(l!=n){b.useProgram(l);n=l}this.loadCamera(l,h);this.loadMatrices(l);if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){this.setupLights(l,g);g=this.lights;j.uniforms.enableLighting.value=g.directional.length+g.point.length;j.uniforms.ambientLightColor.value=
-g.ambient;j.uniforms.directionalLightColor.value=g.directional.colors;j.uniforms.directionalLightDirection.value=g.directional.positions;j.uniforms.pointLightColor.value=g.point.colors;j.uniforms.pointLightPosition.value=g.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){j.uniforms.color.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);j.uniforms.opacity.value=j.opacity;j.uniforms.map.texture=
-j.map;j.uniforms.env_map.texture=j.env_map;j.uniforms.reflectivity.value=j.reflectivity;j.uniforms.refraction_ratio.value=j.refraction_ratio;j.uniforms.combine.value=j.combine;j.uniforms.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping;if(f){j.uniforms.fogColor.value.setHex(f.color.hex);if(f instanceof THREE.Fog){j.uniforms.fogNear.value=f.near;j.uniforms.fogFar.value=f.far}else if(f instanceof THREE.FogExp2)j.uniforms.fogDensity.value=f.density}}if(j instanceof
-THREE.LineBasicMaterial){j.uniforms.color.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);j.uniforms.opacity.value=j.opacity;if(f){j.uniforms.fogColor.value.setHex(f.color.hex);if(f instanceof THREE.Fog){j.uniforms.fogNear.value=f.near;j.uniforms.fogFar.value=f.far}else if(f instanceof THREE.FogExp2)j.uniforms.fogDensity.value=f.density}}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}if(j instanceof THREE.MeshDepthMaterial){j.uniforms.mNear.value=h.near;j.uniforms.mFar.value=h.far}h=j.uniforms;var A,q,G;for(A in h)if(G=l.uniforms[A]){g=h[A];q=g.type;f=g.value;if(q=="i")b.uniform1i(G,f);else if(q=="f")b.uniform1f(G,f);else if(q=="fv1")b.uniform1fv(G,f);else if(q=="fv")b.uniform3fv(G,f);else if(q=="v2")b.uniform2f(G,f.x,f.y);else if(q=="v3")b.uniform3f(G,f.x,f.y,f.z);else if(q=="c")b.uniform3f(G,f.r,f.g,f.b);else if(q==
-"t"){b.uniform1i(G,f);if(g=g.texture)if(g.image instanceof Array&&g.image.length==6){g=g;f=f;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(q=0;q<6;++q)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,g.image[q]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);g.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+f);b.bindTexture(b.TEXTURE_CUBE_MAP,g.image.__webGLTextureCube)}}else{g=g;f=f;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,e(g.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(g.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(g.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(g.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+f);b.bindTexture(b.TEXTURE_2D,g.__webGLTexture)}}}l=l.attributes;b.bindBuffer(b.ARRAY_BUFFER,
-t.__webGLVertexBuffer);b.vertexAttribPointer(l.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.position);if(l.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLNormalBuffer);b.vertexAttribPointer(l.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.normal)}if(l.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLTangentBuffer);b.vertexAttribPointer(l.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.tangent)}if(l.uv>=0)if(t.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLUVBuffer);
-b.vertexAttribPointer(l.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.uv)}else b.disableVertexAttribArray(l.uv);if(j.wireframe||j instanceof THREE.LineBasicMaterial){l=j.wireframe_linewidth!==undefined?j.wireframe_linewidth:j.linewidth!==undefined?j.linewidth:1;j=j instanceof THREE.LineBasicMaterial&&u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(l);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);b.drawElements(j,t.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-t.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,t.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(h,g,f,j,t,u,l){var A,q,G,r,v;G=0;for(r=j.materials.length;G<r;G++){A=j.materials[G];if(A instanceof THREE.MeshFaceMaterial){A=0;for(q=t.materials.length;A<q;A++)if((v=t.materials[A])&&v.blending==u&&v.opacity<1==l){this.setBlending(v.blending);this.renderBuffer(h,g,f,v,t,j)}}else if((v=A)&&v.blending==u&&v.opacity<1==l){this.setBlending(v.blending);this.renderBuffer(h,g,f,v,t,j)}}};this.render=
-function(h,g,f,j){var t,u,l,A=h.lights,q=h.fog;this.initWebGLObjects(h);j=j!==undefined?j:true;if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=b.createFramebuffer();f.__webGLRenderbuffer=b.createRenderbuffer();f.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,f.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,f.width,f.height);b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(f.wrap_s));b.texParameteri(b.TEXTURE_2D,
-b.TEXTURE_WRAP_T,e(f.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(f.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(f.min_filter));b.texImage2D(b.TEXTURE_2D,0,e(f.format),f.width,f.height,0,e(f.format),e(f.type),null);b.bindFramebuffer(b.FRAMEBUFFER,f.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,f.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,f.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,
-null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(f){t=f.__webGLFramebuffer;l=f.width;u=f.height}else{t=null;l=i.width;u=i.height}if(t!=o){b.bindFramebuffer(b.FRAMEBUFFER,t);b.viewport(0,0,l,u);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);o=t}this.autoClear&&this.clear();g.autoUpdateMatrix&&g.updateMatrix();y.set(g.matrix.flatten());s.set(g.projectionMatrix.flatten());j=0;for(t=h.__webGLObjects.length;j<t;j++){u=h.__webGLObjects[j];l=u.object;u=u.buffer;if(l.visible){this.setupMatrices(l,
-g);this.renderPass(g,A,q,l,u,THREE.NormalBlending,false)}}j=0;for(t=h.__webGLObjects.length;j<t;j++){u=h.__webGLObjects[j];l=u.object;u=u.buffer;if(l.visible){this.setupMatrices(l,g);if(l.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);l.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}this.renderPass(g,A,q,l,u,THREE.AdditiveBlending,false);this.renderPass(g,A,q,l,u,THREE.SubtractiveBlending,false);this.renderPass(g,A,q,l,u,THREE.AdditiveBlending,true);this.renderPass(g,A,q,l,u,THREE.SubtractiveBlending,
-true);this.renderPass(g,A,q,l,u,THREE.NormalBlending,true)}}if(f&&f.min_filter!==THREE.NearestFilter&&f.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(h){function g(G,r,v,D){if(G[r]==undefined){h.__webGLObjects.push({buffer:v,object:D});G[r]=1}}var f,j,t,u,l,A,q;if(!h.__webGLObjects){h.__webGLObjects=[];h.__webGLObjectsMap={}}f=0;for(j=h.objects.length;f<j;f++){t=h.objects[f];
-l=t.geometry;if(h.__webGLObjectsMap[t.id]==undefined)h.__webGLObjectsMap[t.id]={};q=h.__webGLObjectsMap[t.id];if(t instanceof THREE.Mesh){for(u in l.geometryChunks){A=l.geometryChunks[u];if(!A.__webGLVertexBuffer){this.createMeshBuffers(A);this.initMeshBuffers(A,t);l.__dirtyVertices=true;l.__dirtyElements=true;l.__dirtyUvs=true;l.__dirtyNormals=true;l.__dirtyTangents=true}if(l.__dirtyVertices||l.__dirtyElements||l.__dirtyUvs)this.setMeshBuffers(A,t,b.DYNAMIC_DRAW,l.__dirtyVertices,l.__dirtyElements,
-l.__dirtyUvs,l.__dirtyNormals,l.__dirtyTangents);g(q,u,A,t)}l.__dirtyVertices=false;l.__dirtyElements=false;l.__dirtyUvs=false;l.__dirtyNormals=false;l.__dirtyTangents=false}else if(t instanceof THREE.Line){if(!l.__webGLVertexBuffer){this.createLineBuffers(l);this.initLineBuffers(l);l.__dirtyVertices=true;l.__dirtyElements=true}l.__dirtyVertices&&this.setLineBuffers(l,b.DYNAMIC_DRAW,l.__dirtyVertices,l.__dirtyElements);g(q,0,l,t);l.__dirtyVertices=false;l.__dirtyElements=false}else if(t instanceof
-THREE.ParticleSystem){l.__webGLVertexBuffer||this.createParticleBuffers(l);g(q,0,l,t)}}};this.removeObject=function(h,g){var f,j;for(f=h.__webGLObjects.length-1;f>=0;f--){j=h.__webGLObjects[f].object;g==j&&h.__webGLObjects.splice(f,1)}};this.setupMatrices=function(h,g){h.autoUpdateMatrix&&h.updateMatrix();k.multiply(g.matrix,h.matrix);x.set(k.flatten());m=THREE.Matrix4.makeInvert3x3(k).transpose();w.set(m.m);H.set(h.matrix.flatten())};this.loadMatrices=function(h){b.uniformMatrix4fv(h.uniforms.viewMatrix,
-false,y);b.uniformMatrix4fv(h.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(h.uniforms.projectionMatrix,false,s);b.uniformMatrix3fv(h.uniforms.normalMatrix,false,w);b.uniformMatrix4fv(h.uniforms.objectMatrix,false,H)};this.loadCamera=function(h,g){b.uniform3f(h.uniforms.cameraPosition,g.position.x,g.position.y,g.position.z)};this.setBlending=function(h){switch(h){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(h,g){if(h){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(h=="back")b.cullFace(b.BACK);else h=="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,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,e=this.z;this.x=d*a.z-e*a.y;this.y=e*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,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1};
+THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;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,e=a.objects,i=[];a=0;for(c=e.length;a<c;a++){d=e[a];if(d instanceof THREE.Mesh)i=i.concat(this.intersectObject(d))}i.sort(function(b,n){return b.distance-n.distance});return i},intersectObject:function(a){function c(K,p,h,g){g=g.clone().subSelf(p);h=h.clone().subSelf(p);var f=K.clone().subSelf(p);K=g.dot(g);p=g.dot(h);g=g.dot(f);var j=h.dot(h);h=h.dot(f);f=1/(K*j-p*p);j=(j*g-p*h)*f;K=(K*h-p*g)*f;return j>0&&K>0&&j+K<1}var d,e,i,b,n,o,k,m,y,x,
+s,w=a.geometry,H=w.vertices,J=[];d=0;for(e=w.faces.length;d<e;d++){i=w.faces[d];x=this.origin.clone();s=this.direction.clone();b=a.matrix.multiplyVector3(H[i.a].position.clone());n=a.matrix.multiplyVector3(H[i.b].position.clone());o=a.matrix.multiplyVector3(H[i.c].position.clone());k=i instanceof THREE.Face4?a.matrix.multiplyVector3(H[i.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(i.normal.clone());y=s.dot(m);if(y<0){m=m.dot((new THREE.Vector3).sub(b,x))/y;x=x.addSelf(s.multiplyScalar(m));
+if(i instanceof THREE.Face3){if(c(x,b,n,o)){i={distance:this.origin.distanceTo(x),point:x,face:i,object:a};J.push(i)}}else if(i instanceof THREE.Face4)if(c(x,b,n,k)||c(x,n,o,k)){i={distance:this.origin.distanceTo(x),point:x,face:i,object:a};J.push(i)}}}return J}};
+THREE.Rectangle=function(){function a(){b=e-c;n=i-d}var c,d,e,i,b,n,o=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return b};this.getHeight=function(){return n};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return i};this.set=function(k,m,y,x){o=false;c=k;d=m;e=y;i=x;a()};this.addPoint=function(k,m){if(o){o=false;c=k;d=m;e=k;i=m}else{c=c<k?c:k;d=d<m?d:m;e=e>k?e:k;i=i>m?
+i:m}a()};this.add3Points=function(k,m,y,x,s,w){if(o){o=false;c=k<y?k<s?k:s:y<s?y:s;d=m<x?m<w?m:w:x<w?x:w;e=k>y?k>s?k:s:y>s?y:s;i=m>x?m>w?m:w:x>w?x:w}else{c=k<y?k<s?k<c?k:c:s<c?s:c:y<s?y<c?y:c:s<c?s:c;d=m<x?m<w?m<d?m:d:w<d?w:d:x<w?x<d?x:d:w<d?w:d;e=k>y?k>s?k>e?k:e:s>e?s:e:y>s?y>e?y:e:s>e?s:e;i=m>x?m>w?m>i?m:i:w>i?w:i:x>w?x>i?x:i:w>i?w:i}a()};this.addRectangle=function(k){if(o){o=false;c=k.getLeft();d=k.getTop();e=k.getRight();i=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();d=d<k.getTop()?d:k.getTop();
+e=e>k.getRight()?e:k.getRight();i=i>k.getBottom()?i:k.getBottom()}a()};this.inflate=function(k){c-=k;d-=k;e+=k;i+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e<k.getRight()?e:k.getRight();i=i<k.getBottom()?i:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(c,k.getLeft())>=0&&Math.min(i,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){o=true;i=e=d=c=0;a()};this.isEmpty=function(){return o};this.toString=
+function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+i+", width: "+b+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}};
+THREE.Matrix4=function(a,c,d,e,i,b,n,o,k,m,y,x,s,w,H,J){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=i||0;this.n22=b||1;this.n23=n||0;this.n24=o||0;this.n31=k||0;this.n32=m||0;this.n33=y||1;this.n34=x||0;this.n41=s||0;this.n42=w||0;this.n43=H||0;this.n44=J||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,e,i,b,n,o,k,m,y,x,s,w,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=i;this.n22=b;this.n23=n;this.n24=o;this.n31=k;this.n32=m;this.n33=y;this.n34=x;this.n41=s;this.n42=w;this.n43=H;this.n44=J;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 e=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();i.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a);
+this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,i=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*i;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*i;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,i=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*i;a.y=this.n21*c+this.n22*d+this.n23*
+e+this.n24*i;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*i;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*i;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,e=a.n12,i=a.n13,b=a.n14,n=a.n21,o=a.n22,k=a.n23,m=a.n24,y=a.n31,
+x=a.n32,s=a.n33,w=a.n34,H=a.n41,J=a.n42,K=a.n43,p=a.n44,h=c.n11,g=c.n12,f=c.n13,j=c.n14,t=c.n21,u=c.n22,l=c.n23,A=c.n24,q=c.n31,G=c.n32,r=c.n33,v=c.n34,D=c.n41,T=c.n42,E=c.n43,N=c.n44;this.n11=d*h+e*t+i*q+b*D;this.n12=d*g+e*u+i*G+b*T;this.n13=d*f+e*l+i*r+b*E;this.n14=d*j+e*A+i*v+b*N;this.n21=n*h+o*t+k*q+m*D;this.n22=n*g+o*u+k*G+m*T;this.n23=n*f+o*l+k*r+m*E;this.n24=n*j+o*A+k*v+m*N;this.n31=y*h+x*t+s*q+w*D;this.n32=y*g+x*u+s*G+w*T;this.n33=y*f+x*l+s*r+w*E;this.n34=y*j+x*A+s*v+w*N;this.n41=H*h+J*t+
+K*q+p*D;this.n42=H*g+J*u+K*G+p*T;this.n43=H*f+J*l+K*r+p*E;this.n44=H*j+J*A+K*v+p*N;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,i=this.n14,b=this.n21,n=this.n22,o=this.n23,k=this.n24,m=this.n31,y=this.n32,x=this.n33,s=this.n34,w=this.n41,H=this.n42,J=this.n43,K=this.n44,p=a.n11,h=a.n21,g=a.n31,f=a.n41,j=a.n12,t=a.n22,u=a.n32,l=a.n42,A=a.n13,q=a.n23,G=a.n33,r=a.n43,v=a.n14,D=a.n24,T=a.n34;a=a.n44;this.n11=c*p+d*h+e*g+i*f;this.n12=c*j+d*t+e*u+i*l;this.n13=c*A+d*q+e*G+i*
+r;this.n14=c*v+d*D+e*T+i*a;this.n21=b*p+n*h+o*g+k*f;this.n22=b*j+n*t+o*u+k*l;this.n23=b*A+n*q+o*G+k*r;this.n24=b*v+n*D+o*T+k*a;this.n31=m*p+y*h+x*g+s*f;this.n32=m*j+y*t+x*u+s*l;this.n33=m*A+y*q+x*G+s*r;this.n34=m*v+y*D+x*T+s*a;this.n41=w*p+H*h+J*g+K*f;this.n42=w*j+H*t+J*u+K*l;this.n43=w*A+H*q+J*G+K*r;this.n44=w*v+H*D+J*T+K*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,c=this.n12,d=this.n13,e=this.n14,i=this.n21,b=this.n22,n=this.n23,o=this.n24,k=this.n31,m=this.n32,y=this.n33,x=this.n34,s=this.n41,w=this.n42,H=this.n43,J=this.n44;return e*n*m*s-d*o*m*s-e*b*y*s+c*o*y*s+d*b*x*s-c*n*x*s-e*n*k*w+d*o*k*w+e*i*y*w-a*o*y*w-d*i*x*w+a*n*x*w+e*b*k*H-c*o*k*H-e*i*m*H+a*o*m*H+c*i*x*H-a*b*x*H-d*b*k*J+c*n*k*J+d*i*m*J-a*n*m*J-c*i*y*J+a*b*y*J},transpose:function(){function a(c,d,
+e){var i=c[d];c[d]=c[e];c[e]=i}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(){var a=this.flat;a[0]=this.n11;
+a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=
+Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),i=1-d,b=a.x,n=a.y,o=a.z,k=i*b,m=i*n;this.set(k*b+d,k*n-e*o,k*o+e*n,0,k*n+e*o,m*n+d,m*o-e*b,0,k*o-e*n,m*o+e*b,i*o*o+d,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,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};
+THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d};
+THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,i=a.n14,b=a.n21,n=a.n22,o=a.n23,k=a.n24,m=a.n31,y=a.n32,x=a.n33,s=a.n34,w=a.n41,H=a.n42,J=a.n43,K=a.n44,p=new THREE.Matrix4;p.n11=o*s*H-k*x*H+k*y*J-n*s*J-o*y*K+n*x*K;p.n12=i*x*H-e*s*H-i*y*J+d*s*J+e*y*K-d*x*K;p.n13=e*k*H-i*o*H+i*n*J-d*k*J-e*n*K+d*o*K;p.n14=i*o*y-e*k*y-i*n*x+d*k*x+e*n*s-d*o*s;p.n21=k*x*w-o*s*w-k*m*J+b*s*J+o*m*K-b*x*K;p.n22=e*s*w-i*x*w+i*m*J-c*s*J-e*m*K+c*x*K;p.n23=i*o*w-e*k*w-i*b*J+c*k*J+e*b*K-c*o*K;p.n24=e*k*m-i*o*m+
+i*b*x-c*k*x-e*b*s+c*o*s;p.n31=n*s*w-k*y*w+k*m*H-b*s*H-n*m*K+b*y*K;p.n32=i*y*w-d*s*w-i*m*H+c*s*H+d*m*K-c*y*K;p.n33=e*k*w-i*n*w+i*b*H-c*k*H-d*b*K+c*n*K;p.n34=i*n*m-d*k*m-i*b*y+c*k*y+d*b*s-c*n*s;p.n41=o*y*w-n*x*w-o*m*H+b*x*H+n*m*J-b*y*J;p.n42=d*x*w-e*y*w+e*m*H-c*x*H-d*m*J+c*y*J;p.n43=e*n*w-d*o*w-e*b*H+c*o*H+d*b*J-c*n*J;p.n44=d*o*m-e*n*m+e*b*y-c*o*y-d*b*x+c*n*x;p.multiplyScalar(1/a.determinant());return p};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],n=-c[10]*c[4]+c[6]*c[8],o=c[10]*c[0]-c[2]*c[8],k=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*n+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*i;d[2]=c*b;d[3]=c*n;d[4]=c*o;d[5]=c*k;d[6]=c*m;d[7]=c*y;d[8]=c*x;return a};
+THREE.Matrix4.makeFrustum=function(a,c,d,e,i,b){var n,o,k;n=new THREE.Matrix4;o=2*i/(c-a);k=2*i/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+i)/(b-i);i=-2*b*i/(b-i);n.n11=o;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=k;n.n23=d;n.n24=0;n.n31=0;n.n32=0;n.n33=e;n.n34=i;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,d,e){var i;a=d*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,d,e)};
+THREE.Matrix4.makeOrtho=function(a,c,d,e,i,b){var n,o,k,m;n=new THREE.Matrix4;o=c-a;k=d-e;m=b-i;a=(c+a)/o;d=(d+e)/k;i=(b+i)/m;n.n11=2/o;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/k;n.n23=0;n.n24=-d;n.n31=0;n.n32=0;n.n33=-2/m;n.n34=-i;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};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,e,i){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,c,d,e,i,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=b instanceof Array?b:[b]};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,e,i,b,n,o=new THREE.Vector3,k=new THREE.Vector3;e=0;for(i=this.vertices.length;e<i;e++){b=this.vertices[e];b.normal.set(0,0,0)}e=0;for(i=this.faces.length;e<i;e++){b=this.faces[e];if(a&&b.vertexNormals.length){o.set(0,0,0);c=0;for(d=b.normal.length;c<d;c++)o.addSelf(b.vertexNormals[c]);o.divideScalar(3)}else{c=this.vertices[b.a];d=this.vertices[b.b];n=this.vertices[b.c];o.sub(n.position,
+d.position);k.sub(c.position,d.position);o.crossSelf(k)}o.isZero()||o.normalize();b.normal.copy(o)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[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{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[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(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(v,D,T,E,N,U,C){b=v.vertices[D].position;n=v.vertices[T].position;o=v.vertices[E].position;k=i[N];m=i[U];y=i[C];x=n.x-b.x;s=o.x-b.x;w=n.y-b.y;H=o.y-b.y;
+J=n.z-b.z;K=o.z-b.z;p=m.u-k.u;h=y.u-k.u;g=m.v-k.v;f=y.v-k.v;j=1/(p*f-h*g);l.set((f*x-g*s)*j,(f*w-g*H)*j,(f*J-g*K)*j);A.set((p*s-h*x)*j,(p*H-h*w)*j,(p*K-h*J)*j);t[D].addSelf(l);t[T].addSelf(l);t[E].addSelf(l);u[D].addSelf(A);u[T].addSelf(A);u[E].addSelf(A)}var c,d,e,i,b,n,o,k,m,y,x,s,w,H,J,K,p,h,g,f,j,t=[],u=[],l=new THREE.Vector3,A=new THREE.Vector3,q=new THREE.Vector3,G=new THREE.Vector3,r=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){t[c]=new THREE.Vector3;u[c]=new THREE.Vector3}c=0;
+for(d=this.faces.length;c<d;c++){e=this.faces[c];i=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){r.copy(this.vertices[c].normal);e=t[c];q.copy(e);q.subSelf(r.multiplyScalar(r.dot(e))).normalize();G.cross(this.vertices[c].normal,e);e=G.dot(u[c]);e=e<0?-1:1;this.vertices[c].tangent.set(q.x,q.y,q.z,e)}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(y){var x=[];c=0;for(d=y.length;c<d;c++)y[c]==undefined?x.push("undefined"):x.push(y[c].toString());return x.join("_")}var c,d,e,i,b,n,o,k,m={};e=0;for(i=this.faces.length;e<i;e++){b=this.faces[e];
+n=b.materials;o=a(n);if(m[o]==undefined)m[o]={hash:o,counter:0};k=m[o].hash+"_"+m[o].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:n,vertices:0};b=b instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+b>65535){m[o].counter+=1;k=m[o].hash+"_"+m[o].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:n,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+
+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
+THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;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(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
+this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);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.PointLight.prototype=new THREE.Light;THREE.PointLight.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.rotationMatrix=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,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};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,e,i,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=b!==undefined?b: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,e,i={};for(c in a){i[c]={};for(d in a[c]){e=a[c][d];i[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return i},merge:function(a){var c,d,e,i={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(d in e)i[d]=e[d]}return i}};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(u,l){return l.z-u.z}function c(u,l){var A=0,q=1,G=u.z+u.w,r=l.z+l.w,v=-u.z+u.w,D=-l.z+l.w;if(G>=0&&r>=0&&v>=0&&D>=0)return true;else if(G<0&&r<0||v<0&&D<0)return false;else{if(G<0)A=Math.max(A,G/(G-r));else if(r<0)q=Math.min(q,G/(G-r));if(v<0)A=Math.max(A,v/(v-D));else if(D<0)q=Math.min(q,v/(v-D));if(q<A)return false;else{u.lerpSelf(l,A);l.lerpSelf(u,1-q);return true}}}var d,e,i=[],b,n,o,k=[],m,y,x=[],s,w,H=[],J=new THREE.Vector4,K=new THREE.Vector4,p=new THREE.Matrix4,
+h=new THREE.Matrix4,g=[],f=new THREE.Vector4,j=new THREE.Vector4,t;this.projectObjects=function(u,l,A){var q=[],G,r;e=0;p.multiply(l.projectionMatrix,l.matrix);g[0]=new THREE.Vector4(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);g[1]=new THREE.Vector4(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);g[2]=new THREE.Vector4(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);g[3]=new THREE.Vector4(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);g[4]=new THREE.Vector4(p.n41-p.n31,p.n42-p.n32,p.n43-
+p.n33,p.n44-p.n34);g[5]=new THREE.Vector4(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);l=0;for(G=g.length;l<G;l++){r=g[l];r.divideScalar(Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z))}G=u.objects;u=0;for(l=G.length;u<l;u++){r=G[u];var v;if(!(v=!r.visible)){if(v=r instanceof THREE.Mesh){a:{v=void 0;for(var D=r.position,T=-r.geometry.boundingSphere.radius*Math.max(r.scale.x,Math.max(r.scale.y,r.scale.z)),E=0;E<6;E++){v=g[E].x*D.x+g[E].y*D.y+g[E].z*D.z+g[E].w;if(v<=T){v=false;break a}}v=true}v=!v}v=v}if(!v){d=
+i[e]=i[e]||new THREE.RenderableObject;J.copy(r.position);p.multiplyVector3(J);d.object=r;d.z=J.z;q.push(d);e++}}A&&q.sort(a);return q};this.projectScene=function(u,l,A){var q=[],G=l.near,r=l.far,v,D,T,E,N,U,C,S,Y,M,I,L,P,z,Q,V;o=y=w=0;l.autoUpdateMatrix&&l.updateMatrix();p.multiply(l.projectionMatrix,l.matrix);U=this.projectObjects(u,l,true);u=0;for(v=U.length;u<v;u++){C=U[u].object;if(C.visible){C.autoUpdateMatrix&&C.updateMatrix();S=C.matrix;Y=C.rotationMatrix;M=C.materials;I=C.overdraw;if(C instanceof
+THREE.Mesh){L=C.geometry;P=L.vertices;D=0;for(T=P.length;D<T;D++){z=P[D];z.positionWorld.copy(z.position);S.multiplyVector3(z.positionWorld);E=z.positionScreen;E.copy(z.positionWorld);p.multiplyVector4(E);E.x/=E.w;E.y/=E.w;z.__visible=E.z>G&&E.z<r}L=L.faces;D=0;for(T=L.length;D<T;D++){z=L[D];if(z instanceof THREE.Face3){E=P[z.a];N=P[z.b];Q=P[z.c];if(E.__visible&&N.__visible&&Q.__visible)if(C.doubleSided||C.flipSided!=(Q.positionScreen.x-E.positionScreen.x)*(N.positionScreen.y-E.positionScreen.y)-
+(Q.positionScreen.y-E.positionScreen.y)*(N.positionScreen.x-E.positionScreen.x)<0){b=k[o]=k[o]||new THREE.RenderableFace3;b.v1.positionWorld.copy(E.positionWorld);b.v2.positionWorld.copy(N.positionWorld);b.v3.positionWorld.copy(Q.positionWorld);b.v1.positionScreen.copy(E.positionScreen);b.v2.positionScreen.copy(N.positionScreen);b.v3.positionScreen.copy(Q.positionScreen);b.normalWorld.copy(z.normal);Y.multiplyVector3(b.normalWorld);b.centroidWorld.copy(z.centroid);S.multiplyVector3(b.centroidWorld);
+b.centroidScreen.copy(b.centroidWorld);p.multiplyVector3(b.centroidScreen);Q=z.vertexNormals;t=b.vertexNormalsWorld;E=0;for(N=Q.length;E<N;E++){V=t[E]=t[E]||new THREE.Vector3;V.copy(Q[E]);Y.multiplyVector3(V)}b.z=b.centroidScreen.z;b.meshMaterials=M;b.faceMaterials=z.materials;b.overdraw=I;if(C.geometry.uvs[D]){b.uvs[0]=C.geometry.uvs[D][0];b.uvs[1]=C.geometry.uvs[D][1];b.uvs[2]=C.geometry.uvs[D][2]}q.push(b);o++}}else if(z instanceof THREE.Face4){E=P[z.a];N=P[z.b];Q=P[z.c];V=P[z.d];if(E.__visible&&
+N.__visible&&Q.__visible&&V.__visible)if(C.doubleSided||C.flipSided!=((V.positionScreen.x-E.positionScreen.x)*(N.positionScreen.y-E.positionScreen.y)-(V.positionScreen.y-E.positionScreen.y)*(N.positionScreen.x-E.positionScreen.x)<0||(N.positionScreen.x-Q.positionScreen.x)*(V.positionScreen.y-Q.positionScreen.y)-(N.positionScreen.y-Q.positionScreen.y)*(V.positionScreen.x-Q.positionScreen.x)<0)){b=k[o]=k[o]||new THREE.RenderableFace3;b.v1.positionWorld.copy(E.positionWorld);b.v2.positionWorld.copy(N.positionWorld);
+b.v3.positionWorld.copy(V.positionWorld);b.v1.positionScreen.copy(E.positionScreen);b.v2.positionScreen.copy(N.positionScreen);b.v3.positionScreen.copy(V.positionScreen);b.normalWorld.copy(z.normal);Y.multiplyVector3(b.normalWorld);b.centroidWorld.copy(z.centroid);S.multiplyVector3(b.centroidWorld);b.centroidScreen.copy(b.centroidWorld);p.multiplyVector3(b.centroidScreen);b.z=b.centroidScreen.z;b.meshMaterials=M;b.faceMaterials=z.materials;b.overdraw=I;if(C.geometry.uvs[D]){b.uvs[0]=C.geometry.uvs[D][0];
+b.uvs[1]=C.geometry.uvs[D][1];b.uvs[2]=C.geometry.uvs[D][3]}q.push(b);o++;n=k[o]=k[o]||new THREE.RenderableFace3;n.v1.positionWorld.copy(N.positionWorld);n.v2.positionWorld.copy(Q.positionWorld);n.v3.positionWorld.copy(V.positionWorld);n.v1.positionScreen.copy(N.positionScreen);n.v2.positionScreen.copy(Q.positionScreen);n.v3.positionScreen.copy(V.positionScreen);n.normalWorld.copy(b.normalWorld);n.centroidWorld.copy(b.centroidWorld);n.centroidScreen.copy(b.centroidScreen);n.z=n.centroidScreen.z;n.meshMaterials=
+M;n.faceMaterials=z.materials;n.overdraw=I;if(C.geometry.uvs[D]){n.uvs[0]=C.geometry.uvs[D][1];n.uvs[1]=C.geometry.uvs[D][2];n.uvs[2]=C.geometry.uvs[D][3]}q.push(n);o++}}}}else if(C instanceof THREE.Line){h.multiply(p,S);P=C.geometry.vertices;z=P[0];z.positionScreen.copy(z.position);h.multiplyVector4(z.positionScreen);D=1;for(T=P.length;D<T;D++){E=P[D];E.positionScreen.copy(E.position);h.multiplyVector4(E.positionScreen);N=P[D-1];f.copy(E.positionScreen);j.copy(N.positionScreen);if(c(f,j)){f.multiplyScalar(1/
+f.w);j.multiplyScalar(1/j.w);m=x[y]=x[y]||new THREE.RenderableLine;m.v1.positionScreen.copy(f);m.v2.positionScreen.copy(j);m.z=Math.max(f.z,j.z);m.materials=C.materials;q.push(m);y++}}}else if(C instanceof THREE.Particle){K.set(C.position.x,C.position.y,C.position.z,1);p.multiplyVector4(K);K.z/=K.w;if(K.z>0&&K.z<1){s=H[w]=H[w]||new THREE.RenderableParticle;s.x=K.x/K.w;s.y=K.y/K.w;s.z=K.z;s.rotation=C.rotation.z;s.scale.x=C.scale.x*Math.abs(s.x-(K.x+l.projectionMatrix.n11)/(K.w+l.projectionMatrix.n14));
+s.scale.y=C.scale.y*Math.abs(s.y-(K.y+l.projectionMatrix.n22)/(K.w+l.projectionMatrix.n24));s.materials=C.materials;q.push(s);w++}}}}A&&q.sort(a);return q};this.unprojectVector=function(u,l){var A=THREE.Matrix4.makeInvert(l.matrix);A.multiplySelf(THREE.Matrix4.makeInvert(l.projectionMatrix));A.multiplyVector3(u);return u}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,i,b;this.domElement=document.createElement("div");this.setSize=function(n,o){d=n;e=o;i=d/2;b=e/2};this.render=function(n,o){var k,m,y,x,s,w,H,J;a=c.projectScene(n,o);k=0;for(m=a.length;k<m;k++){s=a[k];if(s instanceof THREE.RenderableParticle){H=s.x*i+i;J=s.y*b+b;y=0;for(x=s.material.length;y<x;y++){w=s.material[y];if(w instanceof THREE.ParticleDOMMaterial){w=w.domElement;w.style.left=H+"px";w.style.top=J+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ea){if(s!=ea)m.globalAlpha=s=ea}function c(ea){if(w!=ea){switch(ea){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}w=ea}}var d=null,e=new THREE.Projector,i=document.createElement("canvas"),b,n,o,k,m=i.getContext("2d"),y=new THREE.Color(0),x=0,s=1,w=0,H=null,J=null,K=1,p,h,g,f,j,t,u,l,A,q=new THREE.Color,
+G=new THREE.Color,r=new THREE.Color,v=new THREE.Color,D=new THREE.Color,T,E,N,U,C,S,Y,M,I,L=new THREE.Rectangle,P=new THREE.Rectangle,z=new THREE.Rectangle,Q=false,V=new THREE.Color,X=new THREE.Color,fa=new THREE.Color,aa=new THREE.Color,ya=Math.PI*2,$=new THREE.Vector3,ca,oa,ta,ia,ua,za,ra=16;ca=document.createElement("canvas");ca.width=ca.height=2;oa=ca.getContext("2d");oa.fillStyle="rgba(0,0,0,1)";oa.fillRect(0,0,2,2);ta=oa.getImageData(0,0,2,2);ia=ta.data;ua=document.createElement("canvas");ua.width=
+ua.height=ra;za=ua.getContext("2d");za.translate(-ra/2,-ra/2);za.scale(ra,ra);ra--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ea,pa){b=ea;n=pa;o=b/2;k=n/2;i.width=b;i.height=n;L.set(-o,-k,o,k);s=1;w=0;J=H=null;K=1};this.setClearColor=function(ea,pa){y.setHex(ea);x=pa;P.set(-o,-k,o,k);m.setTransform(1,0,0,-1,o,k);this.clear()};this.clear=function(){m.setTransform(1,0,0,-1,o,k);if(!P.isEmpty()){P.inflate(1);P.minSelf(L);if(y.hex==0&&x==0)m.clearRect(P.getX(),
+P.getY(),P.getWidth(),P.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+x+")";m.fillRect(P.getX(),P.getY(),P.getWidth(),P.getHeight())}P.empty()}};this.render=function(ea,pa){function Ma(B){var W,R,F,O=B.lights;X.setRGB(0,0,0);fa.setRGB(0,0,0);aa.setRGB(0,0,0);B=0;for(W=O.length;B<W;B++){R=O[B];F=R.color;if(R instanceof THREE.AmbientLight){X.r+=F.r;X.g+=F.g;X.b+=F.b}else if(R instanceof THREE.DirectionalLight){fa.r+=
+F.r;fa.g+=F.g;fa.b+=F.b}else if(R instanceof THREE.PointLight){aa.r+=F.r;aa.g+=F.g;aa.b+=F.b}}}function Aa(B,W,R,F){var O,Z,da,ga,ha=B.lights;B=0;for(O=ha.length;B<O;B++){Z=ha[B];da=Z.color;ga=Z.intensity;if(Z instanceof THREE.DirectionalLight){Z=R.dot(Z.position)*ga;if(Z>0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}else if(Z instanceof THREE.PointLight){$.sub(Z.position,W);$.normalize();Z=R.dot($)*ga;if(Z>0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}}}function Na(B,W,R){if(R.opacity!=0){a(R.opacity);c(R.blending);
+var F,O,Z,da,ga,ha;if(R instanceof THREE.ParticleBasicMaterial){if(R.map&&R.map.image.loaded){da=R.map.image;ga=da.width>>1;ha=da.height>>1;O=W.scale.x*o;Z=W.scale.y*k;R=O*ga;F=Z*ha;z.set(B.x-R,B.y-F,B.x+R,B.y+F);if(L.instersects(z)){m.save();m.translate(B.x,B.y);m.rotate(-W.rotation);m.scale(O,-Z);m.translate(-ga,-ha);m.drawImage(da,0,0);m.restore()}}}else if(R instanceof THREE.ParticleCircleMaterial){if(Q){V.r=X.r+fa.r+aa.r;V.g=X.g+fa.g+aa.g;V.b=X.b+fa.b+aa.b;q.r=R.color.r*V.r;q.g=R.color.g*V.g;
+q.b=R.color.b*V.b;q.updateStyleString()}else q.__styleString=R.color.__styleString;R=W.scale.x*o;F=W.scale.y*k;z.set(B.x-R,B.y-F,B.x+R,B.y+F);if(L.instersects(z)){O=q.__styleString;if(J!=O)m.fillStyle=J=O;m.save();m.translate(B.x,B.y);m.rotate(-W.rotation);m.scale(R,F);m.beginPath();m.arc(0,0,1,0,ya,true);m.closePath();m.fill();m.restore()}}}}function Oa(B,W,R,F){if(F.opacity!=0){a(F.opacity);c(F.blending);m.beginPath();m.moveTo(B.positionScreen.x,B.positionScreen.y);m.lineTo(W.positionScreen.x,W.positionScreen.y);
+m.closePath();if(F instanceof THREE.LineBasicMaterial){q.__styleString=F.color.__styleString;B=F.linewidth;if(K!=B)m.lineWidth=K=B;B=q.__styleString;if(H!=B)m.strokeStyle=H=B;m.stroke();z.inflate(F.linewidth*2)}}}function Ia(B,W,R,F,O,Z){if(O.opacity!=0){a(O.opacity);c(O.blending);f=B.positionScreen.x;j=B.positionScreen.y;t=W.positionScreen.x;u=W.positionScreen.y;l=R.positionScreen.x;A=R.positionScreen.y;m.beginPath();m.moveTo(f,j);m.lineTo(t,u);m.lineTo(l,A);m.lineTo(f,j);m.closePath();if(O instanceof
+THREE.MeshBasicMaterial)if(O.map)O.map.image.loaded&&O.map.mapping instanceof THREE.UVMapping&&va(f,j,t,u,l,A,O.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);else if(O.env_map){if(O.env_map.image.loaded)if(O.env_map.mapping instanceof THREE.SphericalReflectionMapping){B=pa.matrix;$.copy(F.vertexNormalsWorld[0]);U=($.x*B.n11+$.y*B.n12+$.z*B.n13)*0.5+0.5;C=-($.x*B.n21+$.y*B.n22+$.z*B.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[1]);S=($.x*B.n11+$.y*B.n12+$.z*B.n13)*0.5+0.5;
+Y=-($.x*B.n21+$.y*B.n22+$.z*B.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[2]);M=($.x*B.n11+$.y*B.n12+$.z*B.n13)*0.5+0.5;I=-($.x*B.n21+$.y*B.n22+$.z*B.n23)*0.5+0.5;va(f,j,t,u,l,A,O.env_map.image,U,C,S,Y,M,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&&va(f,j,t,u,l,A,O.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);
+c(THREE.SubtractiveBlending)}if(Q)if(!O.wireframe&&O.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){G.r=r.r=v.r=X.r;G.g=r.g=v.g=X.g;G.b=r.b=v.b=X.b;Aa(Z,F.v1.positionWorld,F.vertexNormalsWorld[0],G);Aa(Z,F.v2.positionWorld,F.vertexNormalsWorld[1],r);Aa(Z,F.v3.positionWorld,F.vertexNormalsWorld[2],v);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,t,u,l,A,N,0,0,1,0,0,1)}else{V.r=X.r;V.g=X.g;V.b=X.b;Aa(Z,F.centroidWorld,F.normalWorld,V);q.r=O.color.r*V.r;q.g=
+O.color.g*V.g;q.b=O.color.b*V.b;q.updateStyleString();O.wireframe?Ba(q.__styleString,O.wireframe_linewidth):Ca(q.__styleString)}else O.wireframe?Ba(O.color.__styleString,O.wireframe_linewidth):Ca(O.color.__styleString)}else if(O instanceof THREE.MeshDepthMaterial){T=pa.near;E=pa.far;G.r=G.g=G.b=1-Ea(B.positionScreen.z,T,E);r.r=r.g=r.b=1-Ea(W.positionScreen.z,T,E);v.r=v.g=v.b=1-Ea(R.positionScreen.z,T,E);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,t,u,l,A,N,0,0,1,0,0,
+1)}else if(O instanceof THREE.MeshNormalMaterial){q.r=Fa(F.normalWorld.x);q.g=Fa(F.normalWorld.y);q.b=Fa(F.normalWorld.z);q.updateStyleString();O.wireframe?Ba(q.__styleString,O.wireframe_linewidth):Ca(q.__styleString)}}}function Ba(B,W){if(H!=B)m.strokeStyle=H=B;if(K!=W)m.lineWidth=K=W;m.stroke();z.inflate(W*2)}function Ca(B){if(J!=B)m.fillStyle=J=B;m.fill()}function va(B,W,R,F,O,Z,da,ga,ha,la,ja,ma,wa){var qa,na;qa=da.width-1;na=da.height-1;ga*=qa;ha*=na;la*=qa;ja*=na;ma*=qa;wa*=na;R-=B;F-=W;O-=
+B;Z-=W;la-=ga;ja-=ha;ma-=ga;wa-=ha;na=1/(la*wa-ma*ja);qa=(wa*R-ja*O)*na;ja=(wa*F-ja*Z)*na;R=(la*O-ma*R)*na;F=(la*Z-ma*F)*na;B=B-qa*ga-R*ha;W=W-ja*ga-F*ha;m.save();m.transform(qa,ja,R,F,B,W);m.clip();m.drawImage(da,0,0);m.restore()}function Ja(B,W,R,F){var O=~~(B.r*255),Z=~~(B.g*255);B=~~(B.b*255);var da=~~(W.r*255),ga=~~(W.g*255);W=~~(W.b*255);var ha=~~(R.r*255),la=~~(R.g*255);R=~~(R.b*255);var ja=~~(F.r*255),ma=~~(F.g*255);F=~~(F.b*255);ia[0]=O<0?0:O>255?255:O;ia[1]=Z<0?0:Z>255?255:Z;ia[2]=B<0?0:
+B>255?255:B;ia[4]=da<0?0:da>255?255:da;ia[5]=ga<0?0:ga>255?255:ga;ia[6]=W<0?0:W>255?255:W;ia[8]=ha<0?0:ha>255?255:ha;ia[9]=la<0?0:la>255?255:la;ia[10]=R<0?0:R>255?255:R;ia[12]=ja<0?0:ja>255?255:ja;ia[13]=ma<0?0:ma>255?255:ma;ia[14]=F<0?0:F>255?255:F;oa.putImageData(ta,0,0);za.drawImage(ca,0,0);return ua}function Ea(B,W,R){B=(B-W)/(R-W);return B*B*(3-2*B)}function Fa(B){B=(B+1)*0.5;return B<0?0:B>1?1:B}function Ga(B,W){var R=W.x-B.x,F=W.y-B.y,O=1/Math.sqrt(R*R+F*F);R*=O;F*=O;W.x+=R;W.y+=F;B.x-=R;B.y-=
+F}var Da,Ka,ba,ka,sa,Ha,La,xa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,k);d=e.projectScene(ea,pa,this.sortElements);(Q=ea.lights.length>0)&&Ma(ea);Da=0;for(Ka=d.length;Da<Ka;Da++){ba=d[Da];z.empty();if(ba instanceof THREE.RenderableParticle){p=ba;p.x*=o;p.y*=k;ka=0;for(sa=ba.materials.length;ka<sa;ka++)Na(p,ba,ba.materials[ka],ea)}else if(ba instanceof THREE.RenderableLine){p=ba.v1;h=ba.v2;p.positionScreen.x*=o;p.positionScreen.y*=k;h.positionScreen.x*=o;h.positionScreen.y*=k;z.addPoint(p.positionScreen.x,
+p.positionScreen.y);z.addPoint(h.positionScreen.x,h.positionScreen.y);if(L.instersects(z)){ka=0;for(sa=ba.materials.length;ka<sa;)Oa(p,h,ba,ba.materials[ka++],ea)}}else if(ba instanceof THREE.RenderableFace3){p=ba.v1;h=ba.v2;g=ba.v3;p.positionScreen.x*=o;p.positionScreen.y*=k;h.positionScreen.x*=o;h.positionScreen.y*=k;g.positionScreen.x*=o;g.positionScreen.y*=k;if(ba.overdraw){Ga(p.positionScreen,h.positionScreen);Ga(h.positionScreen,g.positionScreen);Ga(g.positionScreen,p.positionScreen)}z.add3Points(p.positionScreen.x,
+p.positionScreen.y,h.positionScreen.x,h.positionScreen.y,g.positionScreen.x,g.positionScreen.y);if(L.instersects(z)){ka=0;for(sa=ba.meshMaterials.length;ka<sa;){xa=ba.meshMaterials[ka++];if(xa instanceof THREE.MeshFaceMaterial){Ha=0;for(La=ba.faceMaterials.length;Ha<La;)(xa=ba.faceMaterials[Ha++])&&Ia(p,h,g,ba,xa,ea)}else Ia(p,h,g,ba,xa,ea)}}}P.addRectangle(z)}m.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(U,C,S){var Y,M,I,L;Y=0;for(M=U.lights.length;Y<M;Y++){I=U.lights[Y];if(I instanceof THREE.DirectionalLight){L=C.normalWorld.dot(I.position)*I.intensity;if(L>0){S.r+=I.color.r*L;S.g+=I.color.g*L;S.b+=I.color.b*L}}else if(I instanceof THREE.PointLight){A.sub(I.position,C.centroidWorld);A.normalize();L=C.normalWorld.dot(A)*I.intensity;if(L>0){S.r+=I.color.r*L;S.g+=I.color.g*L;S.b+=I.color.b*L}}}}function c(U,C,S,Y,M,I){v=e(D++);v.setAttribute("d","M "+U.positionScreen.x+
+" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(I,Y,f);g.r=M.color.r*f.r;g.g=M.color.g*f.g;g.b=M.color.b*f.b;g.updateStyleString()}else g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){l=1-M.__2near/(M.__farPlusNear-Y.z*M.__farMinusNear);
+g.setRGB(l,l,l)}else M instanceof THREE.MeshNormalMaterial&&g.setRGB(i(Y.normalWorld.x),i(Y.normalWorld.y),i(Y.normalWorld.z));M.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+M.opacity);o.appendChild(v)}function d(U,C,S,Y,M,I,L){v=e(D++);v.setAttribute("d",
+"M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(L,M,f);g.r=I.color.r*f.r;g.g=I.color.g*f.g;g.b=I.color.b*f.b;g.updateStyleString()}else g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){l=
+1-I.__2near/(I.__farPlusNear-M.z*I.__farMinusNear);g.setRGB(l,l,l)}else I instanceof THREE.MeshNormalMaterial&&g.setRGB(i(M.normalWorld.x),i(M.normalWorld.y),i(M.normalWorld.z));I.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+I.opacity);o.appendChild(v)}
+function e(U){if(q[U]==null){q[U]=document.createElementNS("http://www.w3.org/2000/svg","path");N==0&&q[U].setAttribute("shape-rendering","crispEdges");return q[U]}return q[U]}function i(U){return U<0?Math.min((1+U)*0.5,0.5):0.5+Math.min(U*0.5,0.5)}var b=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,y,x,s,w,H,J,K=new THREE.Rectangle,p=new THREE.Rectangle,h=false,g=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),t=new THREE.Color(0),
+u=new THREE.Color(0),l,A=new THREE.Vector3,q=[],G=[],r=[],v,D,T,E,N=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(U){switch(U){case "high":N=1;break;case "low":N=0}};this.setSize=function(U,C){k=U;m=C;y=k/2;x=m/2;o.setAttribute("viewBox",-y+" "+-x+" "+k+" "+m);o.setAttribute("width",k);o.setAttribute("height",m);K.set(-y,-x,y,x)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(U,C){var S,Y,
+M,I,L,P,z,Q;this.autoClear&&this.clear();b=n.projectScene(U,C,this.sortElements);E=T=D=0;if(h=U.lights.length>0){z=U.lights;j.setRGB(0,0,0);t.setRGB(0,0,0);u.setRGB(0,0,0);S=0;for(Y=z.length;S<Y;S++){M=z[S];I=M.color;if(M instanceof THREE.AmbientLight){j.r+=I.r;j.g+=I.g;j.b+=I.b}else if(M instanceof THREE.DirectionalLight){t.r+=I.r;t.g+=I.g;t.b+=I.b}else if(M instanceof THREE.PointLight){u.r+=I.r;u.g+=I.g;u.b+=I.b}}}S=0;for(Y=b.length;S<Y;S++){z=b[S];p.empty();if(z instanceof THREE.RenderableParticle){s=
+z;s.x*=y;s.y*=-x;M=0;for(I=z.materials.length;M<I;M++)if(Q=z.materials[M]){L=s;P=z;Q=Q;var V=T++;if(G[V]==null){G[V]=document.createElementNS("http://www.w3.org/2000/svg","circle");N==0&&G[V].setAttribute("shape-rendering","crispEdges")}v=G[V];v.setAttribute("cx",L.x);v.setAttribute("cy",L.y);v.setAttribute("r",P.scale.x*y);if(Q instanceof THREE.ParticleCircleMaterial){if(h){f.r=j.r+t.r+u.r;f.g=j.g+t.g+u.g;f.b=j.b+t.b+u.b;g.r=Q.color.r*f.r;g.g=Q.color.g*f.g;g.b=Q.color.b*f.b;g.updateStyleString()}else g=
+Q.color;v.setAttribute("style","fill: "+g.__styleString)}o.appendChild(v)}}else if(z instanceof THREE.RenderableLine){s=z.v1;w=z.v2;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);if(K.instersects(p)){M=0;for(I=z.materials.length;M<I;)if(Q=z.materials[M++]){L=s;P=w;Q=Q;V=E++;if(r[V]==null){r[V]=document.createElementNS("http://www.w3.org/2000/svg","line");N==
+0&&r[V].setAttribute("shape-rendering","crispEdges")}v=r[V];v.setAttribute("x1",L.positionScreen.x);v.setAttribute("y1",L.positionScreen.y);v.setAttribute("x2",P.positionScreen.x);v.setAttribute("y2",P.positionScreen.y);if(Q instanceof THREE.LineBasicMaterial){g.__styleString=Q.color.__styleString;v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+Q.linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.linecap+"; stroke-linejoin: "+Q.linejoin);o.appendChild(v)}}}}else if(z instanceof
+THREE.RenderableFace3){s=z.v1;w=z.v2;H=z.v3;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;H.positionScreen.x*=y;H.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);if(K.instersects(p)){M=0;for(I=z.meshMaterials.length;M<I;){Q=z.meshMaterials[M++];if(Q instanceof THREE.MeshFaceMaterial){L=0;for(P=z.faceMaterials.length;L<P;)(Q=z.faceMaterials[L++])&&
+c(s,w,H,z,Q,U)}else Q&&c(s,w,H,z,Q,U)}}}else if(z instanceof THREE.RenderableFace4){s=z.v1;w=z.v2;H=z.v3;J=z.v4;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;H.positionScreen.x*=y;H.positionScreen.y*=-x;J.positionScreen.x*=y;J.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);p.addPoint(J.positionScreen.x,J.positionScreen.y);if(K.instersects(p)){M=
+0;for(I=z.meshMaterials.length;M<I;){Q=z.meshMaterials[M++];if(Q instanceof THREE.MeshFaceMaterial){L=0;for(P=z.faceMaterials.length;L<P;)(Q=z.faceMaterials[L++])&&d(s,w,H,J,z,Q,U)}else Q&&d(s,w,H,J,z,Q,U)}}}}}};
+THREE.WebGLRenderer=function(a){function c(h,g){h.fragment_shader=g.fragment_shader;h.vertex_shader=g.vertex_shader;h.uniforms=Uniforms.clone(g.uniforms)}function d(h,g){var f;if(h=="fragment")f=b.createShader(b.FRAGMENT_SHADER);else if(h=="vertex")f=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,g);b.compileShader(f);if(!b.getShaderParameter(f,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(f));return null}return f}function e(h){switch(h){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 i=document.createElement("canvas"),b,n=null,o=null,k=new THREE.Matrix4,m,y=new Float32Array(16),x=new Float32Array(16),
+s=new Float32Array(16),w=new Float32Array(9),H=new Float32Array(16),J=true,K=new THREE.Color(0),p=0;if(a){if(a.antialias!==undefined)J=a.antialias;a.clearColor!==undefined&&K.setHex(a.clearColor);if(a.clearAlpha!==undefined)p=a.clearAlpha}this.domElement=i;this.autoClear=true;(function(h,g,f){try{b=i.getContext("experimental-webgl",{antialias:h})}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,f)})(J,K,p);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(h,g){i.width=h;i.height=g;b.viewport(0,0,i.width,i.height)};this.setClearColor=function(h,g){var f=new THREE.Color(h);b.clearColor(f.r,f.g,f.b,g)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|
+b.DEPTH_BUFFER_BIT)};this.setupLights=function(h,g){var f,j,t,u=0,l=0,A=0,q,G,r,v=this.lights,D=v.directional.colors,T=v.directional.positions,E=v.point.colors,N=v.point.positions,U=0,C=0;f=0;for(j=g.length;f<j;f++){t=g[f];q=t.color;G=t.position;r=t.intensity;if(t instanceof THREE.AmbientLight){u+=q.r;l+=q.g;A+=q.b}else if(t instanceof THREE.DirectionalLight){D[U*3]=q.r*r;D[U*3+1]=q.g*r;D[U*3+2]=q.b*r;T[U*3]=G.x;T[U*3+1]=G.y;T[U*3+2]=G.z;U+=1}else if(t instanceof THREE.PointLight){E[C*3]=q.r*r;E[C*
+3+1]=q.g*r;E[C*3+2]=q.b*r;N[C*3]=G.x;N[C*3+1]=G.y;N[C*3+2]=G.z;C+=1}}v.point.length=C;v.directional.length=U;v.ambient[0]=u;v.ambient[1]=l;v.ambient[2]=A};this.createParticleBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLNormalBuffer=b.createBuffer();h.__webGLTangentBuffer=
+b.createBuffer();h.__webGLUVBuffer=b.createBuffer();h.__webGLFaceBuffer=b.createBuffer();h.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(h){var g=h.vertices.length;h.__vertexArray=new Float32Array(g*3);h.__lineArray=new Uint16Array(g);h.__webGLLineCount=g};this.initMeshBuffers=function(h,g){var f,j,t=0,u=0,l=0,A=g.geometry.faces,q=h.faces;f=0;for(j=q.length;f<j;f++){fi=q[f];face=A[fi];if(face instanceof THREE.Face3){t+=3;u+=1;l+=3}else if(face instanceof THREE.Face4){t+=4;u+=2;
+l+=4}}h.__vertexArray=new Float32Array(t*3);h.__normalArray=new Float32Array(t*3);h.__tangentArray=new Float32Array(t*4);h.__uvArray=new Float32Array(t*2);h.__faceArray=new Uint16Array(u*3);h.__lineArray=new Uint16Array(l*2);t=false;f=0;for(j=g.materials.length;f<j;f++){A=g.materials[f];if(A instanceof THREE.MeshFaceMaterial){A=0;for(q=h.materials.length;A<q;A++)if(h.materials[A]&&h.materials[A].shading!=undefined&&h.materials[A].shading==THREE.SmoothShading){t=true;break}}else if(A&&A.shading!=undefined&&
+A.shading==THREE.SmoothShading){t=true;break}if(t)break}h.__needsSmoothNormals=t;h.__webGLFaceCount=u*3;h.__webGLLineCount=l*2};this.setMeshBuffers=function(h,g,f,j,t,u,l,A){var q,G,r,v,D,T,E,N,U,C=0,S=0,Y=0,M=0,I=0,L=0,P=0,z=h.__vertexArray,Q=h.__uvArray,V=h.__normalArray,X=h.__tangentArray,fa=h.__faceArray,aa=h.__lineArray,ya=h.__needsSmoothNormals,$=g.geometry,ca=$.vertices,oa=h.faces,ta=$.faces,ia=$.uvs;g=0;for(q=oa.length;g<q;g++){G=oa[g];r=ta[G];G=ia[G];v=r.vertexNormals;D=r.normal;if(r instanceof
+THREE.Face3){if(j){T=ca[r.a].position;E=ca[r.b].position;N=ca[r.c].position;z[S]=T.x;z[S+1]=T.y;z[S+2]=T.z;z[S+3]=E.x;z[S+4]=E.y;z[S+5]=E.z;z[S+6]=N.x;z[S+7]=N.y;z[S+8]=N.z;S+=9}if(A&&$.hasTangents){T=ca[r.a].tangent;E=ca[r.b].tangent;N=ca[r.c].tangent;X[L]=T.x;X[L+1]=T.y;X[L+2]=T.z;X[L+3]=T.w;X[L+4]=E.x;X[L+5]=E.y;X[L+6]=E.z;X[L+7]=E.w;X[L+8]=N.x;X[L+9]=N.y;X[L+10]=N.z;X[L+11]=N.w;L+=12}if(l)if(v.length==3&&ya)for(r=0;r<3;r++){D=v[r];V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}else for(r=0;r<3;r++){V[I]=
+D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}if(u&&G)for(r=0;r<3;r++){v=G[r];Q[Y]=v.u;Q[Y+1]=v.v;Y+=2}if(t){fa[M]=C;fa[M+1]=C+1;fa[M+2]=C+2;M+=3;aa[P]=C;aa[P+1]=C+1;aa[P+2]=C;aa[P+3]=C+2;aa[P+4]=C+1;aa[P+5]=C+2;P+=6;C+=3}}else if(r instanceof THREE.Face4){if(j){T=ca[r.a].position;E=ca[r.b].position;N=ca[r.c].position;U=ca[r.d].position;z[S]=T.x;z[S+1]=T.y;z[S+2]=T.z;z[S+3]=E.x;z[S+4]=E.y;z[S+5]=E.z;z[S+6]=N.x;z[S+7]=N.y;z[S+8]=N.z;z[S+9]=U.x;z[S+10]=U.y;z[S+11]=U.z;S+=12}if(A&&$.hasTangents){T=ca[r.a].tangent;
+E=ca[r.b].tangent;N=ca[r.c].tangent;r=ca[r.d].tangent;X[L]=T.x;X[L+1]=T.y;X[L+2]=T.z;X[L+3]=T.w;X[L+4]=E.x;X[L+5]=E.y;X[L+6]=E.z;X[L+7]=E.w;X[L+8]=N.x;X[L+9]=N.y;X[L+10]=N.z;X[L+11]=N.w;X[L+12]=r.x;X[L+13]=r.y;X[L+14]=r.z;X[L+15]=r.w;L+=16}if(l)if(v.length==4&&ya)for(r=0;r<4;r++){D=v[r];V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}else for(r=0;r<4;r++){V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}if(u&&G)for(r=0;r<4;r++){v=G[r];Q[Y]=v.u;Q[Y+1]=v.v;Y+=2}if(t){fa[M]=C;fa[M+1]=C+1;fa[M+2]=C+2;fa[M+3]=C;fa[M+4]=C+2;fa[M+
+5]=C+3;M+=6;aa[P]=C;aa[P+1]=C+1;aa[P+2]=C;aa[P+3]=C+3;aa[P+4]=C+1;aa[P+5]=C+2;aa[P+6]=C+2;aa[P+7]=C+3;P+=8;C+=4}}}if(j){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,z,f)}if(l){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,V,f)}if(A&&$.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,X,f)}if(u&&Y>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Q,f)}if(t){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+h.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,f);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,f)}};this.setLineBuffers=function(h,g,f,j){var t,u,l=h.vertices,A=l.length,q=h.__vertexArray,G=h.__lineArray;if(f)for(f=0;f<A;f++){t=l[f].position;u=f*3;q[u]=t.x;q[u+1]=t.y;q[u+2]=t.z}if(j)for(f=0;f<A;f++)G[f]=f;b.bindBuffer(b.ARRAY_BUFFER,h.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,q,g);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);
+b.bufferData(b.ELEMENT_ARRAY_BUFFER,G,g)};this.setParticleBuffers=function(){};this.initMaterial=function(h,g,f){if(!h.program){var j,t;if(h instanceof THREE.MeshDepthMaterial)c(h,THREE.ShaderLib.depth);else if(h instanceof THREE.MeshNormalMaterial)c(h,THREE.ShaderLib.normal);else if(h instanceof THREE.MeshBasicMaterial)c(h,THREE.ShaderLib.basic);else if(h instanceof THREE.MeshLambertMaterial)c(h,THREE.ShaderLib.lambert);else if(h instanceof THREE.MeshPhongMaterial)c(h,THREE.ShaderLib.phong);else h instanceof
+THREE.LineBasicMaterial&&c(h,THREE.ShaderLib.basic);var u,l,A,q;t=A=q=0;for(u=g.length;t<u;t++){l=g[t];l instanceof THREE.DirectionalLight&&A++;l instanceof THREE.PointLight&&q++}if(q+A<=4){g=A;q=q}else{g=Math.ceil(4*A/(q+A));q=4-g}t={directional:g,point:q};q=h.fragment_shader;g=h.vertex_shader;u={fog:f,map:h.map,env_map:h.env_map,maxDirLights:t.directional,maxPointLights:t.point};f=b.createProgram();t=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+
+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.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(f,d("fragment",t+q));b.attachShader(f,d("vertex",u+g));b.linkProgram(f);b.getProgramParameter(f,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(f,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");f.uniforms={};f.attributes={};h.program=f;f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(j in h.uniforms)f.push(j);j=h.program;q=0;for(g=f.length;q<g;q++){t=f[q];j.uniforms[t]=b.getUniformLocation(j,
+t)}h=h.program;j=["position","normal","uv","tangent"];f=0;for(q=j.length;f<q;f++){g=j[f];h.attributes[g]=b.getAttribLocation(h,g)}}};this.renderBuffer=function(h,g,f,j,t,u){var l;this.initMaterial(j,g,f);l=j.program;if(l!=n){b.useProgram(l);n=l}this.loadCamera(l,h);this.loadMatrices(l);if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){this.setupLights(l,g);g=this.lights;j.uniforms.enableLighting.value=g.directional.length+g.point.length;j.uniforms.ambientLightColor.value=
+g.ambient;j.uniforms.directionalLightColor.value=g.directional.colors;j.uniforms.directionalLightDirection.value=g.directional.positions;j.uniforms.pointLightColor.value=g.point.colors;j.uniforms.pointLightPosition.value=g.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){j.uniforms.color.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);j.uniforms.opacity.value=j.opacity;j.uniforms.map.texture=
+j.map;j.uniforms.env_map.texture=j.env_map;j.uniforms.reflectivity.value=j.reflectivity;j.uniforms.refraction_ratio.value=j.refraction_ratio;j.uniforms.combine.value=j.combine;j.uniforms.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping;if(f){j.uniforms.fogColor.value.setHex(f.color.hex);if(f instanceof THREE.Fog){j.uniforms.fogNear.value=f.near;j.uniforms.fogFar.value=f.far}else if(f instanceof THREE.FogExp2)j.uniforms.fogDensity.value=f.density}}if(j instanceof
+THREE.LineBasicMaterial){j.uniforms.color.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);j.uniforms.opacity.value=j.opacity;if(f){j.uniforms.fogColor.value.setHex(f.color.hex);if(f instanceof THREE.Fog){j.uniforms.fogNear.value=f.near;j.uniforms.fogFar.value=f.far}else if(f instanceof THREE.FogExp2)j.uniforms.fogDensity.value=f.density}}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}if(j instanceof THREE.MeshDepthMaterial){j.uniforms.mNear.value=h.near;j.uniforms.mFar.value=h.far}h=j.uniforms;var A,q,G;for(A in h)if(G=l.uniforms[A]){g=h[A];q=g.type;f=g.value;if(q=="i")b.uniform1i(G,f);else if(q=="f")b.uniform1f(G,f);else if(q=="fv1")b.uniform1fv(G,f);else if(q=="fv")b.uniform3fv(G,f);else if(q=="v2")b.uniform2f(G,f.x,f.y);else if(q=="v3")b.uniform3f(G,f.x,f.y,f.z);else if(q=="c")b.uniform3f(G,f.r,f.g,f.b);else if(q==
+"t"){b.uniform1i(G,f);if(g=g.texture)if(g.image instanceof Array&&g.image.length==6){g=g;f=f;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(q=0;q<6;++q)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,g.image[q]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);g.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+f);b.bindTexture(b.TEXTURE_CUBE_MAP,g.image.__webGLTextureCube)}}else{g=g;f=f;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,e(g.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(g.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(g.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(g.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+f);b.bindTexture(b.TEXTURE_2D,g.__webGLTexture)}}}l=l.attributes;b.bindBuffer(b.ARRAY_BUFFER,
+t.__webGLVertexBuffer);b.vertexAttribPointer(l.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.position);if(l.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLNormalBuffer);b.vertexAttribPointer(l.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.normal)}if(l.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLTangentBuffer);b.vertexAttribPointer(l.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.tangent)}if(l.uv>=0)if(t.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLUVBuffer);
+b.vertexAttribPointer(l.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(l.uv)}else b.disableVertexAttribArray(l.uv);if(j.wireframe||j instanceof THREE.LineBasicMaterial){l=j.wireframe_linewidth!==undefined?j.wireframe_linewidth:j.linewidth!==undefined?j.linewidth:1;j=j instanceof THREE.LineBasicMaterial&&u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(l);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);b.drawElements(j,t.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+t.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,t.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(h,g,f,j,t,u,l){var A,q,G,r,v;G=0;for(r=j.materials.length;G<r;G++){A=j.materials[G];if(A instanceof THREE.MeshFaceMaterial){A=0;for(q=t.materials.length;A<q;A++)if((v=t.materials[A])&&v.blending==u&&v.opacity<1==l){this.setBlending(v.blending);this.renderBuffer(h,g,f,v,t,j)}}else if((v=A)&&v.blending==u&&v.opacity<1==l){this.setBlending(v.blending);this.renderBuffer(h,g,f,v,t,j)}}};this.render=
+function(h,g,f,j){var t,u,l,A=h.lights,q=h.fog;this.initWebGLObjects(h);j=j!==undefined?j:true;if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=b.createFramebuffer();f.__webGLRenderbuffer=b.createRenderbuffer();f.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,f.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,f.width,f.height);b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(f.wrap_s));b.texParameteri(b.TEXTURE_2D,
+b.TEXTURE_WRAP_T,e(f.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(f.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(f.min_filter));b.texImage2D(b.TEXTURE_2D,0,e(f.format),f.width,f.height,0,e(f.format),e(f.type),null);b.bindFramebuffer(b.FRAMEBUFFER,f.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,f.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,f.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,
+null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(f){t=f.__webGLFramebuffer;l=f.width;u=f.height}else{t=null;l=i.width;u=i.height}if(t!=o){b.bindFramebuffer(b.FRAMEBUFFER,t);b.viewport(0,0,l,u);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);o=t}this.autoClear&&this.clear();g.autoUpdateMatrix&&g.updateMatrix();y.set(g.matrix.flatten());s.set(g.projectionMatrix.flatten());j=0;for(t=h.__webGLObjects.length;j<t;j++){u=h.__webGLObjects[j];l=u.object;u=u.buffer;if(l.visible){this.setupMatrices(l,
+g);this.renderPass(g,A,q,l,u,THREE.NormalBlending,false)}}j=0;for(t=h.__webGLObjects.length;j<t;j++){u=h.__webGLObjects[j];l=u.object;u=u.buffer;if(l.visible){this.setupMatrices(l,g);if(l.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);l.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}this.renderPass(g,A,q,l,u,THREE.AdditiveBlending,false);this.renderPass(g,A,q,l,u,THREE.SubtractiveBlending,false);this.renderPass(g,A,q,l,u,THREE.AdditiveBlending,true);this.renderPass(g,A,q,l,u,THREE.SubtractiveBlending,
+true);this.renderPass(g,A,q,l,u,THREE.NormalBlending,true)}}if(f&&f.min_filter!==THREE.NearestFilter&&f.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(h){function g(G,r,v,D){if(G[r]==undefined){h.__webGLObjects.push({buffer:v,object:D});G[r]=1}}var f,j,t,u,l,A,q;if(!h.__webGLObjects){h.__webGLObjects=[];h.__webGLObjectsMap={}}f=0;for(j=h.objects.length;f<j;f++){t=h.objects[f];
+l=t.geometry;if(h.__webGLObjectsMap[t.id]==undefined)h.__webGLObjectsMap[t.id]={};q=h.__webGLObjectsMap[t.id];if(t instanceof THREE.Mesh){for(u in l.geometryChunks){A=l.geometryChunks[u];if(!A.__webGLVertexBuffer){this.createMeshBuffers(A);this.initMeshBuffers(A,t);l.__dirtyVertices=true;l.__dirtyElements=true;l.__dirtyUvs=true;l.__dirtyNormals=true;l.__dirtyTangents=true}if(l.__dirtyVertices||l.__dirtyElements||l.__dirtyUvs)this.setMeshBuffers(A,t,b.DYNAMIC_DRAW,l.__dirtyVertices,l.__dirtyElements,
+l.__dirtyUvs,l.__dirtyNormals,l.__dirtyTangents);g(q,u,A,t)}l.__dirtyVertices=false;l.__dirtyElements=false;l.__dirtyUvs=false;l.__dirtyNormals=false;l.__dirtyTangents=false}else if(t instanceof THREE.Line){if(!l.__webGLVertexBuffer){this.createLineBuffers(l);this.initLineBuffers(l);l.__dirtyVertices=true;l.__dirtyElements=true}l.__dirtyVertices&&this.setLineBuffers(l,b.DYNAMIC_DRAW,l.__dirtyVertices,l.__dirtyElements);g(q,0,l,t);l.__dirtyVertices=false;l.__dirtyElements=false}else if(t instanceof
+THREE.ParticleSystem){l.__webGLVertexBuffer||this.createParticleBuffers(l);g(q,0,l,t)}}};this.removeObject=function(h,g){var f,j;for(f=h.__webGLObjects.length-1;f>=0;f--){j=h.__webGLObjects[f].object;g==j&&h.__webGLObjects.splice(f,1)}};this.setupMatrices=function(h,g){h.autoUpdateMatrix&&h.updateMatrix();k.multiply(g.matrix,h.matrix);x.set(k.flatten());m=THREE.Matrix4.makeInvert3x3(k).transpose();w.set(m.m);H.set(h.matrix.flatten())};this.loadMatrices=function(h){b.uniformMatrix4fv(h.uniforms.viewMatrix,
+false,y);b.uniformMatrix4fv(h.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(h.uniforms.projectionMatrix,false,s);b.uniformMatrix3fv(h.uniforms.normalMatrix,false,w);b.uniformMatrix4fv(h.uniforms.objectMatrix,false,H)};this.loadCamera=function(h,g){b.uniform3f(h.uniforms.cameraPosition,g.position.x,g.position.y,g.position.z)};this.setBlending=function(h){switch(h){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(h,g){if(h){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(h=="back")b.cullFace(b.BACK);else h=="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};

+ 203 - 203
build/ThreeDebug.js

@@ -1,203 +1,203 @@
-// 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,e=this.z;this.x=d*a.z-e*a.y;this.y=e*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,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1};
-THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;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,e=a.objects,i=[];a=0;for(c=e.length;a<c;a++){d=e[a];if(d instanceof THREE.Mesh)i=i.concat(this.intersectObject(d))}i.sort(function(b,n){return b.distance-n.distance});return i},intersectObject:function(a){function c(L,p,h,g){g=g.clone().subSelf(p);h=h.clone().subSelf(p);var f=L.clone().subSelf(p);L=g.dot(g);p=g.dot(h);g=g.dot(f);var j=h.dot(h);h=h.dot(f);f=1/(L*j-p*p);j=(j*g-p*h)*f;L=(L*h-p*g)*f;return j>0&&L>0&&j+L<1}var d,e,i,b,n,o,l,k,y,x,
-s,w=a.geometry,H=w.vertices,K=[];d=0;for(e=w.faces.length;d<e;d++){i=w.faces[d];x=this.origin.clone();s=this.direction.clone();b=a.matrix.multiplyVector3(H[i.a].position.clone());n=a.matrix.multiplyVector3(H[i.b].position.clone());o=a.matrix.multiplyVector3(H[i.c].position.clone());l=i instanceof THREE.Face4?a.matrix.multiplyVector3(H[i.d].position.clone()):null;k=a.rotationMatrix.multiplyVector3(i.normal.clone());y=s.dot(k);if(y<0){k=k.dot((new THREE.Vector3).sub(b,x))/y;x=x.addSelf(s.multiplyScalar(k));
-if(i instanceof THREE.Face3){if(c(x,b,n,o)){i={distance:this.origin.distanceTo(x),point:x,face:i,object:a};K.push(i)}}else if(i instanceof THREE.Face4)if(c(x,b,n,l)||c(x,n,o,l)){i={distance:this.origin.distanceTo(x),point:x,face:i,object:a};K.push(i)}}}return K}};
-THREE.Rectangle=function(){function a(){b=e-c;n=i-d}var c,d,e,i,b,n,o=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return b};this.getHeight=function(){return n};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return i};this.set=function(l,k,y,x){o=false;c=l;d=k;e=y;i=x;a()};this.addPoint=function(l,k){if(o){o=false;c=l;d=k;e=l;i=k}else{c=c<l?c:l;d=d<k?d:k;e=e>l?e:l;i=i>k?
-i:k}a()};this.add3Points=function(l,k,y,x,s,w){if(o){o=false;c=l<y?l<s?l:s:y<s?y:s;d=k<x?k<w?k:w:x<w?x:w;e=l>y?l>s?l:s:y>s?y:s;i=k>x?k>w?k:w:x>w?x:w}else{c=l<y?l<s?l<c?l:c:s<c?s:c:y<s?y<c?y:c:s<c?s:c;d=k<x?k<w?k<d?k:d:w<d?w:d:x<w?x<d?x:d:w<d?w:d;e=l>y?l>s?l>e?l:e:s>e?s:e:y>s?y>e?y:e:s>e?s:e;i=k>x?k>w?k>i?k:i:w>i?w:i:x>w?x>i?x:i:w>i?w:i}a()};this.addRectangle=function(l){if(o){o=false;c=l.getLeft();d=l.getTop();e=l.getRight();i=l.getBottom()}else{c=c<l.getLeft()?c:l.getLeft();d=d<l.getTop()?d:l.getTop();
-e=e>l.getRight()?e:l.getRight();i=i>l.getBottom()?i:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;e+=l;i+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();e=e<l.getRight()?e:l.getRight();i=i<l.getBottom()?i:l.getBottom();a()};this.instersects=function(l){return Math.min(e,l.getRight())-Math.max(c,l.getLeft())>=0&&Math.min(i,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){o=true;i=e=d=c=0;a()};this.isEmpty=function(){return o};this.toString=
-function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+i+", width: "+b+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}};
-THREE.Matrix4=function(a,c,d,e,i,b,n,o,l,k,y,x,s,w,H,K){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=i||0;this.n22=b||1;this.n23=n||0;this.n24=o||0;this.n31=l||0;this.n32=k||0;this.n33=y||1;this.n34=x||0;this.n41=s||0;this.n42=w||0;this.n43=H||0;this.n44=K||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,e,i,b,n,o,l,k,y,x,s,w,H,K){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=i;this.n22=b;this.n23=n;this.n24=o;this.n31=l;this.n32=k;this.n33=y;this.n34=x;this.n41=s;this.n42=w;this.n43=H;this.n44=K;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 e=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();i.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a);
-this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,i=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*i;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*i;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,i=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*i;a.y=this.n21*c+this.n22*d+this.n23*
-e+this.n24*i;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*i;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*i;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,e=a.n12,i=a.n13,b=a.n14,n=a.n21,o=a.n22,l=a.n23,k=a.n24,y=a.n31,
-x=a.n32,s=a.n33,w=a.n34,H=a.n41,K=a.n42,L=a.n43,p=a.n44,h=c.n11,g=c.n12,f=c.n13,j=c.n14,t=c.n21,u=c.n22,m=c.n23,B=c.n24,q=c.n31,G=c.n32,r=c.n33,v=c.n34,D=c.n41,T=c.n42,E=c.n43,N=c.n44;this.n11=d*h+e*t+i*q+b*D;this.n12=d*g+e*u+i*G+b*T;this.n13=d*f+e*m+i*r+b*E;this.n14=d*j+e*B+i*v+b*N;this.n21=n*h+o*t+l*q+k*D;this.n22=n*g+o*u+l*G+k*T;this.n23=n*f+o*m+l*r+k*E;this.n24=n*j+o*B+l*v+k*N;this.n31=y*h+x*t+s*q+w*D;this.n32=y*g+x*u+s*G+w*T;this.n33=y*f+x*m+s*r+w*E;this.n34=y*j+x*B+s*v+w*N;this.n41=H*h+K*t+
-L*q+p*D;this.n42=H*g+K*u+L*G+p*T;this.n43=H*f+K*m+L*r+p*E;this.n44=H*j+K*B+L*v+p*N;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,i=this.n14,b=this.n21,n=this.n22,o=this.n23,l=this.n24,k=this.n31,y=this.n32,x=this.n33,s=this.n34,w=this.n41,H=this.n42,K=this.n43,L=this.n44,p=a.n11,h=a.n21,g=a.n31,f=a.n41,j=a.n12,t=a.n22,u=a.n32,m=a.n42,B=a.n13,q=a.n23,G=a.n33,r=a.n43,v=a.n14,D=a.n24,T=a.n34;a=a.n44;this.n11=c*p+d*h+e*g+i*f;this.n12=c*j+d*t+e*u+i*m;this.n13=c*B+d*q+e*G+i*
-r;this.n14=c*v+d*D+e*T+i*a;this.n21=b*p+n*h+o*g+l*f;this.n22=b*j+n*t+o*u+l*m;this.n23=b*B+n*q+o*G+l*r;this.n24=b*v+n*D+o*T+l*a;this.n31=k*p+y*h+x*g+s*f;this.n32=k*j+y*t+x*u+s*m;this.n33=k*B+y*q+x*G+s*r;this.n34=k*v+y*D+x*T+s*a;this.n41=w*p+H*h+K*g+L*f;this.n42=w*j+H*t+K*u+L*m;this.n43=w*B+H*q+K*G+L*r;this.n44=w*v+H*D+K*T+L*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,c=this.n12,d=this.n13,e=this.n14,i=this.n21,b=this.n22,n=this.n23,o=this.n24,l=this.n31,k=this.n32,y=this.n33,x=this.n34,s=this.n41,w=this.n42,H=this.n43,K=this.n44;return e*n*k*s-d*o*k*s-e*b*y*s+c*o*y*s+d*b*x*s-c*n*x*s-e*n*l*w+d*o*l*w+e*i*y*w-a*o*y*w-d*i*x*w+a*n*x*w+e*b*l*H-c*o*l*H-e*i*k*H+a*o*k*H+c*i*x*H-a*b*x*H-d*b*l*K+c*n*l*K+d*i*k*K-a*n*k*K-c*i*y*K+a*b*y*K},transpose:function(){function a(c,d,
-e){var i=c[d];c[d]=c[e];c[e]=i}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(){var a=this.flat;a[0]=this.n11;
-a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=
-Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),i=1-d,b=a.x,n=a.y,o=a.z,l=i*b,k=i*n;this.set(l*b+d,l*n-e*o,l*o+e*n,0,l*n+e*o,k*n+d,k*o-e*b,0,l*o-e*n,k*o+e*b,i*o*o+d,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,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};
-THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d};
-THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,i=a.n14,b=a.n21,n=a.n22,o=a.n23,l=a.n24,k=a.n31,y=a.n32,x=a.n33,s=a.n34,w=a.n41,H=a.n42,K=a.n43,L=a.n44,p=new THREE.Matrix4;p.n11=o*s*H-l*x*H+l*y*K-n*s*K-o*y*L+n*x*L;p.n12=i*x*H-e*s*H-i*y*K+d*s*K+e*y*L-d*x*L;p.n13=e*l*H-i*o*H+i*n*K-d*l*K-e*n*L+d*o*L;p.n14=i*o*y-e*l*y-i*n*x+d*l*x+e*n*s-d*o*s;p.n21=l*x*w-o*s*w-l*k*K+b*s*K+o*k*L-b*x*L;p.n22=e*s*w-i*x*w+i*k*K-c*s*K-e*k*L+c*x*L;p.n23=i*o*w-e*l*w-i*b*K+c*l*K+e*b*L-c*o*L;p.n24=e*l*k-i*o*k+
-i*b*x-c*l*x-e*b*s+c*o*s;p.n31=n*s*w-l*y*w+l*k*H-b*s*H-n*k*L+b*y*L;p.n32=i*y*w-d*s*w-i*k*H+c*s*H+d*k*L-c*y*L;p.n33=e*l*w-i*n*w+i*b*H-c*l*H-d*b*L+c*n*L;p.n34=i*n*k-d*l*k-i*b*y+c*l*y+d*b*s-c*n*s;p.n41=o*y*w-n*x*w-o*k*H+b*x*H+n*k*K-b*y*K;p.n42=d*x*w-e*y*w+e*k*H-c*x*H-d*k*K+c*y*K;p.n43=e*n*w-d*o*w-e*b*H+c*o*H+d*b*K-c*n*K;p.n44=d*o*k-e*n*k+e*b*y-c*o*y-d*b*x+c*n*x;p.multiplyScalar(1/a.determinant());return p};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],n=-c[10]*c[4]+c[6]*c[8],o=c[10]*c[0]-c[2]*c[8],l=-c[6]*c[0]+c[2]*c[4],k=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*n+c[2]*k;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*i;d[2]=c*b;d[3]=c*n;d[4]=c*o;d[5]=c*l;d[6]=c*k;d[7]=c*y;d[8]=c*x;return a};
-THREE.Matrix4.makeFrustum=function(a,c,d,e,i,b){var n,o,l;n=new THREE.Matrix4;o=2*i/(c-a);l=2*i/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+i)/(b-i);i=-2*b*i/(b-i);n.n11=o;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=l;n.n23=d;n.n24=0;n.n31=0;n.n32=0;n.n33=e;n.n34=i;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,d,e){var i;a=d*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,d,e)};
-THREE.Matrix4.makeOrtho=function(a,c,d,e,i,b){var n,o,l,k;n=new THREE.Matrix4;o=c-a;l=d-e;k=b-i;a=(c+a)/o;d=(d+e)/l;i=(b+i)/k;n.n11=2/o;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/l;n.n23=0;n.n24=-d;n.n31=0;n.n32=0;n.n33=-2/k;n.n34=-i;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};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,e,i){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,c,d,e,i,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=b instanceof Array?b:[b]};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,e,i,b,n,o=new THREE.Vector3,l=new THREE.Vector3;e=0;for(i=this.vertices.length;e<i;e++){b=this.vertices[e];b.normal.set(0,0,0)}e=0;for(i=this.faces.length;e<i;e++){b=this.faces[e];if(a&&b.vertexNormals.length){o.set(0,0,0);c=0;for(d=b.normal.length;c<d;c++)o.addSelf(b.vertexNormals[c]);o.divideScalar(3)}else{c=this.vertices[b.a];d=this.vertices[b.b];n=this.vertices[b.c];o.sub(n.position,
-d.position);l.sub(c.position,d.position);o.crossSelf(l)}o.isZero()||o.normalize();b.normal.copy(o)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[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{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[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(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(v,D,T,E,N,U,C){b=v.vertices[D].position;n=v.vertices[T].position;o=v.vertices[E].position;l=i[N];k=i[U];y=i[C];x=n.x-b.x;s=o.x-b.x;w=n.y-b.y;H=o.y-b.y;
-K=n.z-b.z;L=o.z-b.z;p=k.u-l.u;h=y.u-l.u;g=k.v-l.v;f=y.v-l.v;j=1/(p*f-h*g);m.set((f*x-g*s)*j,(f*w-g*H)*j,(f*K-g*L)*j);B.set((p*s-h*x)*j,(p*H-h*w)*j,(p*L-h*K)*j);t[D].addSelf(m);t[T].addSelf(m);t[E].addSelf(m);u[D].addSelf(B);u[T].addSelf(B);u[E].addSelf(B)}var c,d,e,i,b,n,o,l,k,y,x,s,w,H,K,L,p,h,g,f,j,t=[],u=[],m=new THREE.Vector3,B=new THREE.Vector3,q=new THREE.Vector3,G=new THREE.Vector3,r=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){t[c]=new THREE.Vector3;u[c]=new THREE.Vector3}c=0;
-for(d=this.faces.length;c<d;c++){e=this.faces[c];i=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){r.copy(this.vertices[c].normal);e=t[c];q.copy(e);q.subSelf(r.multiplyScalar(r.dot(e))).normalize();G.cross(this.vertices[c].normal,e);e=G.dot(u[c]);e=e<0?-1:1;this.vertices[c].tangent.set(q.x,q.y,q.z,e)}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(y){var x=[];c=0;for(d=y.length;c<d;c++)y[c]==undefined?x.push("undefined"):x.push(y[c].toString());return x.join("_")}var c,d,e,i,b,n,o,l,k={};e=0;for(i=this.faces.length;e<i;e++){b=this.faces[e];
-n=b.materials;o=a(n);if(k[o]==undefined)k[o]={hash:o,counter:0};l=k[o].hash+"_"+k[o].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:n,vertices:0};b=b instanceof THREE.Face3?3:4;if(this.geometryChunks[l].vertices+b>65535){k[o].counter+=1;l=k[o].hash+"_"+k[o].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:n,vertices:0}}this.geometryChunks[l].faces.push(e);this.geometryChunks[l].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+
-this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
-THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;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(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
-this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);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.PointLight.prototype=new THREE.Light;THREE.PointLight.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.rotationMatrix=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,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};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,e,i,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=b!==undefined?b: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,e,i={};for(c in a){i[c]={};for(d in a[c]){e=a[c][d];i[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return i},merge:function(a){var c,d,e,i={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(d in e)i[d]=e[d]}return i}};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(u,m){return m.z-u.z}function c(u,m){var B=0,q=1,G=u.z+u.w,r=m.z+m.w,v=-u.z+u.w,D=-m.z+m.w;if(G>=0&&r>=0&&v>=0&&D>=0)return true;else if(G<0&&r<0||v<0&&D<0)return false;else{if(G<0)B=Math.max(B,G/(G-r));else if(r<0)q=Math.min(q,G/(G-r));if(v<0)B=Math.max(B,v/(v-D));else if(D<0)q=Math.min(q,v/(v-D));if(q<B)return false;else{u.lerpSelf(m,B);m.lerpSelf(u,1-q);return true}}}var d,e,i=[],b,n,o,l=[],k,y,x=[],s,w,H=[],K=new THREE.Vector4,L=new THREE.Vector4,p=new THREE.Matrix4,
-h=new THREE.Matrix4,g=[],f=new THREE.Vector4,j=new THREE.Vector4,t;this.projectObjects=function(u,m,B){var q=[],G,r;e=0;p.multiply(m.projectionMatrix,m.matrix);g[0]=new THREE.Vector4(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);g[1]=new THREE.Vector4(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);g[2]=new THREE.Vector4(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);g[3]=new THREE.Vector4(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);g[4]=new THREE.Vector4(p.n41-p.n31,p.n42-p.n32,p.n43-
-p.n33,p.n44-p.n34);g[5]=new THREE.Vector4(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);m=0;for(G=g.length;m<G;m++){r=g[m];r.divideScalar(Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z))}G=u.objects;u=0;for(m=G.length;u<m;u++){r=G[u];var v;if(!(v=!r.visible)){if(v=r instanceof THREE.Mesh){a:{v=void 0;for(var D=r.position,T=-r.geometry.boundingSphere.radius*Math.max(r.scale.x,Math.max(r.scale.y,r.scale.z)),E=0;E<6;E++){v=g[E].x*D.x+g[E].y*D.y+g[E].z*D.z+g[E].w;if(v<=T){v=false;break a}}v=true}v=!v}v=v}if(!v){d=
-i[e]=i[e]||new THREE.RenderableObject;K.copy(r.position);p.multiplyVector3(K);d.object=r;d.z=K.z;q.push(d);e++}}B&&q.sort(a);return q};this.projectScene=function(u,m,B){var q=[],G=m.near,r=m.far,v,D,T,E,N,U,C,S,Y,M,I,J,O,z,Q,V;o=y=w=0;m.autoUpdateMatrix&&m.updateMatrix();p.multiply(m.projectionMatrix,m.matrix);U=this.projectObjects(u,m,true);u=0;for(v=U.length;u<v;u++){C=U[u].object;if(C.visible){C.autoUpdateMatrix&&C.updateMatrix();S=C.matrix;Y=C.rotationMatrix;M=C.materials;I=C.overdraw;if(C instanceof
-THREE.Mesh){J=C.geometry;O=J.vertices;D=0;for(T=O.length;D<T;D++){z=O[D];z.positionWorld.copy(z.position);S.multiplyVector3(z.positionWorld);E=z.positionScreen;E.copy(z.positionWorld);p.multiplyVector4(E);E.x/=E.w;E.y/=E.w;z.__visible=E.z>G&&E.z<r}J=J.faces;D=0;for(T=J.length;D<T;D++){z=J[D];if(z instanceof THREE.Face3){E=O[z.a];N=O[z.b];Q=O[z.c];if(E.__visible&&N.__visible&&Q.__visible)if(C.doubleSided||C.flipSided!=(Q.positionScreen.x-E.positionScreen.x)*(N.positionScreen.y-E.positionScreen.y)-
-(Q.positionScreen.y-E.positionScreen.y)*(N.positionScreen.x-E.positionScreen.x)<0){b=l[o]=l[o]||new THREE.RenderableFace3;b.v1.positionWorld.copy(E.positionWorld);b.v2.positionWorld.copy(N.positionWorld);b.v3.positionWorld.copy(Q.positionWorld);b.v1.positionScreen.copy(E.positionScreen);b.v2.positionScreen.copy(N.positionScreen);b.v3.positionScreen.copy(Q.positionScreen);b.normalWorld.copy(z.normal);Y.multiplyVector3(b.normalWorld);b.centroidWorld.copy(z.centroid);S.multiplyVector3(b.centroidWorld);
-b.centroidScreen.copy(b.centroidWorld);p.multiplyVector3(b.centroidScreen);Q=z.vertexNormals;t=b.vertexNormalsWorld;E=0;for(N=Q.length;E<N;E++){V=t[E]=t[E]||new THREE.Vector3;V.copy(Q[E]);Y.multiplyVector3(V)}b.z=b.centroidScreen.z;b.meshMaterials=M;b.faceMaterials=z.materials;b.overdraw=I;if(C.geometry.uvs[D]){b.uvs[0]=C.geometry.uvs[D][0];b.uvs[1]=C.geometry.uvs[D][1];b.uvs[2]=C.geometry.uvs[D][2]}q.push(b);o++}}else if(z instanceof THREE.Face4){E=O[z.a];N=O[z.b];Q=O[z.c];V=O[z.d];if(E.__visible&&
-N.__visible&&Q.__visible&&V.__visible)if(C.doubleSided||C.flipSided!=((V.positionScreen.x-E.positionScreen.x)*(N.positionScreen.y-E.positionScreen.y)-(V.positionScreen.y-E.positionScreen.y)*(N.positionScreen.x-E.positionScreen.x)<0||(N.positionScreen.x-Q.positionScreen.x)*(V.positionScreen.y-Q.positionScreen.y)-(N.positionScreen.y-Q.positionScreen.y)*(V.positionScreen.x-Q.positionScreen.x)<0)){b=l[o]=l[o]||new THREE.RenderableFace3;b.v1.positionWorld.copy(E.positionWorld);b.v2.positionWorld.copy(N.positionWorld);
-b.v3.positionWorld.copy(V.positionWorld);b.v1.positionScreen.copy(E.positionScreen);b.v2.positionScreen.copy(N.positionScreen);b.v3.positionScreen.copy(V.positionScreen);b.normalWorld.copy(z.normal);Y.multiplyVector3(b.normalWorld);b.centroidWorld.copy(z.centroid);S.multiplyVector3(b.centroidWorld);b.centroidScreen.copy(b.centroidWorld);p.multiplyVector3(b.centroidScreen);b.z=b.centroidScreen.z;b.meshMaterials=M;b.faceMaterials=z.materials;b.overdraw=I;if(C.geometry.uvs[D]){b.uvs[0]=C.geometry.uvs[D][0];
-b.uvs[1]=C.geometry.uvs[D][1];b.uvs[2]=C.geometry.uvs[D][3]}q.push(b);o++;n=l[o]=l[o]||new THREE.RenderableFace3;n.v1.positionWorld.copy(N.positionWorld);n.v2.positionWorld.copy(Q.positionWorld);n.v3.positionWorld.copy(V.positionWorld);n.v1.positionScreen.copy(N.positionScreen);n.v2.positionScreen.copy(Q.positionScreen);n.v3.positionScreen.copy(V.positionScreen);n.normalWorld.copy(b.normalWorld);n.centroidWorld.copy(b.centroidWorld);n.centroidScreen.copy(b.centroidScreen);n.z=n.centroidScreen.z;n.meshMaterials=
-M;n.faceMaterials=z.materials;n.overdraw=I;if(C.geometry.uvs[D]){n.uvs[0]=C.geometry.uvs[D][1];n.uvs[1]=C.geometry.uvs[D][2];n.uvs[2]=C.geometry.uvs[D][3]}q.push(n);o++}}}}else if(C instanceof THREE.Line){h.multiply(p,S);O=C.geometry.vertices;z=O[0];z.positionScreen.copy(z.position);h.multiplyVector4(z.positionScreen);D=1;for(T=O.length;D<T;D++){E=O[D];E.positionScreen.copy(E.position);h.multiplyVector4(E.positionScreen);N=O[D-1];f.copy(E.positionScreen);j.copy(N.positionScreen);if(c(f,j)){f.multiplyScalar(1/
-f.w);j.multiplyScalar(1/j.w);k=x[y]=x[y]||new THREE.RenderableLine;k.v1.positionScreen.copy(f);k.v2.positionScreen.copy(j);k.z=Math.max(f.z,j.z);k.materials=C.materials;q.push(k);y++}}}else if(C instanceof THREE.Particle){L.set(C.position.x,C.position.y,C.position.z,1);p.multiplyVector4(L);L.z/=L.w;if(L.z>0&&L.z<1){s=H[w]=H[w]||new THREE.RenderableParticle;s.x=L.x/L.w;s.y=L.y/L.w;s.z=L.z;s.rotation=C.rotation.z;s.scale.x=C.scale.x*Math.abs(s.x-(L.x+m.projectionMatrix.n11)/(L.w+m.projectionMatrix.n14));
-s.scale.y=C.scale.y*Math.abs(s.y-(L.y+m.projectionMatrix.n22)/(L.w+m.projectionMatrix.n24));s.materials=C.materials;q.push(s);w++}}}}B&&q.sort(a);return q};this.unprojectVector=function(u,m){var B=THREE.Matrix4.makeInvert(m.matrix);B.multiplySelf(THREE.Matrix4.makeInvert(m.projectionMatrix));B.multiplyVector3(u);return u}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,i,b;this.domElement=document.createElement("div");this.setSize=function(n,o){d=n;e=o;i=d/2;b=e/2};this.render=function(n,o){var l,k,y,x,s,w,H,K;a=c.projectScene(n,o);l=0;for(k=a.length;l<k;l++){s=a[l];if(s instanceof THREE.RenderableParticle){H=s.x*i+i;K=s.y*b+b;y=0;for(x=s.material.length;y<x;y++){w=s.material[y];if(w instanceof THREE.ParticleDOMMaterial){w=w.domElement;w.style.left=H+"px";w.style.top=K+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(ea){if(s!=ea)k.globalAlpha=s=ea}function c(ea){if(w!=ea){switch(ea){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}w=ea}}var d=null,e=new THREE.Projector,i=document.createElement("canvas"),b,n,o,l,k=i.getContext("2d"),y=new THREE.Color(0),x=0,s=1,w=0,H=null,K=null,L=1,p,h,g,f,j,t,u,m,B,q=new THREE.Color,
-G=new THREE.Color,r=new THREE.Color,v=new THREE.Color,D=new THREE.Color,T,E,N,U,C,S,Y,M,I,J=new THREE.Rectangle,O=new THREE.Rectangle,z=new THREE.Rectangle,Q=false,V=new THREE.Color,X=new THREE.Color,fa=new THREE.Color,aa=new THREE.Color,ya=Math.PI*2,$=new THREE.Vector3,ca,oa,ta,ia,ua,za,ra=16;ca=document.createElement("canvas");ca.width=ca.height=2;oa=ca.getContext("2d");oa.fillStyle="rgba(0,0,0,1)";oa.fillRect(0,0,2,2);ta=oa.getImageData(0,0,2,2);ia=ta.data;ua=document.createElement("canvas");ua.width=
-ua.height=ra;za=ua.getContext("2d");za.translate(-ra/2,-ra/2);za.scale(ra,ra);ra--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ea,pa){b=ea;n=pa;o=b/2;l=n/2;i.width=b;i.height=n;J.set(-o,-l,o,l);s=1;w=0;K=H=null;L=1};this.setClearColor=function(ea,pa){y.setHex(ea);x=pa;O.set(-o,-l,o,l);k.setTransform(1,0,0,-1,o,l);this.clear()};this.clear=function(){if(!O.isEmpty()){O.inflate(1);O.minSelf(J);if(y.hex==0&&x==0)k.clearRect(O.getX(),O.getY(),O.getWidth(),
-O.getHeight());else{c(THREE.NormalBlending);a(1);k.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+x+")";k.fillRect(O.getX(),O.getY(),O.getWidth(),O.getHeight())}O.empty()}};this.render=function(ea,pa){function Ma(A){var W,R,F,P=A.lights;X.setRGB(0,0,0);fa.setRGB(0,0,0);aa.setRGB(0,0,0);A=0;for(W=P.length;A<W;A++){R=P[A];F=R.color;if(R instanceof THREE.AmbientLight){X.r+=F.r;X.g+=F.g;X.b+=F.b}else if(R instanceof THREE.DirectionalLight){fa.r+=F.r;fa.g+=F.g;
-fa.b+=F.b}else if(R instanceof THREE.PointLight){aa.r+=F.r;aa.g+=F.g;aa.b+=F.b}}}function Aa(A,W,R,F){var P,Z,da,ga,ha=A.lights;A=0;for(P=ha.length;A<P;A++){Z=ha[A];da=Z.color;ga=Z.intensity;if(Z instanceof THREE.DirectionalLight){Z=R.dot(Z.position)*ga;if(Z>0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}else if(Z instanceof THREE.PointLight){$.sub(Z.position,W);$.normalize();Z=R.dot($)*ga;if(Z>0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}}}function Na(A,W,R){if(R.opacity!=0){a(R.opacity);c(R.blending);var F,
-P,Z,da,ga,ha;if(R instanceof THREE.ParticleBasicMaterial){if(R.map){da=R.map;ga=da.width>>1;ha=da.height>>1;P=W.scale.x*o;Z=W.scale.y*l;R=P*ga;F=Z*ha;z.set(A.x-R,A.y-F,A.x+R,A.y+F);if(!J.instersects(z))return;k.save();k.translate(A.x,A.y);k.rotate(-W.rotation);k.scale(P,-Z);k.translate(-ga,-ha);k.drawImage(da,0,0);k.restore()}k.beginPath();k.moveTo(A.x-10,A.y);k.lineTo(A.x+10,A.y);k.moveTo(A.x,A.y-10);k.lineTo(A.x,A.y+10);k.closePath();k.strokeStyle="rgb(255,255,0)";k.stroke()}else if(R instanceof
-THREE.ParticleCircleMaterial){if(Q){V.r=X.r+fa.r+aa.r;V.g=X.g+fa.g+aa.g;V.b=X.b+fa.b+aa.b;q.r=R.color.r*V.r;q.g=R.color.g*V.g;q.b=R.color.b*V.b;q.updateStyleString()}else q.__styleString=R.color.__styleString;R=W.scale.x*o;F=W.scale.y*l;z.set(A.x-R,A.y-F,A.x+R,A.y+F);if(J.instersects(z)){P=q.__styleString;if(K!=P)k.fillStyle=K=P;k.save();k.translate(A.x,A.y);k.rotate(-W.rotation);k.scale(R,F);k.beginPath();k.arc(0,0,1,0,ya,true);k.closePath();k.fill();k.restore()}}}}function Oa(A,W,R,F){if(F.opacity!=
-0){a(F.opacity);c(F.blending);k.beginPath();k.moveTo(A.positionScreen.x,A.positionScreen.y);k.lineTo(W.positionScreen.x,W.positionScreen.y);k.closePath();if(F instanceof THREE.LineBasicMaterial){q.__styleString=F.color.__styleString;A=F.linewidth;if(L!=A)k.lineWidth=L=A;A=q.__styleString;if(H!=A)k.strokeStyle=H=A;k.stroke();z.inflate(F.linewidth*2)}}}function Ia(A,W,R,F,P,Z){if(P.opacity!=0){a(P.opacity);c(P.blending);f=A.positionScreen.x;j=A.positionScreen.y;t=W.positionScreen.x;u=W.positionScreen.y;
-m=R.positionScreen.x;B=R.positionScreen.y;k.beginPath();k.moveTo(f,j);k.lineTo(t,u);k.lineTo(m,B);k.lineTo(f,j);k.closePath();if(P instanceof THREE.MeshBasicMaterial)if(P.map)P.map.image.loaded&&P.map.mapping instanceof THREE.UVMapping&&va(f,j,t,u,m,B,P.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);else if(P.env_map){if(P.env_map.image.loaded)if(P.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=pa.matrix;$.copy(F.vertexNormalsWorld[0]);U=($.x*A.n11+$.y*
-A.n12+$.z*A.n13)*0.5+0.5;C=-($.x*A.n21+$.y*A.n22+$.z*A.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[1]);S=($.x*A.n11+$.y*A.n12+$.z*A.n13)*0.5+0.5;Y=-($.x*A.n21+$.y*A.n22+$.z*A.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[2]);M=($.x*A.n11+$.y*A.n12+$.z*A.n13)*0.5+0.5;I=-($.x*A.n21+$.y*A.n22+$.z*A.n23)*0.5+0.5;va(f,j,t,u,m,B,P.env_map.image,U,C,S,Y,M,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&&va(f,j,t,u,m,B,P.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);c(THREE.SubtractiveBlending)}if(Q)if(!P.wireframe&&P.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){G.r=r.r=v.r=X.r;G.g=r.g=v.g=X.g;G.b=r.b=v.b=X.b;Aa(Z,F.v1.positionWorld,F.vertexNormalsWorld[0],G);Aa(Z,F.v2.positionWorld,F.vertexNormalsWorld[1],r);Aa(Z,F.v3.positionWorld,F.vertexNormalsWorld[2],v);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,
-t,u,m,B,N,0,0,1,0,0,1)}else{V.r=X.r;V.g=X.g;V.b=X.b;Aa(Z,F.centroidWorld,F.normalWorld,V);q.r=P.color.r*V.r;q.g=P.color.g*V.g;q.b=P.color.b*V.b;q.updateStyleString();P.wireframe?Ba(q.__styleString,P.wireframe_linewidth):Ca(q.__styleString)}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString)}else if(P instanceof THREE.MeshDepthMaterial){T=pa.near;E=pa.far;G.r=G.g=G.b=1-Ea(A.positionScreen.z,T,E);r.r=r.g=r.b=1-Ea(W.positionScreen.z,T,E);v.r=v.g=v.b=1-Ea(R.positionScreen.z,
-T,E);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,t,u,m,B,N,0,0,1,0,0,1)}else if(P instanceof THREE.MeshNormalMaterial){q.r=Fa(F.normalWorld.x);q.g=Fa(F.normalWorld.y);q.b=Fa(F.normalWorld.z);q.updateStyleString();P.wireframe?Ba(q.__styleString,P.wireframe_linewidth):Ca(q.__styleString)}}}function Ba(A,W){if(H!=A)k.strokeStyle=H=A;if(L!=W)k.lineWidth=L=W;k.stroke();z.inflate(W*2)}function Ca(A){if(K!=A)k.fillStyle=K=A;k.fill()}function va(A,W,R,F,P,Z,da,ga,ha,la,ja,ma,
-wa){var qa,na;qa=da.width-1;na=da.height-1;ga*=qa;ha*=na;la*=qa;ja*=na;ma*=qa;wa*=na;R-=A;F-=W;P-=A;Z-=W;la-=ga;ja-=ha;ma-=ga;wa-=ha;na=1/(la*wa-ma*ja);qa=(wa*R-ja*P)*na;ja=(wa*F-ja*Z)*na;R=(la*P-ma*R)*na;F=(la*Z-ma*F)*na;A=A-qa*ga-R*ha;W=W-ja*ga-F*ha;k.save();k.transform(qa,ja,R,F,A,W);k.clip();k.drawImage(da,0,0);k.restore()}function Ja(A,W,R,F){var P=~~(A.r*255),Z=~~(A.g*255);A=~~(A.b*255);var da=~~(W.r*255),ga=~~(W.g*255);W=~~(W.b*255);var ha=~~(R.r*255),la=~~(R.g*255);R=~~(R.b*255);var ja=~~(F.r*
-255),ma=~~(F.g*255);F=~~(F.b*255);ia[0]=P<0?0:P>255?255:P;ia[1]=Z<0?0:Z>255?255:Z;ia[2]=A<0?0:A>255?255:A;ia[4]=da<0?0:da>255?255:da;ia[5]=ga<0?0:ga>255?255:ga;ia[6]=W<0?0:W>255?255:W;ia[8]=ha<0?0:ha>255?255:ha;ia[9]=la<0?0:la>255?255:la;ia[10]=R<0?0:R>255?255:R;ia[12]=ja<0?0:ja>255?255:ja;ia[13]=ma<0?0:ma>255?255:ma;ia[14]=F<0?0:F>255?255:F;oa.putImageData(ta,0,0);za.drawImage(ca,0,0);return ua}function Ea(A,W,R){A=(A-W)/(R-W);return A*A*(3-2*A)}function Fa(A){A=(A+1)*0.5;return A<0?0:A>1?1:A}function Ga(A,
-W){var R=W.x-A.x,F=W.y-A.y,P=1/Math.sqrt(R*R+F*F);R*=P;F*=P;W.x+=R;W.y+=F;A.x-=R;A.y-=F}var Da,Ka,ba,ka,sa,Ha,La,xa;k.setTransform(1,0,0,-1,o,l);this.autoClear&&this.clear();d=e.projectScene(ea,pa,this.sortElements);k.fillStyle="rgba( 0, 255, 255, 0.5 )";k.fillRect(J.getX(),J.getY(),J.getWidth(),J.getHeight());(Q=ea.lights.length>0)&&Ma(ea);Da=0;for(Ka=d.length;Da<Ka;Da++){ba=d[Da];z.empty();if(ba instanceof THREE.RenderableParticle){p=ba;p.x*=o;p.y*=l;ka=0;for(sa=ba.materials.length;ka<sa;ka++)Na(p,
-ba,ba.materials[ka],ea)}else if(ba instanceof THREE.RenderableLine){p=ba.v1;h=ba.v2;p.positionScreen.x*=o;p.positionScreen.y*=l;h.positionScreen.x*=o;h.positionScreen.y*=l;z.addPoint(p.positionScreen.x,p.positionScreen.y);z.addPoint(h.positionScreen.x,h.positionScreen.y);if(J.instersects(z)){ka=0;for(sa=ba.materials.length;ka<sa;)Oa(p,h,ba,ba.materials[ka++],ea)}}else if(ba instanceof THREE.RenderableFace3){p=ba.v1;h=ba.v2;g=ba.v3;p.positionScreen.x*=o;p.positionScreen.y*=l;h.positionScreen.x*=o;
-h.positionScreen.y*=l;g.positionScreen.x*=o;g.positionScreen.y*=l;if(ba.overdraw){Ga(p.positionScreen,h.positionScreen);Ga(h.positionScreen,g.positionScreen);Ga(g.positionScreen,p.positionScreen)}z.add3Points(p.positionScreen.x,p.positionScreen.y,h.positionScreen.x,h.positionScreen.y,g.positionScreen.x,g.positionScreen.y);if(J.instersects(z)){ka=0;for(sa=ba.meshMaterials.length;ka<sa;){xa=ba.meshMaterials[ka++];if(xa instanceof THREE.MeshFaceMaterial){Ha=0;for(La=ba.faceMaterials.length;Ha<La;)(xa=
-ba.faceMaterials[Ha++])&&Ia(p,h,g,ba,xa,ea)}else Ia(p,h,g,ba,xa,ea)}}}O.addRectangle(z)}k.lineWidth=1;k.strokeStyle="rgba( 255, 0, 0, 0.5 )";k.strokeRect(O.getX(),O.getY(),O.getWidth(),O.getHeight());k.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(U,C,S){var Y,M,I,J;Y=0;for(M=U.lights.length;Y<M;Y++){I=U.lights[Y];if(I instanceof THREE.DirectionalLight){J=C.normalWorld.dot(I.position)*I.intensity;if(J>0){S.r+=I.color.r*J;S.g+=I.color.g*J;S.b+=I.color.b*J}}else if(I instanceof THREE.PointLight){B.sub(I.position,C.centroidWorld);B.normalize();J=C.normalWorld.dot(B)*I.intensity;if(J>0){S.r+=I.color.r*J;S.g+=I.color.g*J;S.b+=I.color.b*J}}}}function c(U,C,S,Y,M,I){v=e(D++);v.setAttribute("d","M "+U.positionScreen.x+
-" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(I,Y,f);g.r=M.color.r*f.r;g.g=M.color.g*f.g;g.b=M.color.b*f.b;g.updateStyleString()}else g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){m=1-M.__2near/(M.__farPlusNear-Y.z*M.__farMinusNear);
-g.setRGB(m,m,m)}else M instanceof THREE.MeshNormalMaterial&&g.setRGB(i(Y.normalWorld.x),i(Y.normalWorld.y),i(Y.normalWorld.z));M.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+M.opacity);o.appendChild(v)}function d(U,C,S,Y,M,I,J){v=e(D++);v.setAttribute("d",
-"M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(J,M,f);g.r=I.color.r*f.r;g.g=I.color.g*f.g;g.b=I.color.b*f.b;g.updateStyleString()}else g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){m=
-1-I.__2near/(I.__farPlusNear-M.z*I.__farMinusNear);g.setRGB(m,m,m)}else I instanceof THREE.MeshNormalMaterial&&g.setRGB(i(M.normalWorld.x),i(M.normalWorld.y),i(M.normalWorld.z));I.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+I.opacity);o.appendChild(v)}
-function e(U){if(q[U]==null){q[U]=document.createElementNS("http://www.w3.org/2000/svg","path");N==0&&q[U].setAttribute("shape-rendering","crispEdges");return q[U]}return q[U]}function i(U){return U<0?Math.min((1+U)*0.5,0.5):0.5+Math.min(U*0.5,0.5)}var b=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,y,x,s,w,H,K,L=new THREE.Rectangle,p=new THREE.Rectangle,h=false,g=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),t=new THREE.Color(0),
-u=new THREE.Color(0),m,B=new THREE.Vector3,q=[],G=[],r=[],v,D,T,E,N=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(U){switch(U){case "high":N=1;break;case "low":N=0}};this.setSize=function(U,C){l=U;k=C;y=l/2;x=k/2;o.setAttribute("viewBox",-y+" "+-x+" "+l+" "+k);o.setAttribute("width",l);o.setAttribute("height",k);L.set(-y,-x,y,x)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(U,C){var S,Y,
-M,I,J,O,z,Q;this.autoClear&&this.clear();b=n.projectScene(U,C,this.sortElements);E=T=D=0;if(h=U.lights.length>0){z=U.lights;j.setRGB(0,0,0);t.setRGB(0,0,0);u.setRGB(0,0,0);S=0;for(Y=z.length;S<Y;S++){M=z[S];I=M.color;if(M instanceof THREE.AmbientLight){j.r+=I.r;j.g+=I.g;j.b+=I.b}else if(M instanceof THREE.DirectionalLight){t.r+=I.r;t.g+=I.g;t.b+=I.b}else if(M instanceof THREE.PointLight){u.r+=I.r;u.g+=I.g;u.b+=I.b}}}S=0;for(Y=b.length;S<Y;S++){z=b[S];p.empty();if(z instanceof THREE.RenderableParticle){s=
-z;s.x*=y;s.y*=-x;M=0;for(I=z.materials.length;M<I;M++)if(Q=z.materials[M]){J=s;O=z;Q=Q;var V=T++;if(G[V]==null){G[V]=document.createElementNS("http://www.w3.org/2000/svg","circle");N==0&&G[V].setAttribute("shape-rendering","crispEdges")}v=G[V];v.setAttribute("cx",J.x);v.setAttribute("cy",J.y);v.setAttribute("r",O.scale.x*y);if(Q instanceof THREE.ParticleCircleMaterial){if(h){f.r=j.r+t.r+u.r;f.g=j.g+t.g+u.g;f.b=j.b+t.b+u.b;g.r=Q.color.r*f.r;g.g=Q.color.g*f.g;g.b=Q.color.b*f.b;g.updateStyleString()}else g=
-Q.color;v.setAttribute("style","fill: "+g.__styleString)}o.appendChild(v)}}else if(z instanceof THREE.RenderableLine){s=z.v1;w=z.v2;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);if(L.instersects(p)){M=0;for(I=z.materials.length;M<I;)if(Q=z.materials[M++]){J=s;O=w;Q=Q;V=E++;if(r[V]==null){r[V]=document.createElementNS("http://www.w3.org/2000/svg","line");N==
-0&&r[V].setAttribute("shape-rendering","crispEdges")}v=r[V];v.setAttribute("x1",J.positionScreen.x);v.setAttribute("y1",J.positionScreen.y);v.setAttribute("x2",O.positionScreen.x);v.setAttribute("y2",O.positionScreen.y);if(Q instanceof THREE.LineBasicMaterial){g.__styleString=Q.color.__styleString;v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+Q.linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.linecap+"; stroke-linejoin: "+Q.linejoin);o.appendChild(v)}}}}else if(z instanceof
-THREE.RenderableFace3){s=z.v1;w=z.v2;H=z.v3;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;H.positionScreen.x*=y;H.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);if(L.instersects(p)){M=0;for(I=z.meshMaterials.length;M<I;){Q=z.meshMaterials[M++];if(Q instanceof THREE.MeshFaceMaterial){J=0;for(O=z.faceMaterials.length;J<O;)(Q=z.faceMaterials[J++])&&
-c(s,w,H,z,Q,U)}else Q&&c(s,w,H,z,Q,U)}}}else if(z instanceof THREE.RenderableFace4){s=z.v1;w=z.v2;H=z.v3;K=z.v4;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;H.positionScreen.x*=y;H.positionScreen.y*=-x;K.positionScreen.x*=y;K.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);p.addPoint(K.positionScreen.x,K.positionScreen.y);if(L.instersects(p)){M=
-0;for(I=z.meshMaterials.length;M<I;){Q=z.meshMaterials[M++];if(Q instanceof THREE.MeshFaceMaterial){J=0;for(O=z.faceMaterials.length;J<O;)(Q=z.faceMaterials[J++])&&d(s,w,H,K,z,Q,U)}else Q&&d(s,w,H,K,z,Q,U)}}}}}};
-THREE.WebGLRenderer=function(a){function c(h,g){h.fragment_shader=g.fragment_shader;h.vertex_shader=g.vertex_shader;h.uniforms=Uniforms.clone(g.uniforms)}function d(h,g){var f;if(h=="fragment")f=b.createShader(b.FRAGMENT_SHADER);else if(h=="vertex")f=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,g);b.compileShader(f);if(!b.getShaderParameter(f,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(f));return null}return f}function e(h){switch(h){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 i=document.createElement("canvas"),b,n=null,o=null,l=new THREE.Matrix4,k,y=new Float32Array(16),x=new Float32Array(16),
-s=new Float32Array(16),w=new Float32Array(9),H=new Float32Array(16),K=true,L=new THREE.Color(0),p=0;if(a){if(a.antialias!==undefined)K=a.antialias;a.clearColor!==undefined&&L.setHex(a.clearColor);if(a.clearAlpha!==undefined)p=a.clearAlpha}this.domElement=i;this.autoClear=true;(function(h,g,f){try{b=i.getContext("experimental-webgl",{antialias:h})}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,f)})(K,L,p);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(h,g){i.width=h;i.height=g;b.viewport(0,0,i.width,i.height)};this.setClearColor=function(h,g){var f=new THREE.Color(h);b.clearColor(f.r,f.g,f.b,g)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|
-b.DEPTH_BUFFER_BIT)};this.setupLights=function(h,g){var f,j,t,u=0,m=0,B=0,q,G,r,v=this.lights,D=v.directional.colors,T=v.directional.positions,E=v.point.colors,N=v.point.positions,U=0,C=0;f=0;for(j=g.length;f<j;f++){t=g[f];q=t.color;G=t.position;r=t.intensity;if(t instanceof THREE.AmbientLight){u+=q.r;m+=q.g;B+=q.b}else if(t instanceof THREE.DirectionalLight){D[U*3]=q.r*r;D[U*3+1]=q.g*r;D[U*3+2]=q.b*r;T[U*3]=G.x;T[U*3+1]=G.y;T[U*3+2]=G.z;U+=1}else if(t instanceof THREE.PointLight){E[C*3]=q.r*r;E[C*
-3+1]=q.g*r;E[C*3+2]=q.b*r;N[C*3]=G.x;N[C*3+1]=G.y;N[C*3+2]=G.z;C+=1}}v.point.length=C;v.directional.length=U;v.ambient[0]=u;v.ambient[1]=m;v.ambient[2]=B};this.createParticleBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLNormalBuffer=b.createBuffer();h.__webGLTangentBuffer=
-b.createBuffer();h.__webGLUVBuffer=b.createBuffer();h.__webGLFaceBuffer=b.createBuffer();h.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(h){var g=h.vertices.length;h.__vertexArray=new Float32Array(g*3);h.__lineArray=new Uint16Array(g);h.__webGLLineCount=g};this.initMeshBuffers=function(h,g){var f,j,t=0,u=0,m=0,B=g.geometry.faces,q=h.faces;f=0;for(j=q.length;f<j;f++){fi=q[f];face=B[fi];if(face instanceof THREE.Face3){t+=3;u+=1;m+=3}else if(face instanceof THREE.Face4){t+=4;u+=2;
-m+=4}}h.__vertexArray=new Float32Array(t*3);h.__normalArray=new Float32Array(t*3);h.__tangentArray=new Float32Array(t*4);h.__uvArray=new Float32Array(t*2);h.__faceArray=new Uint16Array(u*3);h.__lineArray=new Uint16Array(m*2);t=false;f=0;for(j=g.materials.length;f<j;f++){B=g.materials[f];if(B instanceof THREE.MeshFaceMaterial){B=0;for(q=h.materials.length;B<q;B++)if(h.materials[B]&&h.materials[B].shading!=undefined&&h.materials[B].shading==THREE.SmoothShading){t=true;break}}else if(B&&B.shading!=undefined&&
-B.shading==THREE.SmoothShading){t=true;break}if(t)break}h.__needsSmoothNormals=t;h.__webGLFaceCount=u*3;h.__webGLLineCount=m*2};this.setMeshBuffers=function(h,g,f,j,t,u,m,B){var q,G,r,v,D,T,E,N,U,C=0,S=0,Y=0,M=0,I=0,J=0,O=0,z=h.__vertexArray,Q=h.__uvArray,V=h.__normalArray,X=h.__tangentArray,fa=h.__faceArray,aa=h.__lineArray,ya=h.__needsSmoothNormals,$=g.geometry,ca=$.vertices,oa=h.faces,ta=$.faces,ia=$.uvs;g=0;for(q=oa.length;g<q;g++){G=oa[g];r=ta[G];G=ia[G];v=r.vertexNormals;D=r.normal;if(r instanceof
-THREE.Face3){if(j){T=ca[r.a].position;E=ca[r.b].position;N=ca[r.c].position;z[S]=T.x;z[S+1]=T.y;z[S+2]=T.z;z[S+3]=E.x;z[S+4]=E.y;z[S+5]=E.z;z[S+6]=N.x;z[S+7]=N.y;z[S+8]=N.z;S+=9}if(B&&$.hasTangents){T=ca[r.a].tangent;E=ca[r.b].tangent;N=ca[r.c].tangent;X[J]=T.x;X[J+1]=T.y;X[J+2]=T.z;X[J+3]=T.w;X[J+4]=E.x;X[J+5]=E.y;X[J+6]=E.z;X[J+7]=E.w;X[J+8]=N.x;X[J+9]=N.y;X[J+10]=N.z;X[J+11]=N.w;J+=12}if(m)if(v.length==3&&ya)for(r=0;r<3;r++){D=v[r];V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}else for(r=0;r<3;r++){V[I]=
-D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}if(u&&G)for(r=0;r<3;r++){v=G[r];Q[Y]=v.u;Q[Y+1]=v.v;Y+=2}if(t){fa[M]=C;fa[M+1]=C+1;fa[M+2]=C+2;M+=3;aa[O]=C;aa[O+1]=C+1;aa[O+2]=C;aa[O+3]=C+2;aa[O+4]=C+1;aa[O+5]=C+2;O+=6;C+=3}}else if(r instanceof THREE.Face4){if(j){T=ca[r.a].position;E=ca[r.b].position;N=ca[r.c].position;U=ca[r.d].position;z[S]=T.x;z[S+1]=T.y;z[S+2]=T.z;z[S+3]=E.x;z[S+4]=E.y;z[S+5]=E.z;z[S+6]=N.x;z[S+7]=N.y;z[S+8]=N.z;z[S+9]=U.x;z[S+10]=U.y;z[S+11]=U.z;S+=12}if(B&&$.hasTangents){T=ca[r.a].tangent;
-E=ca[r.b].tangent;N=ca[r.c].tangent;r=ca[r.d].tangent;X[J]=T.x;X[J+1]=T.y;X[J+2]=T.z;X[J+3]=T.w;X[J+4]=E.x;X[J+5]=E.y;X[J+6]=E.z;X[J+7]=E.w;X[J+8]=N.x;X[J+9]=N.y;X[J+10]=N.z;X[J+11]=N.w;X[J+12]=r.x;X[J+13]=r.y;X[J+14]=r.z;X[J+15]=r.w;J+=16}if(m)if(v.length==4&&ya)for(r=0;r<4;r++){D=v[r];V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}else for(r=0;r<4;r++){V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}if(u&&G)for(r=0;r<4;r++){v=G[r];Q[Y]=v.u;Q[Y+1]=v.v;Y+=2}if(t){fa[M]=C;fa[M+1]=C+1;fa[M+2]=C+2;fa[M+3]=C;fa[M+4]=C+2;fa[M+
-5]=C+3;M+=6;aa[O]=C;aa[O+1]=C+1;aa[O+2]=C;aa[O+3]=C+3;aa[O+4]=C+1;aa[O+5]=C+2;aa[O+6]=C+2;aa[O+7]=C+3;O+=8;C+=4}}}if(j){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,z,f)}if(m){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,V,f)}if(B&&$.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,X,f)}if(u&&Y>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Q,f)}if(t){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-h.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,f);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,f)}};this.setLineBuffers=function(h,g,f,j){var t,u,m=h.vertices,B=m.length,q=h.__vertexArray,G=h.__lineArray;if(f)for(f=0;f<B;f++){t=m[f].position;u=f*3;q[u]=t.x;q[u+1]=t.y;q[u+2]=t.z}if(j)for(f=0;f<B;f++)G[f]=f;b.bindBuffer(b.ARRAY_BUFFER,h.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,q,g);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);
-b.bufferData(b.ELEMENT_ARRAY_BUFFER,G,g)};this.setParticleBuffers=function(){};this.initMaterial=function(h,g,f){if(!h.program){var j,t;if(h instanceof THREE.MeshDepthMaterial)c(h,THREE.ShaderLib.depth);else if(h instanceof THREE.MeshNormalMaterial)c(h,THREE.ShaderLib.normal);else if(h instanceof THREE.MeshBasicMaterial)c(h,THREE.ShaderLib.basic);else if(h instanceof THREE.MeshLambertMaterial)c(h,THREE.ShaderLib.lambert);else if(h instanceof THREE.MeshPhongMaterial)c(h,THREE.ShaderLib.phong);else h instanceof
-THREE.LineBasicMaterial&&c(h,THREE.ShaderLib.basic);var u,m,B,q;t=B=q=0;for(u=g.length;t<u;t++){m=g[t];m instanceof THREE.DirectionalLight&&B++;m instanceof THREE.PointLight&&q++}if(q+B<=4){g=B;q=q}else{g=Math.ceil(4*B/(q+B));q=4-g}t={directional:g,point:q};q=h.fragment_shader;g=h.vertex_shader;u={fog:f,map:h.map,env_map:h.env_map,maxDirLights:t.directional,maxPointLights:t.point};f=b.createProgram();t=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+
-u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.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(f,d("fragment",t+q));b.attachShader(f,d("vertex",u+g));b.linkProgram(f);b.getProgramParameter(f,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(f,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");f.uniforms={};f.attributes={};h.program=f;f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(j in h.uniforms)f.push(j);j=h.program;q=0;for(g=f.length;q<g;q++){t=f[q];j.uniforms[t]=b.getUniformLocation(j,
-t)}h=h.program;j=["position","normal","uv","tangent"];f=0;for(q=j.length;f<q;f++){g=j[f];h.attributes[g]=b.getAttribLocation(h,g)}}};this.renderBuffer=function(h,g,f,j,t,u){var m;this.initMaterial(j,g,f);m=j.program;if(m!=n){b.useProgram(m);n=m}this.loadCamera(m,h);this.loadMatrices(m);if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){this.setupLights(m,g);g=this.lights;j.uniforms.enableLighting.value=g.directional.length+g.point.length;j.uniforms.ambientLightColor.value=
-g.ambient;j.uniforms.directionalLightColor.value=g.directional.colors;j.uniforms.directionalLightDirection.value=g.directional.positions;j.uniforms.pointLightColor.value=g.point.colors;j.uniforms.pointLightPosition.value=g.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){j.uniforms.color.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);j.uniforms.opacity.value=j.opacity;j.uniforms.map.texture=
-j.map;j.uniforms.env_map.texture=j.env_map;j.uniforms.reflectivity.value=j.reflectivity;j.uniforms.refraction_ratio.value=j.refraction_ratio;j.uniforms.combine.value=j.combine;j.uniforms.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping;if(f){j.uniforms.fogColor.value.setHex(f.color.hex);if(f instanceof THREE.Fog){j.uniforms.fogNear.value=f.near;j.uniforms.fogFar.value=f.far}else if(f instanceof THREE.FogExp2)j.uniforms.fogDensity.value=f.density}}if(j instanceof
-THREE.LineBasicMaterial){j.uniforms.color.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);j.uniforms.opacity.value=j.opacity;if(f){j.uniforms.fogColor.value.setHex(f.color.hex);if(f instanceof THREE.Fog){j.uniforms.fogNear.value=f.near;j.uniforms.fogFar.value=f.far}else if(f instanceof THREE.FogExp2)j.uniforms.fogDensity.value=f.density}}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}if(j instanceof THREE.MeshDepthMaterial){j.uniforms.mNear.value=h.near;j.uniforms.mFar.value=h.far}h=j.uniforms;var B,q,G;for(B in h)if(G=m.uniforms[B]){g=h[B];q=g.type;f=g.value;if(q=="i")b.uniform1i(G,f);else if(q=="f")b.uniform1f(G,f);else if(q=="fv1")b.uniform1fv(G,f);else if(q=="fv")b.uniform3fv(G,f);else if(q=="v2")b.uniform2f(G,f.x,f.y);else if(q=="v3")b.uniform3f(G,f.x,f.y,f.z);else if(q=="c")b.uniform3f(G,f.r,f.g,f.b);else if(q==
-"t"){b.uniform1i(G,f);if(g=g.texture)if(g.image instanceof Array&&g.image.length==6){g=g;f=f;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(q=0;q<6;++q)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,g.image[q]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);g.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+f);b.bindTexture(b.TEXTURE_CUBE_MAP,g.image.__webGLTextureCube)}}else{g=g;f=f;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,e(g.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(g.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(g.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(g.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+f);b.bindTexture(b.TEXTURE_2D,g.__webGLTexture)}}}m=m.attributes;b.bindBuffer(b.ARRAY_BUFFER,
-t.__webGLVertexBuffer);b.vertexAttribPointer(m.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.position);if(m.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLNormalBuffer);b.vertexAttribPointer(m.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.normal)}if(m.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLTangentBuffer);b.vertexAttribPointer(m.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.tangent)}if(m.uv>=0)if(t.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLUVBuffer);
-b.vertexAttribPointer(m.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.uv)}else b.disableVertexAttribArray(m.uv);if(j.wireframe||j instanceof THREE.LineBasicMaterial){m=j.wireframe_linewidth!==undefined?j.wireframe_linewidth:j.linewidth!==undefined?j.linewidth:1;j=j instanceof THREE.LineBasicMaterial&&u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(m);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);b.drawElements(j,t.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-t.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,t.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(h,g,f,j,t,u,m){var B,q,G,r,v;G=0;for(r=j.materials.length;G<r;G++){B=j.materials[G];if(B instanceof THREE.MeshFaceMaterial){B=0;for(q=t.materials.length;B<q;B++)if((v=t.materials[B])&&v.blending==u&&v.opacity<1==m){this.setBlending(v.blending);this.renderBuffer(h,g,f,v,t,j)}}else if((v=B)&&v.blending==u&&v.opacity<1==m){this.setBlending(v.blending);this.renderBuffer(h,g,f,v,t,j)}}};this.render=
-function(h,g,f,j){var t,u,m,B=h.lights,q=h.fog;this.initWebGLObjects(h);j=j!==undefined?j:true;if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=b.createFramebuffer();f.__webGLRenderbuffer=b.createRenderbuffer();f.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,f.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,f.width,f.height);b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(f.wrap_s));b.texParameteri(b.TEXTURE_2D,
-b.TEXTURE_WRAP_T,e(f.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(f.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(f.min_filter));b.texImage2D(b.TEXTURE_2D,0,e(f.format),f.width,f.height,0,e(f.format),e(f.type),null);b.bindFramebuffer(b.FRAMEBUFFER,f.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,f.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,f.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,
-null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(f){t=f.__webGLFramebuffer;m=f.width;u=f.height}else{t=null;m=i.width;u=i.height}if(t!=o){b.bindFramebuffer(b.FRAMEBUFFER,t);b.viewport(0,0,m,u);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);o=t}this.autoClear&&this.clear();g.autoUpdateMatrix&&g.updateMatrix();y.set(g.matrix.flatten());s.set(g.projectionMatrix.flatten());j=0;for(t=h.__webGLObjects.length;j<t;j++){u=h.__webGLObjects[j];m=u.object;u=u.buffer;if(m.visible){this.setupMatrices(m,
-g);this.renderPass(g,B,q,m,u,THREE.NormalBlending,false)}}j=0;for(t=h.__webGLObjects.length;j<t;j++){u=h.__webGLObjects[j];m=u.object;u=u.buffer;if(m.visible){this.setupMatrices(m,g);if(m.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);m.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}this.renderPass(g,B,q,m,u,THREE.AdditiveBlending,false);this.renderPass(g,B,q,m,u,THREE.SubtractiveBlending,false);this.renderPass(g,B,q,m,u,THREE.AdditiveBlending,true);this.renderPass(g,B,q,m,u,THREE.SubtractiveBlending,
-true);this.renderPass(g,B,q,m,u,THREE.NormalBlending,true)}}if(f&&f.min_filter!==THREE.NearestFilter&&f.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(h){function g(G,r,v,D){if(G[r]==undefined){h.__webGLObjects.push({buffer:v,object:D});G[r]=1}}var f,j,t,u,m,B,q;if(!h.__webGLObjects){h.__webGLObjects=[];h.__webGLObjectsMap={}}f=0;for(j=h.objects.length;f<j;f++){t=h.objects[f];
-m=t.geometry;if(h.__webGLObjectsMap[t.id]==undefined)h.__webGLObjectsMap[t.id]={};q=h.__webGLObjectsMap[t.id];if(t instanceof THREE.Mesh){for(u in m.geometryChunks){B=m.geometryChunks[u];if(!B.__webGLVertexBuffer){this.createMeshBuffers(B);this.initMeshBuffers(B,t);m.__dirtyVertices=true;m.__dirtyElements=true;m.__dirtyUvs=true;m.__dirtyNormals=true;m.__dirtyTangents=true}if(m.__dirtyVertices||m.__dirtyElements||m.__dirtyUvs)this.setMeshBuffers(B,t,b.DYNAMIC_DRAW,m.__dirtyVertices,m.__dirtyElements,
-m.__dirtyUvs,m.__dirtyNormals,m.__dirtyTangents);g(q,u,B,t)}m.__dirtyVertices=false;m.__dirtyElements=false;m.__dirtyUvs=false;m.__dirtyNormals=false;m.__dirtyTangents=false}else if(t instanceof THREE.Line){if(!m.__webGLVertexBuffer){this.createLineBuffers(m);this.initLineBuffers(m);m.__dirtyVertices=true;m.__dirtyElements=true}m.__dirtyVertices&&this.setLineBuffers(m,b.DYNAMIC_DRAW,m.__dirtyVertices,m.__dirtyElements);g(q,0,m,t);m.__dirtyVertices=false;m.__dirtyElements=false}else if(t instanceof
-THREE.ParticleSystem){m.__webGLVertexBuffer||this.createParticleBuffers(m);g(q,0,m,t)}}};this.removeObject=function(h,g){var f,j;for(f=h.__webGLObjects.length-1;f>=0;f--){j=h.__webGLObjects[f].object;g==j&&h.__webGLObjects.splice(f,1)}};this.setupMatrices=function(h,g){h.autoUpdateMatrix&&h.updateMatrix();l.multiply(g.matrix,h.matrix);x.set(l.flatten());k=THREE.Matrix4.makeInvert3x3(l).transpose();w.set(k.m);H.set(h.matrix.flatten())};this.loadMatrices=function(h){b.uniformMatrix4fv(h.uniforms.viewMatrix,
-false,y);b.uniformMatrix4fv(h.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(h.uniforms.projectionMatrix,false,s);b.uniformMatrix3fv(h.uniforms.normalMatrix,false,w);b.uniformMatrix4fv(h.uniforms.objectMatrix,false,H)};this.loadCamera=function(h,g){b.uniform3f(h.uniforms.cameraPosition,g.position.x,g.position.y,g.position.z)};this.setBlending=function(h){switch(h){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(h,g){if(h){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(h=="back")b.cullFace(b.BACK);else h=="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,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,e=this.z;this.x=d*a.z-e*a.y;this.y=e*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,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1};
+THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;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,e=a.objects,i=[];a=0;for(c=e.length;a<c;a++){d=e[a];if(d instanceof THREE.Mesh)i=i.concat(this.intersectObject(d))}i.sort(function(b,n){return b.distance-n.distance});return i},intersectObject:function(a){function c(L,p,h,g){g=g.clone().subSelf(p);h=h.clone().subSelf(p);var f=L.clone().subSelf(p);L=g.dot(g);p=g.dot(h);g=g.dot(f);var j=h.dot(h);h=h.dot(f);f=1/(L*j-p*p);j=(j*g-p*h)*f;L=(L*h-p*g)*f;return j>0&&L>0&&j+L<1}var d,e,i,b,n,o,l,k,y,x,
+s,w=a.geometry,H=w.vertices,K=[];d=0;for(e=w.faces.length;d<e;d++){i=w.faces[d];x=this.origin.clone();s=this.direction.clone();b=a.matrix.multiplyVector3(H[i.a].position.clone());n=a.matrix.multiplyVector3(H[i.b].position.clone());o=a.matrix.multiplyVector3(H[i.c].position.clone());l=i instanceof THREE.Face4?a.matrix.multiplyVector3(H[i.d].position.clone()):null;k=a.rotationMatrix.multiplyVector3(i.normal.clone());y=s.dot(k);if(y<0){k=k.dot((new THREE.Vector3).sub(b,x))/y;x=x.addSelf(s.multiplyScalar(k));
+if(i instanceof THREE.Face3){if(c(x,b,n,o)){i={distance:this.origin.distanceTo(x),point:x,face:i,object:a};K.push(i)}}else if(i instanceof THREE.Face4)if(c(x,b,n,l)||c(x,n,o,l)){i={distance:this.origin.distanceTo(x),point:x,face:i,object:a};K.push(i)}}}return K}};
+THREE.Rectangle=function(){function a(){b=e-c;n=i-d}var c,d,e,i,b,n,o=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return b};this.getHeight=function(){return n};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return i};this.set=function(l,k,y,x){o=false;c=l;d=k;e=y;i=x;a()};this.addPoint=function(l,k){if(o){o=false;c=l;d=k;e=l;i=k}else{c=c<l?c:l;d=d<k?d:k;e=e>l?e:l;i=i>k?
+i:k}a()};this.add3Points=function(l,k,y,x,s,w){if(o){o=false;c=l<y?l<s?l:s:y<s?y:s;d=k<x?k<w?k:w:x<w?x:w;e=l>y?l>s?l:s:y>s?y:s;i=k>x?k>w?k:w:x>w?x:w}else{c=l<y?l<s?l<c?l:c:s<c?s:c:y<s?y<c?y:c:s<c?s:c;d=k<x?k<w?k<d?k:d:w<d?w:d:x<w?x<d?x:d:w<d?w:d;e=l>y?l>s?l>e?l:e:s>e?s:e:y>s?y>e?y:e:s>e?s:e;i=k>x?k>w?k>i?k:i:w>i?w:i:x>w?x>i?x:i:w>i?w:i}a()};this.addRectangle=function(l){if(o){o=false;c=l.getLeft();d=l.getTop();e=l.getRight();i=l.getBottom()}else{c=c<l.getLeft()?c:l.getLeft();d=d<l.getTop()?d:l.getTop();
+e=e>l.getRight()?e:l.getRight();i=i>l.getBottom()?i:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;e+=l;i+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();e=e<l.getRight()?e:l.getRight();i=i<l.getBottom()?i:l.getBottom();a()};this.instersects=function(l){return Math.min(e,l.getRight())-Math.max(c,l.getLeft())>=0&&Math.min(i,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){o=true;i=e=d=c=0;a()};this.isEmpty=function(){return o};this.toString=
+function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+i+", width: "+b+", height: "+n+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}};
+THREE.Matrix4=function(a,c,d,e,i,b,n,o,l,k,y,x,s,w,H,K){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=i||0;this.n22=b||1;this.n23=n||0;this.n24=o||0;this.n31=l||0;this.n32=k||0;this.n33=y||1;this.n34=x||0;this.n41=s||0;this.n42=w||0;this.n43=H||0;this.n44=K||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,e,i,b,n,o,l,k,y,x,s,w,H,K){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=i;this.n22=b;this.n23=n;this.n24=o;this.n31=l;this.n32=k;this.n33=y;this.n34=x;this.n41=s;this.n42=w;this.n43=H;this.n44=K;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 e=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();i.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a);
+this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,i=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*i;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*i;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,i=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*i;a.y=this.n21*c+this.n22*d+this.n23*
+e+this.n24*i;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*i;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*i;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,e=a.n12,i=a.n13,b=a.n14,n=a.n21,o=a.n22,l=a.n23,k=a.n24,y=a.n31,
+x=a.n32,s=a.n33,w=a.n34,H=a.n41,K=a.n42,L=a.n43,p=a.n44,h=c.n11,g=c.n12,f=c.n13,j=c.n14,t=c.n21,u=c.n22,m=c.n23,B=c.n24,q=c.n31,G=c.n32,r=c.n33,v=c.n34,D=c.n41,T=c.n42,E=c.n43,N=c.n44;this.n11=d*h+e*t+i*q+b*D;this.n12=d*g+e*u+i*G+b*T;this.n13=d*f+e*m+i*r+b*E;this.n14=d*j+e*B+i*v+b*N;this.n21=n*h+o*t+l*q+k*D;this.n22=n*g+o*u+l*G+k*T;this.n23=n*f+o*m+l*r+k*E;this.n24=n*j+o*B+l*v+k*N;this.n31=y*h+x*t+s*q+w*D;this.n32=y*g+x*u+s*G+w*T;this.n33=y*f+x*m+s*r+w*E;this.n34=y*j+x*B+s*v+w*N;this.n41=H*h+K*t+
+L*q+p*D;this.n42=H*g+K*u+L*G+p*T;this.n43=H*f+K*m+L*r+p*E;this.n44=H*j+K*B+L*v+p*N;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,i=this.n14,b=this.n21,n=this.n22,o=this.n23,l=this.n24,k=this.n31,y=this.n32,x=this.n33,s=this.n34,w=this.n41,H=this.n42,K=this.n43,L=this.n44,p=a.n11,h=a.n21,g=a.n31,f=a.n41,j=a.n12,t=a.n22,u=a.n32,m=a.n42,B=a.n13,q=a.n23,G=a.n33,r=a.n43,v=a.n14,D=a.n24,T=a.n34;a=a.n44;this.n11=c*p+d*h+e*g+i*f;this.n12=c*j+d*t+e*u+i*m;this.n13=c*B+d*q+e*G+i*
+r;this.n14=c*v+d*D+e*T+i*a;this.n21=b*p+n*h+o*g+l*f;this.n22=b*j+n*t+o*u+l*m;this.n23=b*B+n*q+o*G+l*r;this.n24=b*v+n*D+o*T+l*a;this.n31=k*p+y*h+x*g+s*f;this.n32=k*j+y*t+x*u+s*m;this.n33=k*B+y*q+x*G+s*r;this.n34=k*v+y*D+x*T+s*a;this.n41=w*p+H*h+K*g+L*f;this.n42=w*j+H*t+K*u+L*m;this.n43=w*B+H*q+K*G+L*r;this.n44=w*v+H*D+K*T+L*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,c=this.n12,d=this.n13,e=this.n14,i=this.n21,b=this.n22,n=this.n23,o=this.n24,l=this.n31,k=this.n32,y=this.n33,x=this.n34,s=this.n41,w=this.n42,H=this.n43,K=this.n44;return e*n*k*s-d*o*k*s-e*b*y*s+c*o*y*s+d*b*x*s-c*n*x*s-e*n*l*w+d*o*l*w+e*i*y*w-a*o*y*w-d*i*x*w+a*n*x*w+e*b*l*H-c*o*l*H-e*i*k*H+a*o*k*H+c*i*x*H-a*b*x*H-d*b*l*K+c*n*l*K+d*i*k*K-a*n*k*K-c*i*y*K+a*b*y*K},transpose:function(){function a(c,d,
+e){var i=c[d];c[d]=c[e];c[e]=i}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(){var a=this.flat;a[0]=this.n11;
+a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=
+Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),i=1-d,b=a.x,n=a.y,o=a.z,l=i*b,k=i*n;this.set(l*b+d,l*n-e*o,l*o+e*n,0,l*n+e*o,k*n+d,k*o-e*b,0,l*o-e*n,k*o+e*b,i*o*o+d,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,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};
+THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d};
+THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,i=a.n14,b=a.n21,n=a.n22,o=a.n23,l=a.n24,k=a.n31,y=a.n32,x=a.n33,s=a.n34,w=a.n41,H=a.n42,K=a.n43,L=a.n44,p=new THREE.Matrix4;p.n11=o*s*H-l*x*H+l*y*K-n*s*K-o*y*L+n*x*L;p.n12=i*x*H-e*s*H-i*y*K+d*s*K+e*y*L-d*x*L;p.n13=e*l*H-i*o*H+i*n*K-d*l*K-e*n*L+d*o*L;p.n14=i*o*y-e*l*y-i*n*x+d*l*x+e*n*s-d*o*s;p.n21=l*x*w-o*s*w-l*k*K+b*s*K+o*k*L-b*x*L;p.n22=e*s*w-i*x*w+i*k*K-c*s*K-e*k*L+c*x*L;p.n23=i*o*w-e*l*w-i*b*K+c*l*K+e*b*L-c*o*L;p.n24=e*l*k-i*o*k+
+i*b*x-c*l*x-e*b*s+c*o*s;p.n31=n*s*w-l*y*w+l*k*H-b*s*H-n*k*L+b*y*L;p.n32=i*y*w-d*s*w-i*k*H+c*s*H+d*k*L-c*y*L;p.n33=e*l*w-i*n*w+i*b*H-c*l*H-d*b*L+c*n*L;p.n34=i*n*k-d*l*k-i*b*y+c*l*y+d*b*s-c*n*s;p.n41=o*y*w-n*x*w-o*k*H+b*x*H+n*k*K-b*y*K;p.n42=d*x*w-e*y*w+e*k*H-c*x*H-d*k*K+c*y*K;p.n43=e*n*w-d*o*w-e*b*H+c*o*H+d*b*K-c*n*K;p.n44=d*o*k-e*n*k+e*b*y-c*o*y-d*b*x+c*n*x;p.multiplyScalar(1/a.determinant());return p};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],n=-c[10]*c[4]+c[6]*c[8],o=c[10]*c[0]-c[2]*c[8],l=-c[6]*c[0]+c[2]*c[4],k=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*n+c[2]*k;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*i;d[2]=c*b;d[3]=c*n;d[4]=c*o;d[5]=c*l;d[6]=c*k;d[7]=c*y;d[8]=c*x;return a};
+THREE.Matrix4.makeFrustum=function(a,c,d,e,i,b){var n,o,l;n=new THREE.Matrix4;o=2*i/(c-a);l=2*i/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+i)/(b-i);i=-2*b*i/(b-i);n.n11=o;n.n12=0;n.n13=a;n.n14=0;n.n21=0;n.n22=l;n.n23=d;n.n24=0;n.n31=0;n.n32=0;n.n33=e;n.n34=i;n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(a,c,d,e){var i;a=d*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,d,e)};
+THREE.Matrix4.makeOrtho=function(a,c,d,e,i,b){var n,o,l,k;n=new THREE.Matrix4;o=c-a;l=d-e;k=b-i;a=(c+a)/o;d=(d+e)/l;i=(b+i)/k;n.n11=2/o;n.n12=0;n.n13=0;n.n14=-a;n.n21=0;n.n22=2/l;n.n23=0;n.n24=-d;n.n31=0;n.n32=0;n.n33=-2/k;n.n34=-i;n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};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,e,i){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,c,d,e,i,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=b instanceof Array?b:[b]};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,e,i,b,n,o=new THREE.Vector3,l=new THREE.Vector3;e=0;for(i=this.vertices.length;e<i;e++){b=this.vertices[e];b.normal.set(0,0,0)}e=0;for(i=this.faces.length;e<i;e++){b=this.faces[e];if(a&&b.vertexNormals.length){o.set(0,0,0);c=0;for(d=b.normal.length;c<d;c++)o.addSelf(b.vertexNormals[c]);o.divideScalar(3)}else{c=this.vertices[b.a];d=this.vertices[b.b];n=this.vertices[b.c];o.sub(n.position,
+d.position);l.sub(c.position,d.position);o.crossSelf(l)}o.isZero()||o.normalize();b.normal.copy(o)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[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{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[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(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(v,D,T,E,N,U,C){b=v.vertices[D].position;n=v.vertices[T].position;o=v.vertices[E].position;l=i[N];k=i[U];y=i[C];x=n.x-b.x;s=o.x-b.x;w=n.y-b.y;H=o.y-b.y;
+K=n.z-b.z;L=o.z-b.z;p=k.u-l.u;h=y.u-l.u;g=k.v-l.v;f=y.v-l.v;j=1/(p*f-h*g);m.set((f*x-g*s)*j,(f*w-g*H)*j,(f*K-g*L)*j);B.set((p*s-h*x)*j,(p*H-h*w)*j,(p*L-h*K)*j);t[D].addSelf(m);t[T].addSelf(m);t[E].addSelf(m);u[D].addSelf(B);u[T].addSelf(B);u[E].addSelf(B)}var c,d,e,i,b,n,o,l,k,y,x,s,w,H,K,L,p,h,g,f,j,t=[],u=[],m=new THREE.Vector3,B=new THREE.Vector3,q=new THREE.Vector3,G=new THREE.Vector3,r=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){t[c]=new THREE.Vector3;u[c]=new THREE.Vector3}c=0;
+for(d=this.faces.length;c<d;c++){e=this.faces[c];i=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){r.copy(this.vertices[c].normal);e=t[c];q.copy(e);q.subSelf(r.multiplyScalar(r.dot(e))).normalize();G.cross(this.vertices[c].normal,e);e=G.dot(u[c]);e=e<0?-1:1;this.vertices[c].tangent.set(q.x,q.y,q.z,e)}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(y){var x=[];c=0;for(d=y.length;c<d;c++)y[c]==undefined?x.push("undefined"):x.push(y[c].toString());return x.join("_")}var c,d,e,i,b,n,o,l,k={};e=0;for(i=this.faces.length;e<i;e++){b=this.faces[e];
+n=b.materials;o=a(n);if(k[o]==undefined)k[o]={hash:o,counter:0};l=k[o].hash+"_"+k[o].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:n,vertices:0};b=b instanceof THREE.Face3?3:4;if(this.geometryChunks[l].vertices+b>65535){k[o].counter+=1;l=k[o].hash+"_"+k[o].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:n,vertices:0}}this.geometryChunks[l].faces.push(e);this.geometryChunks[l].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+
+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
+THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;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(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
+this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);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.PointLight.prototype=new THREE.Light;THREE.PointLight.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.rotationMatrix=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,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};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,e,i,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=b!==undefined?b: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,e,i={};for(c in a){i[c]={};for(d in a[c]){e=a[c][d];i[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return i},merge:function(a){var c,d,e,i={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(d in e)i[d]=e[d]}return i}};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(u,m){return m.z-u.z}function c(u,m){var B=0,q=1,G=u.z+u.w,r=m.z+m.w,v=-u.z+u.w,D=-m.z+m.w;if(G>=0&&r>=0&&v>=0&&D>=0)return true;else if(G<0&&r<0||v<0&&D<0)return false;else{if(G<0)B=Math.max(B,G/(G-r));else if(r<0)q=Math.min(q,G/(G-r));if(v<0)B=Math.max(B,v/(v-D));else if(D<0)q=Math.min(q,v/(v-D));if(q<B)return false;else{u.lerpSelf(m,B);m.lerpSelf(u,1-q);return true}}}var d,e,i=[],b,n,o,l=[],k,y,x=[],s,w,H=[],K=new THREE.Vector4,L=new THREE.Vector4,p=new THREE.Matrix4,
+h=new THREE.Matrix4,g=[],f=new THREE.Vector4,j=new THREE.Vector4,t;this.projectObjects=function(u,m,B){var q=[],G,r;e=0;p.multiply(m.projectionMatrix,m.matrix);g[0]=new THREE.Vector4(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);g[1]=new THREE.Vector4(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);g[2]=new THREE.Vector4(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);g[3]=new THREE.Vector4(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);g[4]=new THREE.Vector4(p.n41-p.n31,p.n42-p.n32,p.n43-
+p.n33,p.n44-p.n34);g[5]=new THREE.Vector4(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);m=0;for(G=g.length;m<G;m++){r=g[m];r.divideScalar(Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z))}G=u.objects;u=0;for(m=G.length;u<m;u++){r=G[u];var v;if(!(v=!r.visible)){if(v=r instanceof THREE.Mesh){a:{v=void 0;for(var D=r.position,T=-r.geometry.boundingSphere.radius*Math.max(r.scale.x,Math.max(r.scale.y,r.scale.z)),E=0;E<6;E++){v=g[E].x*D.x+g[E].y*D.y+g[E].z*D.z+g[E].w;if(v<=T){v=false;break a}}v=true}v=!v}v=v}if(!v){d=
+i[e]=i[e]||new THREE.RenderableObject;K.copy(r.position);p.multiplyVector3(K);d.object=r;d.z=K.z;q.push(d);e++}}B&&q.sort(a);return q};this.projectScene=function(u,m,B){var q=[],G=m.near,r=m.far,v,D,T,E,N,U,C,S,Y,M,I,J,O,z,Q,V;o=y=w=0;m.autoUpdateMatrix&&m.updateMatrix();p.multiply(m.projectionMatrix,m.matrix);U=this.projectObjects(u,m,true);u=0;for(v=U.length;u<v;u++){C=U[u].object;if(C.visible){C.autoUpdateMatrix&&C.updateMatrix();S=C.matrix;Y=C.rotationMatrix;M=C.materials;I=C.overdraw;if(C instanceof
+THREE.Mesh){J=C.geometry;O=J.vertices;D=0;for(T=O.length;D<T;D++){z=O[D];z.positionWorld.copy(z.position);S.multiplyVector3(z.positionWorld);E=z.positionScreen;E.copy(z.positionWorld);p.multiplyVector4(E);E.x/=E.w;E.y/=E.w;z.__visible=E.z>G&&E.z<r}J=J.faces;D=0;for(T=J.length;D<T;D++){z=J[D];if(z instanceof THREE.Face3){E=O[z.a];N=O[z.b];Q=O[z.c];if(E.__visible&&N.__visible&&Q.__visible)if(C.doubleSided||C.flipSided!=(Q.positionScreen.x-E.positionScreen.x)*(N.positionScreen.y-E.positionScreen.y)-
+(Q.positionScreen.y-E.positionScreen.y)*(N.positionScreen.x-E.positionScreen.x)<0){b=l[o]=l[o]||new THREE.RenderableFace3;b.v1.positionWorld.copy(E.positionWorld);b.v2.positionWorld.copy(N.positionWorld);b.v3.positionWorld.copy(Q.positionWorld);b.v1.positionScreen.copy(E.positionScreen);b.v2.positionScreen.copy(N.positionScreen);b.v3.positionScreen.copy(Q.positionScreen);b.normalWorld.copy(z.normal);Y.multiplyVector3(b.normalWorld);b.centroidWorld.copy(z.centroid);S.multiplyVector3(b.centroidWorld);
+b.centroidScreen.copy(b.centroidWorld);p.multiplyVector3(b.centroidScreen);Q=z.vertexNormals;t=b.vertexNormalsWorld;E=0;for(N=Q.length;E<N;E++){V=t[E]=t[E]||new THREE.Vector3;V.copy(Q[E]);Y.multiplyVector3(V)}b.z=b.centroidScreen.z;b.meshMaterials=M;b.faceMaterials=z.materials;b.overdraw=I;if(C.geometry.uvs[D]){b.uvs[0]=C.geometry.uvs[D][0];b.uvs[1]=C.geometry.uvs[D][1];b.uvs[2]=C.geometry.uvs[D][2]}q.push(b);o++}}else if(z instanceof THREE.Face4){E=O[z.a];N=O[z.b];Q=O[z.c];V=O[z.d];if(E.__visible&&
+N.__visible&&Q.__visible&&V.__visible)if(C.doubleSided||C.flipSided!=((V.positionScreen.x-E.positionScreen.x)*(N.positionScreen.y-E.positionScreen.y)-(V.positionScreen.y-E.positionScreen.y)*(N.positionScreen.x-E.positionScreen.x)<0||(N.positionScreen.x-Q.positionScreen.x)*(V.positionScreen.y-Q.positionScreen.y)-(N.positionScreen.y-Q.positionScreen.y)*(V.positionScreen.x-Q.positionScreen.x)<0)){b=l[o]=l[o]||new THREE.RenderableFace3;b.v1.positionWorld.copy(E.positionWorld);b.v2.positionWorld.copy(N.positionWorld);
+b.v3.positionWorld.copy(V.positionWorld);b.v1.positionScreen.copy(E.positionScreen);b.v2.positionScreen.copy(N.positionScreen);b.v3.positionScreen.copy(V.positionScreen);b.normalWorld.copy(z.normal);Y.multiplyVector3(b.normalWorld);b.centroidWorld.copy(z.centroid);S.multiplyVector3(b.centroidWorld);b.centroidScreen.copy(b.centroidWorld);p.multiplyVector3(b.centroidScreen);b.z=b.centroidScreen.z;b.meshMaterials=M;b.faceMaterials=z.materials;b.overdraw=I;if(C.geometry.uvs[D]){b.uvs[0]=C.geometry.uvs[D][0];
+b.uvs[1]=C.geometry.uvs[D][1];b.uvs[2]=C.geometry.uvs[D][3]}q.push(b);o++;n=l[o]=l[o]||new THREE.RenderableFace3;n.v1.positionWorld.copy(N.positionWorld);n.v2.positionWorld.copy(Q.positionWorld);n.v3.positionWorld.copy(V.positionWorld);n.v1.positionScreen.copy(N.positionScreen);n.v2.positionScreen.copy(Q.positionScreen);n.v3.positionScreen.copy(V.positionScreen);n.normalWorld.copy(b.normalWorld);n.centroidWorld.copy(b.centroidWorld);n.centroidScreen.copy(b.centroidScreen);n.z=n.centroidScreen.z;n.meshMaterials=
+M;n.faceMaterials=z.materials;n.overdraw=I;if(C.geometry.uvs[D]){n.uvs[0]=C.geometry.uvs[D][1];n.uvs[1]=C.geometry.uvs[D][2];n.uvs[2]=C.geometry.uvs[D][3]}q.push(n);o++}}}}else if(C instanceof THREE.Line){h.multiply(p,S);O=C.geometry.vertices;z=O[0];z.positionScreen.copy(z.position);h.multiplyVector4(z.positionScreen);D=1;for(T=O.length;D<T;D++){E=O[D];E.positionScreen.copy(E.position);h.multiplyVector4(E.positionScreen);N=O[D-1];f.copy(E.positionScreen);j.copy(N.positionScreen);if(c(f,j)){f.multiplyScalar(1/
+f.w);j.multiplyScalar(1/j.w);k=x[y]=x[y]||new THREE.RenderableLine;k.v1.positionScreen.copy(f);k.v2.positionScreen.copy(j);k.z=Math.max(f.z,j.z);k.materials=C.materials;q.push(k);y++}}}else if(C instanceof THREE.Particle){L.set(C.position.x,C.position.y,C.position.z,1);p.multiplyVector4(L);L.z/=L.w;if(L.z>0&&L.z<1){s=H[w]=H[w]||new THREE.RenderableParticle;s.x=L.x/L.w;s.y=L.y/L.w;s.z=L.z;s.rotation=C.rotation.z;s.scale.x=C.scale.x*Math.abs(s.x-(L.x+m.projectionMatrix.n11)/(L.w+m.projectionMatrix.n14));
+s.scale.y=C.scale.y*Math.abs(s.y-(L.y+m.projectionMatrix.n22)/(L.w+m.projectionMatrix.n24));s.materials=C.materials;q.push(s);w++}}}}B&&q.sort(a);return q};this.unprojectVector=function(u,m){var B=THREE.Matrix4.makeInvert(m.matrix);B.multiplySelf(THREE.Matrix4.makeInvert(m.projectionMatrix));B.multiplyVector3(u);return u}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,i,b;this.domElement=document.createElement("div");this.setSize=function(n,o){d=n;e=o;i=d/2;b=e/2};this.render=function(n,o){var l,k,y,x,s,w,H,K;a=c.projectScene(n,o);l=0;for(k=a.length;l<k;l++){s=a[l];if(s instanceof THREE.RenderableParticle){H=s.x*i+i;K=s.y*b+b;y=0;for(x=s.material.length;y<x;y++){w=s.material[y];if(w instanceof THREE.ParticleDOMMaterial){w=w.domElement;w.style.left=H+"px";w.style.top=K+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ea){if(s!=ea)k.globalAlpha=s=ea}function c(ea){if(w!=ea){switch(ea){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}w=ea}}var d=null,e=new THREE.Projector,i=document.createElement("canvas"),b,n,o,l,k=i.getContext("2d"),y=new THREE.Color(0),x=0,s=1,w=0,H=null,K=null,L=1,p,h,g,f,j,t,u,m,B,q=new THREE.Color,
+G=new THREE.Color,r=new THREE.Color,v=new THREE.Color,D=new THREE.Color,T,E,N,U,C,S,Y,M,I,J=new THREE.Rectangle,O=new THREE.Rectangle,z=new THREE.Rectangle,Q=false,V=new THREE.Color,X=new THREE.Color,fa=new THREE.Color,aa=new THREE.Color,ya=Math.PI*2,$=new THREE.Vector3,ca,oa,ta,ia,ua,za,ra=16;ca=document.createElement("canvas");ca.width=ca.height=2;oa=ca.getContext("2d");oa.fillStyle="rgba(0,0,0,1)";oa.fillRect(0,0,2,2);ta=oa.getImageData(0,0,2,2);ia=ta.data;ua=document.createElement("canvas");ua.width=
+ua.height=ra;za=ua.getContext("2d");za.translate(-ra/2,-ra/2);za.scale(ra,ra);ra--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ea,pa){b=ea;n=pa;o=b/2;l=n/2;i.width=b;i.height=n;J.set(-o,-l,o,l);s=1;w=0;K=H=null;L=1};this.setClearColor=function(ea,pa){y.setHex(ea);x=pa;O.set(-o,-l,o,l);k.setTransform(1,0,0,-1,o,l);this.clear()};this.clear=function(){k.setTransform(1,0,0,-1,o,l);if(!O.isEmpty()){O.inflate(1);O.minSelf(J);if(y.hex==0&&x==0)k.clearRect(O.getX(),
+O.getY(),O.getWidth(),O.getHeight());else{c(THREE.NormalBlending);a(1);k.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+x+")";k.fillRect(O.getX(),O.getY(),O.getWidth(),O.getHeight())}O.empty()}};this.render=function(ea,pa){function Ma(A){var W,R,F,P=A.lights;X.setRGB(0,0,0);fa.setRGB(0,0,0);aa.setRGB(0,0,0);A=0;for(W=P.length;A<W;A++){R=P[A];F=R.color;if(R instanceof THREE.AmbientLight){X.r+=F.r;X.g+=F.g;X.b+=F.b}else if(R instanceof THREE.DirectionalLight){fa.r+=
+F.r;fa.g+=F.g;fa.b+=F.b}else if(R instanceof THREE.PointLight){aa.r+=F.r;aa.g+=F.g;aa.b+=F.b}}}function Aa(A,W,R,F){var P,Z,da,ga,ha=A.lights;A=0;for(P=ha.length;A<P;A++){Z=ha[A];da=Z.color;ga=Z.intensity;if(Z instanceof THREE.DirectionalLight){Z=R.dot(Z.position)*ga;if(Z>0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}else if(Z instanceof THREE.PointLight){$.sub(Z.position,W);$.normalize();Z=R.dot($)*ga;if(Z>0){F.r+=da.r*Z;F.g+=da.g*Z;F.b+=da.b*Z}}}}function Na(A,W,R){if(R.opacity!=0){a(R.opacity);c(R.blending);
+var F,P,Z,da,ga,ha;if(R instanceof THREE.ParticleBasicMaterial){if(R.map&&R.map.image.loaded){da=R.map.image;ga=da.width>>1;ha=da.height>>1;P=W.scale.x*o;Z=W.scale.y*l;R=P*ga;F=Z*ha;z.set(A.x-R,A.y-F,A.x+R,A.y+F);if(!J.instersects(z))return;k.save();k.translate(A.x,A.y);k.rotate(-W.rotation);k.scale(P,-Z);k.translate(-ga,-ha);k.drawImage(da,0,0);k.restore()}k.beginPath();k.moveTo(A.x-10,A.y);k.lineTo(A.x+10,A.y);k.moveTo(A.x,A.y-10);k.lineTo(A.x,A.y+10);k.closePath();k.strokeStyle="rgb(255,255,0)";
+k.stroke()}else if(R instanceof THREE.ParticleCircleMaterial){if(Q){V.r=X.r+fa.r+aa.r;V.g=X.g+fa.g+aa.g;V.b=X.b+fa.b+aa.b;q.r=R.color.r*V.r;q.g=R.color.g*V.g;q.b=R.color.b*V.b;q.updateStyleString()}else q.__styleString=R.color.__styleString;R=W.scale.x*o;F=W.scale.y*l;z.set(A.x-R,A.y-F,A.x+R,A.y+F);if(J.instersects(z)){P=q.__styleString;if(K!=P)k.fillStyle=K=P;k.save();k.translate(A.x,A.y);k.rotate(-W.rotation);k.scale(R,F);k.beginPath();k.arc(0,0,1,0,ya,true);k.closePath();k.fill();k.restore()}}}}
+function Oa(A,W,R,F){if(F.opacity!=0){a(F.opacity);c(F.blending);k.beginPath();k.moveTo(A.positionScreen.x,A.positionScreen.y);k.lineTo(W.positionScreen.x,W.positionScreen.y);k.closePath();if(F instanceof THREE.LineBasicMaterial){q.__styleString=F.color.__styleString;A=F.linewidth;if(L!=A)k.lineWidth=L=A;A=q.__styleString;if(H!=A)k.strokeStyle=H=A;k.stroke();z.inflate(F.linewidth*2)}}}function Ia(A,W,R,F,P,Z){if(P.opacity!=0){a(P.opacity);c(P.blending);f=A.positionScreen.x;j=A.positionScreen.y;t=
+W.positionScreen.x;u=W.positionScreen.y;m=R.positionScreen.x;B=R.positionScreen.y;k.beginPath();k.moveTo(f,j);k.lineTo(t,u);k.lineTo(m,B);k.lineTo(f,j);k.closePath();if(P instanceof THREE.MeshBasicMaterial)if(P.map)P.map.image.loaded&&P.map.mapping instanceof THREE.UVMapping&&va(f,j,t,u,m,B,P.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);else if(P.env_map){if(P.env_map.image.loaded)if(P.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=pa.matrix;$.copy(F.vertexNormalsWorld[0]);
+U=($.x*A.n11+$.y*A.n12+$.z*A.n13)*0.5+0.5;C=-($.x*A.n21+$.y*A.n22+$.z*A.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[1]);S=($.x*A.n11+$.y*A.n12+$.z*A.n13)*0.5+0.5;Y=-($.x*A.n21+$.y*A.n22+$.z*A.n23)*0.5+0.5;$.copy(F.vertexNormalsWorld[2]);M=($.x*A.n11+$.y*A.n12+$.z*A.n13)*0.5+0.5;I=-($.x*A.n21+$.y*A.n22+$.z*A.n23)*0.5+0.5;va(f,j,t,u,m,B,P.env_map.image,U,C,S,Y,M,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&&va(f,j,t,u,m,B,P.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);c(THREE.SubtractiveBlending)}if(Q)if(!P.wireframe&&P.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){G.r=r.r=v.r=X.r;G.g=r.g=v.g=X.g;G.b=r.b=v.b=X.b;Aa(Z,F.v1.positionWorld,F.vertexNormalsWorld[0],G);Aa(Z,F.v2.positionWorld,F.vertexNormalsWorld[1],r);Aa(Z,F.v3.positionWorld,F.vertexNormalsWorld[2],v);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;
+D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,t,u,m,B,N,0,0,1,0,0,1)}else{V.r=X.r;V.g=X.g;V.b=X.b;Aa(Z,F.centroidWorld,F.normalWorld,V);q.r=P.color.r*V.r;q.g=P.color.g*V.g;q.b=P.color.b*V.b;q.updateStyleString();P.wireframe?Ba(q.__styleString,P.wireframe_linewidth):Ca(q.__styleString)}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString)}else if(P instanceof THREE.MeshDepthMaterial){T=pa.near;E=pa.far;G.r=G.g=G.b=1-Ea(A.positionScreen.z,T,E);r.r=r.g=r.b=1-Ea(W.positionScreen.z,
+T,E);v.r=v.g=v.b=1-Ea(R.positionScreen.z,T,E);D.r=(r.r+v.r)*0.5;D.g=(r.g+v.g)*0.5;D.b=(r.b+v.b)*0.5;N=Ja(G,r,v,D);va(f,j,t,u,m,B,N,0,0,1,0,0,1)}else if(P instanceof THREE.MeshNormalMaterial){q.r=Fa(F.normalWorld.x);q.g=Fa(F.normalWorld.y);q.b=Fa(F.normalWorld.z);q.updateStyleString();P.wireframe?Ba(q.__styleString,P.wireframe_linewidth):Ca(q.__styleString)}}}function Ba(A,W){if(H!=A)k.strokeStyle=H=A;if(L!=W)k.lineWidth=L=W;k.stroke();z.inflate(W*2)}function Ca(A){if(K!=A)k.fillStyle=K=A;k.fill()}
+function va(A,W,R,F,P,Z,da,ga,ha,la,ja,ma,wa){var qa,na;qa=da.width-1;na=da.height-1;ga*=qa;ha*=na;la*=qa;ja*=na;ma*=qa;wa*=na;R-=A;F-=W;P-=A;Z-=W;la-=ga;ja-=ha;ma-=ga;wa-=ha;na=1/(la*wa-ma*ja);qa=(wa*R-ja*P)*na;ja=(wa*F-ja*Z)*na;R=(la*P-ma*R)*na;F=(la*Z-ma*F)*na;A=A-qa*ga-R*ha;W=W-ja*ga-F*ha;k.save();k.transform(qa,ja,R,F,A,W);k.clip();k.drawImage(da,0,0);k.restore()}function Ja(A,W,R,F){var P=~~(A.r*255),Z=~~(A.g*255);A=~~(A.b*255);var da=~~(W.r*255),ga=~~(W.g*255);W=~~(W.b*255);var ha=~~(R.r*255),
+la=~~(R.g*255);R=~~(R.b*255);var ja=~~(F.r*255),ma=~~(F.g*255);F=~~(F.b*255);ia[0]=P<0?0:P>255?255:P;ia[1]=Z<0?0:Z>255?255:Z;ia[2]=A<0?0:A>255?255:A;ia[4]=da<0?0:da>255?255:da;ia[5]=ga<0?0:ga>255?255:ga;ia[6]=W<0?0:W>255?255:W;ia[8]=ha<0?0:ha>255?255:ha;ia[9]=la<0?0:la>255?255:la;ia[10]=R<0?0:R>255?255:R;ia[12]=ja<0?0:ja>255?255:ja;ia[13]=ma<0?0:ma>255?255:ma;ia[14]=F<0?0:F>255?255:F;oa.putImageData(ta,0,0);za.drawImage(ca,0,0);return ua}function Ea(A,W,R){A=(A-W)/(R-W);return A*A*(3-2*A)}function Fa(A){A=
+(A+1)*0.5;return A<0?0:A>1?1:A}function Ga(A,W){var R=W.x-A.x,F=W.y-A.y,P=1/Math.sqrt(R*R+F*F);R*=P;F*=P;W.x+=R;W.y+=F;A.x-=R;A.y-=F}var Da,Ka,ba,ka,sa,Ha,La,xa;this.autoClear?this.clear():k.setTransform(1,0,0,-1,o,l);d=e.projectScene(ea,pa,this.sortElements);k.fillStyle="rgba( 0, 255, 255, 0.5 )";k.fillRect(J.getX(),J.getY(),J.getWidth(),J.getHeight());(Q=ea.lights.length>0)&&Ma(ea);Da=0;for(Ka=d.length;Da<Ka;Da++){ba=d[Da];z.empty();if(ba instanceof THREE.RenderableParticle){p=ba;p.x*=o;p.y*=l;
+ka=0;for(sa=ba.materials.length;ka<sa;ka++)Na(p,ba,ba.materials[ka],ea)}else if(ba instanceof THREE.RenderableLine){p=ba.v1;h=ba.v2;p.positionScreen.x*=o;p.positionScreen.y*=l;h.positionScreen.x*=o;h.positionScreen.y*=l;z.addPoint(p.positionScreen.x,p.positionScreen.y);z.addPoint(h.positionScreen.x,h.positionScreen.y);if(J.instersects(z)){ka=0;for(sa=ba.materials.length;ka<sa;)Oa(p,h,ba,ba.materials[ka++],ea)}}else if(ba instanceof THREE.RenderableFace3){p=ba.v1;h=ba.v2;g=ba.v3;p.positionScreen.x*=
+o;p.positionScreen.y*=l;h.positionScreen.x*=o;h.positionScreen.y*=l;g.positionScreen.x*=o;g.positionScreen.y*=l;if(ba.overdraw){Ga(p.positionScreen,h.positionScreen);Ga(h.positionScreen,g.positionScreen);Ga(g.positionScreen,p.positionScreen)}z.add3Points(p.positionScreen.x,p.positionScreen.y,h.positionScreen.x,h.positionScreen.y,g.positionScreen.x,g.positionScreen.y);if(J.instersects(z)){ka=0;for(sa=ba.meshMaterials.length;ka<sa;){xa=ba.meshMaterials[ka++];if(xa instanceof THREE.MeshFaceMaterial){Ha=
+0;for(La=ba.faceMaterials.length;Ha<La;)(xa=ba.faceMaterials[Ha++])&&Ia(p,h,g,ba,xa,ea)}else Ia(p,h,g,ba,xa,ea)}}}O.addRectangle(z)}k.lineWidth=1;k.strokeStyle="rgba( 255, 0, 0, 0.5 )";k.strokeRect(O.getX(),O.getY(),O.getWidth(),O.getHeight());k.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(U,C,S){var Y,M,I,J;Y=0;for(M=U.lights.length;Y<M;Y++){I=U.lights[Y];if(I instanceof THREE.DirectionalLight){J=C.normalWorld.dot(I.position)*I.intensity;if(J>0){S.r+=I.color.r*J;S.g+=I.color.g*J;S.b+=I.color.b*J}}else if(I instanceof THREE.PointLight){B.sub(I.position,C.centroidWorld);B.normalize();J=C.normalWorld.dot(B)*I.intensity;if(J>0){S.r+=I.color.r*J;S.g+=I.color.g*J;S.b+=I.color.b*J}}}}function c(U,C,S,Y,M,I){v=e(D++);v.setAttribute("d","M "+U.positionScreen.x+
+" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(I,Y,f);g.r=M.color.r*f.r;g.g=M.color.g*f.g;g.b=M.color.b*f.b;g.updateStyleString()}else g.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){m=1-M.__2near/(M.__farPlusNear-Y.z*M.__farMinusNear);
+g.setRGB(m,m,m)}else M instanceof THREE.MeshNormalMaterial&&g.setRGB(i(Y.normalWorld.x),i(Y.normalWorld.y),i(Y.normalWorld.z));M.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+M.opacity);o.appendChild(v)}function d(U,C,S,Y,M,I,J){v=e(D++);v.setAttribute("d",
+"M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(h){f.r=j.r;f.g=j.g;f.b=j.b;a(J,M,f);g.r=I.color.r*f.r;g.g=I.color.g*f.g;g.b=I.color.b*f.b;g.updateStyleString()}else g.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){m=
+1-I.__2near/(I.__farPlusNear-M.z*I.__farMinusNear);g.setRGB(m,m,m)}else I instanceof THREE.MeshNormalMaterial&&g.setRGB(i(M.normalWorld.x),i(M.normalWorld.y),i(M.normalWorld.z));I.wireframe?v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):v.setAttribute("style","fill: "+g.__styleString+"; fill-opacity: "+I.opacity);o.appendChild(v)}
+function e(U){if(q[U]==null){q[U]=document.createElementNS("http://www.w3.org/2000/svg","path");N==0&&q[U].setAttribute("shape-rendering","crispEdges");return q[U]}return q[U]}function i(U){return U<0?Math.min((1+U)*0.5,0.5):0.5+Math.min(U*0.5,0.5)}var b=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,y,x,s,w,H,K,L=new THREE.Rectangle,p=new THREE.Rectangle,h=false,g=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),t=new THREE.Color(0),
+u=new THREE.Color(0),m,B=new THREE.Vector3,q=[],G=[],r=[],v,D,T,E,N=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(U){switch(U){case "high":N=1;break;case "low":N=0}};this.setSize=function(U,C){l=U;k=C;y=l/2;x=k/2;o.setAttribute("viewBox",-y+" "+-x+" "+l+" "+k);o.setAttribute("width",l);o.setAttribute("height",k);L.set(-y,-x,y,x)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(U,C){var S,Y,
+M,I,J,O,z,Q;this.autoClear&&this.clear();b=n.projectScene(U,C,this.sortElements);E=T=D=0;if(h=U.lights.length>0){z=U.lights;j.setRGB(0,0,0);t.setRGB(0,0,0);u.setRGB(0,0,0);S=0;for(Y=z.length;S<Y;S++){M=z[S];I=M.color;if(M instanceof THREE.AmbientLight){j.r+=I.r;j.g+=I.g;j.b+=I.b}else if(M instanceof THREE.DirectionalLight){t.r+=I.r;t.g+=I.g;t.b+=I.b}else if(M instanceof THREE.PointLight){u.r+=I.r;u.g+=I.g;u.b+=I.b}}}S=0;for(Y=b.length;S<Y;S++){z=b[S];p.empty();if(z instanceof THREE.RenderableParticle){s=
+z;s.x*=y;s.y*=-x;M=0;for(I=z.materials.length;M<I;M++)if(Q=z.materials[M]){J=s;O=z;Q=Q;var V=T++;if(G[V]==null){G[V]=document.createElementNS("http://www.w3.org/2000/svg","circle");N==0&&G[V].setAttribute("shape-rendering","crispEdges")}v=G[V];v.setAttribute("cx",J.x);v.setAttribute("cy",J.y);v.setAttribute("r",O.scale.x*y);if(Q instanceof THREE.ParticleCircleMaterial){if(h){f.r=j.r+t.r+u.r;f.g=j.g+t.g+u.g;f.b=j.b+t.b+u.b;g.r=Q.color.r*f.r;g.g=Q.color.g*f.g;g.b=Q.color.b*f.b;g.updateStyleString()}else g=
+Q.color;v.setAttribute("style","fill: "+g.__styleString)}o.appendChild(v)}}else if(z instanceof THREE.RenderableLine){s=z.v1;w=z.v2;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);if(L.instersects(p)){M=0;for(I=z.materials.length;M<I;)if(Q=z.materials[M++]){J=s;O=w;Q=Q;V=E++;if(r[V]==null){r[V]=document.createElementNS("http://www.w3.org/2000/svg","line");N==
+0&&r[V].setAttribute("shape-rendering","crispEdges")}v=r[V];v.setAttribute("x1",J.positionScreen.x);v.setAttribute("y1",J.positionScreen.y);v.setAttribute("x2",O.positionScreen.x);v.setAttribute("y2",O.positionScreen.y);if(Q instanceof THREE.LineBasicMaterial){g.__styleString=Q.color.__styleString;v.setAttribute("style","fill: none; stroke: "+g.__styleString+"; stroke-width: "+Q.linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.linecap+"; stroke-linejoin: "+Q.linejoin);o.appendChild(v)}}}}else if(z instanceof
+THREE.RenderableFace3){s=z.v1;w=z.v2;H=z.v3;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;H.positionScreen.x*=y;H.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);if(L.instersects(p)){M=0;for(I=z.meshMaterials.length;M<I;){Q=z.meshMaterials[M++];if(Q instanceof THREE.MeshFaceMaterial){J=0;for(O=z.faceMaterials.length;J<O;)(Q=z.faceMaterials[J++])&&
+c(s,w,H,z,Q,U)}else Q&&c(s,w,H,z,Q,U)}}}else if(z instanceof THREE.RenderableFace4){s=z.v1;w=z.v2;H=z.v3;K=z.v4;s.positionScreen.x*=y;s.positionScreen.y*=-x;w.positionScreen.x*=y;w.positionScreen.y*=-x;H.positionScreen.x*=y;H.positionScreen.y*=-x;K.positionScreen.x*=y;K.positionScreen.y*=-x;p.addPoint(s.positionScreen.x,s.positionScreen.y);p.addPoint(w.positionScreen.x,w.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);p.addPoint(K.positionScreen.x,K.positionScreen.y);if(L.instersects(p)){M=
+0;for(I=z.meshMaterials.length;M<I;){Q=z.meshMaterials[M++];if(Q instanceof THREE.MeshFaceMaterial){J=0;for(O=z.faceMaterials.length;J<O;)(Q=z.faceMaterials[J++])&&d(s,w,H,K,z,Q,U)}else Q&&d(s,w,H,K,z,Q,U)}}}}}};
+THREE.WebGLRenderer=function(a){function c(h,g){h.fragment_shader=g.fragment_shader;h.vertex_shader=g.vertex_shader;h.uniforms=Uniforms.clone(g.uniforms)}function d(h,g){var f;if(h=="fragment")f=b.createShader(b.FRAGMENT_SHADER);else if(h=="vertex")f=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,g);b.compileShader(f);if(!b.getShaderParameter(f,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(f));return null}return f}function e(h){switch(h){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 i=document.createElement("canvas"),b,n=null,o=null,l=new THREE.Matrix4,k,y=new Float32Array(16),x=new Float32Array(16),
+s=new Float32Array(16),w=new Float32Array(9),H=new Float32Array(16),K=true,L=new THREE.Color(0),p=0;if(a){if(a.antialias!==undefined)K=a.antialias;a.clearColor!==undefined&&L.setHex(a.clearColor);if(a.clearAlpha!==undefined)p=a.clearAlpha}this.domElement=i;this.autoClear=true;(function(h,g,f){try{b=i.getContext("experimental-webgl",{antialias:h})}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,f)})(K,L,p);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(h,g){i.width=h;i.height=g;b.viewport(0,0,i.width,i.height)};this.setClearColor=function(h,g){var f=new THREE.Color(h);b.clearColor(f.r,f.g,f.b,g)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|
+b.DEPTH_BUFFER_BIT)};this.setupLights=function(h,g){var f,j,t,u=0,m=0,B=0,q,G,r,v=this.lights,D=v.directional.colors,T=v.directional.positions,E=v.point.colors,N=v.point.positions,U=0,C=0;f=0;for(j=g.length;f<j;f++){t=g[f];q=t.color;G=t.position;r=t.intensity;if(t instanceof THREE.AmbientLight){u+=q.r;m+=q.g;B+=q.b}else if(t instanceof THREE.DirectionalLight){D[U*3]=q.r*r;D[U*3+1]=q.g*r;D[U*3+2]=q.b*r;T[U*3]=G.x;T[U*3+1]=G.y;T[U*3+2]=G.z;U+=1}else if(t instanceof THREE.PointLight){E[C*3]=q.r*r;E[C*
+3+1]=q.g*r;E[C*3+2]=q.b*r;N[C*3]=G.x;N[C*3+1]=G.y;N[C*3+2]=G.z;C+=1}}v.point.length=C;v.directional.length=U;v.ambient[0]=u;v.ambient[1]=m;v.ambient[2]=B};this.createParticleBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(h){h.__webGLVertexBuffer=b.createBuffer();h.__webGLNormalBuffer=b.createBuffer();h.__webGLTangentBuffer=
+b.createBuffer();h.__webGLUVBuffer=b.createBuffer();h.__webGLFaceBuffer=b.createBuffer();h.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(h){var g=h.vertices.length;h.__vertexArray=new Float32Array(g*3);h.__lineArray=new Uint16Array(g);h.__webGLLineCount=g};this.initMeshBuffers=function(h,g){var f,j,t=0,u=0,m=0,B=g.geometry.faces,q=h.faces;f=0;for(j=q.length;f<j;f++){fi=q[f];face=B[fi];if(face instanceof THREE.Face3){t+=3;u+=1;m+=3}else if(face instanceof THREE.Face4){t+=4;u+=2;
+m+=4}}h.__vertexArray=new Float32Array(t*3);h.__normalArray=new Float32Array(t*3);h.__tangentArray=new Float32Array(t*4);h.__uvArray=new Float32Array(t*2);h.__faceArray=new Uint16Array(u*3);h.__lineArray=new Uint16Array(m*2);t=false;f=0;for(j=g.materials.length;f<j;f++){B=g.materials[f];if(B instanceof THREE.MeshFaceMaterial){B=0;for(q=h.materials.length;B<q;B++)if(h.materials[B]&&h.materials[B].shading!=undefined&&h.materials[B].shading==THREE.SmoothShading){t=true;break}}else if(B&&B.shading!=undefined&&
+B.shading==THREE.SmoothShading){t=true;break}if(t)break}h.__needsSmoothNormals=t;h.__webGLFaceCount=u*3;h.__webGLLineCount=m*2};this.setMeshBuffers=function(h,g,f,j,t,u,m,B){var q,G,r,v,D,T,E,N,U,C=0,S=0,Y=0,M=0,I=0,J=0,O=0,z=h.__vertexArray,Q=h.__uvArray,V=h.__normalArray,X=h.__tangentArray,fa=h.__faceArray,aa=h.__lineArray,ya=h.__needsSmoothNormals,$=g.geometry,ca=$.vertices,oa=h.faces,ta=$.faces,ia=$.uvs;g=0;for(q=oa.length;g<q;g++){G=oa[g];r=ta[G];G=ia[G];v=r.vertexNormals;D=r.normal;if(r instanceof
+THREE.Face3){if(j){T=ca[r.a].position;E=ca[r.b].position;N=ca[r.c].position;z[S]=T.x;z[S+1]=T.y;z[S+2]=T.z;z[S+3]=E.x;z[S+4]=E.y;z[S+5]=E.z;z[S+6]=N.x;z[S+7]=N.y;z[S+8]=N.z;S+=9}if(B&&$.hasTangents){T=ca[r.a].tangent;E=ca[r.b].tangent;N=ca[r.c].tangent;X[J]=T.x;X[J+1]=T.y;X[J+2]=T.z;X[J+3]=T.w;X[J+4]=E.x;X[J+5]=E.y;X[J+6]=E.z;X[J+7]=E.w;X[J+8]=N.x;X[J+9]=N.y;X[J+10]=N.z;X[J+11]=N.w;J+=12}if(m)if(v.length==3&&ya)for(r=0;r<3;r++){D=v[r];V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}else for(r=0;r<3;r++){V[I]=
+D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}if(u&&G)for(r=0;r<3;r++){v=G[r];Q[Y]=v.u;Q[Y+1]=v.v;Y+=2}if(t){fa[M]=C;fa[M+1]=C+1;fa[M+2]=C+2;M+=3;aa[O]=C;aa[O+1]=C+1;aa[O+2]=C;aa[O+3]=C+2;aa[O+4]=C+1;aa[O+5]=C+2;O+=6;C+=3}}else if(r instanceof THREE.Face4){if(j){T=ca[r.a].position;E=ca[r.b].position;N=ca[r.c].position;U=ca[r.d].position;z[S]=T.x;z[S+1]=T.y;z[S+2]=T.z;z[S+3]=E.x;z[S+4]=E.y;z[S+5]=E.z;z[S+6]=N.x;z[S+7]=N.y;z[S+8]=N.z;z[S+9]=U.x;z[S+10]=U.y;z[S+11]=U.z;S+=12}if(B&&$.hasTangents){T=ca[r.a].tangent;
+E=ca[r.b].tangent;N=ca[r.c].tangent;r=ca[r.d].tangent;X[J]=T.x;X[J+1]=T.y;X[J+2]=T.z;X[J+3]=T.w;X[J+4]=E.x;X[J+5]=E.y;X[J+6]=E.z;X[J+7]=E.w;X[J+8]=N.x;X[J+9]=N.y;X[J+10]=N.z;X[J+11]=N.w;X[J+12]=r.x;X[J+13]=r.y;X[J+14]=r.z;X[J+15]=r.w;J+=16}if(m)if(v.length==4&&ya)for(r=0;r<4;r++){D=v[r];V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}else for(r=0;r<4;r++){V[I]=D.x;V[I+1]=D.y;V[I+2]=D.z;I+=3}if(u&&G)for(r=0;r<4;r++){v=G[r];Q[Y]=v.u;Q[Y+1]=v.v;Y+=2}if(t){fa[M]=C;fa[M+1]=C+1;fa[M+2]=C+2;fa[M+3]=C;fa[M+4]=C+2;fa[M+
+5]=C+3;M+=6;aa[O]=C;aa[O+1]=C+1;aa[O+2]=C;aa[O+3]=C+3;aa[O+4]=C+1;aa[O+5]=C+2;aa[O+6]=C+2;aa[O+7]=C+3;O+=8;C+=4}}}if(j){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,z,f)}if(m){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,V,f)}if(B&&$.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,X,f)}if(u&&Y>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Q,f)}if(t){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+h.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,f);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,f)}};this.setLineBuffers=function(h,g,f,j){var t,u,m=h.vertices,B=m.length,q=h.__vertexArray,G=h.__lineArray;if(f)for(f=0;f<B;f++){t=m[f].position;u=f*3;q[u]=t.x;q[u+1]=t.y;q[u+2]=t.z}if(j)for(f=0;f<B;f++)G[f]=f;b.bindBuffer(b.ARRAY_BUFFER,h.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,q,g);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);
+b.bufferData(b.ELEMENT_ARRAY_BUFFER,G,g)};this.setParticleBuffers=function(){};this.initMaterial=function(h,g,f){if(!h.program){var j,t;if(h instanceof THREE.MeshDepthMaterial)c(h,THREE.ShaderLib.depth);else if(h instanceof THREE.MeshNormalMaterial)c(h,THREE.ShaderLib.normal);else if(h instanceof THREE.MeshBasicMaterial)c(h,THREE.ShaderLib.basic);else if(h instanceof THREE.MeshLambertMaterial)c(h,THREE.ShaderLib.lambert);else if(h instanceof THREE.MeshPhongMaterial)c(h,THREE.ShaderLib.phong);else h instanceof
+THREE.LineBasicMaterial&&c(h,THREE.ShaderLib.basic);var u,m,B,q;t=B=q=0;for(u=g.length;t<u;t++){m=g[t];m instanceof THREE.DirectionalLight&&B++;m instanceof THREE.PointLight&&q++}if(q+B<=4){g=B;q=q}else{g=Math.ceil(4*B/(q+B));q=4-g}t={directional:g,point:q};q=h.fragment_shader;g=h.vertex_shader;u={fog:f,map:h.map,env_map:h.env_map,maxDirLights:t.directional,maxPointLights:t.point};f=b.createProgram();t=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+
+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.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(f,d("fragment",t+q));b.attachShader(f,d("vertex",u+g));b.linkProgram(f);b.getProgramParameter(f,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(f,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");f.uniforms={};f.attributes={};h.program=f;f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(j in h.uniforms)f.push(j);j=h.program;q=0;for(g=f.length;q<g;q++){t=f[q];j.uniforms[t]=b.getUniformLocation(j,
+t)}h=h.program;j=["position","normal","uv","tangent"];f=0;for(q=j.length;f<q;f++){g=j[f];h.attributes[g]=b.getAttribLocation(h,g)}}};this.renderBuffer=function(h,g,f,j,t,u){var m;this.initMaterial(j,g,f);m=j.program;if(m!=n){b.useProgram(m);n=m}this.loadCamera(m,h);this.loadMatrices(m);if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){this.setupLights(m,g);g=this.lights;j.uniforms.enableLighting.value=g.directional.length+g.point.length;j.uniforms.ambientLightColor.value=
+g.ambient;j.uniforms.directionalLightColor.value=g.directional.colors;j.uniforms.directionalLightDirection.value=g.directional.positions;j.uniforms.pointLightColor.value=g.point.colors;j.uniforms.pointLightPosition.value=g.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){j.uniforms.color.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);j.uniforms.opacity.value=j.opacity;j.uniforms.map.texture=
+j.map;j.uniforms.env_map.texture=j.env_map;j.uniforms.reflectivity.value=j.reflectivity;j.uniforms.refraction_ratio.value=j.refraction_ratio;j.uniforms.combine.value=j.combine;j.uniforms.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping;if(f){j.uniforms.fogColor.value.setHex(f.color.hex);if(f instanceof THREE.Fog){j.uniforms.fogNear.value=f.near;j.uniforms.fogFar.value=f.far}else if(f instanceof THREE.FogExp2)j.uniforms.fogDensity.value=f.density}}if(j instanceof
+THREE.LineBasicMaterial){j.uniforms.color.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);j.uniforms.opacity.value=j.opacity;if(f){j.uniforms.fogColor.value.setHex(f.color.hex);if(f instanceof THREE.Fog){j.uniforms.fogNear.value=f.near;j.uniforms.fogFar.value=f.far}else if(f instanceof THREE.FogExp2)j.uniforms.fogDensity.value=f.density}}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}if(j instanceof THREE.MeshDepthMaterial){j.uniforms.mNear.value=h.near;j.uniforms.mFar.value=h.far}h=j.uniforms;var B,q,G;for(B in h)if(G=m.uniforms[B]){g=h[B];q=g.type;f=g.value;if(q=="i")b.uniform1i(G,f);else if(q=="f")b.uniform1f(G,f);else if(q=="fv1")b.uniform1fv(G,f);else if(q=="fv")b.uniform3fv(G,f);else if(q=="v2")b.uniform2f(G,f.x,f.y);else if(q=="v3")b.uniform3f(G,f.x,f.y,f.z);else if(q=="c")b.uniform3f(G,f.r,f.g,f.b);else if(q==
+"t"){b.uniform1i(G,f);if(g=g.texture)if(g.image instanceof Array&&g.image.length==6){g=g;f=f;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(q=0;q<6;++q)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,g.image[q]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);g.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+f);b.bindTexture(b.TEXTURE_CUBE_MAP,g.image.__webGLTextureCube)}}else{g=g;f=f;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,e(g.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(g.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(g.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(g.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+f);b.bindTexture(b.TEXTURE_2D,g.__webGLTexture)}}}m=m.attributes;b.bindBuffer(b.ARRAY_BUFFER,
+t.__webGLVertexBuffer);b.vertexAttribPointer(m.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.position);if(m.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLNormalBuffer);b.vertexAttribPointer(m.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.normal)}if(m.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLTangentBuffer);b.vertexAttribPointer(m.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.tangent)}if(m.uv>=0)if(t.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLUVBuffer);
+b.vertexAttribPointer(m.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(m.uv)}else b.disableVertexAttribArray(m.uv);if(j.wireframe||j instanceof THREE.LineBasicMaterial){m=j.wireframe_linewidth!==undefined?j.wireframe_linewidth:j.linewidth!==undefined?j.linewidth:1;j=j instanceof THREE.LineBasicMaterial&&u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(m);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);b.drawElements(j,t.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+t.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,t.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(h,g,f,j,t,u,m){var B,q,G,r,v;G=0;for(r=j.materials.length;G<r;G++){B=j.materials[G];if(B instanceof THREE.MeshFaceMaterial){B=0;for(q=t.materials.length;B<q;B++)if((v=t.materials[B])&&v.blending==u&&v.opacity<1==m){this.setBlending(v.blending);this.renderBuffer(h,g,f,v,t,j)}}else if((v=B)&&v.blending==u&&v.opacity<1==m){this.setBlending(v.blending);this.renderBuffer(h,g,f,v,t,j)}}};this.render=
+function(h,g,f,j){var t,u,m,B=h.lights,q=h.fog;this.initWebGLObjects(h);j=j!==undefined?j:true;if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=b.createFramebuffer();f.__webGLRenderbuffer=b.createRenderbuffer();f.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,f.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,f.width,f.height);b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(f.wrap_s));b.texParameteri(b.TEXTURE_2D,
+b.TEXTURE_WRAP_T,e(f.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(f.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(f.min_filter));b.texImage2D(b.TEXTURE_2D,0,e(f.format),f.width,f.height,0,e(f.format),e(f.type),null);b.bindFramebuffer(b.FRAMEBUFFER,f.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,f.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,f.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,
+null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(f){t=f.__webGLFramebuffer;m=f.width;u=f.height}else{t=null;m=i.width;u=i.height}if(t!=o){b.bindFramebuffer(b.FRAMEBUFFER,t);b.viewport(0,0,m,u);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);o=t}this.autoClear&&this.clear();g.autoUpdateMatrix&&g.updateMatrix();y.set(g.matrix.flatten());s.set(g.projectionMatrix.flatten());j=0;for(t=h.__webGLObjects.length;j<t;j++){u=h.__webGLObjects[j];m=u.object;u=u.buffer;if(m.visible){this.setupMatrices(m,
+g);this.renderPass(g,B,q,m,u,THREE.NormalBlending,false)}}j=0;for(t=h.__webGLObjects.length;j<t;j++){u=h.__webGLObjects[j];m=u.object;u=u.buffer;if(m.visible){this.setupMatrices(m,g);if(m.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);m.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}this.renderPass(g,B,q,m,u,THREE.AdditiveBlending,false);this.renderPass(g,B,q,m,u,THREE.SubtractiveBlending,false);this.renderPass(g,B,q,m,u,THREE.AdditiveBlending,true);this.renderPass(g,B,q,m,u,THREE.SubtractiveBlending,
+true);this.renderPass(g,B,q,m,u,THREE.NormalBlending,true)}}if(f&&f.min_filter!==THREE.NearestFilter&&f.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(h){function g(G,r,v,D){if(G[r]==undefined){h.__webGLObjects.push({buffer:v,object:D});G[r]=1}}var f,j,t,u,m,B,q;if(!h.__webGLObjects){h.__webGLObjects=[];h.__webGLObjectsMap={}}f=0;for(j=h.objects.length;f<j;f++){t=h.objects[f];
+m=t.geometry;if(h.__webGLObjectsMap[t.id]==undefined)h.__webGLObjectsMap[t.id]={};q=h.__webGLObjectsMap[t.id];if(t instanceof THREE.Mesh){for(u in m.geometryChunks){B=m.geometryChunks[u];if(!B.__webGLVertexBuffer){this.createMeshBuffers(B);this.initMeshBuffers(B,t);m.__dirtyVertices=true;m.__dirtyElements=true;m.__dirtyUvs=true;m.__dirtyNormals=true;m.__dirtyTangents=true}if(m.__dirtyVertices||m.__dirtyElements||m.__dirtyUvs)this.setMeshBuffers(B,t,b.DYNAMIC_DRAW,m.__dirtyVertices,m.__dirtyElements,
+m.__dirtyUvs,m.__dirtyNormals,m.__dirtyTangents);g(q,u,B,t)}m.__dirtyVertices=false;m.__dirtyElements=false;m.__dirtyUvs=false;m.__dirtyNormals=false;m.__dirtyTangents=false}else if(t instanceof THREE.Line){if(!m.__webGLVertexBuffer){this.createLineBuffers(m);this.initLineBuffers(m);m.__dirtyVertices=true;m.__dirtyElements=true}m.__dirtyVertices&&this.setLineBuffers(m,b.DYNAMIC_DRAW,m.__dirtyVertices,m.__dirtyElements);g(q,0,m,t);m.__dirtyVertices=false;m.__dirtyElements=false}else if(t instanceof
+THREE.ParticleSystem){m.__webGLVertexBuffer||this.createParticleBuffers(m);g(q,0,m,t)}}};this.removeObject=function(h,g){var f,j;for(f=h.__webGLObjects.length-1;f>=0;f--){j=h.__webGLObjects[f].object;g==j&&h.__webGLObjects.splice(f,1)}};this.setupMatrices=function(h,g){h.autoUpdateMatrix&&h.updateMatrix();l.multiply(g.matrix,h.matrix);x.set(l.flatten());k=THREE.Matrix4.makeInvert3x3(l).transpose();w.set(k.m);H.set(h.matrix.flatten())};this.loadMatrices=function(h){b.uniformMatrix4fv(h.uniforms.viewMatrix,
+false,y);b.uniformMatrix4fv(h.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(h.uniforms.projectionMatrix,false,s);b.uniformMatrix3fv(h.uniforms.normalMatrix,false,w);b.uniformMatrix4fv(h.uniforms.objectMatrix,false,H)};this.loadCamera=function(h,g){b.uniform3f(h.uniforms.cameraPosition,g.position.x,g.position.y,g.position.z)};this.setBlending=function(h){switch(h){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(h,g){if(h){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(h=="back")b.cullFace(b.BACK);else h=="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 - 219
build/ThreeExtras.js


+ 2 - 2
src/renderers/CanvasRenderer.js

@@ -109,9 +109,9 @@ THREE.CanvasRenderer = function () {
 
 	this.clear = function () {
 
-		if ( !_clearRect.isEmpty() ) {
+		_context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf );
 
-			_context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf );
+		if ( !_clearRect.isEmpty() ) {
 
 			_clearRect.inflate( 1 );
 			_clearRect.minSelf( _clipRect );

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