// Three.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,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var e,f,g,h,j,m;if(b==0)e=f=g=0;else{h=Math.floor(a*6);j=a*6-h;a=b*(1-c);m=b*(1-c*j);c=b*(1-c*(1-j));switch(h){case 1:e=m;f=b;g=a;break;case 2:e=a;f=b;g=c;break;case 3:e=a;f=m;g=b;break;case 4:e=c;f=a;g=b;break;case 5:e=b;f=a; g=m;break;case 6:case 0:e=b;f=c;g=a}}this.r=e;this.g=f;this.b=g;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,b){this.set(a||0,c||0,b||0)}; THREE.Vector3.prototype={set:function(a,c,b){this.x=a;this.y=c;this.z=b;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,b=this.y,e=this.z;this.set(b*a.z-e*a.y,e*a.x-c*a.z,c*a.y-b*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,b=this.y-a.y;a=this.z-a.z;return c*c+b*b+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,b,e){this.set(a||0,c||0,b||0,e||1)}; THREE.Vector4.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;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,b,e=a.objects,f=[];a=0;for(c=e.length;a0&&G>0&&N+G<1}var b,e,f,g,h,j,m,o,n,t, y,w=a.geometry,z=w.vertices,E=[];b=0;for(e=w.faces.length;bm?e:m;f=f>o?f:o}a()}; this.add3Points=function(m,o,n,t,y,w){if(j){j=!1;c=mn?m>y?m:y:n>y?n:y;f=o>t?o>w?o:w:t>w?t:w}else{c=mn?m>y?m>e?m:e:y>e?y:e:n>y?n>e?n:e:y>e?y:e;f=o>t?o>w?o>f?o:f:w>f?w:f:t>w?t>f?t:f:w>f?w:f}a()};this.addRectangle=function(m){if(j){j=!1;c=m.getLeft();b=m.getTop();e=m.getRight();f=m.getBottom()}else{c=cm.getRight()? e:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){c-=m;b-=m;e+=m;f+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();b=b>m.getTop()?b:m.getTop();e=e=0&&Math.min(f,m.getBottom())-Math.max(b,m.getTop())>=0};this.empty=function(){j=!0;f=e=b=c=0;a()};this.isEmpty=function(){return j}}; 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,b,e,f,g,h,j,m,o,n,t,y,w,z,E){this.set(a||1,c||0,b||0,e||0,f||0,g||1,h||0,j||0,m||0,o||0,n||1,t||0,y||0,w||0,z||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4.prototype={set:function(a,c,b,e,f,g,h,j,m,o,n,t,y,w,z,E){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=f;this.n22=g;this.n23=h;this.n24=j;this.n31=m;this.n32=o;this.n33=n;this.n34=t;this.n41=y;this.n42=w;this.n43=z;this.n44=E;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,b){var e=THREE.Matrix4.__v1, f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;e.cross(b,g).normalize();if(e.length()===0){g.x+=1.0E-4;e.cross(b,g).normalize()}f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,f=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23* e+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*e+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*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 b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,m=a.n23,o=a.n24,n=a.n31,t=a.n32,y=a.n33,w=a.n34,z=a.n41,E=a.n42,G=a.n43,J=a.n44,S=c.n11,D=c.n12,L=c.n13,N=c.n14,O=c.n21,Fa=c.n22, oa=c.n23,xa=c.n24,W=c.n31,d=c.n32,Z=c.n33,ya=c.n34;this.n11=b*S+e*O+f*W;this.n12=b*D+e*Fa+f*d;this.n13=b*L+e*oa+f*Z;this.n14=b*N+e*xa+f*ya+g;this.n21=h*S+j*O+m*W;this.n22=h*D+j*Fa+m*d;this.n23=h*L+j*oa+m*Z;this.n24=h*N+j*xa+m*ya+o;this.n31=n*S+t*O+y*W;this.n32=n*D+t*Fa+y*d;this.n33=n*L+t*oa+y*Z;this.n34=n*N+t*xa+y*ya+w;this.n41=z*S+E*O+G*W;this.n42=z*D+E*Fa+G*d;this.n43=z*L+E*oa+G*Z;this.n44=z*N+E*xa+G*ya+J;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);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 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,b=this.n13,e=this.n14,f=this.n21,g=this.n22,h=this.n23,j=this.n24,m=this.n31,o=this.n32,n=this.n33,t=this.n34,y=this.n41,w=this.n42,z=this.n43,E=this.n44;return e*h*o*y-b*j*o*y-e*g*n*y+c*j*n*y+b*g*t*y-c*h*t*y-e*h*m*w+b*j*m*w+e*f*n*w-a*j*n*w-b*f*t*w+a*h*t*w+e*g*m*z-c*j*m*z-e*f*o*z+a*j*o*z+c*f*t*z-a*g*t*z-b*g*m*E+c*h*m*E+b*f*o*E-a*h*o*E-c*f*n*E+a*g*n*E},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,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this}, setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,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 b=Math.cos(c),e=Math.sin(c),f=1-b,g=a.x,h=a.y,j= a.z,m=f*g,o=f*h;this.set(m*g+b,m*h-e*j,m*j+e*h,0,m*h+e*j,o*h+b,o*j-e*g,0,m*j-e*h,o*j+e*g,f*j*j+b,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,b=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(e);e=Math.sin(e);var h=a*b,j=c*b;this.n11=f*g;this.n12=-f*e;this.n13=b;this.n21=j*g+a*e;this.n22=-j*e+a*g;this.n23=-c*f;this.n31=-h*g+c*e;this.n32=h*e+c*g;this.n33=a*f;return this}, setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,f=a.w,g=c+c,h=b+b,j=e+e;a=c*g;var m=c*h;c*=j;var o=b*h;b*=j;e*=j;g*=f;h*=f;f*=j;this.n11=1-(o+e);this.n12=m-f;this.n13=c+h;this.n21=m+f;this.n22=1-(a+e);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+o);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;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 b=1/c.x,e=1/c.y,f=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}}; THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,m=a.n23,o=a.n24,n=a.n31,t=a.n32,y=a.n33,w=a.n34,z=a.n41,E=a.n42,G=a.n43,J=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*w*E-o*y*E+o*t*G-j*w*G-m*t*J+j*y*J;c.n12=g*y*E-f*w*E-g*t*G+e*w*G+f*t*J-e*y*J;c.n13=f*o*E-g*m*E+g*j*G-e*o*G-f*j*J+e*m*J;c.n14=g*m*t-f*o*t-g*j*y+e*o*y+f*j*w-e*m*w;c.n21=o*y*z-m*w*z-o*n*G+h*w*G+m*n*J-h*y*J;c.n22=f*w*z-g*y*z+g*n*G-b*w*G-f*n*J+b*y*J;c.n23=g*m*z-f*o*z-g*h*G+b*o*G+f*h*J-b*m*J; c.n24=f*o*n-g*m*n+g*h*y-b*o*y-f*h*w+b*m*w;c.n31=j*w*z-o*t*z+o*n*E-h*w*E-j*n*J+h*t*J;c.n32=g*t*z-e*w*z-g*n*E+b*w*E+e*n*J-b*t*J;c.n33=f*o*z-g*j*z+g*h*E-b*o*E-e*h*J+b*j*J;c.n34=g*j*n-e*o*n-g*h*t+b*o*t+e*h*w-b*j*w;c.n41=m*t*z-j*y*z-m*n*E+h*y*E+j*n*G-h*t*G;c.n42=e*y*z-f*t*z+f*n*E-b*y*E-e*n*G+b*t*G;c.n43=f*j*z-e*m*z-f*h*E+b*m*E+e*h*G-b*j*G;c.n44=e*m*n-f*j*n+f*h*t-b*m*t-e*h*y+b*j*y;c.multiplyScalar(1/a.determinant());return c}; THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,t=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*h+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*e;b[1]=a*f;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*m;b[6]=a*o;b[7]=a*n;b[8]=a*t;return c}; THREE.Matrix4.makeFrustum=function(a,c,b,e,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*f/(e-b);h.n23=(e+b)/(e-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,e){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,e)}; THREE.Matrix4.makeOrtho=function(a,c,b,e,f,g){var h,j,m,o;h=new THREE.Matrix4;j=c-a;m=b-e;o=g-f;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((b+e)/m);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((g+f)/o);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};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,b){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 e=this.children.length;a=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}f=Math.sin((1-e)*g)/h;e=Math.sin(e*g)/h;b.w=a.w*f+c.w*e;b.x=a.x*f+c.x*e;b.y=a.y*f+c.y*e;b.z=a.z*f+c.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,c,b,e,f,g){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,c,b,e,f,g,h){this.a=a;this.b=c;this.c=b;this.d=e;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.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,b;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,b=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,b=this.vertices.length;cthis.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;o=this.points[b[0]];n=this.points[b[1]]; t=this.points[b[2]];y=this.points[b[3]];j=h*h;m=h*j;e.x=c(o.x,n.x,t.x,y.x,h,j,m);e.y=c(o.y,n.y,t.y,y.y,h,j,m);e.z=c(o.z,n.z,t.z,y.z,h,j,m);return e};this.getControlPointsArray=function(){var w,z,E=this.points.length,G=[];for(w=0;w1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+w);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= this.getPrevKeyWith("pos",w,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",w,j.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b=== "rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}}}}if(this.JITCompile&&n[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(w=0;wa.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];m=a[b[2]];o=a[b[3]];b=f*f;h=f*b;e[0]=this.interpolate(g[0],j[0],m[0],o[0],f,b,h);e[1]=this.interpolate(g[1],j[1],m[1],o[1],f,b,h);e[2]=this.interpolate(g[2],j[2],m[2],o[2],f,b,h);return e}; THREE.Animation.prototype.interpolate=function(a,c,b,e,f,g,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[e.length-1]}; THREE.Camera=function(a,c,b,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=e||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,b){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=b.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 e=1;e=this.LODs[e].visibleAtDistance){this.LODs[e-1].object3D.visible= !1;this.LODs[e].object3D.visible=!0}else break;for(;e=0&&ra>=0&&X>=0&&qa>=0)return!0;else if(Ha<0&&ra<0||X<0&&qa<0)return!1;else{if(Ha<0)ya=Math.max(ya,Ha/(Ha-ra));else ra<0&&(Ga=Math.min(Ga,Ha/(Ha-ra)));if(X<0)ya=Math.max(ya,X/(X-qa));else qa<0&&(Ga=Math.min(Ga,X/(X-qa)));if(GaHa&&h.positionScreen.z0&&N.z<1){Sa=D[S]=D[S]||new THREE.RenderableParticle;S++;J=Sa;J.x=N.x/N.w;J.y=N.y/N.w;J.z=N.z;J.rotation=Da.rotation.z;J.scale.x=Da.scale.x*Math.abs(J.x-(N.x+Z.projectionMatrix.n11)/(N.w+Z.projectionMatrix.n14));J.scale.y=Da.scale.y*Math.abs(J.y-(N.y+Z.projectionMatrix.n22)/(N.w+Z.projectionMatrix.n24));J.materials=Da.materials;Ga.push(J)}}}}ya&&Ga.sort(c);return Ga}}; THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,f,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;e=j;f=b/2;g=e/2};this.render=function(h,j){var m,o,n,t,y,w,z,E;a=c.projectScene(h,j);m=0;for(o=a.length;m>1;Oa=pa.height>>1;aa=da.scale.x*m;Ja=da.scale.y*o;T=aa*Q;ta=Ja*Oa;x.set(P.x-T,P.y-ta,P.x+T,P.y+ta);if(k.instersects(x)){n.save();n.translate(P.x,P.y);n.rotate(-da.rotation); n.scale(aa,-Ja);n.translate(-Q,-Oa);n.drawImage(pa,0,0);n.restore()}}}else if(aa instanceof THREE.ParticleCanvasMaterial){T=da.scale.x*m;ta=da.scale.y*o;x.set(P.x-T,P.y-ta,P.x+T,P.y+ta);if(k.instersects(x)){b(aa.color.__styleString);Ja=aa.color.__styleString;if(G!=Ja)n.fillStyle=G=Ja;n.save();n.translate(P.x,P.y);n.rotate(-da.rotation);n.scale(T,ta);aa.program(n);n.restore()}}}function Qa(P,da,aa,T){a(T.opacity);c(T.blending);n.beginPath();n.moveTo(P.positionScreen.x,P.positionScreen.y);n.lineTo(da.positionScreen.x, da.positionScreen.y);n.closePath();if(T instanceof THREE.LineBasicMaterial){ma.__styleString=T.color.__styleString;P=T.linewidth;if(J!=P)n.lineWidth=J=P;P=T.linecap;if(S!=P)n.lineCap=S=P;P=T.linejoin;if(D!=P)n.lineJoin=D=P;b(ma.__styleString);n.stroke();x.inflate(T.linewidth*2)}}function Va(P,da,aa,T,ta,Ja,pa,Q,Oa){a(Q.opacity);c(Q.blending);W=P.positionScreen.x;d=P.positionScreen.y;Z=da.positionScreen.x;ya=da.positionScreen.y;Ga=aa.positionScreen.x;Ha=aa.positionScreen.y;Ma(W,d,Z,ya,Ga,Ha);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Ta=pa.uvs[0];bb(W,d,Z,ya,Ga,Ha,Q.map.image,Ta[T].u,Ta[T].v,Ta[ta].u,Ta[ta].v,Ta[Ja].u,Ta[Ja].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){P=va.matrixWorldInverse;C.copy(pa.vertexNormalsWorld[0]);M=(C.x*P.n11+C.y*P.n12+C.z*P.n13)*0.5+0.5;V=-(C.x*P.n21+C.y*P.n22+C.z*P.n23)*0.5+0.5;C.copy(pa.vertexNormalsWorld[1]);na=(C.x*P.n11+C.y*P.n12+C.z*P.n13)*0.5+0.5;Aa=-(C.x*P.n21+C.y*P.n22+ C.z*P.n23)*0.5+0.5;C.copy(pa.vertexNormalsWorld[2]);ca=(C.x*P.n11+C.y*P.n12+C.z*P.n13)*0.5+0.5;ga=-(C.x*P.n21+C.y*P.n22+C.z*P.n23)*0.5+0.5;bb(W,d,Z,ya,Ga,Ha,Q.envMap.image,M,V,na,Aa,ca,ga)}}else Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Ta=pa.uvs[0];bb(W,d,Z,ya,Ga,Ha,Q.map.image,Ta[T].u,Ta[T].v,Ta[ta].u, Ta[ta].v,Ta[Ja].u,Ta[Ja].v)}c(THREE.SubtractiveBlending)}if(p)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&pa.vertexNormalsWorld.length==3){Ca.r=fa.r=ja.r=F.r;Ca.g=fa.g=ja.g=F.g;Ca.b=fa.b=ja.b=F.b;ia(Oa,pa.v1.positionWorld,pa.vertexNormalsWorld[0],Ca);ia(Oa,pa.v2.positionWorld,pa.vertexNormalsWorld[1],fa);ia(Oa,pa.v3.positionWorld,pa.vertexNormalsWorld[2],ja);Da.r=(fa.r+ja.r)*0.5;Da.g=(fa.g+ja.g)*0.5;Da.b=(fa.b+ja.b)*0.5;Wa=$a(Ca,fa,ja,Da);bb(W,d,Z,ya,Ga,Ha,Wa,0,0,1,0,0,1)}else{B.r=F.r;B.g=F.g; B.b=F.b;ia(Oa,pa.centroidWorld,pa.normalWorld,B);ma.r=Q.color.r*B.r;ma.g=Q.color.g*B.g;ma.b=Q.color.b*B.b;ma.updateStyleString();Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}else Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=va.near;Xa=va.far;Ca.r=Ca.g=Ca.b=1-Za(P.positionScreen.z,Sa,Xa);fa.r=fa.g=fa.b=1- Za(da.positionScreen.z,Sa,Xa);ja.r=ja.g=ja.b=1-Za(aa.positionScreen.z,Sa,Xa);Da.r=(fa.r+ja.r)*0.5;Da.g=(fa.g+ja.g)*0.5;Da.b=(fa.b+ja.b)*0.5;Wa=$a(Ca,fa,ja,Da);bb(W,d,Z,ya,Ga,Ha,Wa,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=Ka(pa.normalWorld.x);ma.g=Ka(pa.normalWorld.y);ma.b=Ka(pa.normalWorld.z);ma.updateStyleString();Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}}function eb(P,da,aa,T,ta,Ja,pa,Q,Oa){a(Q.opacity); c(Q.blending);if(Q.map||Q.envMap){Va(P,da,T,0,1,3,pa,Q,Oa);Va(ta,aa,Ja,1,2,3,pa,Q,Oa)}else{W=P.positionScreen.x;d=P.positionScreen.y;Z=da.positionScreen.x;ya=da.positionScreen.y;Ga=aa.positionScreen.x;Ha=aa.positionScreen.y;ra=T.positionScreen.x;X=T.positionScreen.y;qa=ta.positionScreen.x;za=ta.positionScreen.y;ea=Ja.positionScreen.x;U=Ja.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin): cb(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(p)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&pa.vertexNormalsWorld.length==4){Ca.r=fa.r=ja.r=Da.r=F.r;Ca.g=fa.g=ja.g=Da.g=F.g;Ca.b=fa.b=ja.b=Da.b=F.b;ia(Oa,pa.v1.positionWorld,pa.vertexNormalsWorld[0],Ca);ia(Oa,pa.v2.positionWorld,pa.vertexNormalsWorld[1],fa);ia(Oa,pa.v4.positionWorld,pa.vertexNormalsWorld[3],ja);ia(Oa,pa.v3.positionWorld,pa.vertexNormalsWorld[2],Da);Wa=$a(Ca,fa,ja,Da);Ma(W,d,Z,ya,ra,X);bb(W,d,Z,ya, ra,X,Wa,0,0,1,0,0,1);Ma(qa,za,Ga,Ha,ea,U);bb(qa,za,Ga,Ha,ea,U,Wa,1,0,1,1,0,1)}else{B.r=F.r;B.g=F.g;B.b=F.b;ia(Oa,pa.centroidWorld,pa.normalWorld,B);ma.r=Q.color.r*B.r;ma.g=Q.color.g*B.g;ma.b=Q.color.b*B.b;ma.updateStyleString();La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}else{La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=Ka(pa.normalWorld.x);ma.g=Ka(pa.normalWorld.y);ma.b=Ka(pa.normalWorld.z);ma.updateStyleString();La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=va.near;Xa=va.far;Ca.r=Ca.g=Ca.b=1-Za(P.positionScreen.z,Sa,Xa);fa.r=fa.g=fa.b=1-Za(da.positionScreen.z,Sa,Xa);ja.r=ja.g=ja.b=1-Za(T.positionScreen.z,Sa,Xa);Da.r=Da.g=Da.b=1-Za(aa.positionScreen.z, Sa,Xa);Wa=$a(Ca,fa,ja,Da);Ma(W,d,Z,ya,ra,X);bb(W,d,Z,ya,ra,X,Wa,0,0,1,0,0,1);Ma(qa,za,Ga,Ha,ea,U);bb(qa,za,Ga,Ha,ea,U,Wa,1,0,1,1,0,1)}}}function Ma(P,da,aa,T,ta,Ja){n.beginPath();n.moveTo(P,da);n.lineTo(aa,T);n.lineTo(ta,Ja);n.lineTo(P,da);n.closePath()}function La(P,da,aa,T,ta,Ja,pa,Q){n.beginPath();n.moveTo(P,da);n.lineTo(aa,T);n.lineTo(ta,Ja);n.lineTo(pa,Q);n.lineTo(P,da);n.closePath()}function Pa(P,da,aa,T){if(J!=da)n.lineWidth=J=da;if(S!=aa)n.lineCap=S=aa;if(D!=T)n.lineJoin=D=T;b(P);n.stroke(); x.inflate(da*2)}function cb(P){if(G!=P)n.fillStyle=G=P;n.fill()}function bb(P,da,aa,T,ta,Ja,pa,Q,Oa,Ra,db,hb,jb){var fb,ib;fb=pa.width-1;ib=pa.height-1;Q*=fb;Oa*=ib;Ra*=fb;db*=ib;hb*=fb;jb*=ib;aa-=P;T-=da;ta-=P;Ja-=da;Ra-=Q;db-=Oa;hb-=Q;jb-=Oa;fb=Ra*jb-hb*db;if(fb!=0){ib=1/fb;fb=(jb*aa-db*ta)*ib;db=(jb*T-db*Ja)*ib;aa=(Ra*ta-hb*aa)*ib;T=(Ra*Ja-hb*T)*ib;P=P-fb*Q-aa*Oa;da=da-db*Q-T*Oa;n.save();n.transform(fb,db,aa,T,P,da);n.clip();n.drawImage(pa,0,0);n.restore()}}function $a(P,da,aa,T){var ta=~~(P.r* 255),Ja=~~(P.g*255);P=~~(P.b*255);var pa=~~(da.r*255),Q=~~(da.g*255);da=~~(da.b*255);var Oa=~~(aa.r*255),Ra=~~(aa.g*255);aa=~~(aa.b*255);var db=~~(T.r*255),hb=~~(T.g*255);T=~~(T.b*255);Y[0]=ta<0?0:ta>255?255:ta;Y[1]=Ja<0?0:Ja>255?255:Ja;Y[2]=P<0?0:P>255?255:P;Y[4]=pa<0?0:pa>255?255:pa;Y[5]=Q<0?0:Q>255?255:Q;Y[6]=da<0?0:da>255?255:da;Y[8]=Oa<0?0:Oa>255?255:Oa;Y[9]=Ra<0?0:Ra>255?255:Ra;Y[10]=aa<0?0:aa>255?255:aa;Y[12]=db<0?0:db>255?255:db;Y[13]=hb<0?0:hb>255?255:hb;Y[14]=T<0?0:T>255?255:T;I.putImageData(la, 0,0);sa.drawImage($,0,0);return ua}function Za(P,da,aa){P=(P-da)/(aa-da);return P*P*(3-2*P)}function Ka(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function Ya(P,da){var aa=da.x-P.x,T=da.y-P.y,ta=1/Math.sqrt(aa*aa+T*T);aa*=ta;T*=ta;da.x+=aa;da.y+=T;P.x-=aa;P.y-=T}var Ua,R,Ba,Na,gb,kb,ab,Ia;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,o);e=f.projectScene(ka,va,this.sortElements);(p=ka.lights.length>0)&&ha(ka);Ua=0;for(R=e.length;Ua0){qa.r+=U.color.r*ma;qa.g+=U.color.g*ma;qa.b+=U.color.b*ma}}else if(U instanceof THREE.PointLight){xa.sub(U.position,X.centroidWorld);xa.normalize();ma=X.normalWorld.dot(xa)*U.intensity;if(ma>0){qa.r+=U.color.r*ma;qa.g+=U.color.g*ma;qa.b+=U.color.b*ma}}}}function c(ra,X,qa,za,ea,U){Z=e(ya++); Z.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+X.positionScreen.x+" "+X.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(ea instanceof THREE.MeshBasicMaterial)D.__styleString=ea.color.__styleString;else if(ea instanceof THREE.MeshLambertMaterial)if(S){L.r=N.r;L.g=N.g;L.b=N.b;a(U,za,L);D.r=ea.color.r*L.r;D.g=ea.color.g*L.g;D.b=ea.color.b*L.b;D.updateStyleString()}else D.__styleString=ea.color.__styleString;else if(ea instanceof THREE.MeshDepthMaterial){oa= 1-ea.__2near/(ea.__farPlusNear-za.z*ea.__farMinusNear);D.setRGB(oa,oa,oa)}else ea instanceof THREE.MeshNormalMaterial&&D.setRGB(f(za.normalWorld.x),f(za.normalWorld.y),f(za.normalWorld.z));ea.wireframe?Z.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+ea.wireframeLinewidth+"; stroke-opacity: "+ea.opacity+"; stroke-linecap: "+ea.wireframeLinecap+"; stroke-linejoin: "+ea.wireframeLinejoin):Z.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+ea.opacity); j.appendChild(Z)}function b(ra,X,qa,za,ea,U,ma){Z=e(ya++);Z.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+X.positionScreen.x+" "+X.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+" L "+za.positionScreen.x+","+za.positionScreen.y+"z");if(U instanceof THREE.MeshBasicMaterial)D.__styleString=U.color.__styleString;else if(U instanceof THREE.MeshLambertMaterial)if(S){L.r=N.r;L.g=N.g;L.b=N.b;a(ma,ea,L);D.r=U.color.r*L.r;D.g=U.color.g*L.g;D.b=U.color.b*L.b;D.updateStyleString()}else D.__styleString= U.color.__styleString;else if(U instanceof THREE.MeshDepthMaterial){oa=1-U.__2near/(U.__farPlusNear-ea.z*U.__farMinusNear);D.setRGB(oa,oa,oa)}else U instanceof THREE.MeshNormalMaterial&&D.setRGB(f(ea.normalWorld.x),f(ea.normalWorld.y),f(ea.normalWorld.z));U.wireframe?Z.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+U.wireframeLinewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.wireframeLinecap+"; stroke-linejoin: "+U.wireframeLinejoin):Z.setAttribute("style", "fill: "+D.__styleString+"; fill-opacity: "+U.opacity);j.appendChild(Z)}function e(ra){if(W[ra]==null){W[ra]=document.createElementNS("http://www.w3.org/2000/svg","path");Ha==0&&W[ra].setAttribute("shape-rendering","crispEdges")}return W[ra]}function f(ra){return ra<0?Math.min((1+ra)*0.5,0.5):0.5+Math.min(ra*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,o,n,t,y,w,z,E,G=new THREE.Rectangle,J=new THREE.Rectangle,S=!1,D=new THREE.Color(16777215), L=new THREE.Color(16777215),N=new THREE.Color(0),O=new THREE.Color(0),Fa=new THREE.Color(0),oa,xa=new THREE.Vector3,W=[],d=[],Z,ya,Ga,Ha=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ra){switch(ra){case "high":Ha=1;break;case "low":Ha=0}};this.setSize=function(ra,X){m=ra;o=X;n=m/2;t=o/2;j.setAttribute("viewBox",-n+" "+-t+" "+m+" "+o);j.setAttribute("width",m);j.setAttribute("height",o);G.set(-n,-t,n,t)};this.clear=function(){for(;j.childNodes.length> 0;)j.removeChild(j.childNodes[0])};this.render=function(ra,X){var qa,za,ea,U,ma,Ca,fa,ja;this.autoClear&&this.clear();g=h.projectScene(ra,X,this.sortElements);Ga=ya=0;if(S=ra.lights.length>0){fa=ra.lights;N.setRGB(0,0,0);O.setRGB(0,0,0);Fa.setRGB(0,0,0);qa=0;for(za=fa.length;qa 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(k,A,x){var p,B,F,H=k.vertices,K=H.length,C=k.colors,$=C.length,I=k.__vertexArray,la=k.__colorArray,Y=k.__sortArray,ua=k.__dirtyVertices,sa=k.__dirtyColors;if(x.sortParticles){Da.multiplySelf(x.matrixWorld);for(p=0;pC){$=I;C=K[$]}d.bindBuffer(d.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[$]);d.vertexAttribPointer(A["morphTarget"+x],3,d.FLOAT,!1,0,0);F.__webglMorphTargetInfluences[x]=C;H[$]=1;C=-1;x++}}d.uniform1fv(p.program.uniforms.morphTargetInfluences,F.__webglMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER, B.__webglVertexBuffer);d.vertexAttribPointer(k.position,3,d.FLOAT,!1,0,0)}if(k.color>=0){d.bindBuffer(d.ARRAY_BUFFER,B.__webglColorBuffer);d.vertexAttribPointer(k.color,3,d.FLOAT,!1,0,0)}if(k.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,B.__webglNormalBuffer);d.vertexAttribPointer(k.normal,3,d.FLOAT,!1,0,0)}if(k.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,B.__webglTangentBuffer);d.vertexAttribPointer(k.tangent,4,d.FLOAT,!1,0,0)}if(k.uv>=0)if(B.__webglUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,B.__webglUVBuffer); d.vertexAttribPointer(k.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(k.uv)}else d.disableVertexAttribArray(k.uv);if(k.uv2>=0)if(B.__webglUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,B.__webglUV2Buffer);d.vertexAttribPointer(k.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(k.uv2)}else d.disableVertexAttribArray(k.uv2);if(p.skinning&&k.skinVertexA>=0&&k.skinVertexB>=0&&k.skinIndex>=0&&k.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,B.__webglSkinVertexABuffer);d.vertexAttribPointer(k.skinVertexA,4,d.FLOAT, !1,0,0);d.bindBuffer(d.ARRAY_BUFFER,B.__webglSkinVertexBBuffer);d.vertexAttribPointer(k.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,B.__webglSkinIndicesBuffer);d.vertexAttribPointer(k.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,B.__webglSkinWeightsBuffer);d.vertexAttribPointer(k.skinWeight,4,d.FLOAT,!1,0,0)}if(F instanceof THREE.Mesh)if(p.wireframe){d.lineWidth(p.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,B.__webglLineBuffer);d.drawElements(d.LINES,B.__webglLineCount, d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,B.__webglFaceBuffer);d.drawElements(d.TRIANGLES,B.__webglFaceCount,d.UNSIGNED_SHORT,0)}else if(F instanceof THREE.Line){F=F.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(p.linewidth);d.drawArrays(F,0,B.__webglLineCount)}else if(F instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,B.__webglParticleCount);else F instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,B.__webglVertexCount)}}function g(k,A){if(!k.__webglVertexBuffer)k.__webglVertexBuffer= d.createBuffer();if(!k.__webglNormalBuffer)k.__webglNormalBuffer=d.createBuffer();if(k.hasPos){d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,k.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(A.attributes.position);d.vertexAttribPointer(A.attributes.position,3,d.FLOAT,!1,0,0)}if(k.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,k.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,k.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(A.attributes.normal);d.vertexAttribPointer(A.attributes.normal, 3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,k.count);k.count=0}function h(k){if(X!=k.doubleSided){k.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);X=k.doubleSided}if(qa!=k.flipSided){k.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);qa=k.flipSided}}function j(k){if(ea!=k){k?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);ea=k}}function m(k){ja[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);ja[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);ja[2].set(k.n41+k.n21,k.n42+k.n22, k.n43+k.n23,k.n44+k.n24);ja[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);ja[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);ja[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);var A;for(k=0;k<6;k++){A=ja[k];A.divideScalar(Math.sqrt(A.x*A.x+A.y*A.y+A.z*A.z))}}function o(k){for(var A=k.matrixWorld,x=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),p=0;p<6;p++){k=ja[p].x*A.n14+ja[p].y*A.n24+ja[p].z*A.n34+ja[p].w;if(k<=x)return!1}return!0}function n(k, A){k.list[k.count]=A;k.count+=1}function t(k){var A,x,p=k.object,B=k.opaque,F=k.transparent;F.count=0;k=B.count=0;for(A=p.materials.length;k0.0010&&C.scale>0.0010){Y[0]=C.x;Y[1]=C.y;Y[2]=C.z;I=C.size*C.scale/fa;la[0]=I*$;la[1]=I;d.uniform3fv(va.screenPosition,Y);d.uniform1f(va.rotation,C.rotation);d.uniform2fv(va.scale,la);d.uniform1f(va.opacity,C.opacity);L(C.blending);O(C.texture,0);d.drawElements(d.TRIANGLES, 6,d.UNSIGNED_SHORT,0)}}}d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Ha)}function G(k,A){k._modelViewMatrix.multiplyToArray(A.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(k._modelViewMatrix).transposeIntoArray(k._normalMatrixArray)}function J(k){var A,x,p;if(k instanceof THREE.Mesh){x=k.geometry;for(A in x.geometryGroups){p=x.geometryGroups[A];if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors|| x.__dirtyTangents){var B=d.DYNAMIC_DRAW,F=void 0,H=void 0,K=void 0,C=void 0;K=void 0;var $=void 0,I=void 0,la=void 0,Y=void 0,ua=void 0,sa=void 0,Ea=void 0,ka=void 0,va=void 0,ha=void 0,ia=void 0,wa=void 0,Qa=void 0;I=void 0;la=void 0;C=void 0;Y=void 0;C=void 0;ha=void 0;ia=void 0;I=void 0;ha=void 0;ia=void 0;wa=void 0;Qa=void 0;ha=void 0;ia=void 0;wa=void 0;Qa=void 0;ha=void 0;ia=void 0;wa=void 0;Qa=void 0;ha=void 0;ia=void 0;wa=void 0;C=void 0;Y=void 0;$=void 0;K=void 0;K=void 0;var Va=void 0,eb= void 0,Ma=void 0,La=0,Pa=0,cb=0,bb=0,$a=0,Za=0,Ka=0,Ya=0,Ua=0,R=0,Ba=0,Na=p.__vertexArray,gb=p.__uvArray,kb=p.__uv2Array,ab=p.__normalArray,Ia=p.__tangentArray,P=p.__colorArray,da=p.__skinVertexAArray,aa=p.__skinVertexBArray,T=p.__skinIndexArray,ta=p.__skinWeightArray,Ja=p.__morphTargetsArrays,pa=p.__faceArray,Q=p.__lineArray,Oa=p.__needsSmoothNormals;sa=p.__vertexColorType;ua=p.__uvType;Ea=p.__normalType;var Ra=k.geometry,db=Ra.__dirtyVertices,hb=Ra.__dirtyElements,jb=Ra.__dirtyUvs,fb=Ra.__dirtyNormals, ib=Ra.__dirtyTangents,sb=Ra.__dirtyColors,tb=Ra.__dirtyMorphTargets,ob=Ra.vertices,ub=p.faces,xb=Ra.faces,vb=Ra.faceVertexUvs[0],wb=Ra.faceVertexUvs[1],pb=Ra.skinVerticesA,qb=Ra.skinVerticesB,rb=Ra.skinIndices,mb=Ra.skinWeights,nb=Ra.edgeFaces,lb=Ra.morphTargets;F=0;for(H=ub.length;F0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,P,B)}if(fb){d.bindBuffer(d.ARRAY_BUFFER,p.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,ab,B)}if(ib&&Ra.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,p.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,Ia,B)}if(jb&&cb>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglUVBuffer);d.bufferData(d.ARRAY_BUFFER,gb,B)}if(jb&&bb>0){d.bindBuffer(d.ARRAY_BUFFER, p.__webglUV2Buffer);d.bufferData(d.ARRAY_BUFFER,kb,B)}if(hb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,pa,B);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Q,B)}if(R>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,da,B);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,aa,B);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinIndicesBuffer); d.bufferData(d.ARRAY_BUFFER,T,B);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ta,B)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(k instanceof THREE.Ribbon){x=k.geometry;if(x.__dirtyVertices||x.__dirtyColors){k=x;A=d.DYNAMIC_DRAW;Ea=k.vertices;B=k.colors;ka=Ea.length;F=B.length;va=k.__vertexArray;H=k.__colorArray;La=k.__dirtyColors;if(k.__dirtyVertices){for(ua= 0;ua65535){I[C].counter+=1;$=I[C].hash+"_"+I[C].counter;k.geometryGroups[$]==undefined&&(k.geometryGroups[$]={faces:[],materials:K,vertices:0,numMorphTargets:la})}k.geometryGroups[$].faces.push(B);k.geometryGroups[$].vertices+=H}}function D(k,A,x){k.push({buffer:A,object:x,opaque:{list:[],count:0},transparent:{list:[], count:0}})}function L(k){if(k!=za){switch(k){case THREE.AdditiveAlphaBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD);d.blendFuncSeparate(d.SRC_ALPHA, d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}za=k}}function N(k,A,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){d.texParameteri(k,d.TEXTURE_WRAP_S,W(A.wrapS));d.texParameteri(k,d.TEXTURE_WRAP_T,W(A.wrapT));d.texParameteri(k,d.TEXTURE_MAG_FILTER,W(A.magFilter));d.texParameteri(k,d.TEXTURE_MIN_FILTER,W(A.minFilter));d.generateMipmap(k)}else{d.texParameteri(k,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(k,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(k,d.TEXTURE_MAG_FILTER,xa(A.magFilter)); d.texParameteri(k,d.TEXTURE_MIN_FILTER,xa(A.minFilter))}}function O(k,A){if(k.needsUpdate){if(k.__webglInit){d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,k.image)}else{k.__webglTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image);k.__webglInit=!0}N(d.TEXTURE_2D,k,k.image);d.bindTexture(d.TEXTURE_2D,null);k.needsUpdate=!1}d.activeTexture(d.TEXTURE0+A);d.bindTexture(d.TEXTURE_2D, k.__webglTexture)}function Fa(k){if(k&&!k.__webglFramebuffer){k.__webglFramebuffer=d.createFramebuffer();k.__webglRenderbuffer=d.createRenderbuffer();k.__webglTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,k.__webglRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,k.width,k.height);d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,W(k.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,W(k.wrapT));d.texParameteri(d.TEXTURE_2D, d.TEXTURE_MAG_FILTER,W(k.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,W(k.minFilter));d.texImage2D(d.TEXTURE_2D,0,W(k.format),k.width,k.height,0,W(k.format),W(k.type),null);d.bindFramebuffer(d.FRAMEBUFFER,k.__webglFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,k.__webglTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,k.__webglRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null); d.bindFramebuffer(d.FRAMEBUFFER,null)}var A,x;if(k){A=k.__webglFramebuffer;x=k.width;k=k.height}else{A=null;x=Ca;k=fa}if(A!=Ga){d.bindFramebuffer(d.FRAMEBUFFER,A);d.viewport(U,ma,x,k);Ga=A}}function oa(k,A){var x;if(k=="fragment")x=d.createShader(d.FRAGMENT_SHADER);else k=="vertex"&&(x=d.createShader(d.VERTEX_SHADER));d.shaderSource(x,A);d.compileShader(x);if(!d.getShaderParameter(x,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(x));console.error(A);return null}return x}function xa(k){switch(k){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST; default:return d.LINEAR}}function W(k){switch(k){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR; case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0} var d,Z=document.createElement("canvas"),ya=null,Ga=null,Ha=!0,ra=this,X=null,qa=null,za=null,ea=null,U=0,ma=0,Ca=0,fa=0,ja=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Sa=new Float32Array(16),Xa=new Float32Array(16),Wa=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},M=!0,V=!0,na=new THREE.Color(0),Aa=0;if(a){if(a.stencil!= undefined)M=a.stencil;if(a.antialias!==undefined)V=a.antialias;a.clearColor!==undefined&&na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Aa=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Z;this.autoClear=!0;this.sortObjects=!0;(function(k,A,x,p){try{if(!(d=Z.getContext("experimental-webgl",{antialias:k,stencil:p})))throw"Error creating WebGL context.";}catch(B){console.error(B)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK); d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(A.r,A.g,A.b,x)})(V,na,Aa,M);this.context=d;if(M){var ca={};ca.vertices=new Float32Array(12);ca.faces=new Uint16Array(6);ca.darkness=0.5;ca.vertices[0]=-2;ca.vertices[1]=-1;ca.vertices[2]=-1;ca.vertices[3]=2;ca.vertices[4]=-1;ca.vertices[5]=-1;ca.vertices[6]=2;ca.vertices[7]=1;ca.vertices[8]=-1;ca.vertices[9]=-2;ca.vertices[10]=1;ca.vertices[11]=-1;ca.faces[0]=0;ca.faces[1]= 1;ca.faces[2]=2;ca.faces[3]=0;ca.faces[4]=2;ca.faces[5]=3;ca.vertexBuffer=d.createBuffer();ca.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,ca.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,ca.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ca.faces,d.STATIC_DRAW);ca.program=d.createProgram();d.attachShader(ca.program,oa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(ca.program,oa("vertex",THREE.ShaderLib.shadowPost.vertexShader)); d.linkProgram(ca.program);ca.vertexLocation=d.getAttribLocation(ca.program,"position");ca.projectionLocation=d.getUniformLocation(ca.program,"projectionMatrix");ca.darknessLocation=d.getUniformLocation(ca.program,"darkness")}var ga={};ga.vertices=new Float32Array(16);ga.faces=new Uint16Array(6);ga.transparency=0.5;a=0;ga.vertices[a++]=-1;ga.vertices[a++]=-1;ga.vertices[a++]=0;ga.vertices[a++]=0;ga.vertices[a++]=1;ga.vertices[a++]=-1;ga.vertices[a++]=1;ga.vertices[a++]=0;ga.vertices[a++]=1;ga.vertices[a++]= 1;ga.vertices[a++]=1;ga.vertices[a++]=1;ga.vertices[a++]=-1;ga.vertices[a++]=1;ga.vertices[a++]=0;ga.vertices[a++]=1;a=0;ga.faces[a++]=0;ga.faces[a++]=1;ga.faces[a++]=2;ga.faces[a++]=0;ga.faces[a++]=2;ga.faces[a++]=3;ga.vertexBuffer=d.createBuffer();ga.elementBuffer=d.createBuffer();ga.tempTexture=d.createTexture();ga.readBackPixels=new Uint8Array(1024);d.bindBuffer(d.ARRAY_BUFFER,ga.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,ga.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,ga.elementBuffer); d.bufferData(d.ELEMENT_ARRAY_BUFFER,ga.faces,d.STATIC_DRAW);d.bindTexture(d.TEXTURE_2D,ga.tempTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGB,16,16,0,d.RGB,d.UNSIGNED_BYTE,null);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.NEAREST);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST);ga.program=d.createProgram();d.attachShader(ga.program,oa("fragment",THREE.ShaderLib.lensFlare.fragmentShader)); d.attachShader(ga.program,oa("vertex",THREE.ShaderLib.lensFlare.vertexShader));d.linkProgram(ga.program);ga.attributes={};ga.uniforms={};ga.attributes.vertex=d.getAttribLocation(ga.program,"position");ga.attributes.uv=d.getAttribLocation(ga.program,"UV");ga.uniforms.map=d.getUniformLocation(ga.program,"map");ga.uniforms.opacity=d.getUniformLocation(ga.program,"opacity");ga.uniforms.scale=d.getUniformLocation(ga.program,"scale");ga.uniforms.rotation=d.getUniformLocation(ga.program,"rotation");ga.uniforms.screenPosition= d.getUniformLocation(ga.program,"screenPosition");ga.uniforms.renderPink=d.getUniformLocation(ga.program,"renderPink");this.setSize=function(k,A){Z.width=k;Z.height=A;this.setViewport(0,0,Z.width,Z.height)};this.setViewport=function(k,A,x,p){U=k;ma=A;Ca=x;fa=p;d.viewport(U,ma,Ca,fa)};this.setScissor=function(k,A,x,p){d.scissor(k,A,x,p)};this.enableScissorTest=function(k){k?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(k){Ha=k;d.depthMask(k)};this.setClearColorHex= function(k,A){var x=new THREE.Color(k);d.clearColor(x.r,x.g,x.b,A)};this.setClearColor=function(k,A){d.clearColor(k.r,k.g,k.b,A)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(k){ca.darkness=k};this.initMaterial=function(k,A,x,p){var B,F,H,K;if(k instanceof THREE.MeshDepthMaterial)b(k,THREE.ShaderLib.depth);else if(k instanceof THREE.ShadowVolumeDynamicMaterial)b(k,THREE.ShaderLib.shadowVolumeDynamic);else if(k instanceof THREE.MeshNormalMaterial)b(k,THREE.ShaderLib.normal);else if(k instanceof THREE.MeshBasicMaterial)b(k,THREE.ShaderLib.basic);else if(k instanceof THREE.MeshLambertMaterial)b(k,THREE.ShaderLib.lambert);else if(k instanceof THREE.MeshPhongMaterial)b(k,THREE.ShaderLib.phong);else if(k instanceof THREE.LineBasicMaterial)b(k,THREE.ShaderLib.basic);else k instanceof THREE.ParticleBasicMaterial&&b(k,THREE.ShaderLib.particle_basic);if(!k.program){var C,$,I;C=I=K=0;for(H=A.length;C0?"#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"); d.attachShader(A,oa("fragment",C+x));d.attachShader(A,oa("vertex",H+K));d.linkProgram(A);d.getProgramParameter(A,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(A,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");A.uniforms={};A.attributes={};k.program=A;x=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in k.uniforms)x.push(B); B=k.program;K=0;for(A=x.length;K=0&&d.enableVertexAttribArray(F.color);F.normal>=0&&d.enableVertexAttribArray(F.normal); F.tangent>=0&&d.enableVertexAttribArray(F.tangent);if(k.skinning&&F.skinVertexA>=0&&F.skinVertexB>=0&&F.skinIndex>=0&&F.skinWeight>=0){d.enableVertexAttribArray(F.skinVertexA);d.enableVertexAttribArray(F.skinVertexB);d.enableVertexAttribArray(F.skinIndex);d.enableVertexAttribArray(F.skinWeight)}if(k.morphTargets){k.numSupportedMorphTargets=0;if(F.morphTarget0>=0){d.enableVertexAttribArray(F.morphTarget0);k.numSupportedMorphTargets++}if(F.morphTarget1>=0){d.enableVertexAttribArray(F.morphTarget1); k.numSupportedMorphTargets++}if(F.morphTarget2>=0){d.enableVertexAttribArray(F.morphTarget2);k.numSupportedMorphTargets++}if(F.morphTarget3>=0){d.enableVertexAttribArray(F.morphTarget3);k.numSupportedMorphTargets++}if(F.morphTarget4>=0){d.enableVertexAttribArray(F.morphTarget4);k.numSupportedMorphTargets++}if(F.morphTarget5>=0){d.enableVertexAttribArray(F.morphTarget5);k.numSupportedMorphTargets++}if(F.morphTarget6>=0){d.enableVertexAttribArray(F.morphTarget6);k.numSupportedMorphTargets++}if(F.morphTarget7>= 0){d.enableVertexAttribArray(F.morphTarget7);k.numSupportedMorphTargets++}p.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);B=0;for(F=this.maxMorphTargets;B0||Ea.faceVertexUvs.length>0)H.__uvArray=new Float32Array(C*2);if(Ea.faceUvs.length>1||Ea.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(C*2)}if(K.geometry.skinWeights.length&&K.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(C*4);H.__skinVertexBArray=new Float32Array(C*4);H.__skinIndexArray= new Float32Array(C*4);H.__skinWeightArray=new Float32Array(C*4)}H.__faceArray=new Uint16Array(Y*3+(K.geometry.edgeFaces?K.geometry.edgeFaces.length*6:0));H.__lineArray=new Uint16Array(ua*2);if(H.numMorphTargets){Ea=void 0;ka=void 0;H.__morphTargetsArrays=[];Ea=0;for(ka=H.numMorphTargets;Ea=0;B--){p=x.__webglObjects[B].object;A==p&&x.__webglObjects.splice(B,1)}k.__objectsRemoved.splice(0,1)}A=0;for(x=k.__webglObjects.length;A0}}; THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==undefined?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==undefined?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==undefined?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==undefined?b.minFilter:THREE.LinearMipMapLinearFilter;this.format=b.format!==undefined?b.format:THREE.RGBFormat;this.type=b.type!==undefined?b.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(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var e,f=b.length;for(e=0;e= 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&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=e=0;cthis.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 b=this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);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;b=this.target.position;var e=this.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()}, !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(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(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))}; THREE.PathCamera=function(a){function c(o,n,t,y){var w={name:t,fps:0.6,length:y,hierarchy:[]},z,E=n.getControlPointsArray(),G=n.getLength(),J=E.length,S=0;z=J-1;n={parent:-1,keys:[]};n.keys[0]={time:0,pos:E[0],rot:[0,0,0,1],scl:[1,1,1]};n.keys[z]={time:y,pos:E[z],rot:[0,0,0,1],scl:[1,1,1]};for(z=1;z=0?y:y+f;y=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange; this.phi=(this.phi-y[0])*(w[1]-w[0])/(y[1]-y[0])+w[0];y=this.horizontalAngleMap.srcRange;w=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(w[1]-w[0])/(y[1]-y[0])+w[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,n,t)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(m,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation= c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(o,n){return function(){n.apply(o,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(a,c,b,e,f,g,h,j,m){function o(G,J,S,D,L,N,O,Fa){var oa,xa,W=e||1,d=f||1,Z=L/2,ya=N/2,Ga=n.vertices.length;if(G=="x"&&J=="y"||G=="y"&&J=="x")oa="z";else if(G=="x"&&J=="z"||G=="z"&&J=="x"){oa="y";d=g||1}else if(G=="z"&&J=="y"||G=="y"&&J=="z"){oa="x";W=g||1}var Ha=W+1,ra=d+1;L/=W;var X=N/d;for(xa=0;xa0){h(0,0,-o-(g||0));for(e=a;e0){h(0,0,o+(f||0)); for(e=a+a/2;e<2*a;e++)j.faces.push(new THREE.Face4(2*a+1,(2*e-2*a+2)%a+a,(2*e-2*a+1)%a+a,(2*e-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder; var Icosahedron=function(a){function c(t,y,w){var z=Math.sqrt(t*t+y*y+w*w);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(t/z,y/z,w/z)))-1}function b(t,y,w,z){z.faces.push(new THREE.Face3(t,y,w))}function e(t,y){var w=f.vertices[t].position,z=f.vertices[y].position;return c((w.x+z.x)/2,(w.y+z.y)/2,(w.z+z.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0, 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,j,y)))-1);o.push(n)}c.push(o)}var w,z,E;f=c.length;for(b=0;b0)for(e=0;e1){w=this.vertices[h].position.clone(); z=this.vertices[m].position.clone();E=this.vertices[o].position.clone();w.normalize();z.normalize();E.normalize();this.faces.push(new THREE.Face3(h,m,o,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([n,t,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; var Torus=function(a,c,b,e){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b= 1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,f,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; var TorusKnot=function(a,c,b,e,f,g,h){function j(t,y,w,z,E,G){y=w/z*t;w=Math.cos(y);return new THREE.Vector3(E*(2+w)*0.5*Math.cos(t),E*(2+w)*Math.sin(t)*0.5,G*E*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a>7)-127;na|=(ca&127)<<16|Aa<<8;if(na==0&&k==-127)return 0;return(1-2*(ga>>7))*(1+na*Math.pow(2,-23))*Math.pow(2,k)}function j(M,V){var na=n(M,V),Aa=n(M,V+1),ca=n(M,V+2);return(n(M,V+3)<<24)+(ca<<16)+(Aa<<8)+na}function m(M,V){var na=n(M,V);return(n(M,V+1)<<8)+na}function o(M,V){var na=n(M,V);return na>127? na-256:na}function n(M,V){return M.charCodeAt(V)&255}function t(M){var V,na,Aa;V=j(a,M);na=j(a,M+O);Aa=j(a,M+Fa);M=m(a,M+oa);THREE.BinaryLoader.prototype.f3(J,V,na,Aa,M)}function y(M){var V,na,Aa,ca,ga,k;V=j(a,M);na=j(a,M+O);Aa=j(a,M+Fa);ca=m(a,M+oa);ga=j(a,M+xa);k=j(a,M+W);M=j(a,M+d);THREE.BinaryLoader.prototype.f3n(J,L,V,na,Aa,ca,ga,k,M)}function w(M){var V,na,Aa,ca;V=j(a,M);na=j(a,M+Z);Aa=j(a,M+ya);ca=j(a,M+Ga);M=m(a,M+Ha);THREE.BinaryLoader.prototype.f4(J,V,na,Aa,ca,M)}function z(M){var V,na, Aa,ca,ga,k,A,x;V=j(a,M);na=j(a,M+Z);Aa=j(a,M+ya);ca=j(a,M+Ga);ga=m(a,M+Ha);k=j(a,M+ra);A=j(a,M+X);x=j(a,M+qa);M=j(a,M+za);THREE.BinaryLoader.prototype.f4n(J,L,V,na,Aa,ca,ga,k,A,x,M)}function E(M){var V,na;V=j(a,M);na=j(a,M+ea);M=j(a,M+U);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],N[V*2],N[V*2+1],N[na*2],N[na*2+1],N[M*2],N[M*2+1])}function G(M){var V,na,Aa;V=j(a,M);na=j(a,M+ma);Aa=j(a,M+Ca);M=j(a,M+fa);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0],N[V*2],N[V*2+1],N[na*2],N[na*2+1],N[Aa* 2],N[Aa*2+1],N[M*2],N[M*2+1])}var J=this,S=0,D,L=[],N=[],O,Fa,oa,xa,W,d,Z,ya,Ga,Ha,ra,X,qa,za,ea,U,ma,Ca,fa,ja,Da,Sa,Xa,Wa,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(J,e,g);D={signature:a.substr(S,8),header_bytes:n(a,S+8),vertex_coordinate_bytes:n(a,S+9),normal_coordinate_bytes:n(a,S+10),uv_coordinate_bytes:n(a,S+11),vertex_index_bytes:n(a,S+12),normal_index_bytes:n(a,S+13),uv_index_bytes:n(a,S+14),material_index_bytes:n(a,S+15),nvertices:j(a,S+16),nnormals:j(a,S+16+4),nuvs:j(a, S+16+8),ntri_flat:j(a,S+16+12),ntri_smooth:j(a,S+16+16),ntri_flat_uv:j(a,S+16+20),ntri_smooth_uv:j(a,S+16+24),nquad_flat:j(a,S+16+28),nquad_smooth:j(a,S+16+32),nquad_flat_uv:j(a,S+16+36),nquad_smooth_uv:j(a,S+16+40)};S+=D.header_bytes;O=D.vertex_index_bytes;Fa=D.vertex_index_bytes*2;oa=D.vertex_index_bytes*3;xa=D.vertex_index_bytes*3+D.material_index_bytes;W=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;d=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Z= D.vertex_index_bytes;ya=D.vertex_index_bytes*2;Ga=D.vertex_index_bytes*3;Ha=D.vertex_index_bytes*4;ra=D.vertex_index_bytes*4+D.material_index_bytes;X=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;qa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;za=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ea=D.uv_index_bytes;U=D.uv_index_bytes*2;ma=D.uv_index_bytes;Ca=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;g=D.vertex_index_bytes*3+D.material_index_bytes; Ta=D.vertex_index_bytes*4+D.material_index_bytes;ja=D.ntri_flat*g;Da=D.ntri_smooth*(g+D.normal_index_bytes*3);Sa=D.ntri_flat_uv*(g+D.uv_index_bytes*3);Xa=D.ntri_smooth_uv*(g+D.normal_index_bytes*3+D.uv_index_bytes*3);Wa=D.nquad_flat*Ta;g=D.nquad_smooth*(Ta+D.normal_index_bytes*4);Ta=D.nquad_flat_uv*(Ta+D.uv_index_bytes*4);S+=function(M){for(var V,na,Aa,ca=D.vertex_coordinate_bytes*3,ga=M+D.nvertices*ca;M=this.maxCount-3&&j(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;ethis.size-1&&(m=this.size-1);var y=Math.floor(o-j);y<1&&(y=1);o=Math.floor(o+j);o>this.size-1&&(o= this.size-1);var w=Math.floor(n-j);w<1&&(w=1);j=Math.floor(n+j);j>this.size-1&&(j=this.size-1);for(var z,E,G,J,S,D;t0&&(this.field[G+z]+=J)}}}};this.addPlaneX=function(b,e){var f,g,h,j,m,o=this.size,n=this.yd,t=this.zd,y=this.field,w=o*Math.sqrt(b/e);w>o&&(w=o);for(f=0;f0)for(g=0;gn&&(z=n);for(g=0;g0){m=g*t;for(f=0;fsize&&(dist=size);for(h=0;h0){m=zd*h;for(g=0;g