// Three.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; THREE.Color.prototype={setRGB:function(a,c,e){this.r=a;this.g=c;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,e){var g,i,k,q,p,l;if(e==0)g=i=k=0;else{q=Math.floor(a*6);p=a*6-q;a=e*(1-c);l=e*(1-c*p);c=e*(1-c*(1-p));switch(q){case 1:g=l;i=e;k=a;break;case 2:g=a;i=e;k=c;break;case 3:g=a;i=l;k=e;break;case 4:g=c;i=a;k=e;break;case 5:g=e;i=a;k=l;break;case 6:case 0:g=e;i=c;k=a}}this.r=g;this.g=i;this.b=k;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,e){this.x=a||0;this.y=c||0;this.z=e||0}; THREE.Vector3.prototype={set:function(a,c,e){this.x=a;this.y=c;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,e=this.y,g=this.z;this.x=e*a.z-g*a.y;this.y=g*a.x-c*a.z;this.z=c*a.y-e*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+e*e+a*a)},distanceToSquared:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return c*c+e*e+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; THREE.Vector4=function(a,c,e,g){this.x=a||0;this.y=c||0;this.z=e||0;this.w=g||1}; THREE.Vector4.prototype={set:function(a,c,e,g){this.x=a;this.y=c;this.z=e;this.w=g;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={intersectScene:function(a){var c,e,g=a.objects,i=[];a=0;for(c=g.length;a0&&G>0&&b+G<1}var e,g,i,k,q,p,l,n,y,z, t,x=a.geometry,D=x.vertices,H=[];e=0;for(g=x.faces.length;el?g:l;i=i>n? i:n}a()};this.add3Points=function(l,n,y,z,t,x){if(p){p=false;c=ly?l>t?l:t:y>t?y:t;i=n>z?n>x?n:x:z>x?z:x}else{c=ly?l>t?l>g?l:g:t>g?t:g:y>t?y>g?y:g:t>g?t:g;i=n>z?n>x?n>i?n:i:x>i?x:i:z>x?z>i?z:i:x>i?x:i}a()};this.addRectangle=function(l){if(p){p=false;c=l.getLeft();e=l.getTop();g=l.getRight();i=l.getBottom()}else{c=cl.getRight()?g:l.getRight();i=i>l.getBottom()?i:l.getBottom()}a()};this.inflate=function(l){c-=l;e-=l;g+=l;i+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();e=e>l.getTop()?e:l.getTop();g=g=0&&Math.min(i,l.getBottom())-Math.max(e,l.getTop())>=0};this.empty=function(){p=true;i=g=e=c=0;a()};this.isEmpty=function(){return p};this.toString= function(){return"THREE.Rectangle ( left: "+c+", right: "+g+", top: "+e+", bottom: "+i+", width: "+k+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}}; THREE.Matrix4=function(a,c,e,g,i,k,q,p,l,n,y,z,t,x,D,H){this.n11=a||1;this.n12=c||0;this.n13=e||0;this.n14=g||0;this.n21=i||0;this.n22=k||1;this.n23=q||0;this.n24=p||0;this.n31=l||0;this.n32=n||0;this.n33=y||1;this.n34=z||0;this.n41=t||0;this.n42=x||0;this.n43=D||0;this.n44=H||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,e,g,i,k,q,p,l,n,y,z,t,x,D,H){this.n11=a;this.n12=c;this.n13=e;this.n14=g;this.n21=i;this.n22=k;this.n23=q;this.n24=p;this.n31=l;this.n32=n;this.n33=y;this.n34=z;this.n41=t;this.n42=x;this.n43=D;this.n44=H;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,e){var g=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,k=THREE.Matrix4.__tmpVec3;k.sub(a,c).normalize();g.cross(e,k).normalize();i.cross(k,g).normalize();this.n11=g.x;this.n12=g.y;this.n13=g.z;this.n14=-g.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a); this.n31=k.x;this.n32=k.y;this.n33=k.z;this.n34=-k.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,e=a.y,g=a.z,i=1/(this.n41*c+this.n42*e+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*e+this.n13*g+this.n14)*i;a.y=(this.n21*c+this.n22*e+this.n23*g+this.n24)*i;a.z=(this.n31*c+this.n32*e+this.n33*g+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,e=a.y,g=a.z,i=a.w;a.x=this.n11*c+this.n12*e+this.n13*g+this.n14*i;a.y=this.n21*c+this.n22*e+this.n23* g+this.n24*i;a.z=this.n31*c+this.n32*e+this.n33*g+this.n34*i;a.w=this.n41*c+this.n42*e+this.n43*g+this.n44*i;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var e=a.n11,g=a.n12,i=a.n13,k=a.n14,q=a.n21,p=a.n22,l=a.n23,n=a.n24,y=a.n31, z=a.n32,t=a.n33,x=a.n34,D=a.n41,H=a.n42,G=a.n43,r=a.n44,S=c.n11,B=c.n12,I=c.n13,b=c.n14,aa=c.n21,P=c.n22,J=c.n23,W=c.n24,M=c.n31,R=c.n32,K=c.n33,C=c.n34,L=c.n41,ba=c.n42,N=c.n43,da=c.n44;this.n11=e*S+g*aa+i*M+k*L;this.n12=e*B+g*P+i*R+k*ba;this.n13=e*I+g*J+i*K+k*N;this.n14=e*b+g*W+i*C+k*da;this.n21=q*S+p*aa+l*M+n*L;this.n22=q*B+p*P+l*R+n*ba;this.n23=q*I+p*J+l*K+n*N;this.n24=q*b+p*W+l*C+n*da;this.n31=y*S+z*aa+t*M+x*L;this.n32=y*B+z*P+t*R+x*ba;this.n33=y*I+z*J+t*K+x*N;this.n34=y*b+z*W+t*C+x*da;this.n41= D*S+H*aa+G*M+r*L;this.n42=D*B+H*P+G*R+r*ba;this.n43=D*I+H*J+G*K+r*N;this.n44=D*b+H*W+G*C+r*da;return this},multiplyToArray:function(a,c,e){var g=a.n11,i=a.n12,k=a.n13,q=a.n14,p=a.n21,l=a.n22,n=a.n23,y=a.n24,z=a.n31,t=a.n32,x=a.n33,D=a.n34,H=a.n41,G=a.n42,r=a.n43;a=a.n44;var S=c.n11,B=c.n12,I=c.n13,b=c.n14,aa=c.n21,P=c.n22,J=c.n23,W=c.n24,M=c.n31,R=c.n32,K=c.n33,C=c.n34,L=c.n41,ba=c.n42,N=c.n43;c=c.n44;this.n11=g*S+i*aa+k*M+q*L;this.n12=g*B+i*P+k*R+q*ba;this.n13=g*I+i*J+k*K+q*N;this.n14=g*b+i*W+k* C+q*c;this.n21=p*S+l*aa+n*M+y*L;this.n22=p*B+l*P+n*R+y*ba;this.n23=p*I+l*J+n*K+y*N;this.n24=p*b+l*W+n*C+y*c;this.n31=z*S+t*aa+x*M+D*L;this.n32=z*B+t*P+x*R+D*ba;this.n33=z*I+t*J+x*K+D*N;this.n34=z*b+t*W+x*C+D*c;this.n41=H*S+G*aa+r*M+a*L;this.n42=H*B+G*P+r*R+a*ba;this.n43=H*I+G*J+r*K+a*N;this.n44=H*b+G*W+r*C+a*c;e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]= this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(a){var c=this.n11,e=this.n12,g=this.n13,i=this.n14,k=this.n21,q=this.n22,p=this.n23,l=this.n24,n=this.n31,y=this.n32,z=this.n33,t=this.n34,x=this.n41,D=this.n42,H=this.n43,G=this.n44,r=a.n11,S=a.n21,B=a.n31,I=a.n41,b=a.n12,aa=a.n22,P=a.n32,J=a.n42,W=a.n13,M=a.n23,R=a.n33,K=a.n43,C=a.n14,L=a.n24,ba=a.n34;a=a.n44;this.n11=c*r+e*S+g*B+i*I;this.n12=c*b+e*aa+g*P+i*J;this.n13=c*W+e*M+g*R+i*K;this.n14=c*C+e*L+g*ba+i*a;this.n21=k*r+ q*S+p*B+l*I;this.n22=k*b+q*aa+p*P+l*J;this.n23=k*W+q*M+p*R+l*K;this.n24=k*C+q*L+p*ba+l*a;this.n31=n*r+y*S+z*B+t*I;this.n32=n*b+y*aa+z*P+t*J;this.n33=n*W+y*M+z*R+t*K;this.n34=n*C+y*L+z*ba+t*a;this.n41=x*r+D*S+H*B+G*I;this.n42=x*b+D*aa+H*P+G*J;this.n43=x*W+D*M+H*R+G*K;this.n44=x*C+D*L+H*ba+G*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a; this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,e=this.n13,g=this.n14,i=this.n21,k=this.n22,q=this.n23,p=this.n24,l=this.n31,n=this.n32,y=this.n33,z=this.n34,t=this.n41,x=this.n42,D=this.n43,H=this.n44;return g*q*n*t-e*p*n*t-g*k*y*t+c*p*y*t+e*k*z*t-c*q*z*t-g*q*l*x+e*p*l*x+g*i*y*x-a*p*y*x-e*i*z*x+a*q*z*x+g*k*l*D-c*p*l*D-g*i*n*D+a*p*n*D+c*i*z*D-a*k*z*D-e*k*l*H+c*q*l*H+e*i*n*H-a*q*n*H-c*i*y*H+a*k*y*H},transpose:function(){function a(c,e,g){var i=c[e];c[e]=c[g];c[g]= i}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31; a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,e){this.set(1, 0,0,a,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(a,c,e){this.set(a,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var e=Math.cos(c),g=Math.sin(c), i=1-e,k=a.x,q=a.y,p=a.z,l=i*k,n=i*q;this.set(l*k+e,l*q-g*p,l*p+g*q,0,l*q+g*p,n*q+e,n*p-g*k,0,l*p-g*q,n*p+g*k,i*p*p+e,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,e){var g=new THREE.Matrix4;g.setTranslation(a,c,e);return g}; THREE.Matrix4.scaleMatrix=function(a,c,e){var g=new THREE.Matrix4;g.setScale(a,c,e);return g};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var e=new THREE.Matrix4;e.setRotAxis(a,c);return e}; THREE.Matrix4.makeInvert=function(a){var c=a.n11,e=a.n12,g=a.n13,i=a.n14,k=a.n21,q=a.n22,p=a.n23,l=a.n24,n=a.n31,y=a.n32,z=a.n33,t=a.n34,x=a.n41,D=a.n42,H=a.n43,G=a.n44,r=new THREE.Matrix4;r.n11=p*t*D-l*z*D+l*y*H-q*t*H-p*y*G+q*z*G;r.n12=i*z*D-g*t*D-i*y*H+e*t*H+g*y*G-e*z*G;r.n13=g*l*D-i*p*D+i*q*H-e*l*H-g*q*G+e*p*G;r.n14=i*p*y-g*l*y-i*q*z+e*l*z+g*q*t-e*p*t;r.n21=l*z*x-p*t*x-l*n*H+k*t*H+p*n*G-k*z*G;r.n22=g*t*x-i*z*x+i*n*H-c*t*H-g*n*G+c*z*G;r.n23=i*p*x-g*l*x-i*k*H+c*l*H+g*k*G-c*p*G;r.n24=g*l*n-i*p*n+ i*k*z-c*l*z-g*k*t+c*p*t;r.n31=q*t*x-l*y*x+l*n*D-k*t*D-q*n*G+k*y*G;r.n32=i*y*x-e*t*x-i*n*D+c*t*D+e*n*G-c*y*G;r.n33=g*l*x-i*q*x+i*k*D-c*l*D-e*k*G+c*q*G;r.n34=i*q*n-e*l*n-i*k*y+c*l*y+e*k*t-c*q*t;r.n41=p*y*x-q*z*x-p*n*D+k*z*D+q*n*H-k*y*H;r.n42=e*z*x-g*y*x+g*n*D-c*z*D-e*n*H+c*y*H;r.n43=g*q*x-e*p*x-g*k*D+c*p*D+e*k*H-c*q*H;r.n44=e*p*n-g*q*n+g*k*y-c*p*y-e*k*z+c*q*z;r.multiplyScalar(1/a.determinant());return r}; THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,e=c.m,g=a.n33*a.n22-a.n32*a.n23,i=-a.n33*a.n21+a.n31*a.n23,k=a.n32*a.n21-a.n31*a.n22,q=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,y=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*g+a.n21*q+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;e[0]=a*g;e[1]=a*i;e[2]=a*k;e[3]=a*q;e[4]=a*p;e[5]=a*l;e[6]=a*n;e[7]=a*y;e[8]=a*z;return c}; THREE.Matrix4.makeFrustum=function(a,c,e,g,i,k){var q,p,l;q=new THREE.Matrix4;p=2*i/(c-a);l=2*i/(g-e);a=(c+a)/(c-a);e=(g+e)/(g-e);g=-(k+i)/(k-i);i=-2*k*i/(k-i);q.n11=p;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=l;q.n23=e;q.n24=0;q.n31=0;q.n32=0;q.n33=g;q.n34=i;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,e,g){var i;a=e*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,e,g)}; THREE.Matrix4.makeOrtho=function(a,c,e,g,i,k){var q,p,l,n;q=new THREE.Matrix4;p=c-a;l=e-g;n=k-i;a=(c+a)/p;e=(e+g)/l;i=(k+i)/n;q.n11=2/p;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/l;q.n23=0;q.n24=-e;q.n31=0;q.n32=0;q.n33=-2/n;q.n34=-i;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; THREE.Face3=function(a,c,e,g,i){this.a=a;this.b=c;this.c=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; THREE.Face4=function(a,c,e,g,i,k){this.a=a;this.b=c;this.c=e;this.d=g;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=k instanceof Array?k:[k]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,e;a=0;for(c=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,e=this.vertices.length;c65535){n[p].counter+=1;l=n[p].hash+"_"+n[p].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:q,vertices:0}}this.geometryChunks[l].faces.push(g);this.geometryChunks[l].vertices+=k}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0; THREE.Camera=function(a,c,e,g){this.fov=a;this.aspect=c;this.near=e;this.far=g;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true;this.children=[]}; THREE.Object3D.prototype={addChild:function(a){this.children.indexOf(a)===-1&&this.children.push(a)},removeChild:function(a){a=this.children.indexOf(a);a!==-1&&this.children.splice(a,1)},updateMatrix:function(){var a=this.position,c=this.rotation,e=this.scale,g=this.matrix,i=this.rotationMatrix,k=this.tmpMatrix;g.setTranslation(a.x,a.y,a.z);i.setRotX(c.x);c.y!=0&&i.multiplySelf(k.setRotY(c.y));c.z!=0&&i.multiplySelf(k.setRotZ(c.z));g.multiplySelf(i);if(e.x!=0||e.y!=0||e.z!=0)g.multiplySelf(k.setScale(e.x, e.y,e.z))}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; THREE.Line=function(a,c,e){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=e!=undefined?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=false;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.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
linewidth: "+this.linewidth+"
linecap: "+this.linecap+"
linejoin: "+this.linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.LineBasicMaterialCounter={value:0}; THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){a.color!== undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_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.shading!==undefined)this.shading=a.shading;if(a.blending!== undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+ "
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.MeshBasicMaterialCounter={value:0}; THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){a.color!== undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_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.shading!==undefined)this.shading=a.shading;if(a.blending!== undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+ "
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}};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.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth= 1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;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.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;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.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (
id: "+this.id+"
color: "+this.color+"
ambient: "+this.ambient+"
specular: "+this.specular+"
shininess: "+this.shininess+"
opacity: "+this.opacity+"
map: "+this.map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+ this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.MeshPhongMaterialCounter={value:0}; THREE.MeshDepthMaterial=function(a){this.id=THREE.MeshDepthMaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;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;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshDepthMaterialCounter={value:0}; THREE.MeshNormalMaterial=function(a){this.id=THREE.MeshNormalMaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;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;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshNormalMaterialCounter={value:0};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.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;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.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.MeshShaderMaterialCounter={value:0}; THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending; if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.ParticleBasicMaterialCounter={value:0}; 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 (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,e,g,i,k){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=g!==undefined?g:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=k!==undefined?k: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 (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,c,e){this.width=a;this.height=c;e=e||{};this.wrap_s=e.wrap_s!==undefined?e.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=e.wrap_t!==undefined?e.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=e.mag_filter!==undefined?e.mag_filter:THREE.LinearFilter;this.min_filter=e.min_filter!==undefined?e.min_filter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType}; var Uniforms={clone:function(a){var c,e,g,i={};for(c in a){i[c]={};for(e in a[c]){g=a[c][e];i[c][e]=g instanceof THREE.Color||g instanceof THREE.Vector3||g instanceof THREE.Texture?g.clone():g}}return i},merge:function(a){var c,e,g,i={};for(c=0;c=0&&K>=0&&C>=0&&L>=0)return true;else if(R<0&&K<0||C<0&&L<0)return false;else{if(R<0)W=Math.max(W,R/(R-K));else if(K<0)M=Math.min(M,R/(R-K));if(C<0)W=Math.max(W,C/(C-L));else if(L<0)M=Math.min(M,C/(C-L));if(MR&&N.z0&&G.z<1){t=D[x]=D[x]||new THREE.RenderableParticle;t.x=G.x/G.w;t.y=G.y/G.w;t.z=G.z;t.rotation=d.rotation.z;t.scale.x=d.scale.x*Math.abs(t.x-(G.x+J.projectionMatrix.n11)/ (G.w+J.projectionMatrix.n14));t.scale.y=d.scale.y*Math.abs(t.y-(G.y+J.projectionMatrix.n22)/(G.w+J.projectionMatrix.n24));t.materials=d.materials;M.push(t);x++}}}}W&&M.sort(a);return M};this.unprojectVector=function(P,J){var W=THREE.Matrix4.makeInvert(J.matrix);W.multiplySelf(THREE.Matrix4.makeInvert(J.projectionMatrix));W.multiplyVector3(P);return P}}; THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,e,g,i,k;this.domElement=document.createElement("div");this.setSize=function(q,p){e=q;g=p;i=e/2;k=g/2};this.render=function(q,p){var l,n,y,z,t,x,D,H;a=c.projectScene(q,p);l=0;for(n=a.length;l0){E.r+=pa.r*$;E.g+=pa.g*$;E.b+=pa.b*$}}else if($ instanceof THREE.PointLight){U.sub($.position,X);U.normalize();$=T.dot(U)*wa;if($>0){E.r+= pa.r*$;E.g+=pa.g*$;E.b+=pa.b*$}}}}function va(A,X,T){if(T.opacity!=0){a(T.opacity);c(T.blending);var E,Q,$,pa,wa,ya;if(T instanceof THREE.ParticleBasicMaterial){if(T.map&&T.map.image.loaded){pa=T.map.image;wa=pa.width>>1;ya=pa.height>>1;Q=X.scale.x*p;$=X.scale.y*l;T=Q*wa;E=$*ya;m.set(A.x-T,A.y-E,A.x+T,A.y+E);if(w.instersects(m)){n.save();n.translate(A.x,A.y);n.rotate(-X.rotation);n.scale(Q,-$);n.translate(-wa,-ya);n.drawImage(pa,0,0);n.restore()}}}else if(T instanceof THREE.ParticleCircleMaterial){if(v){s.r= O.r+Y.r+ga.r;s.g=O.g+Y.g+ga.g;s.b=O.b+Y.b+ga.b;M.r=T.color.r*s.r;M.g=T.color.g*s.g;M.b=T.color.b*s.b;M.updateStyleString()}else M.__styleString=T.color.__styleString;T=X.scale.x*p;E=X.scale.y*l;m.set(A.x-T,A.y-E,A.x+T,A.y+E);if(w.instersects(m)){Q=M.__styleString;if(H!=Q)n.fillStyle=H=Q;n.save();n.translate(A.x,A.y);n.rotate(-X.rotation);n.scale(T,E);n.beginPath();n.arc(0,0,1,0,ia,true);n.closePath();n.fill();n.restore()}}}}function ma(A,X,T,E){if(E.opacity!=0){a(E.opacity);c(E.blending);n.beginPath(); n.moveTo(A.positionScreen.x,A.positionScreen.y);n.lineTo(X.positionScreen.x,X.positionScreen.y);n.closePath();if(E instanceof THREE.LineBasicMaterial){M.__styleString=E.color.__styleString;A=E.linewidth;if(G!=A)n.lineWidth=G=A;A=M.__styleString;if(D!=A)n.strokeStyle=D=A;n.stroke();m.inflate(E.linewidth*2)}}}function na(A,X,T,E,Q,$){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);I=A.positionScreen.x;b=A.positionScreen.y;aa=X.positionScreen.x;P=X.positionScreen.y;J=T.positionScreen.x;W=T.positionScreen.y; n.beginPath();n.moveTo(I,b);n.lineTo(aa,P);n.lineTo(J,W);n.lineTo(I,b);n.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&sa(I,b,aa,P,J,W,Q.map.image,E.uvs[0].u,E.uvs[0].v,E.uvs[1].u,E.uvs[1].v,E.uvs[2].u,E.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=fa.matrix;U.copy(E.vertexNormalsWorld[0]);ca=(U.x*A.n11+U.y*A.n12+U.z*A.n13)*0.5+0.5;d=-(U.x*A.n21+ U.y*A.n22+U.z*A.n23)*0.5+0.5;U.copy(E.vertexNormalsWorld[1]);j=(U.x*A.n11+U.y*A.n12+U.z*A.n13)*0.5+0.5;o=-(U.x*A.n21+U.y*A.n22+U.z*A.n23)*0.5+0.5;U.copy(E.vertexNormalsWorld[2]);h=(U.x*A.n11+U.y*A.n12+U.z*A.n13)*0.5+0.5;f=-(U.x*A.n21+U.y*A.n22+U.z*A.n23)*0.5+0.5;sa(I,b,aa,P,J,W,Q.env_map.image,ca,d,j,o,h,f)}}else Q.wireframe?Ea(Q.color.__styleString,Q.wireframe_linewidth):Fa(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&& sa(I,b,aa,P,J,W,Q.map.image,E.uvs[0].u,E.uvs[0].v,E.uvs[1].u,E.uvs[1].v,E.uvs[2].u,E.uvs[2].v);c(THREE.SubtractiveBlending)}if(v)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&E.vertexNormalsWorld.length==3){R.r=K.r=C.r=O.r;R.g=K.g=C.g=O.g;R.b=K.b=C.b=O.b;za($,E.v1.positionWorld,E.vertexNormalsWorld[0],R);za($,E.v2.positionWorld,E.vertexNormalsWorld[1],K);za($,E.v3.positionWorld,E.vertexNormalsWorld[2],C);L.r=(K.r+C.r)*0.5;L.g=(K.g+C.g)*0.5;L.b=(K.b+C.b)*0.5;da=ha(R,K,C,L);sa(I,b,aa,P,J,W,da,0, 0,1,0,0,1)}else{s.r=O.r;s.g=O.g;s.b=O.b;za($,E.centroidWorld,E.normalWorld,s);M.r=Q.color.r*s.r;M.g=Q.color.g*s.g;M.b=Q.color.b*s.b;M.updateStyleString();Q.wireframe?Ea(M.__styleString,Q.wireframe_linewidth):Fa(M.__styleString)}else Q.wireframe?Ea(Q.color.__styleString,Q.wireframe_linewidth):Fa(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){ba=fa.near;N=fa.far;R.r=R.g=R.b=1-la(A.positionScreen.z,ba,N);K.r=K.g=K.b=1-la(X.positionScreen.z,ba,N);C.r=C.g=C.b=1-la(T.positionScreen.z, ba,N);L.r=(K.r+C.r)*0.5;L.g=(K.g+C.g)*0.5;L.b=(K.b+C.b)*0.5;da=ha(R,K,C,L);sa(I,b,aa,P,J,W,da,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){M.r=Aa(E.normalWorld.x);M.g=Aa(E.normalWorld.y);M.b=Aa(E.normalWorld.z);M.updateStyleString();Q.wireframe?Ea(M.__styleString,Q.wireframe_linewidth):Fa(M.__styleString)}}}function Ea(A,X){if(D!=A)n.strokeStyle=D=A;if(G!=X)n.lineWidth=G=X;n.stroke();m.inflate(X*2)}function Fa(A){if(H!=A)n.fillStyle=H=A;n.fill()}function sa(A,X,T,E,Q,$,pa,wa,ya,Ha, Da,Ia,Oa){var Ga,Ja;Ga=pa.width-1;Ja=pa.height-1;wa*=Ga;ya*=Ja;Ha*=Ga;Da*=Ja;Ia*=Ga;Oa*=Ja;T-=A;E-=X;Q-=A;$-=X;Ha-=wa;Da-=ya;Ia-=wa;Oa-=ya;Ga=Ha*Oa-Ia*Da;if(Ga!=0){Ja=1/Ga;Ga=(Oa*T-Da*Q)*Ja;Da=(Oa*E-Da*$)*Ja;T=(Ha*Q-Ia*T)*Ja;E=(Ha*$-Ia*E)*Ja;A=A-Ga*wa-T*ya;X=X-Da*wa-E*ya;n.save();n.transform(Ga,Da,T,E,A,X);n.clip();n.drawImage(pa,0,0);n.restore()}}function ha(A,X,T,E){var Q=~~(A.r*255),$=~~(A.g*255);A=~~(A.b*255);var pa=~~(X.r*255),wa=~~(X.g*255);X=~~(X.b*255);var ya=~~(T.r*255),Ha=~~(T.g*255);T= ~~(T.b*255);var Da=~~(E.r*255),Ia=~~(E.g*255);E=~~(E.b*255);F[0]=Q<0?0:Q>255?255:Q;F[1]=$<0?0:$>255?255:$;F[2]=A<0?0:A>255?255:A;F[4]=pa<0?0:pa>255?255:pa;F[5]=wa<0?0:wa>255?255:wa;F[6]=X<0?0:X>255?255:X;F[8]=ya<0?0:ya>255?255:ya;F[9]=Ha<0?0:Ha>255?255:Ha;F[10]=T<0?0:T>255?255:T;F[12]=Da<0?0:Da>255?255:Da;F[13]=Ia<0?0:Ia>255?255:Ia;F[14]=E<0?0:E>255?255:E;Z.putImageData(qa,0,0);oa.drawImage(ea,0,0);return ua}function la(A,X,T){A=(A-X)/(T-X);return A*A*(3-2*A)}function Aa(A){A=(A+1)*0.5;return A<0? 0:A>1?1:A}function ta(A,X){var T=X.x-A.x,E=X.y-A.y,Q=1/Math.sqrt(T*T+E*E);T*=Q;E*=Q;X.x+=T;X.y+=E;A.x-=T;A.y-=E}var La,xa,ka,Ba,Ca,Ma,Na,Ka;this.autoClear?this.clear():n.setTransform(1,0,0,-1,p,l);e=g.projectScene(V,fa,this.sortElements);(v=V.lights.length>0)&&ja(V);La=0;for(xa=e.length;La0){j.r+=f.color.r*w;j.g+=f.color.g*w;j.b+=f.color.b*w}}else if(f instanceof THREE.PointLight){W.sub(f.position,d.centroidWorld);W.normalize();w=d.normalWorld.dot(W)*f.intensity;if(w>0){j.r+=f.color.r*w;j.g+=f.color.g*w;j.b+=f.color.b*w}}}}function c(ca,d,j,o,h,f){C=g(L++);C.setAttribute("d","M "+ca.positionScreen.x+ " "+ca.positionScreen.y+" L "+d.positionScreen.x+" "+d.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");if(h instanceof THREE.MeshBasicMaterial)B.__styleString=h.color.__styleString;else if(h instanceof THREE.MeshLambertMaterial)if(S){I.r=b.r;I.g=b.g;I.b=b.b;a(f,o,I);B.r=h.color.r*I.r;B.g=h.color.g*I.g;B.b=h.color.b*I.b;B.updateStyleString()}else B.__styleString=h.color.__styleString;else if(h instanceof THREE.MeshDepthMaterial){J=1-h.__2near/(h.__farPlusNear-o.z*h.__farMinusNear); B.setRGB(J,J,J)}else h instanceof THREE.MeshNormalMaterial&&B.setRGB(i(o.normalWorld.x),i(o.normalWorld.y),i(o.normalWorld.z));h.wireframe?C.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+h.wireframe_linewidth+"; stroke-opacity: "+h.opacity+"; stroke-linecap: "+h.wireframe_linecap+"; stroke-linejoin: "+h.wireframe_linejoin):C.setAttribute("style","fill: "+B.__styleString+"; fill-opacity: "+h.opacity);p.appendChild(C)}function e(ca,d,j,o,h,f,w){C=g(L++);C.setAttribute("d", "M "+ca.positionScreen.x+" "+ca.positionScreen.y+" L "+d.positionScreen.x+" "+d.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)B.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(S){I.r=b.r;I.g=b.g;I.b=b.b;a(w,h,I);B.r=f.color.r*I.r;B.g=f.color.g*I.g;B.b=f.color.b*I.b;B.updateStyleString()}else B.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){J=1-f.__2near/(f.__farPlusNear-h.z*f.__farMinusNear);B.setRGB(J,J,J)}else f instanceof THREE.MeshNormalMaterial&&B.setRGB(i(h.normalWorld.x),i(h.normalWorld.y),i(h.normalWorld.z));f.wireframe?C.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):C.setAttribute("style","fill: "+B.__styleString+"; fill-opacity: "+ f.opacity);p.appendChild(C)}function g(ca){if(M[ca]==null){M[ca]=document.createElementNS("http://www.w3.org/2000/svg","path");da==0&&M[ca].setAttribute("shape-rendering","crispEdges");return M[ca]}return M[ca]}function i(ca){return ca<0?Math.min((1+ca)*0.5,0.5):0.5+Math.min(ca*0.5,0.5)}var k=null,q=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,n,y,z,t,x,D,H,G=new THREE.Rectangle,r=new THREE.Rectangle,S=false,B=new THREE.Color(16777215),I=new THREE.Color(16777215), b=new THREE.Color(0),aa=new THREE.Color(0),P=new THREE.Color(0),J,W=new THREE.Vector3,M=[],R=[],K=[],C,L,ba,N,da=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(ca){switch(ca){case "high":da=1;break;case "low":da=0}};this.setSize=function(ca,d){l=ca;n=d;y=l/2;z=n/2;p.setAttribute("viewBox",-y+" "+-z+" "+l+" "+n);p.setAttribute("width",l);p.setAttribute("height",n);G.set(-y,-z,y,z)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])}; this.render=function(ca,d){var j,o,h,f,w,u,m,v;this.autoClear&&this.clear();k=q.projectScene(ca,d,this.sortElements);N=ba=L=0;if(S=ca.lights.length>0){m=ca.lights;b.setRGB(0,0,0);aa.setRGB(0,0,0);P.setRGB(0,0,0);j=0;for(o=m.length;j0){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLUVBuffer); b.bufferData(b.ARRAY_BUFFER,Ea,Y)}if(Ca&&ia>0){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Fa,Y)}if(Ba){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,u.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Aa,Y);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,u.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ta,Y)}}D(objlist,w,h,d,j,o)}f.__dirtyVertices=false;f.__dirtyElements=false;f.__dirtyUvs=false;f.__dirtyNormals=false;f.__dirtyTangents=false;f.__dirtyColors=false}else if(j instanceof THREE.Line){if(!f.__webGLVertexBuffer){f.__webGLVertexBuffer=b.createBuffer();f.__webGLColorBuffer=b.createBuffer();h=f.vertices.length;f.__vertexArray=new Float32Array(h*3);f.__colorArray=new Float32Array(h*3);f.__webGLLineCount=h;f.__dirtyVertices=true;f.__dirtyColors=true}if(f.__dirtyVertices||f.__dirtyColors){h=b.DYNAMIC_DRAW;m=f.vertices;u=f.colors;O=m.length;Y=u.length;ia=f.__vertexArray;ga=f.__colorArray;U=f.__dirtyColors;if(f.__dirtyVertices){for(v=0;v0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,w.map?"#define USE_MAP":"",w.env_map?"#define USE_ENVMAP":"",w.light_map?"#define USE_LIGHTMAP":"",w.vertex_colors?"#define USE_COLOR":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n"); b.attachShader(o,S("fragment",f+v));b.attachShader(o,S("vertex",w+j));b.linkProgram(o);b.getProgramParameter(o,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(o,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");o.uniforms={};o.attributes={};d.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(h in d.uniforms)o.push(h);h=d.program;v=0;for(j=o.length;v=0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLColorBuffer);b.vertexAttribPointer(d.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.color)}if(d.normal>= 0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLNormalBuffer);b.vertexAttribPointer(d.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.normal)}if(d.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLTangentBuffer);b.vertexAttribPointer(d.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.tangent)}if(d.uv>=0)if(f.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.vertexAttribPointer(d.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv)}else b.disableVertexAttribArray(d.uv);if(d.uv2>= 0)if(f.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUV2Buffer);b.vertexAttribPointer(d.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv2)}else b.disableVertexAttribArray(d.uv2);if(w instanceof THREE.Mesh)if(h.wireframe){b.lineWidth(h.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.drawElements(b.LINES,f.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,f.__webGLFaceCount,b.UNSIGNED_SHORT, 0)}else if(w instanceof THREE.Line){w=w.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(h.linewidth);b.drawArrays(w,0,f.__webGLLineCount)}else w instanceof THREE.ParticleSystem&&b.drawArrays(b.POINTS,0,f.__webGLParticleCount)};this.render=function(d,j,o,h){var f,w,u,m,v,s,O,Y=d.lights,ga=d.fog;j.autoUpdateMatrix&&j.updateMatrix();j.matrix.flattenToArray(L);j.projectionMatrix.flattenToArray(C);K.multiply(j.projectionMatrix,j.matrix);k(K);this.initWebGLObjects(d,j);r(o,h!==undefined?h:true); this.autoClear&&this.clear();m=d.__webGLObjects.length;for(h=0;h=0;o--){h=d.__webGLObjects[o].object;j==h&&d.__webGLObjects.splice(o,1)}};this.setDepthTest=function(d){d?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setFaceCulling=function(d,j){if(d){!j||j=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(d=="back")b.cullFace(b.BACK);else d=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)> 0}}; THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif", lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif"}; THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i", value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},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)}}}; THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f", value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment, THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex, "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment, THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex, THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common, THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment, THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex, THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.Snippets.lights_vertex, "gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",THREE.Snippets.color_pars_vertex, "void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null}; THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null}; THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};