// Three.js r38 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(b){this.setHex(b)}; THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,d,c){this.r=b;this.g=d;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,d,c){var f,g,h,j,k,n;if(c==0)f=g=h=0;else{j=Math.floor(b*6);k=b*6-j;b=c*(1-d);n=c*(1-d*k);d=c*(1-d*(1-k));switch(j){case 1:f=n;g=c;h=b;break;case 2:f=b;g=c;h=d;break;case 3:f=b;g=n;h=c;break;case 4:f=d;g=b;h=c;break;case 5:f=c;g=b; h=n;break;case 6:case 0:f=c;g=d;h=b}}this.r=f;this.g=g;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&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(b,d){this.set(b||0,d||0)}; THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);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(b,d,c){this.set(b||0,d||0,c||0)}; THREE.Vector3.prototype={set:function(b,d,c){this.x=b;this.y=d;this.z=c;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b, d){this.set(b.y*d.z-b.z*d.y,b.z*d.x-b.x*d.z,b.x*d.y-b.y*d.x);return this},crossSelf:function(b){var d=this.x,c=this.y,f=this.z;this.set(c*b.z-f*b.y,f*b.x-d*b.z,d*b.y-c*b.x);return this},multiply:function(b,d){this.set(b.x*d.x,b.y*d.y,b.z*d.z);return this},multiplySelf:function(b){this.set(this.x*b.x,this.y*b.y,this.z*b.z);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b,this.z*b);return this},divideSelf:function(b){this.set(this.x/b.x,this.y/b.y,this.z/b.z);return this},divideScalar:function(b){this.set(this.x/ b,this.y/b,this.z/b);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,c=this.y-b.y;b=this.z-b.z;return d*d+c*c+b*b},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 b= this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){this.y=Math.asin(b.n13);var d=Math.cos(this.y);if(Math.abs(d)>1.0E-5){this.x=Math.atan2(-b.n23/d,b.n33/d);this.z=Math.atan2(-b.n13/d,b.n11/d)}else{this.x=0;this.z=Math.atan2(b.n21,b.n22)}},setLength:function(b){return this.normalize().multiplyScalar(b)},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(b,d,c,f){this.set(b||0,d||0,c||0,f||1)}; THREE.Vector4.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x* b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3}; THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b0&&I>0&&O+I<1}var c,f,g,h,j,k,n,p,o,x, A,t=b.geometry,C=t.vertices,F=[];c=0;for(f=t.faces.length;cn?f:n;g=g>p?g:p}b()}; this.add3Points=function(n,p,o,x,A,t){if(k){k=!1;d=no?n>A?n:A:o>A?o:A;g=p>x?p>t?p:t:x>t?x:t}else{d=no?n>A?n>f?n:f:A>f?A:f:o>A?o>f?o:f:A>f?A:f;g=p>x?p>t?p>g?p:g:t>g?t:g:x>t?x>g?x:g:t>g?t:g}b()};this.addRectangle=function(n){if(k){k=!1;d=n.getLeft();c=n.getTop();f=n.getRight();g=n.getBottom()}else{d=dn.getRight()? f:n.getRight();g=g>n.getBottom()?g:n.getBottom()}b()};this.inflate=function(n){d-=n;c-=n;f+=n;g+=n;b()};this.minSelf=function(n){d=d>n.getLeft()?d:n.getLeft();c=c>n.getTop()?c:n.getTop();f=f=0&&Math.min(g,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){k=!0;g=f=c=d=0;b()};this.isEmpty=function(){return k}}; THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}}; THREE.Matrix4=function(b,d,c,f,g,h,j,k,n,p,o,x,A,t,C,F){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,x||0,A||0,t||0,C||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,n,p,o,x,A,t,C,F){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=o;this.n34=x;this.n41=A;this.n42=t;this.n43=C;this.n44=F;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1, g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23* f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize(); return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,A=b.n33,t=b.n34,C=b.n41,F=b.n42,I=b.n43,G=b.n44,U=d.n11,D=d.n12,M=d.n13,O=d.n14,Q=d.n21,Ia=d.n22, ua=d.n23,Aa=d.n24,da=d.n31,e=d.n32,ga=d.n33,Ba=d.n34;this.n11=c*U+f*Q+g*da;this.n12=c*D+f*Ia+g*e;this.n13=c*M+f*ua+g*ga;this.n14=c*O+f*Aa+g*Ba+h;this.n21=j*U+k*Q+n*da;this.n22=j*D+k*Ia+n*e;this.n23=j*M+k*ua+n*ga;this.n24=j*O+k*Aa+n*Ba+p;this.n31=o*U+x*Q+A*da;this.n32=o*D+x*Ia+A*e;this.n33=o*M+x*ua+A*ga;this.n34=o*O+x*Aa+A*Ba+t;this.n41=C*U+F*Q+I*da;this.n42=C*D+F*Ia+I*e;this.n43=C*M+F*ua+I*ga;this.n44=C*O+F*Aa+I*Ba+G;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]= this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*= b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,x=this.n34,A=this.n41,t=this.n42,C=this.n43,F=this.n44;return f*j*p*A-c*k*p*A-f*h*o*A+d*k*o*A+c*h*x*A-d*j*x*A-f*j*n*t+c*k*n*t+f*g*o*t-b*k*o*t-c*g*x*t+b*j*x*t+f*h*n*C-d*k*n*C-f*g*p*C+b*k*p*C+d*g*x*C-b*h*x*C-c*h*n*F+d*j*n*F+c*g*p*F-b*j*p*F-d*g*o*F+b*h*o*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31= this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},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(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42; b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0, 0,1);return this},setScale:function(b,d,c){this.set(b,0,0,0,0,d,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var c=Math.cos(d),f=Math.sin(d),g= 1-c,h=b.x,j=b.y,k=b.z,n=g*h,p=g*j;this.set(n*h+c,n*j-f*k,n*k+f*j,0,n*j+f*k,p*j+c,p*k-f*h,0,n*k-f*j,p*k+f*h,g*k*k+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+d*h;this.n33= b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var n=d*j;d*=k;var p=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=n-g;this.n13=d+j;this.n21=n+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+p);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},extractPosition:function(b){this.n14= b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,x=b.n32,A=b.n33,t=b.n34,C=b.n41,F=b.n42,I=b.n43,G=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=n*t*F-p*A*F+p*x*I-k*t*I-n*x*G+k*A*G;d.n12=h*A*F-g*t*F-h*x*I+f*t*I+g*x*G-f*A*G;d.n13=g*p*F-h*n*F+h*k*I-f*p*I-g*k*G+f*n*G;d.n14=h*n*x-g*p*x-h*k*A+f*p*A+g*k*t-f*n*t;d.n21=p*A*C-n*t*C-p*o*I+j*t*I+n*o*G-j*A*G;d.n22=g*t*C-h*A*C+h*o*I-c*t*I-g*o*G+c*A*G;d.n23=h*n*C-g*p*C-h*j*I+c*p*I+g*j*G-c*n*G; d.n24=g*p*o-h*n*o+h*j*A-c*p*A-g*j*t+c*n*t;d.n31=k*t*C-p*x*C+p*o*F-j*t*F-k*o*G+j*x*G;d.n32=h*x*C-f*t*C-h*o*F+c*t*F+f*o*G-c*x*G;d.n33=g*p*C-h*k*C+h*j*F-c*p*F-f*j*G+c*k*G;d.n34=h*k*o-f*p*o-h*j*x+c*p*x+f*j*t-c*k*t;d.n41=n*x*C-k*A*C-n*o*F+j*A*F+k*o*I-j*x*I;d.n42=f*A*C-g*x*C+g*o*F-c*A*F-f*o*I+c*x*I;d.n43=g*k*C-f*n*C-g*j*F+c*n*F+f*j*I-c*k*I;d.n44=f*n*o-g*k*o+g*j*x-c*n*x-f*j*A+c*k*A;d.multiplyScalar(1/b.determinant());return d}; THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,x=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*n;c[6]=b*p;c[7]=b*o;c[8]=b*x;return d}; THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,c,f){var g;b=c*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,c,f)}; THREE.Matrix4.makeOrtho=function(b,d,c,f,g,h){var j,k,n,p;j=new THREE.Matrix4;k=d-b;n=c-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((d+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);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(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!== undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d instanceof THREE.Scene===!1&&d!==undefined;)d=d.parent;d!==undefined&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,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(b,d,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var f=this.children.length;b=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.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 b,d,c;b=0;for(d=this.faces.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,c=this.vertices.length;dthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x; if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;dthis.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];o=this.points[c[1]]; x=this.points[c[2]];A=this.points[c[3]];k=j*j;n=j*k;f.x=d(p.x,o.x,x.x,A.x,j,k,n);f.y=d(p.y,o.y,x.y,A.y,j,k,n);f.z=d(p.z,o.z,x.z,A.z,j,k,n);return f};this.getControlPointsArray=function(){var t,C,F=this.points.length,I=[];for(t=0;t1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+t);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= this.getPrevKeyWith("pos",t,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c=== "rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!0);for(t=0;tb.length-2?h:h+1;c[3]=h>b.length-3?h:h+2;h=b[c[0]];k=b[c[1]];n=b[c[2]];p=b[c[3]];c=g*g;j=g*c;f[0]=this.interpolate(h[0],k[0],n[0],p[0],g,c,j);f[1]=this.interpolate(h[1],k[1],n[1],p[1],g,c,j);f[2]=this.interpolate(h[2],k[2],n[2],p[2],g,c,j);return f}; THREE.Animation.prototype.interpolate=function(b,d,c,f,g,h,j){b=(c-b)*0.5;f=(f-d)*0.5;return(2*(d-c)+b+f)*j+(-3*(d-c)-2*b-f)*h+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[f.length-1]}; THREE.Camera=function(b,d,c,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=c||0.1;this.far=f||2E3;this.target=g||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(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};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(b,d,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate= !1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b1){b=c.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible= !1;this.LODs[f].object3D.visible=!0}else break;for(;f=0&&wa>=0&&ea>=0&&va>=0)return!0;else if(Ka<0&&wa<0||ea<0&&va<0)return!1;else{if(Ka<0)Ba=Math.max(Ba,Ka/(Ka-wa));else wa<0&&(Ja=Math.min(Ja,Ka/(Ka-wa)));if(ea<0)Ba=Math.max(Ba,ea/(ea-va));else va<0&&(Ja=Math.min(Ja,ea/(ea-va)));if(JaKa&&j.positionScreen.z0&&O.z<1){Ta=D[U]=D[U]||new THREE.RenderableParticle;U++;G=Ta;G.x=O.x/O.w;G.y=O.y/O.w;G.z=O.z;G.rotation=Ha.rotation.z;G.scale.x=Ha.scale.x*Math.abs(G.x-(O.x+ga.projectionMatrix.n11)/(O.w+ga.projectionMatrix.n14));G.scale.y=Ha.scale.y*Math.abs(G.y-(O.y+ga.projectionMatrix.n22)/(O.w+ga.projectionMatrix.n24));G.materials=Ha.materials;Ja.push(G)}}}}Ba&&Ja.sort(d);return Ja}}; THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var n,p,o,x,A,t,C,F;b=d.projectScene(j,k);n=0;for(p=b.length;n>1;Ma=ha.height>>1;na=ja.scale.x*n;xa=ja.scale.y*p;Y=na*V;ya=xa*Ma;z.set(T.x-Y,T.y-ya,T.x+Y,T.y+ya);if(m.instersects(z)){o.save();o.translate(T.x,T.y);o.rotate(-ja.rotation); o.scale(na,-xa);o.translate(-V,-Ma);o.drawImage(ha,0,0);o.restore()}}}else if(na instanceof THREE.ParticleCanvasMaterial){Y=ja.scale.x*n;ya=ja.scale.y*p;z.set(T.x-Y,T.y-ya,T.x+Y,T.y+ya);if(m.instersects(z)){c(na.color.__styleString);xa=na.color.__styleString;if(I!=xa)o.fillStyle=I=xa;o.save();o.translate(T.x,T.y);o.rotate(-ja.rotation);o.scale(Y,ya);na.program(o);o.restore()}}}function oa(T,ja,na,Y){b(Y.opacity);d(Y.blending);o.beginPath();o.moveTo(T.positionScreen.x,T.positionScreen.y);o.lineTo(ja.positionScreen.x, ja.positionScreen.y);o.closePath();if(Y instanceof THREE.LineBasicMaterial){ra.__styleString=Y.color.__styleString;T=Y.linewidth;if(G!=T)o.lineWidth=G=T;T=Y.linecap;if(U!=T)o.lineCap=U=T;T=Y.linejoin;if(D!=T)o.lineJoin=D=T;c(ra.__styleString);o.stroke();z.inflate(Y.linewidth*2)}}function Na(T,ja,na,Y,ya,xa,ha,V,Ma){b(V.opacity);d(V.blending);da=T.positionScreen.x;e=T.positionScreen.y;ga=ja.positionScreen.x;Ba=ja.positionScreen.y;Ja=na.positionScreen.x;Ka=na.positionScreen.y;R(da,e,ga,Ba,Ja,Ka);if(V instanceof THREE.MeshBasicMaterial)if(V.map){if(V.map.mapping instanceof THREE.UVMapping){Ua=ha.uvs[0];Qa(da,e,ga,Ba,Ja,Ka,V.map.image,Ua[Y].u,Ua[Y].v,Ua[ya].u,Ua[ya].v,Ua[xa].u,Ua[xa].v)}}else if(V.envMap){if(V.envMap.mapping instanceof THREE.SphericalReflectionMapping){T=za.matrixWorldInverse;K.copy(ha.vertexNormalsWorld[0]);N=(K.x*T.n11+K.y*T.n12+K.z*T.n13)*0.5+0.5;ca=-(K.x*T.n21+K.y*T.n22+K.z*T.n23)*0.5+0.5;K.copy(ha.vertexNormalsWorld[1]);sa=(K.x*T.n11+K.y*T.n12+K.z*T.n13)*0.5+0.5;Ea=-(K.x*T.n21+K.y*T.n22+ K.z*T.n23)*0.5+0.5;K.copy(ha.vertexNormalsWorld[2]);ia=(K.x*T.n11+K.y*T.n12+K.z*T.n13)*0.5+0.5;ma=-(K.x*T.n21+K.y*T.n22+K.z*T.n23)*0.5+0.5;Qa(da,e,ga,Ba,Ja,Ka,V.envMap.image,N,ca,sa,Ea,ia,ma)}}else V.wireframe?fb(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(V.color.__styleString);else if(V instanceof THREE.MeshLambertMaterial){if(V.map&&!V.wireframe){if(V.map.mapping instanceof THREE.UVMapping){Ua=ha.uvs[0];Qa(da,e,ga,Ba,Ja,Ka,V.map.image,Ua[Y].u,Ua[Y].v,Ua[ya].u, Ua[ya].v,Ua[xa].u,Ua[xa].v)}d(THREE.SubtractiveBlending)}if(w)if(!V.wireframe&&V.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ga.r=la.r=pa.r=P.r;Ga.g=la.g=pa.g=P.g;Ga.b=la.b=pa.b=P.b;Z(Ma,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Z(Ma,ha.v2.positionWorld,ha.vertexNormalsWorld[1],la);Z(Ma,ha.v3.positionWorld,ha.vertexNormalsWorld[2],pa);Ha.r=(la.r+pa.r)*0.5;Ha.g=(la.g+pa.g)*0.5;Ha.b=(la.b+pa.b)*0.5;Xa=jb(Ga,la,pa,Ha);Qa(da,e,ga,Ba,Ja,Ka,Xa,0,0,1,0,0,1)}else{y.r=P.r;y.g=P.g; y.b=P.b;Z(Ma,ha.centroidWorld,ha.normalWorld,y);ra.r=V.color.r*y.r;ra.g=V.color.g*y.g;ra.b=V.color.b*y.b;ra.updateStyleString();V.wireframe?fb(ra.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(ra.__styleString)}else V.wireframe?fb(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(V.color.__styleString)}else if(V instanceof THREE.MeshDepthMaterial){Ta=za.near;ab=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ta,ab);la.r=la.g=la.b=1- gb(ja.positionScreen.z,Ta,ab);pa.r=pa.g=pa.b=1-gb(na.positionScreen.z,Ta,ab);Ha.r=(la.r+pa.r)*0.5;Ha.g=(la.g+pa.g)*0.5;Ha.b=(la.b+pa.b)*0.5;Xa=jb(Ga,la,pa,Ha);Qa(da,e,ga,Ba,Ja,Ka,Xa,0,0,1,0,0,1)}else if(V instanceof THREE.MeshNormalMaterial){ra.r=bb(ha.normalWorld.x);ra.g=bb(ha.normalWorld.y);ra.b=bb(ha.normalWorld.z);ra.updateStyleString();V.wireframe?fb(ra.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(ra.__styleString)}}function $(T,ja,na,Y,ya,xa,ha,V,Ma){b(V.opacity); d(V.blending);if(V.map||V.envMap){Na(T,ja,Y,0,1,3,ha,V,Ma);Na(ya,na,xa,1,2,3,ha,V,Ma)}else{da=T.positionScreen.x;e=T.positionScreen.y;ga=ja.positionScreen.x;Ba=ja.positionScreen.y;Ja=na.positionScreen.x;Ka=na.positionScreen.y;wa=Y.positionScreen.x;ea=Y.positionScreen.y;va=ya.positionScreen.x;Ca=ya.positionScreen.y;ka=xa.positionScreen.x;aa=xa.positionScreen.y;if(V instanceof THREE.MeshBasicMaterial){Sa(da,e,ga,Ba,Ja,Ka,wa,ea);V.wireframe?fb(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap, V.wireframeLinejoin):Pa(V.color.__styleString)}else if(V instanceof THREE.MeshLambertMaterial)if(w)if(!V.wireframe&&V.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Ga.r=la.r=pa.r=Ha.r=P.r;Ga.g=la.g=pa.g=Ha.g=P.g;Ga.b=la.b=pa.b=Ha.b=P.b;Z(Ma,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Z(Ma,ha.v2.positionWorld,ha.vertexNormalsWorld[1],la);Z(Ma,ha.v4.positionWorld,ha.vertexNormalsWorld[3],pa);Z(Ma,ha.v3.positionWorld,ha.vertexNormalsWorld[2],Ha);Xa=jb(Ga,la,pa,Ha);R(da,e,ga,Ba, wa,ea);Qa(da,e,ga,Ba,wa,ea,Xa,0,0,1,0,0,1);R(va,Ca,Ja,Ka,ka,aa);Qa(va,Ca,Ja,Ka,ka,aa,Xa,1,0,1,1,0,1)}else{y.r=P.r;y.g=P.g;y.b=P.b;Z(Ma,ha.centroidWorld,ha.normalWorld,y);ra.r=V.color.r*y.r;ra.g=V.color.g*y.g;ra.b=V.color.b*y.b;ra.updateStyleString();Sa(da,e,ga,Ba,Ja,Ka,wa,ea);V.wireframe?fb(ra.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(ra.__styleString)}else{Sa(da,e,ga,Ba,Ja,Ka,wa,ea);V.wireframe?fb(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin): Pa(V.color.__styleString)}else if(V instanceof THREE.MeshNormalMaterial){ra.r=bb(ha.normalWorld.x);ra.g=bb(ha.normalWorld.y);ra.b=bb(ha.normalWorld.z);ra.updateStyleString();Sa(da,e,ga,Ba,Ja,Ka,wa,ea);V.wireframe?fb(ra.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Pa(ra.__styleString)}else if(V instanceof THREE.MeshDepthMaterial){Ta=za.near;ab=za.far;Ga.r=Ga.g=Ga.b=1-gb(T.positionScreen.z,Ta,ab);la.r=la.g=la.b=1-gb(ja.positionScreen.z,Ta,ab);pa.r=pa.g=pa.b=1-gb(Y.positionScreen.z, Ta,ab);Ha.r=Ha.g=Ha.b=1-gb(na.positionScreen.z,Ta,ab);Xa=jb(Ga,la,pa,Ha);R(da,e,ga,Ba,wa,ea);Qa(da,e,ga,Ba,wa,ea,Xa,0,0,1,0,0,1);R(va,Ca,Ja,Ka,ka,aa);Qa(va,Ca,Ja,Ka,ka,aa,Xa,1,0,1,1,0,1)}}}function R(T,ja,na,Y,ya,xa){o.beginPath();o.moveTo(T,ja);o.lineTo(na,Y);o.lineTo(ya,xa);o.lineTo(T,ja);o.closePath()}function Sa(T,ja,na,Y,ya,xa,ha,V){o.beginPath();o.moveTo(T,ja);o.lineTo(na,Y);o.lineTo(ya,xa);o.lineTo(ha,V);o.lineTo(T,ja);o.closePath()}function fb(T,ja,na,Y){if(G!=ja)o.lineWidth=G=ja;if(U!=na)o.lineCap= U=na;if(D!=Y)o.lineJoin=D=Y;c(T);o.stroke();z.inflate(ja*2)}function Pa(T){if(I!=T)o.fillStyle=I=T;o.fill()}function Qa(T,ja,na,Y,ya,xa,ha,V,Ma,Ya,Wa,kb,Za){var hb,ib;hb=ha.width-1;ib=ha.height-1;V*=hb;Ma*=ib;Ya*=hb;Wa*=ib;kb*=hb;Za*=ib;na-=T;Y-=ja;ya-=T;xa-=ja;Ya-=V;Wa-=Ma;kb-=V;Za-=Ma;hb=Ya*Za-kb*Wa;if(hb!=0){ib=1/hb;hb=(Za*na-Wa*ya)*ib;Wa=(Za*Y-Wa*xa)*ib;na=(Ya*ya-kb*na)*ib;Y=(Ya*xa-kb*Y)*ib;T=T-hb*V-na*Ma;ja=ja-Wa*V-Y*Ma;o.save();o.transform(hb,Wa,na,Y,T,ja);o.clip();o.drawImage(ha,0,0);o.restore()}} function jb(T,ja,na,Y){var ya=~~(T.r*255),xa=~~(T.g*255);T=~~(T.b*255);var ha=~~(ja.r*255),V=~~(ja.g*255);ja=~~(ja.b*255);var Ma=~~(na.r*255),Ya=~~(na.g*255);na=~~(na.b*255);var Wa=~~(Y.r*255),kb=~~(Y.g*255);Y=~~(Y.b*255);qa[0]=ya<0?0:ya>255?255:ya;qa[1]=xa<0?0:xa>255?255:xa;qa[2]=T<0?0:T>255?255:T;qa[4]=ha<0?0:ha>255?255:ha;qa[5]=V<0?0:V>255?255:V;qa[6]=ja<0?0:ja>255?255:ja;qa[8]=Ma<0?0:Ma>255?255:Ma;qa[9]=Ya<0?0:Ya>255?255:Ya;qa[10]=na<0?0:na>255?255:na;qa[12]=Wa<0?0:Wa>255?255:Wa;qa[13]=kb<0?0: kb>255?255:kb;qa[14]=Y<0?0:Y>255?255:Y;L.putImageData(X,0,0);Fa.drawImage(E,0,0);return W}function gb(T,ja,na){T=(T-ja)/(na-ja);return T*T*(3-2*T)}function bb(T){T=(T+1)*0.5;return T<0?0:T>1?1:T}function cb(T,ja){var na=ja.x-T.x,Y=ja.y-T.y,ya=1/Math.sqrt(na*na+Y*Y);na*=ya;Y*=ya;ja.x+=na;ja.y+=Y;T.x-=na;T.y-=Y}var Oa,eb,Da,S,Ra,Va,lb,$a;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,p);f=g.projectScene(ta,za,this.sortElements);(w=ta.lights.length>0)&&db(ta);Oa=0;for(eb=f.length;Oa0){va.r+=aa.color.r*ra;va.g+=aa.color.g*ra;va.b+=aa.color.b*ra}}else if(aa instanceof THREE.PointLight){Aa.sub(aa.position,ea.centroidWorld);Aa.normalize();ra=ea.normalWorld.dot(Aa)*aa.intensity;if(ra>0){va.r+=aa.color.r*ra;va.g+=aa.color.g*ra;va.b+=aa.color.b*ra}}}}function d(wa,ea, va,Ca,ka,aa){ga=f(Ba++);ga.setAttribute("d","M "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)D.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(U){M.r=O.r;M.g=O.g;M.b=O.b;b(aa,Ca,M);D.r=ka.color.r*M.r;D.g=ka.color.g*M.g;D.b=ka.color.b*M.b;D.updateStyleString()}else D.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){ua=1-ka.__2near/(ka.__farPlusNear-Ca.z*ka.__farMinusNear);D.setRGB(ua,ua,ua)}else ka instanceof THREE.MeshNormalMaterial&&D.setRGB(g(Ca.normalWorld.x),g(Ca.normalWorld.y),g(Ca.normalWorld.z));ka.wireframe?ga.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+ka.wireframeLinewidth+"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):ga.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+ ka.opacity);k.appendChild(ga)}function c(wa,ea,va,Ca,ka,aa,ra){ga=f(Ba++);ga.setAttribute("d","M "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Ca.positionScreen.x+","+Ca.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)D.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(U){M.r=O.r;M.g=O.g;M.b=O.b;b(ra,ka,M);D.r=aa.color.r*M.r;D.g=aa.color.g* M.g;D.b=aa.color.b*M.b;D.updateStyleString()}else D.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){ua=1-aa.__2near/(aa.__farPlusNear-ka.z*aa.__farMinusNear);D.setRGB(ua,ua,ua)}else aa instanceof THREE.MeshNormalMaterial&&D.setRGB(g(ka.normalWorld.x),g(ka.normalWorld.y),g(ka.normalWorld.z));aa.wireframe?ga.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+ "; stroke-linejoin: "+aa.wireframeLinejoin):ga.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+aa.opacity);k.appendChild(ga)}function f(wa){if(da[wa]==null){da[wa]=document.createElementNS("http://www.w3.org/2000/svg","path");Ka==0&&da[wa].setAttribute("shape-rendering","crispEdges")}return da[wa]}function g(wa){return wa<0?Math.min((1+wa)*0.5,0.5):0.5+Math.min(wa*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,x,A,t, C,F,I=new THREE.Rectangle,G=new THREE.Rectangle,U=!1,D=new THREE.Color(16777215),M=new THREE.Color(16777215),O=new THREE.Color(0),Q=new THREE.Color(0),Ia=new THREE.Color(0),ua,Aa=new THREE.Vector3,da=[],e=[],ga,Ba,Ja,Ka=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(wa){switch(wa){case "high":Ka=1;break;case "low":Ka=0}};this.setSize=function(wa,ea){n=wa;p=ea;o=n/2;x=p/2;k.setAttribute("viewBox",-o+" "+-x+" "+n+" "+p);k.setAttribute("width", n);k.setAttribute("height",p);I.set(-o,-x,o,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(wa,ea){var va,Ca,ka,aa,ra,Ga,la,pa;this.autoClear&&this.clear();h=j.projectScene(wa,ea,this.sortElements);Ja=Ba=0;if(U=wa.lights.length>0){la=wa.lights;O.setRGB(0,0,0);Q.setRGB(0,0,0);Ia.setRGB(0,0,0);va=0;for(Ca=la.length;va 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(b){function d(m,B,z){var w,y,P,H=m.vertices,J=H.length,K=m.colors,E=K.length,L=m.__vertexArray,X=m.__colorArray,qa=m.__sortArray,W=m.__dirtyVertices,Fa=m.__dirtyColors;if(z.sortParticles){Ha.multiplySelf(z.matrixWorld);for(w=0;wE){L=X;E=K[L]}e.bindBuffer(e.ARRAY_BUFFER,y.__webglMorphTargetsBuffers[L]);e.vertexAttribPointer(B["morphTarget"+z],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[z]=E;J[L]=1;E=-1;z++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,P.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER, y.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(y.__webglCustomAttributes)for(H in y.__webglCustomAttributes)if(m[H]>=0){B=y.__webglCustomAttributes[H];e.bindBuffer(e.ARRAY_BUFFER,B.buffer);e.vertexAttribPointer(m[H],B.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>= 0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(y.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,y.__webglUVBuffer);e.vertexAttribPointer(m.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv)}else e.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(y.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,y.__webglUV2Buffer);e.vertexAttribPointer(m.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv2)}else e.disableVertexAttribArray(m.uv2); if(w.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight, 4,e.FLOAT,!1,0,0)}if(P instanceof THREE.Mesh)if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webglLineBuffer);e.drawElements(e.LINES,y.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webglFaceBuffer);e.drawElements(e.TRIANGLES,y.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(P instanceof THREE.Line){P=P.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(P,0,y.__webglLineCount)}else if(P instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,y.__webglParticleCount);else P instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,y.__webglVertexCount)}}function h(m,B){if(!m.__webglVertexBuffer)m.__webglVertexBuffer=e.createBuffer();if(!m.__webglNormalBuffer)m.__webglNormalBuffer=e.createBuffer();if(m.hasPos){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,m.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(B.attributes.position);e.vertexAttribPointer(B.attributes.position, 3,e.FLOAT,!1,0,0)}if(m.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,m.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(B.attributes.normal);e.vertexAttribPointer(B.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,m.count);m.count=0}function j(m){if(ea!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ea=m.doubleSided}if(va!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);va=m.flipSided}}function k(m){if(ka!= m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ka=m}}function n(m){pa[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);pa[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);pa[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);pa[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);pa[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);pa[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var B;for(m=0;m<6;m++){B=pa[m];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z* B.z))}}function p(m){for(var B=m.matrixWorld,z=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),w=0;w<6;w++){m=pa[w].x*B.n14+pa[w].y*B.n24+pa[w].z*B.n34+pa[w].w;if(m<=z)return!1}return!0}function o(m,B){m.list[m.count]=B;m.count+=1}function x(m){var B,z,w=m.object,y=m.opaque,P=m.transparent;P.count=0;m=y.count=0;for(B=w.materials.length;m0.0010&&K.scale>0.0010){qa[0]=K.x;qa[1]=K.y;qa[2]=K.z;L=K.size*K.scale/la;X[0]=L*E;X[1]=L;e.uniform3fv(za.screenPosition, qa);e.uniform1f(za.rotation,K.rotation);e.uniform2fv(za.scale,X);e.uniform1f(za.opacity,K.opacity);M(K.blending);Q(K.texture,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Ka)}function I(m,B){m._modelViewMatrix.multiplyToArray(B.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function G(m){var B,z,w,y,P;if(m instanceof THREE.Mesh){z=m.geometry; for(B in z.geometryGroups){w=z.geometryGroups[B];P=!1;for(y in w.__webglCustomAttributes)if(w.__webglCustomAttributes[y].needsUpdate){P=!0;break}if(z.__dirtyVertices||z.__dirtyMorphTargets||z.__dirtyElements||z.__dirtyUvs||z.__dirtyNormals||z.__dirtyColors||z.__dirtyTangents||P){P=e.DYNAMIC_DRAW;var H=void 0,J=void 0,K=void 0,E=void 0;K=void 0;var L=void 0,X=void 0,qa=void 0,W=void 0,Fa=void 0,La=void 0,ta=void 0,za=void 0,db=void 0,Z=void 0,fa=void 0,oa=void 0,Na=void 0;X=void 0;qa=void 0;E=void 0; W=void 0;E=void 0;Z=void 0;fa=void 0;X=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;Na=void 0;Z=void 0;fa=void 0;oa=void 0;E=void 0;W=void 0;L=void 0;K=void 0;K=void 0;var $=void 0,R=void 0,Sa=void 0,fb=void 0,Pa=0,Qa=0,jb=0,gb=0,bb=0,cb=0,Oa=0,eb=0,Da=0,S=0,Ra=0;$=0;var Va=w.__vertexArray,lb=w.__uvArray,$a=w.__uv2Array,T=w.__normalArray,ja=w.__tangentArray,na=w.__colorArray,Y=w.__skinVertexAArray,ya=w.__skinVertexBArray,xa=w.__skinIndexArray, ha=w.__skinWeightArray,V=w.__morphTargetsArrays,Ma=w.__webglCustomAttributes;R=void 0;var Ya=w.__faceArray,Wa=w.__lineArray,kb=w.__needsSmoothNormals;La=w.__vertexColorType;Fa=w.__uvType;ta=w.__normalType;var Za=m.geometry,hb=Za.__dirtyVertices,ib=Za.__dirtyElements,tb=Za.__dirtyUvs,ub=Za.__dirtyNormals,vb=Za.__dirtyTangents,wb=Za.__dirtyColors,xb=Za.__dirtyMorphTargets,pb=Za.vertices,yb=w.faces,Bb=Za.faces,zb=Za.faceVertexUvs[0],Ab=Za.faceVertexUvs[1],qb=Za.skinVerticesA,rb=Za.skinVerticesB,sb=Za.skinIndices, nb=Za.skinWeights,ob=Za.edgeFaces,mb=Za.morphTargets;if(Ma)for(fb in Ma)Ma[fb].offset=0;H=0;for(J=yb.length;H0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,P)}if(ub){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,T,P)}if(vb&&Za.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ja,P)}if(tb&& jb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,lb,P)}if(tb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,$a,P)}if(ib){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,P);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Wa,P)}if(S>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,Y,P);e.bindBuffer(e.ARRAY_BUFFER, w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ya,P);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,xa,P);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ha,P)}}}z.__dirtyVertices=!1;z.__dirtyMorphTargets=!1;z.__dirtyElements=!1;z.__dirtyUvs=!1;z.__dirtyNormals=!1;z.__dirtyTangents=!1;z.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){z=m.geometry;if(z.__dirtyVertices||z.__dirtyColors){m=z;B=e.DYNAMIC_DRAW;La=m.vertices; w=m.colors;ta=La.length;P=w.length;za=m.__vertexArray;H=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(J=0;J65535){L[K].counter+=1;E=L[K].hash+"_"+L[K].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:J,vertices:0,numMorphTargets:X})}m.geometryGroups[E].faces.push(y);m.geometryGroups[E].vertices+= H}}function D(m,B,z){m.push({buffer:B,object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(m){if(m!=Ca){switch(m){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}Ca=m}}function O(m,B,z){if((z.width&z.width-1)==0&&(z.height&z.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,da(B.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,da(B.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,da(B.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,da(B.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_MAG_FILTER, Aa(B.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,Aa(B.minFilter))}}function Q(m,B){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}O(e.TEXTURE_2D,m,m.image);e.bindTexture(e.TEXTURE_2D,null);m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+ B);e.bindTexture(e.TEXTURE_2D,m.__webglTexture)}function Ia(m){if(m&&!m.__webglFramebuffer){m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();m.__webglTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,m.width,m.height);e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,da(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,da(m.wrapT)); e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,da(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,da(m.minFilter));e.texImage2D(e.TEXTURE_2D,0,da(m.format),m.width,m.height,0,da(m.format),da(m.type),null);e.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m.__webglTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER, null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var B,z;if(m){B=m.__webglFramebuffer;z=m.width;m=m.height}else{B=null;z=Ga;m=la}if(B!=Ja){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport(aa,ra,z,m);Ja=B}}function ua(m,B){var z;if(m=="fragment")z=e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(z=e.createShader(e.VERTEX_SHADER));e.shaderSource(z,B);e.compileShader(z);if(!e.getShaderParameter(z,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(z));console.error(B);return null}return z}function Aa(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST; default:return e.LINEAR}}function da(m){switch(m){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR; case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0} var e,ga=document.createElement("canvas"),Ba=null,Ja=null,Ka=!0,wa=this,ea=null,va=null,Ca=null,ka=null,aa=0,ra=0,Ga=0,la=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ha=new THREE.Matrix4,Ta=new Float32Array(16),ab=new Float32Array(16),Xa=new THREE.Vector4,Ua={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},N=!0,ca=!0,sa=new THREE.Color(0),Ea=0;if(b){if(b.stencil!= undefined)N=b.stencil;if(b.antialias!==undefined)ca=b.antialias;b.clearColor!==undefined&&sa.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ea=b.clearAlpha}this.maxMorphTargets=8;this.domElement=ga;this.autoClear=!0;this.sortObjects=!0;(function(m,B,z,w){try{if(!(e=ga.getContext("experimental-webgl",{antialias:m,stencil:w})))throw"Error creating WebGL context.";}catch(y){console.error(y)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK); e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(B.r,B.g,B.b,z)})(ca,sa,Ea,N);this.context=e;if(N){var ia={};ia.vertices=new Float32Array(12);ia.faces=new Uint16Array(6);ia.darkness=0.5;ia.vertices[0]=-2;ia.vertices[1]=-1;ia.vertices[2]=-1;ia.vertices[3]=2;ia.vertices[4]=-1;ia.vertices[5]=-1;ia.vertices[6]=2;ia.vertices[7]=1;ia.vertices[8]=-1;ia.vertices[9]=-2;ia.vertices[10]=1;ia.vertices[11]=-1;ia.faces[0]=0;ia.faces[1]= 1;ia.faces[2]=2;ia.faces[3]=0;ia.faces[4]=2;ia.faces[5]=3;ia.vertexBuffer=e.createBuffer();ia.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ia.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ia.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ia.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia.faces,e.STATIC_DRAW);ia.program=e.createProgram();e.attachShader(ia.program,ua("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ia.program,ua("vertex",THREE.ShaderLib.shadowPost.vertexShader)); e.linkProgram(ia.program);ia.vertexLocation=e.getAttribLocation(ia.program,"position");ia.projectionLocation=e.getUniformLocation(ia.program,"projectionMatrix");ia.darknessLocation=e.getUniformLocation(ia.program,"darkness")}var ma={};ma.vertices=new Float32Array(16);ma.faces=new Uint16Array(6);ma.transparency=0.5;b=0;ma.vertices[b++]=-1;ma.vertices[b++]=-1;ma.vertices[b++]=0;ma.vertices[b++]=0;ma.vertices[b++]=1;ma.vertices[b++]=-1;ma.vertices[b++]=1;ma.vertices[b++]=0;ma.vertices[b++]=1;ma.vertices[b++]= 1;ma.vertices[b++]=1;ma.vertices[b++]=1;ma.vertices[b++]=-1;ma.vertices[b++]=1;ma.vertices[b++]=0;ma.vertices[b++]=1;b=0;ma.faces[b++]=0;ma.faces[b++]=1;ma.faces[b++]=2;ma.faces[b++]=0;ma.faces[b++]=2;ma.faces[b++]=3;ma.vertexBuffer=e.createBuffer();ma.elementBuffer=e.createBuffer();ma.tempTexture=e.createTexture();ma.readBackPixels=new Uint8Array(1024);e.bindBuffer(e.ARRAY_BUFFER,ma.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ma.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ma.elementBuffer); e.bufferData(e.ELEMENT_ARRAY_BUFFER,ma.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,ma.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);ma.program=e.createProgram();e.attachShader(ma.program,ua("fragment",THREE.ShaderLib.lensFlare.fragmentShader)); e.attachShader(ma.program,ua("vertex",THREE.ShaderLib.lensFlare.vertexShader));e.linkProgram(ma.program);ma.attributes={};ma.uniforms={};ma.attributes.vertex=e.getAttribLocation(ma.program,"position");ma.attributes.uv=e.getAttribLocation(ma.program,"UV");ma.uniforms.map=e.getUniformLocation(ma.program,"map");ma.uniforms.opacity=e.getUniformLocation(ma.program,"opacity");ma.uniforms.scale=e.getUniformLocation(ma.program,"scale");ma.uniforms.rotation=e.getUniformLocation(ma.program,"rotation");ma.uniforms.screenPosition= e.getUniformLocation(ma.program,"screenPosition");ma.uniforms.renderPink=e.getUniformLocation(ma.program,"renderPink");this.setSize=function(m,B){ga.width=m;ga.height=B;this.setViewport(0,0,ga.width,ga.height)};this.setViewport=function(m,B,z,w){aa=m;ra=B;Ga=z;la=w;e.viewport(aa,ra,Ga,la)};this.setScissor=function(m,B,z,w){e.scissor(m,B,z,w)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){Ka=m;e.depthMask(m)};this.setClearColorHex= function(m,B){var z=new THREE.Color(m);e.clearColor(z.r,z.g,z.b,B)};this.setClearColor=function(m,B){e.clearColor(m.r,m.g,m.b,B)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ia.darkness=m};this.initMaterial=function(m,B,z,w){var y,P,H,J;if(m instanceof THREE.MeshDepthMaterial)c(m,THREE.ShaderLib.depth);else if(m instanceof THREE.ShadowVolumeDynamicMaterial)c(m,THREE.ShaderLib.shadowVolumeDynamic);else if(m instanceof THREE.MeshNormalMaterial)c(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)c(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)c(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)c(m,THREE.ShaderLib.phong);else if(m instanceof THREE.LineBasicMaterial)c(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&c(m,THREE.ShaderLib.particle_basic);if(!m.program){var K,E,L;K=L=J=0;for(H=B.length;K0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+ H.maxPointLights,"#define MAX_BONES "+H.maxBones,H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"",H.skinning?"#define USE_SKINNING":"",H.morphTargets?"#define USE_MORPHTARGETS":"",H.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"); e.attachShader(B,ua("fragment",K+z));e.attachShader(B,ua("vertex",H+J));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};m.program=B;z=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in m.uniforms)z.push(y); y=m.program;J=0;for(B=z.length;J=0&&e.enableVertexAttribArray(y.color);y.normal>=0&&e.enableVertexAttribArray(y.normal); y.tangent>=0&&e.enableVertexAttribArray(y.tangent);if(m.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){e.enableVertexAttribArray(y.skinVertexA);e.enableVertexAttribArray(y.skinVertexB);e.enableVertexAttribArray(y.skinIndex);e.enableVertexAttribArray(y.skinWeight)}for(P in m.attributes)y[P]>=0&&e.enableVertexAttribArray(y[P]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(y.morphTarget0>=0){e.enableVertexAttribArray(y.morphTarget0);m.numSupportedMorphTargets++}if(y.morphTarget1>= 0){e.enableVertexAttribArray(y.morphTarget1);m.numSupportedMorphTargets++}if(y.morphTarget2>=0){e.enableVertexAttribArray(y.morphTarget2);m.numSupportedMorphTargets++}if(y.morphTarget3>=0){e.enableVertexAttribArray(y.morphTarget3);m.numSupportedMorphTargets++}if(y.morphTarget4>=0){e.enableVertexAttribArray(y.morphTarget4);m.numSupportedMorphTargets++}if(y.morphTarget5>=0){e.enableVertexAttribArray(y.morphTarget5);m.numSupportedMorphTargets++}if(y.morphTarget6>=0){e.enableVertexAttribArray(y.morphTarget6); m.numSupportedMorphTargets++}if(y.morphTarget7>=0){e.enableVertexAttribArray(y.morphTarget7);m.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);y=0;for(P=this.maxMorphTargets;y0||qa.faceVertexUvs.length>0)H.__uvArray=new Float32Array(K*2);if(qa.faceUvs.length>1||qa.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(K*2)}if(J.geometry.skinWeights.length&&J.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(K*4);H.__skinVertexBArray=new Float32Array(K*4);H.__skinIndexArray=new Float32Array(K* 4);H.__skinWeightArray=new Float32Array(K*4)}H.__faceArray=new Uint16Array(Fa*3+(J.geometry.edgeFaces?J.geometry.edgeFaces.length*6:0));H.__lineArray=new Uint16Array(La*2);if(H.numMorphTargets){H.__morphTargetsArrays=[];qa=0;for(W=H.numMorphTargets;qa=0;y--){w= z.__webglObjects[y].object;B==w&&z.__webglObjects.splice(y,1)}m.__objectsRemoved.splice(0,1)}B=0;for(z=m.__webglObjects.length;B0}}; THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType}; 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(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 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, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}", vertexShader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"}, cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t", value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i25&&(h=25);g=(h-1)*0.5;c=Array(h);for(d=f=0;dthis.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed); var c=this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;c=this.target.position;var f=this.position;c.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=f.y+100*Math.cos(this.phi);c.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.preventDefault()}, !1);this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype; THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))}; THREE.PathCamera=function(b){function d(p,o,x,A){var t={name:x,fps:0.6,length:A,hierarchy:[]},C,F=o.getControlPointsArray(),I=o.getLength(),G=F.length,U=0;C=G-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[C]={time:A,pos:F[C],rot:[0,0,0,1],scl:[1,1,1]};for(C=1;C=0?A:A+g;A=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange; this.phi=(this.phi-A[0])*(t[1]-t[0])/(A[1]-A[0])+t[0];A=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-A[0])*(t[1]-t[0])/(A[1]-A[0])+t[0];A=this.target.position;A.x=100*Math.sin(this.phi)*Math.cos(this.theta);A.y=100*Math.cos(this.phi);A.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,x)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),n=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(n,j);b.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation= d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(p,o){return function(){o.apply(p,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; var Cube=function(b,d,c,f,g,h,j,k,n){function p(I,G,U,D,M,O,Q,Ia){var ua,Aa,da=f||1,e=g||1,ga=M/2,Ba=O/2,Ja=o.vertices.length;if(I=="x"&&G=="y"||I=="y"&&G=="x")ua="z";else if(I=="x"&&G=="z"||I=="z"&&G=="x"){ua="y";e=h||1}else if(I=="z"&&G=="y"||I=="y"&&G=="z"){ua="x";da=h||1}var Ka=da+1,wa=e+1;M/=da;var ea=O/e;for(Aa=0;Aa0){j(0,0,-p-(h||0));for(f=b;f0){j(0,0,p+(g||0)); for(f=b+b/2;f<2*b;f++)k.faces.push(new THREE.Face4(2*b+1,(2*f-2*b+2)%b+b,(2*f-2*b+1)%b+b,(2*f-2*b)%b+b))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder; var Icosahedron=function(b){function d(x,A,t){var C=Math.sqrt(x*x+A*A+t*t);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(x/C,A/C,t/C)))-1}function c(x,A,t,C){C.faces.push(new THREE.Face3(x,A,t))}function f(x,A){var t=g.vertices[x].position,C=g.vertices[A].position;return d((t.x+C.x)/2,(t.y+C.y)/2,(t.z+C.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0, 1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(b=0;b0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,A)))-1);p.push(o)}d.push(p)}var t,C,F;g=d.length;for(c=0;c0)for(f=0;f1){t=this.vertices[j].position.clone(); C=this.vertices[n].position.clone();F=this.vertices[p].position.clone();t.normalize();C.normalize();F.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(C.x,C.y,C.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,x,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; var Torus=function(b,d,c,f){this.radius=b||100;this.tube=d||40;this.segmentsR=c||8;this.segmentsT=f||6;b=[];THREE.Geometry.call(this);for(d=0;d<=this.segmentsR;++d)for(c=0;c<=this.segmentsT;++c){f=c/this.segmentsT*2*Math.PI;var g=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([c/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(c= 1;c<=this.segmentsT;++c){f=(this.segmentsT+1)*d+c;g=(this.segmentsT+1)*d+c-1;var h=(this.segmentsT+1)*(d-1)+c-1,j=(this.segmentsT+1)*(d-1)+c;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; var TorusKnot=function(b,d,c,f,g,h,j){function k(x,A,t,C,F,I){A=t/C*x;t=Math.cos(A);return new THREE.Vector3(F*(2+t)*0.5*Math.cos(x),F*(2+t)*Math.sin(x)*0.5,I*F*Math.sin(A)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b>7)-127;sa|=(ia&127)<<16|Ea<<8;if(sa==0&&m==-127)return 0;return(1-2*(ma>>7))*(1+sa*Math.pow(2,-23))*Math.pow(2,m)}function k(N,ca){var sa=o(N,ca),Ea=o(N,ca+1),ia=o(N,ca+2);return(o(N,ca+3)<<24)+(ia<<16)+(Ea<<8)+sa}function n(N,ca){var sa=o(N,ca);return(o(N,ca+1)<<8)+sa}function p(N,ca){var sa=o(N,ca); return sa>127?sa-256:sa}function o(N,ca){return N.charCodeAt(ca)&255}function x(N){var ca,sa,Ea;ca=k(b,N);sa=k(b,N+Q);Ea=k(b,N+Ia);N=n(b,N+ua);THREE.BinaryLoader.prototype.f3(G,ca,sa,Ea,N)}function A(N){var ca,sa,Ea,ia,ma,m;ca=k(b,N);sa=k(b,N+Q);Ea=k(b,N+Ia);ia=n(b,N+ua);ma=k(b,N+Aa);m=k(b,N+da);N=k(b,N+e);THREE.BinaryLoader.prototype.f3n(G,M,ca,sa,Ea,ia,ma,m,N)}function t(N){var ca,sa,Ea,ia;ca=k(b,N);sa=k(b,N+ga);Ea=k(b,N+Ba);ia=k(b,N+Ja);N=n(b,N+Ka);THREE.BinaryLoader.prototype.f4(G,ca,sa,Ea,ia, N)}function C(N){var ca,sa,Ea,ia,ma,m,B,z;ca=k(b,N);sa=k(b,N+ga);Ea=k(b,N+Ba);ia=k(b,N+Ja);ma=n(b,N+Ka);m=k(b,N+wa);B=k(b,N+ea);z=k(b,N+va);N=k(b,N+Ca);THREE.BinaryLoader.prototype.f4n(G,M,ca,sa,Ea,ia,ma,m,B,z,N)}function F(N){var ca,sa;ca=k(b,N);sa=k(b,N+ka);N=k(b,N+aa);THREE.BinaryLoader.prototype.uv3(G.faceVertexUvs[0],O[ca*2],O[ca*2+1],O[sa*2],O[sa*2+1],O[N*2],O[N*2+1])}function I(N){var ca,sa,Ea;ca=k(b,N);sa=k(b,N+ra);Ea=k(b,N+Ga);N=k(b,N+la);THREE.BinaryLoader.prototype.uv4(G.faceVertexUvs[0], O[ca*2],O[ca*2+1],O[sa*2],O[sa*2+1],O[Ea*2],O[Ea*2+1],O[N*2],O[N*2+1])}var G=this,U=0,D,M=[],O=[],Q,Ia,ua,Aa,da,e,ga,Ba,Ja,Ka,wa,ea,va,Ca,ka,aa,ra,Ga,la,pa,Ha,Ta,ab,Xa,Ua;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(G,f,h);D={signature:b.substr(U,8),header_bytes:o(b,U+8),vertex_coordinate_bytes:o(b,U+9),normal_coordinate_bytes:o(b,U+10),uv_coordinate_bytes:o(b,U+11),vertex_index_bytes:o(b,U+12),normal_index_bytes:o(b,U+13),uv_index_bytes:o(b,U+14),material_index_bytes:o(b,U+15), nvertices:k(b,U+16),nnormals:k(b,U+16+4),nuvs:k(b,U+16+8),ntri_flat:k(b,U+16+12),ntri_smooth:k(b,U+16+16),ntri_flat_uv:k(b,U+16+20),ntri_smooth_uv:k(b,U+16+24),nquad_flat:k(b,U+16+28),nquad_smooth:k(b,U+16+32),nquad_flat_uv:k(b,U+16+36),nquad_smooth_uv:k(b,U+16+40)};U+=D.header_bytes;Q=D.vertex_index_bytes;Ia=D.vertex_index_bytes*2;ua=D.vertex_index_bytes*3;Aa=D.vertex_index_bytes*3+D.material_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;e=D.vertex_index_bytes* 3+D.material_index_bytes+D.normal_index_bytes*2;ga=D.vertex_index_bytes;Ba=D.vertex_index_bytes*2;Ja=D.vertex_index_bytes*3;Ka=D.vertex_index_bytes*4;wa=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;va=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;Ca=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ka=D.uv_index_bytes;aa=D.uv_index_bytes*2;ra=D.uv_index_bytes;Ga=D.uv_index_bytes*2;la=D.uv_index_bytes* 3;h=D.vertex_index_bytes*3+D.material_index_bytes;Ua=D.vertex_index_bytes*4+D.material_index_bytes;pa=D.ntri_flat*h;Ha=D.ntri_smooth*(h+D.normal_index_bytes*3);Ta=D.ntri_flat_uv*(h+D.uv_index_bytes*3);ab=D.ntri_smooth_uv*(h+D.normal_index_bytes*3+D.uv_index_bytes*3);Xa=D.nquad_flat*Ua;h=D.nquad_smooth*(Ua+D.normal_index_bytes*4);Ua=D.nquad_flat_uv*(Ua+D.uv_index_bytes*4);U+=function(N){for(var ca,sa,Ea,ia=D.vertex_coordinate_bytes*3,ma=N+D.nvertices*ia;N=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;fthis.size-1&&(n=this.size-1);var A=Math.floor(p-k);A<1&&(A=1);p=Math.floor(p+k);p>this.size-1&&(p= this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var C,F,I,G,U,D;x0&&(this.field[I+C]+=G)}}}};this.addPlaneX=function(c,f){var g,h,j,k,n,p=this.size,o=this.yd,x=this.zd,A=this.field,t=p*Math.sqrt(c/f);t>p&&(t=p);for(g=0;g0)for(h=0;ho&&(C=o);for(h=0;h0){n=h*x;for(g=0;gsize&&(dist=size);for(j=0;j0){n=zd*j;for(h=0;h