// 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&&E>0&&N+E<1}var c,f,g,h,j,k,n,p,o,t, x,v=b.geometry,z=v.vertices,C=[];c=0;for(f=v.faces.length;cn?f:n;g=g>p?g:p}b()}; this.add3Points=function(n,p,o,t,x,v){if(k){k=!1;d=no?n>x?n:x:o>x?o:x;g=p>t?p>v?p:v:t>v?t:v}else{d=no?n>x?n>f?n:f:x>f?x:f:o>x?o>f?o:f:x>f?x:f;g=p>t?p>v?p>g?p:g:v>g?v:g:t>v?t>g?t:g:v>g?v: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,t,x,v,z,C){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,t||0,x||0,v||0,z||0,C||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,t,x,v,z,C){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=t;this.n41=x;this.n42=v;this.n43=z;this.n44=C;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,t=b.n32,x=b.n33,v=b.n34,z=b.n41,C=b.n42,E=b.n43,J=b.n44,U=d.n11,y=d.n12,L=d.n13,N=d.n14,P=d.n21,za=d.n22, va=d.n23,ta=d.n24,e=d.n31,fa=d.n32,ea=d.n33,Aa=d.n34;this.n11=c*U+f*P+g*e;this.n12=c*y+f*za+g*fa;this.n13=c*L+f*va+g*ea;this.n14=c*N+f*ta+g*Aa+h;this.n21=j*U+k*P+n*e;this.n22=j*y+k*za+n*fa;this.n23=j*L+k*va+n*ea;this.n24=j*N+k*ta+n*Aa+p;this.n31=o*U+t*P+x*e;this.n32=o*y+t*za+x*fa;this.n33=o*L+t*va+x*ea;this.n34=o*N+t*ta+x*Aa+v;this.n41=z*U+C*P+E*e;this.n42=z*y+C*za+E*fa;this.n43=z*L+C*va+E*ea;this.n44=z*N+C*ta+E*Aa+J;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,t=this.n34,x=this.n41,v=this.n42,z=this.n43,C=this.n44;return f*j*p*x-c*k*p*x-f*h*o*x+d*k*o*x+c*h*t*x-d*j*t*x-f*j*n*v+c*k*n*v+f*g*o*v-b*k*o*v-c*g*t*v+b*j*t*v+f*h*n*z-d*k*n*z-f*g*p*z+b*k*p*z+d*g*t*z-b*h*t*z-c*h*n*C+d*j*n*C+c*g*p*C-b*j*p*C-d*g*o*C+b*h*o*C},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,t=b.n32,x=b.n33,v=b.n34,z=b.n41,C=b.n42,E=b.n43,J=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=n*v*C-p*x*C+p*t*E-k*v*E-n*t*J+k*x*J;d.n12=h*x*C-g*v*C-h*t*E+f*v*E+g*t*J-f*x*J;d.n13=g*p*C-h*n*C+h*k*E-f*p*E-g*k*J+f*n*J;d.n14=h*n*t-g*p*t-h*k*x+f*p*x+g*k*v-f*n*v;d.n21=p*x*z-n*v*z-p*o*E+j*v*E+n*o*J-j*x*J;d.n22=g*v*z-h*x*z+h*o*E-c*v*E-g*o*J+c*x*J;d.n23=h*n*z-g*p*z-h*j*E+c*p*E+g*j*J-c*n*J; d.n24=g*p*o-h*n*o+h*j*x-c*p*x-g*j*v+c*n*v;d.n31=k*v*z-p*t*z+p*o*C-j*v*C-k*o*J+j*t*J;d.n32=h*t*z-f*v*z-h*o*C+c*v*C+f*o*J-c*t*J;d.n33=g*p*z-h*k*z+h*j*C-c*p*C-f*j*J+c*k*J;d.n34=h*k*o-f*p*o-h*j*t+c*p*t+f*j*v-c*k*v;d.n41=n*t*z-k*x*z-n*o*C+j*x*C+k*o*E-j*t*E;d.n42=f*x*z-g*t*z+g*o*C-c*x*C-f*o*E+c*t*E;d.n43=g*k*z-f*n*z-g*j*C+c*n*C+f*j*E-c*k*E;d.n44=f*n*o-g*k*o+g*j*t-c*n*t-f*j*x+c*k*x;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,t=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*t;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]]; t=this.points[c[2]];x=this.points[c[3]];k=j*j;n=j*k;f.x=d(p.x,o.x,t.x,x.x,j,k,n);f.y=d(p.y,o.y,t.y,x.y,j,k,n);f.z=d(p.z,o.z,t.z,x.z,j,k,n);return f};this.getControlPointsArray=function(){var v,z,C=this.points.length,E=[];for(v=0;v1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v);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",v,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",v,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(v=0;vb.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&&ua>=0&&ca>=0&&sa>=0)return!0;else if(Ia<0&&ua<0||ca<0&&sa<0)return!1;else{if(Ia<0)Aa=Math.max(Aa,Ia/(Ia-ua));else ua<0&&(Ha=Math.min(Ha,Ia/(Ia-ua)));if(ca<0)Aa=Math.max(Aa,ca/(ca-sa));else sa<0&&(Ha=Math.min(Ha,ca/(ca-sa)));if(HaIa&&j.positionScreen.z0&&N.z<1){Ra=y[U]=y[U]||new THREE.RenderableParticle;U++;J=Ra;J.x=N.x/N.w;J.y=N.y/N.w;J.z=N.z;J.rotation=Ga.rotation.z;J.scale.x=Ga.scale.x*Math.abs(J.x-(N.x+ea.projectionMatrix.n11)/(N.w+ea.projectionMatrix.n14));J.scale.y=Ga.scale.y*Math.abs(J.y-(N.y+ea.projectionMatrix.n22)/(N.w+ea.projectionMatrix.n24));J.materials=Ga.materials;Ha.push(J)}}}}Aa&&Ha.sort(d);return Ha}}; 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,t,x,v,z,C;b=d.projectScene(j,k);n=0;for(p=b.length;n>1;Ka=ga.height>>1;ma=ia.scale.x*n;wa=ia.scale.y*p;W=ma*V;xa=wa*Ka;w.set(S.x-W,S.y-xa,S.x+W,S.y+xa);if(m.instersects(w)){o.save();o.translate(S.x,S.y);o.rotate(-ia.rotation);o.scale(ma, -wa);o.translate(-V,-Ka);o.drawImage(ga,0,0);o.restore()}}}else if(ma instanceof THREE.ParticleCanvasMaterial){W=ia.scale.x*n;xa=ia.scale.y*p;w.set(S.x-W,S.y-xa,S.x+W,S.y+xa);if(m.instersects(w)){c(ma.color.__styleString);wa=ma.color.__styleString;if(E!=wa)o.fillStyle=E=wa;o.save();o.translate(S.x,S.y);o.rotate(-ia.rotation);o.scale(W,xa);ma.program(o);o.restore()}}}function na(S,ia,ma,W){b(W.opacity);d(W.blending);o.beginPath();o.moveTo(S.positionScreen.x,S.positionScreen.y);o.lineTo(ia.positionScreen.x, ia.positionScreen.y);o.closePath();if(W instanceof THREE.LineBasicMaterial){pa.__styleString=W.color.__styleString;S=W.linewidth;if(J!=S)o.lineWidth=J=S;S=W.linecap;if(U!=S)o.lineCap=U=S;S=W.linejoin;if(y!=S)o.lineJoin=y=S;c(pa.__styleString);o.stroke();w.inflate(W.linewidth*2)}}function La(S,ia,ma,W,xa,wa,ga,V,Ka){b(V.opacity);d(V.blending);e=S.positionScreen.x;fa=S.positionScreen.y;ea=ia.positionScreen.x;Aa=ia.positionScreen.y;Ha=ma.positionScreen.x;Ia=ma.positionScreen.y;Q(e,fa,ea,Aa,Ha,Ia);if(V instanceof THREE.MeshBasicMaterial)if(V.map){if(V.map.mapping instanceof THREE.UVMapping){Sa=ga.uvs[0];Oa(e,fa,ea,Aa,Ha,Ia,V.map.image,Sa[W].u,Sa[W].v,Sa[xa].u,Sa[xa].v,Sa[wa].u,Sa[wa].v)}}else if(V.envMap){if(V.envMap.mapping instanceof THREE.SphericalReflectionMapping){S=ya.matrixWorldInverse;F.copy(ga.vertexNormalsWorld[0]);O=(F.x*S.n11+F.y*S.n12+F.z*S.n13)*0.5+0.5;aa=-(F.x*S.n21+F.y*S.n22+F.z*S.n23)*0.5+0.5;F.copy(ga.vertexNormalsWorld[1]);qa=(F.x*S.n11+F.y*S.n12+F.z*S.n13)*0.5+0.5;Da=-(F.x*S.n21+F.y*S.n22+ F.z*S.n23)*0.5+0.5;F.copy(ga.vertexNormalsWorld[2]);ha=(F.x*S.n11+F.y*S.n12+F.z*S.n13)*0.5+0.5;la=-(F.x*S.n21+F.y*S.n22+F.z*S.n23)*0.5+0.5;Oa(e,fa,ea,Aa,Ha,Ia,V.envMap.image,O,aa,qa,Da,ha,la)}}else V.wireframe?db(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Na(V.color.__styleString);else if(V instanceof THREE.MeshLambertMaterial){if(V.map&&!V.wireframe){if(V.map.mapping instanceof THREE.UVMapping){Sa=ga.uvs[0];Oa(e,fa,ea,Aa,Ha,Ia,V.map.image,Sa[W].u,Sa[W].v,Sa[xa].u, Sa[xa].v,Sa[wa].u,Sa[wa].v)}d(THREE.SubtractiveBlending)}if(u)if(!V.wireframe&&V.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==3){Fa.r=ka.r=oa.r=M.r;Fa.g=ka.g=oa.g=M.g;Fa.b=ka.b=oa.b=M.b;Y(Ka,ga.v1.positionWorld,ga.vertexNormalsWorld[0],Fa);Y(Ka,ga.v2.positionWorld,ga.vertexNormalsWorld[1],ka);Y(Ka,ga.v3.positionWorld,ga.vertexNormalsWorld[2],oa);Ga.r=(ka.r+oa.r)*0.5;Ga.g=(ka.g+oa.g)*0.5;Ga.b=(ka.b+oa.b)*0.5;Va=hb(Fa,ka,oa,Ga);Oa(e,fa,ea,Aa,Ha,Ia,Va,0,0,1,0,0,1)}else{A.r=M.r;A.g=M.g; A.b=M.b;Y(Ka,ga.centroidWorld,ga.normalWorld,A);pa.r=V.color.r*A.r;pa.g=V.color.g*A.g;pa.b=V.color.b*A.b;pa.updateStyleString();V.wireframe?db(pa.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Na(pa.__styleString)}else V.wireframe?db(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Na(V.color.__styleString)}else if(V instanceof THREE.MeshDepthMaterial){Ra=ya.near;Za=ya.far;Fa.r=Fa.g=Fa.b=1-eb(S.positionScreen.z,Ra,Za);ka.r=ka.g=ka.b=1- eb(ia.positionScreen.z,Ra,Za);oa.r=oa.g=oa.b=1-eb(ma.positionScreen.z,Ra,Za);Ga.r=(ka.r+oa.r)*0.5;Ga.g=(ka.g+oa.g)*0.5;Ga.b=(ka.b+oa.b)*0.5;Va=hb(Fa,ka,oa,Ga);Oa(e,fa,ea,Aa,Ha,Ia,Va,0,0,1,0,0,1)}else if(V instanceof THREE.MeshNormalMaterial){pa.r=$a(ga.normalWorld.x);pa.g=$a(ga.normalWorld.y);pa.b=$a(ga.normalWorld.z);pa.updateStyleString();V.wireframe?db(pa.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Na(pa.__styleString)}}function Z(S,ia,ma,W,xa,wa,ga,V,Ka){b(V.opacity); d(V.blending);if(V.map||V.envMap){La(S,ia,W,0,1,3,ga,V,Ka);La(xa,ma,wa,1,2,3,ga,V,Ka)}else{e=S.positionScreen.x;fa=S.positionScreen.y;ea=ia.positionScreen.x;Aa=ia.positionScreen.y;Ha=ma.positionScreen.x;Ia=ma.positionScreen.y;ua=W.positionScreen.x;ca=W.positionScreen.y;sa=xa.positionScreen.x;Ba=xa.positionScreen.y;ja=wa.positionScreen.x;$=wa.positionScreen.y;if(V instanceof THREE.MeshBasicMaterial){Qa(e,fa,ea,Aa,Ha,Ia,ua,ca);V.wireframe?db(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap, V.wireframeLinejoin):Na(V.color.__styleString)}else if(V instanceof THREE.MeshLambertMaterial)if(u)if(!V.wireframe&&V.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==4){Fa.r=ka.r=oa.r=Ga.r=M.r;Fa.g=ka.g=oa.g=Ga.g=M.g;Fa.b=ka.b=oa.b=Ga.b=M.b;Y(Ka,ga.v1.positionWorld,ga.vertexNormalsWorld[0],Fa);Y(Ka,ga.v2.positionWorld,ga.vertexNormalsWorld[1],ka);Y(Ka,ga.v4.positionWorld,ga.vertexNormalsWorld[3],oa);Y(Ka,ga.v3.positionWorld,ga.vertexNormalsWorld[2],Ga);Va=hb(Fa,ka,oa,Ga);Q(e,fa,ea,Aa, ua,ca);Oa(e,fa,ea,Aa,ua,ca,Va,0,0,1,0,0,1);Q(sa,Ba,Ha,Ia,ja,$);Oa(sa,Ba,Ha,Ia,ja,$,Va,1,0,1,1,0,1)}else{A.r=M.r;A.g=M.g;A.b=M.b;Y(Ka,ga.centroidWorld,ga.normalWorld,A);pa.r=V.color.r*A.r;pa.g=V.color.g*A.g;pa.b=V.color.b*A.b;pa.updateStyleString();Qa(e,fa,ea,Aa,Ha,Ia,ua,ca);V.wireframe?db(pa.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Na(pa.__styleString)}else{Qa(e,fa,ea,Aa,Ha,Ia,ua,ca);V.wireframe?db(V.color.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin): Na(V.color.__styleString)}else if(V instanceof THREE.MeshNormalMaterial){pa.r=$a(ga.normalWorld.x);pa.g=$a(ga.normalWorld.y);pa.b=$a(ga.normalWorld.z);pa.updateStyleString();Qa(e,fa,ea,Aa,Ha,Ia,ua,ca);V.wireframe?db(pa.__styleString,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Na(pa.__styleString)}else if(V instanceof THREE.MeshDepthMaterial){Ra=ya.near;Za=ya.far;Fa.r=Fa.g=Fa.b=1-eb(S.positionScreen.z,Ra,Za);ka.r=ka.g=ka.b=1-eb(ia.positionScreen.z,Ra,Za);oa.r=oa.g=oa.b=1-eb(W.positionScreen.z, Ra,Za);Ga.r=Ga.g=Ga.b=1-eb(ma.positionScreen.z,Ra,Za);Va=hb(Fa,ka,oa,Ga);Q(e,fa,ea,Aa,ua,ca);Oa(e,fa,ea,Aa,ua,ca,Va,0,0,1,0,0,1);Q(sa,Ba,Ha,Ia,ja,$);Oa(sa,Ba,Ha,Ia,ja,$,Va,1,0,1,1,0,1)}}}function Q(S,ia,ma,W,xa,wa){o.beginPath();o.moveTo(S,ia);o.lineTo(ma,W);o.lineTo(xa,wa);o.lineTo(S,ia);o.closePath()}function Qa(S,ia,ma,W,xa,wa,ga,V){o.beginPath();o.moveTo(S,ia);o.lineTo(ma,W);o.lineTo(xa,wa);o.lineTo(ga,V);o.lineTo(S,ia);o.closePath()}function db(S,ia,ma,W){if(J!=ia)o.lineWidth=J=ia;if(U!=ma)o.lineCap= U=ma;if(y!=W)o.lineJoin=y=W;c(S);o.stroke();w.inflate(ia*2)}function Na(S){if(E!=S)o.fillStyle=E=S;o.fill()}function Oa(S,ia,ma,W,xa,wa,ga,V,Ka,Wa,Ua,ib,Xa){var fb,gb;fb=ga.width-1;gb=ga.height-1;V*=fb;Ka*=gb;Wa*=fb;Ua*=gb;ib*=fb;Xa*=gb;ma-=S;W-=ia;xa-=S;wa-=ia;Wa-=V;Ua-=Ka;ib-=V;Xa-=Ka;fb=Wa*Xa-ib*Ua;if(fb!=0){gb=1/fb;fb=(Xa*ma-Ua*xa)*gb;Ua=(Xa*W-Ua*wa)*gb;ma=(Wa*xa-ib*ma)*gb;W=(Wa*wa-ib*W)*gb;S=S-fb*V-ma*Ka;ia=ia-Ua*V-W*Ka;o.save();o.transform(fb,Ua,ma,W,S,ia);o.clip();o.drawImage(ga,0,0);o.restore()}} function hb(S,ia,ma,W){var xa=~~(S.r*255),wa=~~(S.g*255);S=~~(S.b*255);var ga=~~(ia.r*255),V=~~(ia.g*255);ia=~~(ia.b*255);var Ka=~~(ma.r*255),Wa=~~(ma.g*255);ma=~~(ma.b*255);var Ua=~~(W.r*255),ib=~~(W.g*255);W=~~(W.b*255);X[0]=xa<0?0:xa>255?255:xa;X[1]=wa<0?0:wa>255?255:wa;X[2]=S<0?0:S>255?255:S;X[4]=ga<0?0:ga>255?255:ga;X[5]=V<0?0:V>255?255:V;X[6]=ia<0?0:ia>255?255:ia;X[8]=Ka<0?0:Ka>255?255:Ka;X[9]=Wa<0?0:Wa>255?255:Wa;X[10]=ma<0?0:ma>255?255:ma;X[12]=Ua<0?0:Ua>255?255:Ua;X[13]=ib<0?0:ib>255?255: ib;X[14]=W<0?0:W>255?255:W;H.putImageData(K,0,0);Ea.drawImage(D,0,0);return T}function eb(S,ia,ma){S=(S-ia)/(ma-ia);return S*S*(3-2*S)}function $a(S){S=(S+1)*0.5;return S<0?0:S>1?1:S}function ab(S,ia){var ma=ia.x-S.x,W=ia.y-S.y,xa=1/Math.sqrt(ma*ma+W*W);ma*=xa;W*=xa;ia.x+=ma;ia.y+=W;S.x-=ma;S.y-=W}var Ma,cb,Ca,R,Pa,Ta,jb,Ya;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,p);f=g.projectScene(ra,ya,this.sortElements);(u=ra.lights.length>0)&&bb(ra);Ma=0;for(cb=f.length;Ma0){sa.r+=$.color.r*pa;sa.g+=$.color.g*pa;sa.b+=$.color.b*pa}}else if($ instanceof THREE.PointLight){ta.sub($.position,ca.centroidWorld);ta.normalize();pa=ca.normalWorld.dot(ta)*$.intensity;if(pa>0){sa.r+=$.color.r*pa;sa.g+=$.color.g*pa;sa.b+=$.color.b*pa}}}}function d(ua,ca,sa,Ba,ja,$){ea= f(Aa++);ea.setAttribute("d","M "+ua.positionScreen.x+" "+ua.positionScreen.y+" L "+ca.positionScreen.x+" "+ca.positionScreen.y+" L "+sa.positionScreen.x+","+sa.positionScreen.y+"z");if(ja instanceof THREE.MeshBasicMaterial)y.__styleString=ja.color.__styleString;else if(ja instanceof THREE.MeshLambertMaterial)if(U){L.r=N.r;L.g=N.g;L.b=N.b;b($,Ba,L);y.r=ja.color.r*L.r;y.g=ja.color.g*L.g;y.b=ja.color.b*L.b;y.updateStyleString()}else y.__styleString=ja.color.__styleString;else if(ja instanceof THREE.MeshDepthMaterial){va= 1-ja.__2near/(ja.__farPlusNear-Ba.z*ja.__farMinusNear);y.setRGB(va,va,va)}else ja instanceof THREE.MeshNormalMaterial&&y.setRGB(g(Ba.normalWorld.x),g(Ba.normalWorld.y),g(Ba.normalWorld.z));ja.wireframe?ea.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+ja.wireframeLinewidth+"; stroke-opacity: "+ja.opacity+"; stroke-linecap: "+ja.wireframeLinecap+"; stroke-linejoin: "+ja.wireframeLinejoin):ea.setAttribute("style","fill: "+y.__styleString+"; fill-opacity: "+ja.opacity); k.appendChild(ea)}function c(ua,ca,sa,Ba,ja,$,pa){ea=f(Aa++);ea.setAttribute("d","M "+ua.positionScreen.x+" "+ua.positionScreen.y+" L "+ca.positionScreen.x+" "+ca.positionScreen.y+" L "+sa.positionScreen.x+","+sa.positionScreen.y+" L "+Ba.positionScreen.x+","+Ba.positionScreen.y+"z");if($ instanceof THREE.MeshBasicMaterial)y.__styleString=$.color.__styleString;else if($ instanceof THREE.MeshLambertMaterial)if(U){L.r=N.r;L.g=N.g;L.b=N.b;b(pa,ja,L);y.r=$.color.r*L.r;y.g=$.color.g*L.g;y.b=$.color.b* L.b;y.updateStyleString()}else y.__styleString=$.color.__styleString;else if($ instanceof THREE.MeshDepthMaterial){va=1-$.__2near/($.__farPlusNear-ja.z*$.__farMinusNear);y.setRGB(va,va,va)}else $ instanceof THREE.MeshNormalMaterial&&y.setRGB(g(ja.normalWorld.x),g(ja.normalWorld.y),g(ja.normalWorld.z));$.wireframe?ea.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+$.wireframeLinewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.wireframeLinecap+"; stroke-linejoin: "+ $.wireframeLinejoin):ea.setAttribute("style","fill: "+y.__styleString+"; fill-opacity: "+$.opacity);k.appendChild(ea)}function f(ua){if(e[ua]==null){e[ua]=document.createElementNS("http://www.w3.org/2000/svg","path");Ia==0&&e[ua].setAttribute("shape-rendering","crispEdges")}return e[ua]}function g(ua){return ua<0?Math.min((1+ua)*0.5,0.5):0.5+Math.min(ua*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,t,x,v,z,C,E=new THREE.Rectangle,J= new THREE.Rectangle,U=!1,y=new THREE.Color(16777215),L=new THREE.Color(16777215),N=new THREE.Color(0),P=new THREE.Color(0),za=new THREE.Color(0),va,ta=new THREE.Vector3,e=[],fa=[],ea,Aa,Ha,Ia=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ua){switch(ua){case "high":Ia=1;break;case "low":Ia=0}};this.setSize=function(ua,ca){n=ua;p=ca;o=n/2;t=p/2;k.setAttribute("viewBox",-o+" "+-t+" "+n+" "+p);k.setAttribute("width",n);k.setAttribute("height", p);E.set(-o,-t,o,t)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(ua,ca){var sa,Ba,ja,$,pa,Fa,ka,oa;this.autoClear&&this.clear();h=j.projectScene(ua,ca,this.sortElements);Ha=Aa=0;if(U=ua.lights.length>0){ka=ua.lights;N.setRGB(0,0,0);P.setRGB(0,0,0);za.setRGB(0,0,0);sa=0;for(Ba=ka.length;sa 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,w){var u,A,M,G=m.vertices,I=G.length,F=m.colors,D=F.length,H=m.__vertexArray,K=m.__colorArray,X=m.__sortArray,T=m.__dirtyVertices,Ea=m.__dirtyColors;if(w.sortParticles){Ga.multiplySelf(w.matrixWorld);for(u=0;uD){H=K;D=F[H]}e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[H]);e.vertexAttribPointer(B["morphTarget"+w],3,e.FLOAT,!1,0,0);M.__webglMorphTargetInfluences[w]=D;I[H]=1;D=-1;w++}}e.uniform1fv(u.program.uniforms.morphTargetInfluences,M.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,A.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(A.__webglCustomAttributes)for(G in A.__webglCustomAttributes)if(m[G]>= 0){B=A.__webglCustomAttributes[G];e.bindBuffer(e.ARRAY_BUFFER,B.buffer);e.vertexAttribPointer(m[G],B.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(A.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER, A.__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(A.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,A.__webglUV2Buffer);e.vertexAttribPointer(m.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv2)}else e.disableVertexAttribArray(m.uv2);if(u.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA, 4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight,4,e.FLOAT,!1,0,0)}if(M instanceof THREE.Mesh)if(u.wireframe){e.lineWidth(u.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webglLineBuffer);e.drawElements(e.LINES, A.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webglFaceBuffer);e.drawElements(e.TRIANGLES,A.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(M instanceof THREE.Line){M=M.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(u.linewidth);e.drawArrays(M,0,A.__webglLineCount)}else if(M instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,A.__webglParticleCount);else M instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,A.__webglVertexCount)}}function g(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 h(m){if(ca!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ca=m.doubleSided}if(sa!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);sa=m.flipSided}}function j(m){if(ja!=m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ja=m}}function k(m){oa[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);oa[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);oa[2].set(m.n41+m.n21,m.n42+m.n22, m.n43+m.n23,m.n44+m.n24);oa[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);oa[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);oa[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=oa[m];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}}function n(m){for(var B=m.matrixWorld,w=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),u=0;u<6;u++){m=oa[u].x*B.n14+oa[u].y*B.n24+oa[u].z*B.n34+oa[u].w;if(m<=w)return!1}return!0}function p(m, B){m.list[m.count]=B;m.count+=1}function o(m){var B,w,u=m.object,A=m.opaque,M=m.transparent;M.count=0;m=A.count=0;for(B=u.materials.length;m0.0010&&F.scale>0.0010){X[0]=F.x;X[1]=F.y;X[2]=F.z;H=F.size*F.scale/ka;K[0]=H*D;K[1]=H;e.uniform3fv(ya.screenPosition,X);e.uniform1f(ya.rotation,F.rotation);e.uniform2fv(ya.scale,K);e.uniform1f(ya.opacity,F.opacity);y(F.blending);N(F.texture,0);e.drawElements(e.TRIANGLES, 6,e.UNSIGNED_SHORT,0)}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Ia)}function C(m,B){m._modelViewMatrix.multiplyToArray(B.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function E(m){var B,w,u,A,M;if(m instanceof THREE.Mesh){w=m.geometry;for(B in w.geometryGroups){u=w.geometryGroups[B];M=!1;for(A in u.__webglCustomAttributes)if(u.__webglCustomAttributes[A].needsUpdate){M=!0;break}if(w.__dirtyVertices|| w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents||M){M=e.DYNAMIC_DRAW;var G=void 0,I=void 0,F=void 0,D=void 0;F=void 0;var H=void 0,K=void 0,X=void 0,T=void 0,Ea=void 0,Ja=void 0,ra=void 0,ya=void 0,bb=void 0,Y=void 0,da=void 0,na=void 0,La=void 0;K=void 0;X=void 0;D=void 0;T=void 0;D=void 0;Y=void 0;da=void 0;K=void 0;Y=void 0;da=void 0;na=void 0;La=void 0;Y=void 0;da=void 0;na=void 0;La=void 0;Y=void 0;da=void 0;na=void 0;La=void 0;Y=void 0; da=void 0;na=void 0;D=void 0;T=void 0;H=void 0;F=void 0;F=void 0;var Z=void 0,Q=void 0,Qa=void 0,db=void 0,Na=0,Oa=0,hb=0,eb=0,$a=0,ab=0,Ma=0,cb=0,Ca=0,R=0,Pa=0;Z=0;var Ta=u.__vertexArray,jb=u.__uvArray,Ya=u.__uv2Array,S=u.__normalArray,ia=u.__tangentArray,ma=u.__colorArray,W=u.__skinVertexAArray,xa=u.__skinVertexBArray,wa=u.__skinIndexArray,ga=u.__skinWeightArray,V=u.__morphTargetsArrays,Ka=u.__webglCustomAttributes;Q=void 0;var Wa=u.__faceArray,Ua=u.__lineArray,ib=u.__needsSmoothNormals;Ja=u.__vertexColorType; Ea=u.__uvType;ra=u.__normalType;var Xa=m.geometry,fb=Xa.__dirtyVertices,gb=Xa.__dirtyElements,rb=Xa.__dirtyUvs,sb=Xa.__dirtyNormals,tb=Xa.__dirtyTangents,ub=Xa.__dirtyColors,vb=Xa.__dirtyMorphTargets,nb=Xa.vertices,wb=u.faces,zb=Xa.faces,xb=Xa.faceVertexUvs[0],yb=Xa.faceVertexUvs[1],ob=Xa.skinVerticesA,pb=Xa.skinVerticesB,qb=Xa.skinIndices,lb=Xa.skinWeights,mb=Xa.edgeFaces,kb=Xa.morphTargets;if(Ka)for(db in Ka)Ka[db].offset=0;G=0;for(I=wb.length;G0){e.bindBuffer(e.ARRAY_BUFFER,u.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ma,M)}if(sb){e.bindBuffer(e.ARRAY_BUFFER,u.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,S,M)}if(tb&&Xa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,u.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ia,M)}if(rb&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,u.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,jb,M)}if(rb&&eb>0){e.bindBuffer(e.ARRAY_BUFFER, u.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Ya,M)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Wa,M);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ua,M)}if(R>0){e.bindBuffer(e.ARRAY_BUFFER,u.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,W,M);e.bindBuffer(e.ARRAY_BUFFER,u.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,xa,M);e.bindBuffer(e.ARRAY_BUFFER,u.__webglSkinIndicesBuffer); e.bufferData(e.ARRAY_BUFFER,wa,M);e.bindBuffer(e.ARRAY_BUFFER,u.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ga,M)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){w=m.geometry;if(w.__dirtyVertices||w.__dirtyColors){m=w;B=e.DYNAMIC_DRAW;Ja=m.vertices;u=m.colors;ra=Ja.length;M=u.length;ya=m.__vertexArray;G=m.__colorArray;bb=m.__dirtyColors;if(m.__dirtyVertices){for(I= 0;I65535){H[F].counter+=1;D=H[F].hash+"_"+H[F].counter;m.geometryGroups[D]==undefined&&(m.geometryGroups[D]={faces:[],materials:I,vertices:0,numMorphTargets:K})}m.geometryGroups[D].faces.push(A);m.geometryGroups[D].vertices+=G}}function U(m,B,w){m.push({buffer:B,object:w,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function y(m){if(m!= Ba){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)}Ba=m}}function L(m,B,w){if((w.width&w.width-1)==0&&(w.height& w.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,ta(B.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,ta(B.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,ta(B.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,ta(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,va(B.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,va(B.minFilter))}}function N(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}L(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 P(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,ta(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,ta(m.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,ta(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,ta(m.minFilter));e.texImage2D(e.TEXTURE_2D, 0,ta(m.format),m.width,m.height,0,ta(m.format),ta(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,w;if(m){B=m.__webglFramebuffer;w=m.width;m=m.height}else{B=null;w=Fa;m=ka}if(B!= Ha){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport($,pa,w,m);Ha=B}}function za(m,B){var w;if(m=="fragment")w=e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(w=e.createShader(e.VERTEX_SHADER));e.shaderSource(w,B);e.compileShader(w);if(!e.getShaderParameter(w,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(w));console.error(B);return null}return w}function va(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}} function ta(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,fa=document.createElement("canvas"),ea=[],Aa=null,Ha=null,Ia=!0,ua=this,ca=null,sa=null,Ba=null,ja=null,$=0,pa=0,Fa=0,ka=0,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,Ra=new Float32Array(16),Za=new Float32Array(16),Va=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},O=!0,aa=!0,qa=new THREE.Color(0),Da=0;if(b){if(b.stencil!= undefined)O=b.stencil;if(b.antialias!==undefined)aa=b.antialias;b.clearColor!==undefined&&qa.setHex(b.clearColor);if(b.clearAlpha!==undefined)Da=b.clearAlpha}this.maxMorphTargets=8;this.domElement=fa;this.autoClear=!0;this.sortObjects=!0;(function(m,B,w,u){try{if(!(e=fa.getContext("experimental-webgl",{antialias:m,stencil:u})))throw"Error creating WebGL context.";}catch(A){console.error(A)}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,w)})(aa,qa,Da,O);this.context=e;if(O){var ha={};ha.vertices=new Float32Array(12);ha.faces=new Uint16Array(6);ha.darkness=0.5;ha.vertices[0]=-2;ha.vertices[1]=-1;ha.vertices[2]=-1;ha.vertices[3]=2;ha.vertices[4]=-1;ha.vertices[5]=-1;ha.vertices[6]=2;ha.vertices[7]=1;ha.vertices[8]=-1;ha.vertices[9]=-2;ha.vertices[10]=1;ha.vertices[11]=-1;ha.faces[0]=0;ha.faces[1]= 1;ha.faces[2]=2;ha.faces[3]=0;ha.faces[4]=2;ha.faces[5]=3;ha.vertexBuffer=e.createBuffer();ha.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ha.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ha.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ha.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha.faces,e.STATIC_DRAW);ha.program=e.createProgram();e.attachShader(ha.program,za("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ha.program,za("vertex",THREE.ShaderLib.shadowPost.vertexShader)); e.linkProgram(ha.program);ha.vertexLocation=e.getAttribLocation(ha.program,"position");ha.projectionLocation=e.getUniformLocation(ha.program,"projectionMatrix");ha.darknessLocation=e.getUniformLocation(ha.program,"darkness")}var la={};la.vertices=new Float32Array(16);la.faces=new Uint16Array(6);la.transparency=0.5;b=0;la.vertices[b++]=-1;la.vertices[b++]=-1;la.vertices[b++]=0;la.vertices[b++]=0;la.vertices[b++]=1;la.vertices[b++]=-1;la.vertices[b++]=1;la.vertices[b++]=0;la.vertices[b++]=1;la.vertices[b++]= 1;la.vertices[b++]=1;la.vertices[b++]=1;la.vertices[b++]=-1;la.vertices[b++]=1;la.vertices[b++]=0;la.vertices[b++]=1;b=0;la.faces[b++]=0;la.faces[b++]=1;la.faces[b++]=2;la.faces[b++]=0;la.faces[b++]=2;la.faces[b++]=3;la.vertexBuffer=e.createBuffer();la.elementBuffer=e.createBuffer();la.tempTexture=e.createTexture();la.readBackPixels=new Uint8Array(1024);e.bindBuffer(e.ARRAY_BUFFER,la.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,la.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,la.elementBuffer); e.bufferData(e.ELEMENT_ARRAY_BUFFER,la.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,la.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);la.program=e.createProgram();e.attachShader(la.program,za("fragment",THREE.ShaderLib.lensFlare.fragmentShader)); e.attachShader(la.program,za("vertex",THREE.ShaderLib.lensFlare.vertexShader));e.linkProgram(la.program);la.attributes={};la.uniforms={};la.attributes.vertex=e.getAttribLocation(la.program,"position");la.attributes.uv=e.getAttribLocation(la.program,"UV");la.uniforms.map=e.getUniformLocation(la.program,"map");la.uniforms.opacity=e.getUniformLocation(la.program,"opacity");la.uniforms.scale=e.getUniformLocation(la.program,"scale");la.uniforms.rotation=e.getUniformLocation(la.program,"rotation");la.uniforms.screenPosition= e.getUniformLocation(la.program,"screenPosition");la.uniforms.renderPink=e.getUniformLocation(la.program,"renderPink");this.setSize=function(m,B){fa.width=m;fa.height=B;this.setViewport(0,0,fa.width,fa.height)};this.setViewport=function(m,B,w,u){$=m;pa=B;Fa=w;ka=u;e.viewport($,pa,Fa,ka)};this.setScissor=function(m,B,w,u){e.scissor(m,B,w,u)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){Ia=m;e.depthMask(m)};this.setClearColorHex= function(m,B){var w=new THREE.Color(m);e.clearColor(w.r,w.g,w.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){ha.darkness=m};this.initMaterial=function(m,B,w,u){var A,M,G;if(m instanceof THREE.MeshDepthMaterial)G="depth";else if(m instanceof THREE.ShadowVolumeDynamicMaterial)G="shadowVolumeDynamic";else if(m instanceof THREE.MeshNormalMaterial)G= "normal";else if(m instanceof THREE.MeshBasicMaterial)G="basic";else if(m instanceof THREE.MeshLambertMaterial)G="lambert";else if(m instanceof THREE.MeshPhongMaterial)G="phong";else if(m instanceof THREE.LineBasicMaterial)G="basic";else m instanceof THREE.ParticleBasicMaterial&&(G="particle_basic");if(G){var I=THREE.ShaderLib[G];m.uniforms=Uniforms.clone(I.uniforms);m.vertexShader=I.vertexShader;m.fragmentShader=I.fragmentShader}var F,D,H;F=H=I=0;for(D=B.length;F0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,"#define MAX_BONES "+w.maxBones,w.map?"#define USE_MAP":"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?"#define USE_COLOR":"",w.skinning?"#define USE_SKINNING":"",w.morphTargets? "#define USE_MORPHTARGETS":"",w.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(X,za("fragment",prefix_fragment+F));e.attachShader(X,za("vertex",prefix_vertex+D));e.linkProgram(X);e.getProgramParameter(X,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(X,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");X.uniforms={};X.attributes={};var T;F=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(T in I)F.push(T); T=F;I=0;for(F=T.length;I=0&&e.enableVertexAttribArray(K.color);K.normal>= 0&&e.enableVertexAttribArray(K.normal);K.tangent>=0&&e.enableVertexAttribArray(K.tangent);if(m.skinning&&K.skinVertexA>=0&&K.skinVertexB>=0&&K.skinIndex>=0&&K.skinWeight>=0){e.enableVertexAttribArray(K.skinVertexA);e.enableVertexAttribArray(K.skinVertexB);e.enableVertexAttribArray(K.skinIndex);e.enableVertexAttribArray(K.skinWeight)}for(A in m.attributes)K[A]>=0&&e.enableVertexAttribArray(K[A]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(K.morphTarget0>=0){e.enableVertexAttribArray(K.morphTarget0); m.numSupportedMorphTargets++}if(K.morphTarget1>=0){e.enableVertexAttribArray(K.morphTarget1);m.numSupportedMorphTargets++}if(K.morphTarget2>=0){e.enableVertexAttribArray(K.morphTarget2);m.numSupportedMorphTargets++}if(K.morphTarget3>=0){e.enableVertexAttribArray(K.morphTarget3);m.numSupportedMorphTargets++}if(K.morphTarget4>=0){e.enableVertexAttribArray(K.morphTarget4);m.numSupportedMorphTargets++}if(K.morphTarget5>=0){e.enableVertexAttribArray(K.morphTarget5);m.numSupportedMorphTargets++}if(K.morphTarget6>= 0){e.enableVertexAttribArray(K.morphTarget6);m.numSupportedMorphTargets++}if(K.morphTarget7>=0){e.enableVertexAttribArray(K.morphTarget7);m.numSupportedMorphTargets++}u.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);m=0;for(A=this.maxMorphTargets;m0||X.faceVertexUvs.length>0)G.__uvArray=new Float32Array(F*2);if(X.faceUvs.length>1||X.faceVertexUvs.length>1)G.__uv2Array=new Float32Array(F*2)}if(I.geometry.skinWeights.length&&I.geometry.skinIndices.length){G.__skinVertexAArray=new Float32Array(F*4);G.__skinVertexBArray=new Float32Array(F* 4);G.__skinIndexArray=new Float32Array(F*4);G.__skinWeightArray=new Float32Array(F*4)}G.__faceArray=new Uint16Array(Ea*3+(I.geometry.edgeFaces?I.geometry.edgeFaces.length*6:0));G.__lineArray=new Uint16Array(Ja*2);if(G.numMorphTargets){G.__morphTargetsArrays=[];X=0;for(T=G.numMorphTargets;X=0;A--){u=w.__webglObjects[A].object;B==u&&w.__webglObjects.splice(A,1)}m.__objectsRemoved.splice(0,1)}B=0;for(w=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;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;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,t,x){var v={name:t,fps:0.6,length:x,hierarchy:[]},z,C=o.getControlPointsArray(),E=o.getLength(),J=C.length,U=0;z=J-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:C[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[z]={time:x,pos:C[z],rot:[0,0,0,1],scl:[1,1,1]};for(z=1;z=0?x:x+g;x=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange; this.phi=(this.phi-x[0])*(v[1]-v[0])/(x[1]-x[0])+v[0];x=this.horizontalAngleMap.srcRange;v=this.horizontalAngleMap.dstRange;this.theta=(this.theta-x[0])*(v[1]-v[0])/(x[1]-x[0])+v[0];x=this.target.position;x.x=100*Math.sin(this.phi)*Math.cos(this.theta);x.y=100*Math.cos(this.phi);x.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,t)};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(E,J,U,y,L,N,P,za){var va,ta,e=f||1,fa=g||1,ea=L/2,Aa=N/2,Ha=o.vertices.length;if(E=="x"&&J=="y"||E=="y"&&J=="x")va="z";else if(E=="x"&&J=="z"||E=="z"&&J=="x"){va="y";fa=h||1}else if(E=="z"&&J=="y"||E=="y"&&J=="z"){va="x";e=h||1}var Ia=e+1,ua=fa+1;L/=e;var ca=N/fa;for(ta=0;ta0){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(t,x,v){var z=Math.sqrt(t*t+x*x+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/z,x/z,v/z)))-1}function c(t,x,v,z){z.faces.push(new THREE.Face3(t,x,v))}function f(t,x){var v=g.vertices[t].position,z=g.vertices[x].position;return d((v.x+z.x)/2,(v.y+z.y)/2,(v.z+z.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(t,k,x)))-1);p.push(o)}d.push(p)}var v,z,C;g=d.length;for(c=0;c0)for(f=0;f1){v=this.vertices[j].position.clone(); z=this.vertices[n].position.clone();C=this.vertices[p].position.clone();v.normalize();z.normalize();C.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(C.x,C.y,C.z)]));this.faceVertexUvs[0].push([o,t,E])}}}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(t,x,v,z,C,E){x=v/z*t;v=Math.cos(x);return new THREE.Vector3(C*(2+v)*0.5*Math.cos(t),C*(2+v)*Math.sin(t)*0.5,E*C*Math.sin(x)*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;qa|=(ha&127)<<16|Da<<8;if(qa==0&&m==-127)return 0;return(1-2*(la>>7))*(1+qa*Math.pow(2,-23))*Math.pow(2,m)}function k(O,aa){var qa=o(O,aa),Da=o(O,aa+1),ha=o(O,aa+2);return(o(O,aa+3)<<24)+(ha<<16)+(Da<<8)+qa}function n(O,aa){var qa=o(O,aa);return(o(O,aa+1)<<8)+qa}function p(O,aa){var qa=o(O,aa); return qa>127?qa-256:qa}function o(O,aa){return O.charCodeAt(aa)&255}function t(O){var aa,qa,Da;aa=k(b,O);qa=k(b,O+P);Da=k(b,O+za);O=n(b,O+va);THREE.BinaryLoader.prototype.f3(J,aa,qa,Da,O)}function x(O){var aa,qa,Da,ha,la,m;aa=k(b,O);qa=k(b,O+P);Da=k(b,O+za);ha=n(b,O+va);la=k(b,O+ta);m=k(b,O+e);O=k(b,O+fa);THREE.BinaryLoader.prototype.f3n(J,L,aa,qa,Da,ha,la,m,O)}function v(O){var aa,qa,Da,ha;aa=k(b,O);qa=k(b,O+ea);Da=k(b,O+Aa);ha=k(b,O+Ha);O=n(b,O+Ia);THREE.BinaryLoader.prototype.f4(J,aa,qa,Da,ha, O)}function z(O){var aa,qa,Da,ha,la,m,B,w;aa=k(b,O);qa=k(b,O+ea);Da=k(b,O+Aa);ha=k(b,O+Ha);la=n(b,O+Ia);m=k(b,O+ua);B=k(b,O+ca);w=k(b,O+sa);O=k(b,O+Ba);THREE.BinaryLoader.prototype.f4n(J,L,aa,qa,Da,ha,la,m,B,w,O)}function C(O){var aa,qa;aa=k(b,O);qa=k(b,O+ja);O=k(b,O+$);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],N[aa*2],N[aa*2+1],N[qa*2],N[qa*2+1],N[O*2],N[O*2+1])}function E(O){var aa,qa,Da;aa=k(b,O);qa=k(b,O+pa);Da=k(b,O+Fa);O=k(b,O+ka);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0], N[aa*2],N[aa*2+1],N[qa*2],N[qa*2+1],N[Da*2],N[Da*2+1],N[O*2],N[O*2+1])}var J=this,U=0,y,L=[],N=[],P,za,va,ta,e,fa,ea,Aa,Ha,Ia,ua,ca,sa,Ba,ja,$,pa,Fa,ka,oa,Ga,Ra,Za,Va,Sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(J,f,h);y={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+=y.header_bytes;P=y.vertex_index_bytes;za=y.vertex_index_bytes*2;va=y.vertex_index_bytes*3;ta=y.vertex_index_bytes*3+y.material_index_bytes;e=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes;fa=y.vertex_index_bytes* 3+y.material_index_bytes+y.normal_index_bytes*2;ea=y.vertex_index_bytes;Aa=y.vertex_index_bytes*2;Ha=y.vertex_index_bytes*3;Ia=y.vertex_index_bytes*4;ua=y.vertex_index_bytes*4+y.material_index_bytes;ca=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes;sa=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*2;Ba=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*3;ja=y.uv_index_bytes;$=y.uv_index_bytes*2;pa=y.uv_index_bytes;Fa=y.uv_index_bytes*2;ka=y.uv_index_bytes* 3;h=y.vertex_index_bytes*3+y.material_index_bytes;Sa=y.vertex_index_bytes*4+y.material_index_bytes;oa=y.ntri_flat*h;Ga=y.ntri_smooth*(h+y.normal_index_bytes*3);Ra=y.ntri_flat_uv*(h+y.uv_index_bytes*3);Za=y.ntri_smooth_uv*(h+y.normal_index_bytes*3+y.uv_index_bytes*3);Va=y.nquad_flat*Sa;h=y.nquad_smooth*(Sa+y.normal_index_bytes*4);Sa=y.nquad_flat_uv*(Sa+y.uv_index_bytes*4);U+=function(O){for(var aa,qa,Da,ha=y.vertex_coordinate_bytes*3,la=O+y.nvertices*ha;O=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 x=Math.floor(p-k);x<1&&(x=1);p=Math.floor(p+k);p>this.size-1&&(p= this.size-1);var v=Math.floor(o-k);v<1&&(v=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var z,C,E,J,U,y;t0&&(this.field[E+z]+=J)}}}};this.addPlaneX=function(c,f){var g,h,j,k,n,p=this.size,o=this.yd,t=this.zd,x=this.field,v=p*Math.sqrt(c/f);v>p&&(v=p);for(g=0;g0)for(h=0;ho&&(z=o);for(h=0;h0){n=h*t;for(g=0;gsize&&(dist=size);for(j=0;j0){n=zd*j;for(h=0;h