Browse Source

Added "v2" uniform type to WebGLRenderer.
Added a shader demo (as in using only 2 triangles).

Mr.doob 14 years ago
parent
commit
9b755e827f
5 changed files with 554 additions and 591 deletions
  1. 194 194
      build/Three.js
  2. 195 195
      build/ThreeDebug.js
  3. 0 202
      build/ThreeExtras.js
  4. 161 0
      examples/shader.html
  5. 4 0
      src/renderers/WebGLRenderer.js

+ 194 - 194
build/Three.js

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

+ 195 - 195
build/ThreeDebug.js

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


+ 161 - 0
examples/shader.html

@@ -0,0 +1,161 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js - shader</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				color: #ffffff;
+				font-family:Monospace;
+				font-size:13px;
+				text-align:center;
+				font-weight: bold;
+
+				background-color: #000000;
+				margin: 0px;
+				overflow: hidden;
+			}
+
+			#info {
+				position: absolute;
+				top: 0px; width: 100%;
+				padding: 5px;
+			}
+
+			a {
+
+				color: #ffffff;
+			}
+
+		</style>
+	</head>
+	<body>
+
+		<div id="container"></div> 
+		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - shader demo. featuring <a href="http://www.pouet.net/prod.php?which=52761" target="_blank">Monjori by Mic</a></div> 
+
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+		<script type="text/javascript" src="../build/Three.js"></script>
+		<script type="text/javascript" src="../src/extras/primitives/Plane.js"></script>
+
+		<script id="vertex_shader" type="x-shader/x-vertex">
+			void main()
+			{
+				gl_Position = vec4( position, 1.0 );
+			}
+		</script>
+
+		<script id="fragment_shader" type="x-shader/x-fragment">
+			#ifdef GL_ES
+			precision highp float;
+			#endif
+
+			uniform vec2 resolution;
+			uniform float time;
+
+			void main(void)
+			{
+			    vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy;
+			    float a = time*40.0;
+			    float d,e,f,g=1.0/40.0,h,i,r,q;
+			    e=400.0*(p.x*0.5+0.5);
+			    f=400.0*(p.y*0.5+0.5);
+			    i=200.0+sin(e*g+a/150.0)*20.0;
+			    d=200.0+cos(f*g/2.0)*18.0+cos(e*g)*7.0;
+			    r=sqrt(pow(i-e,2.0)+pow(d-f,2.0));
+			    q=f/r;
+			    e=(r*cos(q))-a/2.0;f=(r*sin(q))-a/2.0;
+			    d=sin(e*g)*176.0+sin(e*g)*164.0+r;
+			    h=((f+d)+a/2.0)*g;
+			    i=cos(h+r*p.x/1.3)*(e+e+a)+cos(q*g*6.0)*(r+h/3.0);
+			    h=sin(f*g)*144.0-sin(e*g)*212.0*p.x;
+			    h=(h+(f-e)*q+sin(r-(a+h)/7.0)*10.0+i/4.0)*g;
+			    i+=cos(h*2.3*sin(a/350.0-q))*184.0*sin(q-(r*4.3+a/12.0)*g)+tan(r*g+h)*184.0*cos(r*g+h);
+			    i=mod(i/5.6,256.0)/64.0;
+			    if(i<0.0) i+=4.0;
+			    if(i>=2.0) i=4.0-i;
+			    d=r/350.0;
+			    d+=sin(d*d*8.0)*0.52;
+			    f=(sin(a*g)+1.0)/2.0;
+			    gl_FragColor=vec4(vec3(f*i/1.6,i/2.0+d/13.0,i)*d*p.x+vec3(i/1.3+d/8.0,i/2.0+d/18.0,i)*d*(1.0-p.x),1.0);
+			}
+		</script>
+
+		<script type="text/javascript">
+
+			var container, stats;
+
+			var camera, scene, renderer;
+
+			var uniforms, material, mesh;
+
+			var mouseX = 0, mouseY = 0,
+			lat = 0, lon = 0, phy = 0, theta = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			init();
+			setInterval( loop, 1000 / 60 );
+
+			function init() {
+
+				container = document.getElementById( 'container' );
+
+				camera = new THREE.Camera();
+				camera.position.z = 1;
+
+				scene = new THREE.Scene();
+
+				uniforms = {
+					time: { type: "f", value: 1.0 },
+					resolution: { type: "v2", value: new THREE.Vector2() }
+				};
+
+				material = new THREE.MeshShaderMaterial( {
+
+					vertex_shader: document.getElementById( 'vertex_shader' ).innerText,
+					fragment_shader: document.getElementById( 'fragment_shader' ).innerText,
+					uniforms: uniforms
+
+					} );
+
+				mesh = new THREE.Mesh( new Plane( 2, 2 ), material );
+				scene.addObject( mesh );
+
+				renderer = new THREE.WebGLRenderer( { scene: scene } );
+				container.appendChild( renderer.domElement );
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				container.appendChild( stats.domElement );
+
+				onWindowResize();
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize( event ) {
+
+				uniforms.resolution.value.x = window.innerWidth;
+				uniforms.resolution.value.y = window.innerHeight;
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
+			}
+
+			function loop() {
+
+				uniforms.time.value += 0.05;
+
+				renderer.render( scene, camera );
+				stats.update();
+
+			}
+
+		</script>
+
+	</body>
+</html>

+ 4 - 0
src/renderers/WebGLRenderer.js

@@ -1337,6 +1337,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				_gl.uniform1f( location, value );
 				_gl.uniform1f( location, value );
 
 
+			} else if( type == "v2" ) {
+
+				_gl.uniform2f( location, value.x, value.y );
+
 			} else if( type == "v3" ) {
 			} else if( type == "v3" ) {
 
 
 				_gl.uniform3f( location, value.x, value.y, value.z );
 				_gl.uniform3f( location, value.x, value.y, value.z );

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