// ThreeWebGL.js r37 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)}; THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var g,f,i,j,o,p;if(d==0)g=f=i=0;else{j=Math.floor(a*6);o=a*6-j;a=d*(1-c);p=d*(1-c*o);c=d*(1-c*(1-o));switch(j){case 1:g=p;f=d;i=a;break;case 2:g=a;f=d;i=c;break;case 3:g=a;f=p;i=d;break;case 4:g=c;f=a;i=d;break;case 5:g=d;f=a; i=p;break;case 6:case 0:g=d;f=c;i=a}}this.r=g;this.g=f;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB: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)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,c,d){this.set(a||0,c||0,d||0)}; THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a, c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,d=this.y,g=this.z;this.set(d*a.z-g*a.y,g*a.x-c*a.z,c*a.y-d*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/ a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a= this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},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)}};THREE.Vector4=function(a,c,d,g){this.set(a||0,c||0,d||0,g||1)}; THREE.Vector4.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(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)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={intersectScene:function(a){var c,d,g=a.objects,f=[];a=0;for(c=g.length;a0&&T>0&&V+T<1}var d,g, f,i,j,o,p,v,x,y,D,z=a.geometry,K=z.vertices,M=[];d=0;for(g=z.faces.length;dp?g:p;f=f>v?f:v}a()}; this.add3Points=function(p,v,x,y,D,z){if(o){o=!1;c=px?p>D?p:D:x>D?x:D;f=v>y?v>z?v:z:y>z?y:z}else{c=px?p>D?p>g?p:g:D>g?D:g:x>D?x>g?x:g:D>g?D:g;f=v>y?v>z?v>f?v:f:z>f?z:f:y>z?y>f?y:f:z>f?z:f}a()};this.addRectangle=function(p){if(o){o=!1;c=p.getLeft();d=p.getTop();g=p.getRight();f=p.getBottom()}else{c=cp.getRight()? g:p.getRight();f=f>p.getBottom()?f:p.getBottom()}a()};this.inflate=function(p){c-=p;d-=p;g+=p;f+=p;a()};this.minSelf=function(p){c=c>p.getLeft()?c:p.getLeft();d=d>p.getTop()?d:p.getTop();g=g=0&&Math.min(f,p.getBottom())-Math.max(d,p.getTop())>=0};this.empty=function(){o=!0;f=g=d=c=0;a()};this.isEmpty=function(){return o}}; 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,d,g,f,i,j,o,p,v,x,y,D,z,K,M){this.set(a||1,c||0,d||0,g||0,f||0,i||1,j||0,o||0,p||0,v||0,x||1,y||0,D||0,z||0,K||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4.prototype={set:function(a,c,d,g,f,i,j,o,p,v,x,y,D,z,K,M){this.n11=a;this.n12=c;this.n13=d;this.n14=g;this.n21=f;this.n22=i;this.n23=j;this.n24=o;this.n31=p;this.n32=v;this.n33=x;this.n34=y;this.n41=D;this.n42=z;this.n43=K;this.n44=M;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,d){var g=THREE.Matrix4.__v1, f=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(a,c).normalize();if(i.length()===0)i.z=1;g.cross(d,i).normalize();if(g.length()===0){i.x+=1.0E-4;g.cross(d,i).normalize()}f.cross(i,g).normalize();this.n11=g.x;this.n12=f.x;this.n13=i.x;this.n21=g.y;this.n22=f.y;this.n23=i.y;this.n31=g.z;this.n32=f.z;this.n33=i.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,g=a.z,f=1/(this.n41*c+this.n42*d+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*g+this.n14)*f;a.y=(this.n21*c+this.n22*d+this.n23* g+this.n24)*f;a.z=(this.n31*c+this.n32*d+this.n33*g+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,d=a.y,g=a.z,f=a.w;a.x=this.n11*c+this.n12*d+this.n13*g+this.n14*f;a.y=this.n21*c+this.n22*d+this.n23*g+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*g+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*g+this.n44*f;return a},rotateAxis:function(a){var c=a.x,d=a.y,g=a.z;a.x=c*this.n11+d*this.n12+g*this.n13;a.y=c*this.n21+d*this.n22+g*this.n23;a.z=c*this.n31+d*this.n32+g*this.n33;a.normalize(); return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,g=a.n12,f=a.n13,i=a.n14,j=a.n21,o=a.n22,p=a.n23,v=a.n24,x=a.n31,y=a.n32,D=a.n33,z=a.n34,K=a.n41,M=a.n42,T=a.n43,O=a.n44,pa=c.n11,Y=c.n12,qa=c.n13,V=c.n14,E=c.n21,Fa=c.n22, ka=c.n23,Da=c.n24,$=c.n31,b=c.n32,Q=c.n33,la=c.n34;this.n11=d*pa+g*E+f*$;this.n12=d*Y+g*Fa+f*b;this.n13=d*qa+g*ka+f*Q;this.n14=d*V+g*Da+f*la+i;this.n21=j*pa+o*E+p*$;this.n22=j*Y+o*Fa+p*b;this.n23=j*qa+o*ka+p*Q;this.n24=j*V+o*Da+p*la+v;this.n31=x*pa+y*E+D*$;this.n32=x*Y+y*Fa+D*b;this.n33=x*qa+y*ka+D*Q;this.n34=x*V+y*Da+D*la+z;this.n41=K*pa+M*E+T*$;this.n42=K*Y+M*Fa+T*b;this.n43=K*qa+M*ka+T*Q;this.n44=K*V+M*Da+T*la+O;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);d[0]=this.n11;d[1]= this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*= a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,g=this.n14,f=this.n21,i=this.n22,j=this.n23,o=this.n24,p=this.n31,v=this.n32,x=this.n33,y=this.n34,D=this.n41,z=this.n42,K=this.n43,M=this.n44;return g*j*v*D-d*o*v*D-g*i*x*D+c*o*x*D+d*i*y*D-c*j*y*D-g*j*p*z+d*o*p*z+g*f*x*z-a*o*x*z-d*f*y*z+a*j*y*z+g*i*p*K-c*o*p*K-g*f*v*K+a*o*v*K+c*f*y*K-a*i*y*K-d*i*p*M+c*j*p*M+d*f*v*M-a*j*v*M-c*f*x*M+a*i*x*M},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31= this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]= this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},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},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0, 0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,c){var d=Math.cos(c),g=Math.sin(c),f= 1-d,i=a.x,j=a.y,o=a.z,p=f*i,v=f*j;this.set(p*i+d,p*j-g*o,p*o+g*j,0,p*j+g*o,v*j+d,v*o-g*i,0,p*o-g*j,v*o+g*i,f*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,g=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var i=Math.cos(g);g=Math.sin(g);var j=a*d,o=c*d;this.n11=f*i;this.n12=-f*g;this.n13=d;this.n21=o*i+a*g;this.n22=-o*g+a*i;this.n23=-c*f;this.n31=-j*i+c*g;this.n32=j*g+c*i;this.n33= a*f;return this},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,g=a.z,f=a.w,i=c+c,j=d+d,o=g+g;a=c*i;var p=c*j;c*=o;var v=d*j;d*=o;g*=o;i*=f;j*=f;f*=o;this.n11=1-(v+g);this.n12=p-f;this.n13=c+j;this.n21=p+f;this.n22=1-(a+g);this.n23=d-i;this.n31=c-j;this.n32=d+i;this.n33=1-(a+v);return this},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14= a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var d=1/c.x,g=1/c.y,f=1/c.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*g;this.n22=a.n22*g;this.n32=a.n32*g;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}}; THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,g=a.n12,f=a.n13,i=a.n14,j=a.n21,o=a.n22,p=a.n23,v=a.n24,x=a.n31,y=a.n32,D=a.n33,z=a.n34,K=a.n41,M=a.n42,T=a.n43,O=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=p*z*M-v*D*M+v*y*T-o*z*T-p*y*O+o*D*O;c.n12=i*D*M-f*z*M-i*y*T+g*z*T+f*y*O-g*D*O;c.n13=f*v*M-i*p*M+i*o*T-g*v*T-f*o*O+g*p*O;c.n14=i*p*y-f*v*y-i*o*D+g*v*D+f*o*z-g*p*z;c.n21=v*D*K-p*z*K-v*x*T+j*z*T+p*x*O-j*D*O;c.n22=f*z*K-i*D*K+i*x*T-d*z*T-f*x*O+d*D*O;c.n23=i*p*K-f*v*K-i*j*T+d*v*T+f*j*O-d*p*O; c.n24=f*v*x-i*p*x+i*j*D-d*v*D-f*j*z+d*p*z;c.n31=o*z*K-v*y*K+v*x*M-j*z*M-o*x*O+j*y*O;c.n32=i*y*K-g*z*K-i*x*M+d*z*M+g*x*O-d*y*O;c.n33=f*v*K-i*o*K+i*j*M-d*v*M-g*j*O+d*o*O;c.n34=i*o*x-g*v*x-i*j*y+d*v*y+g*j*z-d*o*z;c.n41=p*y*K-o*D*K-p*x*M+j*D*M+o*x*T-j*y*T;c.n42=g*D*K-f*y*K+f*x*M-d*D*M-g*x*T+d*y*T;c.n43=f*o*K-g*p*K-f*j*M+d*p*M+g*j*T-d*o*T;c.n44=g*p*x-f*o*x+f*j*y-d*p*y-g*j*D+d*o*D;c.multiplyScalar(1/a.determinant());return c}; THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,g=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,p=-a.n32*a.n11+a.n31*a.n12,v=a.n23*a.n12-a.n22*a.n13,x=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*g+a.n21*j+a.n31*v;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*g;d[1]=a*f;d[2]=a*i;d[3]=a*j;d[4]=a*o;d[5]=a*p;d[6]=a*v;d[7]=a*x;d[8]=a*y;return c}; THREE.Matrix4.makeFrustum=function(a,c,d,g,f,i){var j;j=new THREE.Matrix4;j.n11=2*f/(c-a);j.n12=0;j.n13=(c+a)/(c-a);j.n14=0;j.n21=0;j.n22=2*f/(g-d);j.n23=(g+d)/(g-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+f)/(i-f);j.n34=-2*i*f/(i-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,c,d,g){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,g)}; THREE.Matrix4.makeOrtho=function(a,c,d,g,f,i){var j,o,p,v;j=new THREE.Matrix4;o=c-a;p=d-g;v=i-f;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((c+a)/o);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((d+g)/p);j.n31=0;j.n32=0;j.n33=-2/v;j.n34=-((i+f)/v);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible= !0;this._vector=new THREE.Vector3}; THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!== undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!== 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var g=this.children.length;a=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var i=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.001){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}f=Math.sin((1-g)*i)/j;g=Math.sin(g*i)/j;d.w=a.w*f+c.w*g;d.x=a.x*f+c.x*g;d.y=a.y*f+c.y*g;d.z=a.z*f+c.z*g;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,c,d,g,f,i){this.a=a;this.b=c;this.c=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,c,d,g,f,i,j){this.a=a;this.b=c;this.c=d;this.d=g;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)}; THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;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,d=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.zthis.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+g+" on bone "+z);g=g<0?0:1}if(d==="pos"){d=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=f[0]+(i[0]-f[0])*g;d.y=f[1]+(i[1]-f[1])*g;d.z=f[2]+(i[2]-f[2])*g}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= this.getPrevKeyWith("pos",z,j.index-1).pos;this.points[1]=f;this.points[2]=i;this.points[3]=this.getNextKeyWith("pos",z,o.index+1).pos;g=g*0.33+0.33;f=this.interpolateCatmullRom(this.points,g);d.x=f[0];d.y=f[1];d.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){g=this.interpolateCatmullRom(this.points,g*1.01);this.target.set(g[0],g[1],g[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();g=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,g,0)}}}else if(d=== "rot")THREE.Quaternion.slerp(f,i,a.quaternion,g);else if(d==="scl"){d=a.scale;d.x=f[0]+(i[0]-f[0])*g;d.y=f[1]+(i[1]-f[1])*g;d.z=f[2]+(i[2]-f[2])*g}}}}if(this.JITCompile&&x[0][v]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;za.length-2?i:i+1;d[3]=i>a.length-3?i:i+2;i=a[d[0]];o=a[d[1]];p=a[d[2]];v=a[d[3]];d=f*f;j=f*d;g[0]=this.interpolate(i[0],o[0],p[0],v[0],f,d,j);g[1]=this.interpolate(i[1],o[1],p[1],v[1],f,d,j);g[2]=this.interpolate(i[2],o[2],p[2],v[2],f,d,j);return g}; THREE.Animation.prototype.interpolate=function(a,c,d,g,f,i,j){a=(d-a)*0.5;g=(g-c)*0.5;return(2*(c-d)+a+g)*j+(-3*(c-d)-2*a-g)*i+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d0?d:0:d>=0?d:d+g.length;d>=0;d--)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[g.length-1]}; THREE.Camera=function(a,c,d,g,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=g||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype; THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)}; THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate= !1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a1){a=d.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var g=1;g=this.LODs[g].visibleAtDistance){this.LODs[g-1].object3D.visible= !1;this.LODs[g].object3D.visible=!0}else break;for(;g=0&&ta>=0&&W>=0&&na>=0)return!0;else if(Ca<0&&ta<0||W<0&&na<0)return!1;else{if(Ca<0)la=Math.max(la,Ca/(Ca-ta));else ta<0&&(Ba=Math.min(Ba,Ca/(Ca-ta)));if(W<0)la=Math.max(la,W/(W-na));else na<0&&(Ba=Math.min(Ba,W/(W-na)));if(BaCa&&j.positionScreen.z0&&V.z<1){La=Y[pa]=Y[pa]||new THREE.RenderableParticle;pa++;O=La;O.x=V.x/V.w;O.y=V.y/V.w;O.z=V.z;O.rotation=ca.rotation.z;O.scale.x=ca.scale.x*Math.abs(O.x-(V.x+Q.projectionMatrix.n11)/(V.w+Q.projectionMatrix.n14));O.scale.y=ca.scale.y*Math.abs(O.y-(V.y+Q.projectionMatrix.n22)/(V.w+Q.projectionMatrix.n24));O.materials=ca.materials;Ba.push(O)}}}}la&&Ba.sort(c);return Ba}}; THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,d){d&&a.update(undefined,!1,c);d=a.sounds;var g,f=d.length;for(g=0;g 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 ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec4 vPointLight[ 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 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\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 vec4 vPointLight[ 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( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + vViewPosition );\nfloat pointDistance = vPointLight[ i ].w;\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 * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\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",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif", morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif", default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\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},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{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)},morphTargetInfluences:{type:"f", value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{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={lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nattribute \tvec2 \tposition;\nattribute vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform int renderPink;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderPink == 1 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}\n}"}, shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform \tfloat \tdarkness;\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, darkness );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos = objectMatrix * vec4( position, 1.0 );\nvec3 norm = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position = projectionMatrix * viewMatrix * ( pos + extruded );\n}", fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"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}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"}, normal:{uniforms:{opacity:{type:"f",value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"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,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;", THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex, THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common, THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment, THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex, THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].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}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;", THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"), vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex, THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.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.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;", THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}}; THREE.WebGLRenderer=function(a){function c(e,m,k){var h,n,u,r=e.vertices,t=r.length,q=e.colors,A=q.length,s=e.__vertexArray,G=e.__colorArray,B=e.__sortArray,L=e.__dirtyVertices,I=e.__dirtyColors;if(k.sortParticles){ca.multiplySelf(k.matrixWorld);for(h=0;hq){A=s;q=t[A]}b.bindBuffer(b.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[A]);b.vertexAttribPointer(m["morphTarget"+k],3,b.FLOAT,!1,0,0);u.__webglMorphTargetInfluences[k]=q;r[A]=1;q=-1;k++}}b.uniform1fv(h.program.uniforms.morphTargetInfluences,u.__webglMorphTargetInfluences)}else{b.bindBuffer(b.ARRAY_BUFFER,n.__webglVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0)}if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER, n.__webglColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,!1,0,0)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webglNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webglTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(n.__webglUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,n.__webglUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>= 0)if(n.__webglUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,n.__webglUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(h.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webglSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,n.__webglSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER, n.__webglSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,n.__webglSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(u instanceof THREE.Mesh)if(h.wireframe){b.lineWidth(h.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer);b.drawElements(b.LINES,n.__webglLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer);b.drawElements(b.TRIANGLES,n.__webglFaceCount,b.UNSIGNED_SHORT, 0)}else if(u instanceof THREE.Line){u=u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(h.linewidth);b.drawArrays(u,0,n.__webglLineCount)}else if(u instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,n.__webglParticleCount);else u instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,n.__webglVertexCount)}}function i(e,m){if(!e.__webglVertexBuffer)e.__webglVertexBuffer=b.createBuffer();if(!e.__webglNormalBuffer)e.__webglNormalBuffer=b.createBuffer();if(e.hasPos){b.bindBuffer(b.ARRAY_BUFFER, e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,e.positionArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(m.attributes.position);b.vertexAttribPointer(m.attributes.position,3,b.FLOAT,!1,0,0)}if(e.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,e.__webglNormalBuffer);b.bufferData(b.ARRAY_BUFFER,e.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(m.attributes.normal);b.vertexAttribPointer(m.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function j(e){if(W!=e.doubleSided){e.doubleSided? b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);W=e.doubleSided}if(na!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);na=e.flipSided}}function o(e){if(oa!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);oa=e}}function p(e){ua[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);ua[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);ua[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);ua[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);ua[4].set(e.n41-e.n31,e.n42- e.n32,e.n43-e.n33,e.n44-e.n34);ua[5].set(e.n41+e.n31,e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var m;for(e=0;e<6;e++){m=ua[e];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function v(e){for(var m=e.matrixWorld,k=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),h=0;h<6;h++){e=ua[h].x*m.n14+ua[h].y*m.n24+ua[h].z*m.n34+ua[h].w;if(e<=k)return!1}return!0}function x(e,m){e.list[e.count]=m;e.count+=1}function y(e){var m,k,h=e.object,n=e.opaque,u=e.transparent;u.count= 0;e=n.count=0;for(m=h.materials.length;e0.001&&q.scale>0.001){B[0]=q.x;B[1]=q.y;B[2]=q.z;s=q.size*q.scale/xa;G[0]=s*A;G[1]=s;b.uniform3fv(R.screenPosition,B);b.uniform1f(R.rotation,q.rotation);b.uniform2fv(R.scale,G);b.uniform1f(R.opacity,q.opacity);qa(q.blending);E(q.texture,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(Ca)}function T(e,m){e._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray); THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function O(e){var m,k,h;if(e instanceof THREE.Mesh){k=e.geometry;for(m in k.geometryGroups){h=k.geometryGroups[m];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents){var n=b.DYNAMIC_DRAW,u=void 0,r=void 0,t=void 0,q=void 0;t=void 0;var A=void 0,s=void 0,G=void 0,B=void 0,L=void 0,I=void 0,P=void 0,N=void 0,R=void 0,C=void 0,F=void 0, J=void 0,da=void 0;s=void 0;G=void 0;q=void 0;B=void 0;q=void 0;C=void 0;F=void 0;s=void 0;C=void 0;F=void 0;J=void 0;da=void 0;C=void 0;F=void 0;J=void 0;da=void 0;C=void 0;F=void 0;J=void 0;da=void 0;C=void 0;F=void 0;J=void 0;q=void 0;B=void 0;A=void 0;t=void 0;t=void 0;var ya=void 0,Oa=void 0,ea=void 0,X=0,va=0,Va=0,Wa=0,Ga=0,Ha=0,Z=0,Ia=0,sa=0,w=0,wa=0,za=h.__vertexArray,db=h.__uvArray,eb=h.__uv2Array,Ma=h.__normalArray,fa=h.__tangentArray,Aa=h.__colorArray,ga=h.__skinVertexAArray,ha=h.__skinVertexBArray, ia=h.__skinIndexArray,ja=h.__skinWeightArray,fb=h.__morphTargetsArrays,Ja=h.__faceArray,Ka=h.__lineArray,mb=h.__needsSmoothNormals;I=h.__vertexColorType;L=h.__uvType;P=h.__normalType;var Ea=e.geometry,gb=Ea.__dirtyVertices,hb=Ea.__dirtyElements,bb=Ea.__dirtyUvs,ib=Ea.__dirtyNormals,jb=Ea.__dirtyTangents,kb=Ea.__dirtyColors,lb=Ea.__dirtyMorphTargets,Xa=Ea.vertices,nb=h.faces,rb=Ea.faces,ob=Ea.faceVertexUvs[0],pb=Ea.faceVertexUvs[1],Ya=Ea.skinVerticesA,Za=Ea.skinVerticesB,$a=Ea.skinIndices,Sa=Ea.skinWeights, Ua=Ea.edgeFaces,Pa=Ea.morphTargets;u=0;for(r=nb.length;u0){b.bindBuffer(b.ARRAY_BUFFER,h.__webglColorBuffer);b.bufferData(b.ARRAY_BUFFER,Aa,n)}if(ib){b.bindBuffer(b.ARRAY_BUFFER,h.__webglNormalBuffer);b.bufferData(b.ARRAY_BUFFER,Ma,n)}if(jb&&Ea.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,h.__webglTangentBuffer);b.bufferData(b.ARRAY_BUFFER,fa,n)}if(bb&&Va>0){b.bindBuffer(b.ARRAY_BUFFER, h.__webglUVBuffer);b.bufferData(b.ARRAY_BUFFER,db,n)}if(bb&&Wa>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webglUV2Buffer);b.bufferData(b.ARRAY_BUFFER,eb,n)}if(hb){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ja,n);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ka,n)}if(w>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,ga,n);b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinVertexBBuffer); b.bufferData(b.ARRAY_BUFFER,ha,n);b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,ia,n);b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,ja,n)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(e instanceof THREE.Ribbon){k=e.geometry;if(k.__dirtyVertices||k.__dirtyColors){e=k;m=b.DYNAMIC_DRAW;P=e.vertices;n=e.colors;N=P.length; u=n.length;R=e.__vertexArray;r=e.__colorArray;X=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L65535){s[q].counter+=1;A=s[q].hash+"_"+s[q].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:t,vertices:0,numMorphTargets:G})}e.geometryGroups[A].faces.push(n);e.geometryGroups[A].vertices+=r}}function Y(e,m,k){e.push({buffer:m,object:k, opaque:{list:[],count:0},transparent:{list:[],count:0}})}function qa(e){if(e!=aa){switch(e){case THREE.AdditiveAlphaBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE);break;case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE);break;case THREE.SubtractiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.SRC_COLOR);break;default:b.blendEquationSeparate(b.FUNC_ADD, b.FUNC_ADD);b.blendFuncSeparate(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA)}aa=e}}function V(e,m,k){if((k.width&k.width-1)==0&&(k.height&k.height-1)==0){b.texParameteri(e,b.TEXTURE_WRAP_S,$(m.wrapS));b.texParameteri(e,b.TEXTURE_WRAP_T,$(m.wrapT));b.texParameteri(e,b.TEXTURE_MAG_FILTER,$(m.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,$(m.minFilter));b.generateMipmap(e)}else{b.texParameteri(e,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE); b.texParameteri(e,b.TEXTURE_MAG_FILTER,Da(m.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,Da(m.minFilter))}}function E(e,m){if(e.needsUpdate){if(e.__webglInit){b.bindTexture(b.TEXTURE_2D,e.__webglTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,e.image)}else{e.__webglTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,e.__webglTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.image);e.__webglInit=!0}V(b.TEXTURE_2D,e,e.image);b.bindTexture(b.TEXTURE_2D,null); e.needsUpdate=!1}b.activeTexture(b.TEXTURE0+m);b.bindTexture(b.TEXTURE_2D,e.__webglTexture)}function Fa(e){if(e&&!e.__webglFramebuffer){e.__webglFramebuffer=b.createFramebuffer();e.__webglRenderbuffer=b.createRenderbuffer();e.__webglTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,e.__webglRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,e.width,e.height);b.bindTexture(b.TEXTURE_2D,e.__webglTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,$(e.wrapS));b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_T,$(e.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,$(e.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,$(e.minFilter));b.texImage2D(b.TEXTURE_2D,0,$(e.format),e.width,e.height,0,$(e.format),$(e.type),null);b.bindFramebuffer(b.FRAMEBUFFER,e.__webglFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e.__webglTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e.__webglRenderbuffer);b.bindTexture(b.TEXTURE_2D, null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var m,k;if(e){m=e.__webglFramebuffer;k=e.width;e=e.height}else{m=null;k=ma;e=xa}if(m!=Ba){b.bindFramebuffer(b.FRAMEBUFFER,m);b.viewport(U,ra,k,e);Ba=m}}function ka(e,m){var k;if(e=="fragment")k=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(k=b.createShader(b.VERTEX_SHADER));b.shaderSource(k,m);b.compileShader(k);if(!b.getShaderParameter(k,b.COMPILE_STATUS)){console.error(b.getShaderInfoLog(k));console.error(m); return null}return k}function Da(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return b.NEAREST;default:return b.LINEAR}}function $(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR; case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA; case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var b,Q=document.createElement("canvas"),la=null,Ba=null,Ca=!0,ta=this,W=null,na=null,aa=null,oa=null,U=0,ra=0,ma=0,xa=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ca=new THREE.Matrix4,La=new Float32Array(16),Qa=new Float32Array(16),Ra=new THREE.Vector4, cb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Na=!0,ab=!0,Ta=new THREE.Color(0),qb=0;if(a){if(a.stencil!=undefined)Na=a.stencil;if(a.antialias!==undefined)ab=a.antialias;a.clearColor!==undefined&&Ta.setHex(a.clearColor);if(a.clearAlpha!==undefined)qb=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Q;this.autoClear=!0;this.sortObjects=!0;(function(e,m,k,h){try{if(!(b=Q.getContext("experimental-webgl",{antialias:e,stencil:h})))throw"Error creating WebGL context."; }catch(n){console.error(n)}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.clearColor(m.r,m.g,m.b,k)})(ab,Ta,qb,Na);this.context=b;if(Na){var S={};S.vertices=new Float32Array(12);S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-2;S.vertices[1]=-1;S.vertices[2]=-1;S.vertices[3]=2;S.vertices[4]=-1;S.vertices[5]= -1;S.vertices[6]=2;S.vertices[7]=1;S.vertices[8]=-1;S.vertices[9]=-2;S.vertices[10]=1;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=b.createBuffer();S.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,S.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,S.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,S.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,S.faces,b.STATIC_DRAW);S.program=b.createProgram();b.attachShader(S.program, ka("fragment",THREE.ShaderLib.shadowPost.fragmentShader));b.attachShader(S.program,ka("vertex",THREE.ShaderLib.shadowPost.vertexShader));b.linkProgram(S.program);S.vertexLocation=b.getAttribLocation(S.program,"position");S.projectionLocation=b.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=b.getUniformLocation(S.program,"darkness")}var H={};H.vertices=new Float32Array(16);H.faces=new Uint16Array(6);H.transparency=0.5;a=0;H.vertices[a++]=-1;H.vertices[a++]=-1;H.vertices[a++]=0; H.vertices[a++]=0;H.vertices[a++]=1;H.vertices[a++]=-1;H.vertices[a++]=1;H.vertices[a++]=0;H.vertices[a++]=1;H.vertices[a++]=1;H.vertices[a++]=1;H.vertices[a++]=1;H.vertices[a++]=-1;H.vertices[a++]=1;H.vertices[a++]=0;H.vertices[a++]=1;a=0;H.faces[a++]=0;H.faces[a++]=1;H.faces[a++]=2;H.faces[a++]=0;H.faces[a++]=2;H.faces[a++]=3;H.vertexBuffer=b.createBuffer();H.elementBuffer=b.createBuffer();H.tempTexture=b.createTexture();H.readBackPixels=new Uint8Array(1024);b.bindBuffer(b.ARRAY_BUFFER,H.vertexBuffer); b.bufferData(b.ARRAY_BUFFER,H.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,H.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,H.faces,b.STATIC_DRAW);b.bindTexture(b.TEXTURE_2D,H.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER, b.NEAREST);H.program=b.createProgram();b.attachShader(H.program,ka("fragment",THREE.ShaderLib.lensFlare.fragmentShader));b.attachShader(H.program,ka("vertex",THREE.ShaderLib.lensFlare.vertexShader));b.linkProgram(H.program);H.attributes={};H.uniforms={};H.attributes.vertex=b.getAttribLocation(H.program,"position");H.attributes.uv=b.getAttribLocation(H.program,"UV");H.uniforms.map=b.getUniformLocation(H.program,"map");H.uniforms.opacity=b.getUniformLocation(H.program,"opacity");H.uniforms.scale=b.getUniformLocation(H.program, "scale");H.uniforms.rotation=b.getUniformLocation(H.program,"rotation");H.uniforms.screenPosition=b.getUniformLocation(H.program,"screenPosition");H.uniforms.renderPink=b.getUniformLocation(H.program,"renderPink");this.setSize=function(e,m){Q.width=e;Q.height=m;this.setViewport(0,0,Q.width,Q.height)};this.setViewport=function(e,m,k,h){U=e;ra=m;ma=k;xa=h;b.viewport(U,ra,ma,xa)};this.setScissor=function(e,m,k,h){b.scissor(e,m,k,h)};this.enableScissorTest=function(e){e?b.enable(b.SCISSOR_TEST):b.disable(b.SCISSOR_TEST)}; this.enableDepthBufferWrite=function(e){Ca=e;b.depthMask(e)};this.setClearColorHex=function(e,m){var k=new THREE.Color(e);b.clearColor(k.r,k.g,k.b,m)};this.setClearColor=function(e,m){b.clearColor(e.r,e.g,e.b,m)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT|b.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(e){S.darkness=e};this.initMaterial=function(e,m,k,h){var n,u,r,t;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.ShadowVolumeDynamicMaterial)d(e, THREE.ShaderLib.shadowVolumeDynamic);else if(e instanceof THREE.MeshNormalMaterial)d(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)d(e,THREE.ShaderLib.lambert);else if(e instanceof THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);if(!e.program){var q, A,s;q=s=t=0;for(r=m.length;q 0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n"); b.attachShader(m,ka("fragment",q+k));b.attachShader(m,ka("vertex",r+t));b.linkProgram(m);b.getProgramParameter(m,b.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+b.getProgramParameter(m,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");m.uniforms={};m.attributes={};e.program=m;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(n in e.uniforms)k.push(n); n=e.program;t=0;for(m=k.length;t=0&&b.enableVertexAttribArray(u.color);u.normal>=0&&b.enableVertexAttribArray(u.normal); u.tangent>=0&&b.enableVertexAttribArray(u.tangent);if(e.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0){b.enableVertexAttribArray(u.skinVertexA);b.enableVertexAttribArray(u.skinVertexB);b.enableVertexAttribArray(u.skinIndex);b.enableVertexAttribArray(u.skinWeight)}if(e.morphTargets){e.numSupportedMorphTargets=0;if(u.morphTarget0>=0){b.enableVertexAttribArray(u.morphTarget0);e.numSupportedMorphTargets++}if(u.morphTarget1>=0){b.enableVertexAttribArray(u.morphTarget1); e.numSupportedMorphTargets++}if(u.morphTarget2>=0){b.enableVertexAttribArray(u.morphTarget2);e.numSupportedMorphTargets++}if(u.morphTarget3>=0){b.enableVertexAttribArray(u.morphTarget3);e.numSupportedMorphTargets++}if(u.morphTarget4>=0){b.enableVertexAttribArray(u.morphTarget4);e.numSupportedMorphTargets++}if(u.morphTarget5>=0){b.enableVertexAttribArray(u.morphTarget5);e.numSupportedMorphTargets++}if(u.morphTarget6>=0){b.enableVertexAttribArray(u.morphTarget6);e.numSupportedMorphTargets++}if(u.morphTarget7>= 0){b.enableVertexAttribArray(u.morphTarget7);e.numSupportedMorphTargets++}h.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(u=this.maxMorphTargets;n0||P.faceVertexUvs.length>0)r.__uvArray=new Float32Array(q*2);if(P.faceUvs.length>1||P.faceVertexUvs.length>1)r.__uv2Array=new Float32Array(q*2)}if(t.geometry.skinWeights.length&&t.geometry.skinIndices.length){r.__skinVertexAArray=new Float32Array(q*4);r.__skinVertexBArray=new Float32Array(q*4);r.__skinIndexArray=new Float32Array(q*4);r.__skinWeightArray=new Float32Array(q*4)}r.__faceArray=new Uint16Array(B*3+(t.geometry.edgeFaces? t.geometry.edgeFaces.length*6:0));r.__lineArray=new Uint16Array(L*2);if(r.numMorphTargets){P=void 0;N=void 0;r.__morphTargetsArrays=[];P=0;for(N=r.numMorphTargets;P=0;n--){h=k.__webglObjects[n].object;m==h&&k.__webglObjects.splice(n,1)}e.__objectsRemoved.splice(0,1)}m=0;for(k=e.__webglObjects.length;m0}}; THREE.WebGLRenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};