// Three.js r36 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)}; THREE.Color.prototype={autoUpdate:!0,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 d,f,g,h,j,k;if(b==0)d=f=g=0;else{h=Math.floor(a*6);j=a*6-h;a=b*(1-c);k=b*(1-c*j);c=b*(1-c*(1-j));switch(h){case 1:d=k;f=b;g=a;break;case 2:d=a;f=b;g=c;break;case 3:d=a;f=k;g=b;break;case 4:d=c;f=a;g=b;break;case 5:d=b;f=a;g=k;break;case 6:case 0:d=b;f=c;g=a}}this.r=d;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,d=this.z;this.set(b*a.z-d*a.y,d*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,d){this.set(a||0,c||0,b||0,d||1)}; THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;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,d=a.objects,f=[];a=0;for(c=d.length;a0&&F>0&&J+F<1}var b,d,f,g,h,j,k,m,q,y, u,o=a.geometry,v=o.vertices,B=[];b=0;for(d=o.faces.length;bk?d:k;f=f>m?f:m}a()}; this.add3Points=function(k,m,q,y,u,o){if(j){j=!1;c=kq?k>u?k:u:q>u?q:u;f=m>y?m>o?m:o:y>o?y:o}else{c=kq?k>u?k>d?k:d:u>d?u:d:q>u?q>d?q:d:u>d?u:d;f=m>y?m>o?m>f?m:f:o>f?o:f:y>o?y>f?y:f:o>f?o:f}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();f=k.getBottom()}else{c=ck.getRight()? d:k.getRight();f=f>k.getBottom()?f:k.getBottom()}a()};this.inflate=function(k){c-=k;b-=k;d+=k;f+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();b=b>k.getTop()?b:k.getTop();d=d=0&&Math.min(f,k.getBottom())-Math.max(b,k.getTop())>=0};this.empty=function(){j=!0;f=d=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,d,f,g,h,j,k,m,q,y,u,o,v,B){this.set(a||1,c||0,b||0,d||0,f||0,g||1,h||0,j||0,k||0,m||0,q||1,y||0,u||0,o||0,v||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4.prototype={set:function(a,c,b,d,f,g,h,j,k,m,q,y,u,o,v,B){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=m;this.n33=q;this.n34=y;this.n41=u;this.n42=o;this.n43=v;this.n44=B;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 d=THREE.Matrix4.__v1, f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,f=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23* d+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*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,d=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,q=a.n31,y=a.n32,u=a.n33,o=a.n34,v=a.n41,B=a.n42,F=a.n43,w=a.n44,G=c.n11,x=c.n12,L=c.n13,J=c.n14,Y=c.n21,N=c.n22, e=c.n23,W=c.n24,R=c.n31,da=c.n32,ga=c.n33,I=c.n34;this.n11=b*G+d*Y+f*R;this.n12=b*x+d*N+f*da;this.n13=b*L+d*e+f*ga;this.n14=b*J+d*W+f*I+g;this.n21=h*G+j*Y+k*R;this.n22=h*x+j*N+k*da;this.n23=h*L+j*e+k*ga;this.n24=h*J+j*W+k*I+m;this.n31=q*G+y*Y+u*R;this.n32=q*x+y*N+u*da;this.n33=q*L+y*e+u*ga;this.n34=q*J+y*W+u*I+o;this.n41=v*G+B*Y+F*R;this.n42=v*x+B*N+F*da;this.n43=v*L+B*e+F*ga;this.n44=v*J+B*W+F*I+w;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,d=this.n14,f=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,m=this.n32,q=this.n33,y=this.n34,u=this.n41,o=this.n42,v=this.n43,B=this.n44;return d*h*m*u-b*j*m*u-d*g*q*u+c*j*q*u+b*g*y*u-c*h*y*u-d*h*k*o+b*j*k*o+d*f*q*o-a*j*q*o-b*f*y*o+a*h*y*o+d*g*k*v-c*j*k*v-d*f*m*v+a*j*m*v+c*f*y*v-a*g*y*v-b*g*k*B+c*h*k*B+b*f*m*B-a*h*m*B-c*f*q*B+a*g*q*B},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),d=Math.sin(c),f=1-b,g=a.x,h=a.y,j=a.z,k=f*g,m=f*h;this.set(k* g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,m*h+b,m*j-d*g,0,k*j-d*h,m*j+d*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,d=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,j=c*b;this.n11=f*g;this.n12=-f*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*f;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*f;return this},setRotationFromQuaternion:function(a){var c= a.x,b=a.y,d=a.z,f=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var m=b*h;b*=j;d*=j;g*=f;h*=f;f*=j;this.n11=1-(m+d);this.n12=k-f;this.n13=c+h;this.n21=k+f;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+m);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,d=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*d;this.n22=a.n22*d;this.n32=a.n32*d;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,d=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,q=a.n31,y=a.n32,u=a.n33,o=a.n34,v=a.n41,B=a.n42,F=a.n43,w=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*o*B-m*u*B+m*y*F-j*o*F-k*y*w+j*u*w;c.n12=g*u*B-f*o*B-g*y*F+d*o*F+f*y*w-d*u*w;c.n13=f*m*B-g*k*B+g*j*F-d*m*F-f*j*w+d*k*w;c.n14=g*k*y-f*m*y-g*j*u+d*m*u+f*j*o-d*k*o;c.n21=m*u*v-k*o*v-m*q*F+h*o*F+k*q*w-h*u*w;c.n22=f*o*v-g*u*v+g*q*F-b*o*F-f*q*w+b*u*w;c.n23=g*k*v-f*m*v-g*h*F+b*m*F+f*h*w-b*k*w; c.n24=f*m*q-g*k*q+g*h*u-b*m*u-f*h*o+b*k*o;c.n31=j*o*v-m*y*v+m*q*B-h*o*B-j*q*w+h*y*w;c.n32=g*y*v-d*o*v-g*q*B+b*o*B+d*q*w-b*y*w;c.n33=f*m*v-g*j*v+g*h*B-b*m*B-d*h*w+b*j*w;c.n34=g*j*q-d*m*q-g*h*y+b*m*y+d*h*o-b*j*o;c.n41=k*y*v-j*u*v-k*q*B+h*u*B+j*q*F-h*y*F;c.n42=d*u*v-f*y*v+f*q*B-b*u*B-d*q*F+b*y*F;c.n43=f*j*v-d*k*v-f*h*B+b*k*B+d*h*F-b*j*F;c.n44=d*k*q-f*j*q+f*h*y-b*k*y-d*h*u+b*j*u;c.multiplyScalar(1/a.determinant());return c}; THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=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,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,q=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*f;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*m;b[7]=a*q;b[8]=a*y;return c}; THREE.Matrix4.makeFrustum=function(a,c,b,d,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/(d-b);h.n23=(d+b)/(d-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,d){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,d)}; THREE.Matrix4.makeOrtho=function(a,c,b,d,f,g){var h,j,k,m;h=new THREE.Matrix4;j=c-a;k=b-d;m=g-f;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((b+d)/k);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);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){if(this.visible){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 d=this.children.length;a< d;a++)this.children[a].update(this.matrixWorld,c,b)}}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)}; THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,f=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*f;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*f*b;this.z=a*f*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*= -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,f=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+f*g+b*j-d*h;this.y=b*a+f*h+d*g-c*j;this.z=d*a+f*j+c*h-b*g;this.w=f*a-c*g-b*h-d*j;return this}, multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,f=a.z,g=this.x,h=this.y,j=this.z,k=this.w,m=k*b+h*f-j*d,q=k*d+j*b-g*f,y=k*f+g*d-h*b;b=-g*b-h*d-j*f;c.x=m*k+b*-g+q*-j-y*-h;c.y=q*k+b*-h+y*-g-m*-j;c.z=y*k+b*-j+m*-h-q*-g;return c}}; THREE.Quaternion.slerp=function(a,c,b,d){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=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-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*f+c.w*d;b.x=a.x*f+c.x*d;b.y=a.y*f+c.y*d;b.z=a.z*f+c.z*d;return b}; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; THREE.Face3=function(a,c,b,d,f){this.a=a;this.b=c;this.c=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,c,b,d,f,g){this.a=a;this.b=c;this.c=b;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]}; 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.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];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.z this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;cthis.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;m=this.points[b[0]];q=this.points[b[1]]; y=this.points[b[2]];u=this.points[b[3]];j=h*h;k=h*j;d.x=c(m.x,q.x,y.x,u.x,h,j,k);d.y=c(m.y,q.y,y.y,u.y,h,j,k);d.z=c(m.z,q.z,y.z,u.z,h,j,k);return d};this.getControlPointsArray=function(){var o,v,B=this.points.length,F=[];for(o=0;o1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*d;b.y=f[1]+(g[1]-f[1])*d;b.z=f[2]+(g[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= this.getPrevKeyWith("pos",o,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",o,j.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b=== "rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*d;b.y=f[1]+(g[1]-f[1])*d;b.z=f[2]+(g[2]-f[2])*d}}}}if(this.JITCompile&&q[0][m]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;oa.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];m=a[b[3]];b=f*f;h=f*b;d[0]=this.interpolate(g[0],j[0],k[0],m[0],f,b,h);d[1]=this.interpolate(g[1],j[1],k[1],m[1],f,b,h);d[2]=this.interpolate(g[2],j[2],k[2],m[2],f,b,h);return d}; THREE.Animation.prototype.interpolate=function(a,c,b,d,f,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=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+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]}; THREE.Camera=function(a,c,b,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||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 d=1;d=this.LODs[d].visibleAtDistance){this.LODs[d-1].object3D.visible= !1;this.LODs[d].object3D.visible=!0}else break;for(;d=0&&ga>=0&&I>=0&&ca>=0)return!0;else if(da<0&&ga<0||I<0&&ca<0)return!1;else{if(da<0)W=Math.max(W,da/(da-ga));else ga<0&&(R=Math.min(R,da/(da-ga)));if(I<0)W=Math.max(W,I/(I-ca));else ca<0&&(R=Math.min(R,I/(I-ca)));if(Rda&&ea.z0&& F.z<1){u=v[o]=v[o]||new THREE.RenderableParticle;u.x=F.x/F.w;u.y=F.y/F.w;u.z=F.z;u.rotation=ha.rotation.z;u.scale.x=ha.scale.x*Math.abs(u.x-(F.x+e.projectionMatrix.n11)/(F.w+e.projectionMatrix.n14));u.scale.y=ha.scale.y*Math.abs(u.y-(F.y+e.projectionMatrix.n22)/(F.w+e.projectionMatrix.n24));u.materials=ha.materials;R.push(u);o++}}}}W&&R.sort(a);return R};this.unprojectVector=function(N,e){var W=e.matrixWorld.clone();W.multiplySelf(THREE.Matrix4.makeInvert(e.projectionMatrix));W.multiplyVector3(N); return N}}; THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;f=b/2;g=d/2};this.render=function(h,j){var k,m,q,y,u,o,v,B;a=c.projectScene(h,j);k=0;for(m=a.length;k0){K.r+=pa.r*fa;K.g+=pa.g*fa;K.b+=pa.b*fa}}else if(fa instanceof THREE.PointLight){p.sub(fa.position,oa);p.normalize();fa=Z.dot(p)*sa;if(fa>0){K.r+=pa.r*fa;K.g+=pa.g*fa;K.b+=pa.b*fa}}}}function Ca(P,oa,Z){if(Z.opacity!=0){a(Z.opacity); c(Z.blending);var K,T,fa,pa,sa,ua;if(Z instanceof THREE.ParticleBasicMaterial){if(Z.map){pa=Z.map.image;sa=pa.width>>1;ua=pa.height>>1;T=oa.scale.x*j;fa=oa.scale.y*k;Z=T*sa;K=fa*ua;Q.set(P.x-Z,P.y-K,P.x+Z,P.y+K);if(qa.instersects(Q)){m.save();m.translate(P.x,P.y);m.rotate(-oa.rotation);m.scale(T,-fa);m.translate(-sa,-ua);m.drawImage(pa,0,0);m.restore()}}}else if(Z instanceof THREE.ParticleCircleMaterial){if(ma){ta.r=l.r+z.r+t.r;ta.g=l.g+z.g+t.g;ta.b=l.b+z.b+t.b;R.r=Z.color.r*ta.r;R.g=Z.color.g*ta.g; R.b=Z.color.b*ta.b;R.updateStyleString()}else R.__styleString=Z.color.__styleString;Z=oa.scale.x*j;K=oa.scale.y*k;Q.set(P.x-Z,P.y-K,P.x+Z,P.y+K);if(qa.instersects(Q)){T=R.__styleString;if(B!=T)m.fillStyle=B=T;m.save();m.translate(P.x,P.y);m.rotate(-oa.rotation);m.scale(Z,K);m.beginPath();m.arc(0,0,1,0,n,!0);m.closePath();m.fill();m.restore()}}}}function Da(P,oa,Z,K){if(K.opacity!=0){a(K.opacity);c(K.blending);m.beginPath();m.moveTo(P.positionScreen.x,P.positionScreen.y);m.lineTo(oa.positionScreen.x, oa.positionScreen.y);m.closePath();if(K instanceof THREE.LineBasicMaterial){R.__styleString=K.color.__styleString;P=K.linewidth;if(F!=P)m.lineWidth=F=P;P=R.__styleString;if(v!=P)m.strokeStyle=v=P;m.stroke();Q.inflate(K.linewidth*2)}}}function Pa(P,oa,Z,K,T,fa){if(T.opacity!=0){a(T.opacity);c(T.blending);L=P.positionScreen.x;J=P.positionScreen.y;Y=oa.positionScreen.x;N=oa.positionScreen.y;e=Z.positionScreen.x;W=Z.positionScreen.y;m.beginPath();m.moveTo(L,J);m.lineTo(Y,N);m.lineTo(e,W);m.lineTo(L,J); m.closePath();if(T instanceof THREE.MeshBasicMaterial)if(T.map)T.map.mapping instanceof THREE.UVMapping&&Ia(L,J,Y,N,e,W,T.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);else if(T.envMap){if(T.envMap.mapping instanceof THREE.SphericalReflectionMapping){P=na.matrixWorldInverse;p.copy(K.vertexNormalsWorld[0]);ja=(p.x*P.n11+p.y*P.n12+p.z*P.n13)*0.5+0.5;ha=-(p.x*P.n21+p.y*P.n22+p.z*P.n23)*0.5+0.5;p.copy(K.vertexNormalsWorld[1]);va=(p.x*P.n11+p.y*P.n12+p.z*P.n13)*0.5+0.5;Aa= -(p.x*P.n21+p.y*P.n22+p.z*P.n23)*0.5+0.5;p.copy(K.vertexNormalsWorld[2]);ia=(p.x*P.n11+p.y*P.n12+p.z*P.n13)*0.5+0.5;$=-(p.x*P.n21+p.y*P.n22+p.z*P.n23)*0.5+0.5;Ia(L,J,Y,N,e,W,T.envMap.image,ja,ha,va,Aa,ia,$)}}else T.wireframe?M(T.color.__styleString,T.wireframeLinewidth):Na(T.color.__styleString);else if(T instanceof THREE.MeshLambertMaterial){if(T.map&&!T.wireframe){T.map.mapping instanceof THREE.UVMapping&&Ia(L,J,Y,N,e,W,T.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v); c(THREE.SubtractiveBlending)}if(ma)if(!T.wireframe&&T.shading==THREE.SmoothShading&&K.vertexNormalsWorld.length==3){da.r=ga.r=I.r=l.r;da.g=ga.g=I.g=l.g;da.b=ga.b=I.b=l.b;la(fa,K.v1.positionWorld,K.vertexNormalsWorld[0],da);la(fa,K.v2.positionWorld,K.vertexNormalsWorld[1],ga);la(fa,K.v3.positionWorld,K.vertexNormalsWorld[2],I);ca.r=(ga.r+I.r)*0.5;ca.g=(ga.g+I.g)*0.5;ca.b=(ga.b+I.b)*0.5;xa=Oa(da,ga,I,ca);Ia(L,J,Y,N,e,W,xa,0,0,1,0,0,1)}else{ta.r=l.r;ta.g=l.g;ta.b=l.b;la(fa,K.centroidWorld,K.normalWorld, ta);R.r=T.color.r*ta.r;R.g=T.color.g*ta.g;R.b=T.color.b*ta.b;R.updateStyleString();T.wireframe?M(R.__styleString,T.wireframeLinewidth):Na(R.__styleString)}else T.wireframe?M(T.color.__styleString,T.wireframeLinewidth):Na(T.color.__styleString)}else if(T instanceof THREE.MeshDepthMaterial){za=na.near;ea=na.far;da.r=da.g=da.b=1-S(P.positionScreen.z,za,ea);ga.r=ga.g=ga.b=1-S(oa.positionScreen.z,za,ea);I.r=I.g=I.b=1-S(Z.positionScreen.z,za,ea);ca.r=(ga.r+I.r)*0.5;ca.g=(ga.g+I.g)*0.5;ca.b=(ga.b+I.b)*0.5; xa=Oa(da,ga,I,ca);Ia(L,J,Y,N,e,W,xa,0,0,1,0,0,1)}else if(T instanceof THREE.MeshNormalMaterial){R.r=U(K.normalWorld.x);R.g=U(K.normalWorld.y);R.b=U(K.normalWorld.z);R.updateStyleString();T.wireframe?M(R.__styleString,T.wireframeLinewidth):Na(R.__styleString)}}}function M(P,oa){if(v!=P)m.strokeStyle=v=P;if(F!=oa)m.lineWidth=F=oa;m.stroke();Q.inflate(oa*2)}function Na(P){if(B!=P)m.fillStyle=B=P;m.fill()}function Ia(P,oa,Z,K,T,fa,pa,sa,ua,Ra,La,Ka,Wa){var Ea,Sa;Ea=pa.width-1;Sa=pa.height-1;sa*=Ea;ua*= Sa;Ra*=Ea;La*=Sa;Ka*=Ea;Wa*=Sa;Z-=P;K-=oa;T-=P;fa-=oa;Ra-=sa;La-=ua;Ka-=sa;Wa-=ua;Ea=Ra*Wa-Ka*La;if(Ea!=0){Sa=1/Ea;Ea=(Wa*Z-La*T)*Sa;La=(Wa*K-La*fa)*Sa;Z=(Ra*T-Ka*Z)*Sa;K=(Ra*fa-Ka*K)*Sa;P=P-Ea*sa-Z*ua;oa=oa-La*sa-K*ua;m.save();m.transform(Ea,La,Z,K,P,oa);m.clip();m.drawImage(pa,0,0);m.restore()}}function Oa(P,oa,Z,K){var T=~~(P.r*255),fa=~~(P.g*255);P=~~(P.b*255);var pa=~~(oa.r*255),sa=~~(oa.g*255);oa=~~(oa.b*255);var ua=~~(Z.r*255),Ra=~~(Z.g*255);Z=~~(Z.b*255);var La=~~(K.r*255),Ka=~~(K.g*255); K=~~(K.b*255);O[0]=T<0?0:T>255?255:T;O[1]=fa<0?0:fa>255?255:fa;O[2]=P<0?0:P>255?255:P;O[4]=pa<0?0:pa>255?255:pa;O[5]=sa<0?0:sa>255?255:sa;O[6]=oa<0?0:oa>255?255:oa;O[8]=ua<0?0:ua>255?255:ua;O[9]=Ra<0?0:Ra>255?255:Ra;O[10]=Z<0?0:Z>255?255:Z;O[12]=La<0?0:La>255?255:La;O[13]=Ka<0?0:Ka>255?255:Ka;O[14]=K<0?0:K>255?255:K;A.putImageData(D,0,0);E.drawImage(C,0,0);return X}function S(P,oa,Z){P=(P-oa)/(Z-oa);return P*P*(3-2*P)}function U(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function V(P,oa){var Z=oa.x-P.x, K=oa.y-P.y,T=1/Math.sqrt(Z*Z+K*K);Z*=T;K*=T;oa.x+=Z;oa.y+=K;P.x-=Z;P.y-=K}var ya,Ma,Fa,Ba,Ga,H,Ja,Ha;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,k);b=d.projectScene(ka,na,this.sortElements);(ma=ka.lights.length>0)&&wa(ka);ya=0;for(Ma=b.length;ya0){va.r+=$.color.r*qa;va.g+=$.color.g*qa;va.b+=$.color.b*qa}}else if($ instanceof THREE.PointLight){W.sub($.position,ha.centroidWorld);W.normalize();qa=ha.normalWorld.dot(W)*$.intensity;if(qa>0){va.r+=$.color.r*qa;va.g+=$.color.g*qa;va.b+=$.color.b*qa}}}}function c(ja,ha,va,Aa,ia,$){I=d(ca++); I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)x.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a($,Aa,L);x.r=ia.color.r*L.r;x.g=ia.color.g*L.g;x.b=ia.color.b*L.b;x.updateStyleString()}else x.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshDepthMaterial){e= 1-ia.__2near/(ia.__farPlusNear-Aa.z*ia.__farMinusNear);x.setRGB(e,e,e)}else ia instanceof THREE.MeshNormalMaterial&&x.setRGB(f(Aa.normalWorld.x),f(Aa.normalWorld.y),f(Aa.normalWorld.z));ia.wireframe?I.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+ia.wireframeLinewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.wireframeLinecap+"; stroke-linejoin: "+ia.wireframeLinejoin):I.setAttribute("style","fill: "+x.__styleString+"; fill-opacity: "+ia.opacity);j.appendChild(I)} function b(ja,ha,va,Aa,ia,$,qa){I=d(ca++);I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Aa.positionScreen.x+","+Aa.positionScreen.y+"z");if($ instanceof THREE.MeshBasicMaterial)x.__styleString=$.color.__styleString;else if($ instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a(qa,ia,L);x.r=$.color.r*L.r;x.g=$.color.g*L.g;x.b=$.color.b*L.b;x.updateStyleString()}else x.__styleString= $.color.__styleString;else if($ instanceof THREE.MeshDepthMaterial){e=1-$.__2near/($.__farPlusNear-ia.z*$.__farMinusNear);x.setRGB(e,e,e)}else $ instanceof THREE.MeshNormalMaterial&&x.setRGB(f(ia.normalWorld.x),f(ia.normalWorld.y),f(ia.normalWorld.z));$.wireframe?I.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+$.wireframeLinewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.wireframeLinecap+"; stroke-linejoin: "+$.wireframeLinejoin):I.setAttribute("style", "fill: "+x.__styleString+"; fill-opacity: "+$.opacity);j.appendChild(I)}function d(ja){if(R[ja]==null){R[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");xa==0&&R[ja].setAttribute("shape-rendering","crispEdges")}return R[ja]}function f(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,q,y,u,o,v,B,F=new THREE.Rectangle,w=new THREE.Rectangle,G=!1,x=new THREE.Color(16777215), L=new THREE.Color(16777215),J=new THREE.Color(0),Y=new THREE.Color(0),N=new THREE.Color(0),e,W=new THREE.Vector3,R=[],da=[],ga=[],I,ca,za,ea,xa=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ja){switch(ja){case "high":xa=1;break;case "low":xa=0}};this.setSize=function(ja,ha){k=ja;m=ha;q=k/2;y=m/2;j.setAttribute("viewBox",-q+" "+-y+" "+k+" "+m);j.setAttribute("width",k);j.setAttribute("height",m);F.set(-q,-y,q,y)};this.clear=function(){for(;j.childNodes.length> 0;)j.removeChild(j.childNodes[0])};this.render=function(ja,ha){var va,Aa,ia,$,qa,ra,Q,ma;this.autoClear&&this.clear();g=h.projectScene(ja,ha,this.sortElements);ea=za=ca=0;if(G=ja.lights.length>0){Q=ja.lights;J.setRGB(0,0,0);Y.setRGB(0,0,0);N.setRGB(0,0,0);va=0;for(Aa=Q.length;va 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",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 || USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\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:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},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={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(l,z,t){var n,p,C,A=l.vertices,D=A.length,O=l.colors,X=O.length,E=l.__vertexArray,aa=l.__colorArray,ka=l.__sortArray,na=l.__dirtyVertices,wa=l.__dirtyColors;if(t.sortParticles){Aa.multiplySelf(t.matrixWorld);for(n=0;nt){A=O;t=D[A]}e.bindBuffer(e.ARRAY_BUFFER,p.__webGLMorphTargetsBuffers[A]);e.vertexAttribPointer(l["morphTarget"+E],3,e.FLOAT,!1,0,0);C.__webGLMorphTargetInfluences[E]=t;z[A]=1;t=-1;E++}e.uniform1fv(n.program.uniforms.morphTargetInfluences,C.__webGLMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,p.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0)}if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.vertexAttribPointer(l.color,3, e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(p.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(p.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER, p.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);if(n.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex, 4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0)}if(C instanceof THREE.Mesh)if(n.wireframe){e.lineWidth(n.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);e.drawElements(e.LINES,p.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,p.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(C instanceof THREE.Line){C=C.type==THREE.LineStrip? e.LINE_STRIP:e.LINES;e.lineWidth(n.linewidth);e.drawArrays(C,0,p.__webGLLineCount)}else if(C instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,p.__webGLParticleCount);else C instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,p.__webGLVertexCount)}}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray, e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.position);e.vertexAttribPointer(z.attributes.position,3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.normal);e.vertexAttribPointer(z.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(ga!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ga= l.doubleSided}if(I!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);I=l.flipSided}}function j(l){if(za!=l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);za=l}}function k(l){va[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);va[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);va[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);va[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);va[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);va[5].set(l.n41+ l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=va[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function m(l){for(var z=l.matrixWorld,t=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=va[n].x*z.n14+va[n].y*z.n24+va[n].z*z.n34+va[n].w;if(l<=t)return!1}return!0}function q(l,z){l.list[l.count]=z;l.count+=1}function y(l){var z,t,n=l.object,p=l.opaque,C=l.transparent;C.count=0;l=p.count=0;for(z=n.materials.length;l65535){E[O].counter+=1;X=E[O].hash+"_"+E[O].counter;l.geometryGroups[X]==undefined&&(l.geometryGroups[X]={faces:[],materials:D,vertices:0,numMorphTargets:aa})}l.geometryGroups[X].faces.push(p);l.geometryGroups[X].vertices+=A}}function F(l,z,t){l.push({buffer:z, object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD); e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ca=l}}function G(l,z,t){if((t.width&t.width-1)==0&&(t.height&t.height-1)==0){e.texParameteri(l,e.TEXTURE_WRAP_S,Y(z.wrapS));e.texParameteri(l,e.TEXTURE_WRAP_T,Y(z.wrapT));e.texParameteri(l,e.TEXTURE_MAG_FILTER,Y(z.magFilter));e.texParameteri(l,e.TEXTURE_MIN_FILTER,Y(z.minFilter));e.generateMipmap(l)}else{e.texParameteri(l,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(l,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(l,e.TEXTURE_MAG_FILTER,J(z.magFilter)); e.texParameteri(l,e.TEXTURE_MIN_FILTER,J(z.minFilter))}}function x(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,Y(l.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T, Y(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,Y(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,Y(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,Y(l.format),l.width,l.height,0,Y(l.format),Y(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null); e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var z,t;if(l){z=l.__webGLFramebuffer;t=l.width;l=l.height}else{z=null;t=ja;l=ha}if(z!=R){e.bindFramebuffer(e.FRAMEBUFFER,z);e.viewport(ea,xa,t,l);R=z}}function L(l,z){var t;if(l=="fragment")t=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(t=e.createShader(e.VERTEX_SHADER));e.shaderSource(t,z);e.compileShader(t);if(!e.getShaderParameter(t,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(t));return null}return t}function J(l){switch(l){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST; case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return e.LINEAR}}function Y(l){switch(l){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 N=document.createElement("canvas"),e,W=null,R=null,da=this,ga=null,I=null,ca=null,za=null,ea=0,xa=0,ja=0,ha=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,ia=new Float32Array(16),$=new Float32Array(16),qa=new THREE.Vector4,ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0, colors:[],positions:[]}},Q=!0,ma=new THREE.Color(0),ta=0;if(a){if(a.antialias!==undefined)Q=a.antialias;a.clearColor!==undefined&&ma.setHex(a.clearColor);if(a.clearAlpha!==undefined)ta=a.clearAlpha}this.maxMorphTargets=8;this.domElement=N;this.autoClear=!0;this.sortObjects=!0;(function(l,z,t){try{if(!(e=N.getContext("experimental-webgl",{antialias:l})))throw"Error creating WebGL context.";}catch(n){console.error(n)}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.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(z.r,z.g,z.b,t);_cullEnabled=!0})(Q,ma,ta);this.context=e;this.setSize=function(l,z){N.width=l;N.height=z;this.setViewport(0,0,N.width,N.height)};this.setViewport=function(l,z,t,n){ea=l;xa=z;ja=t;ha=n;e.viewport(ea,xa,ja,ha)};this.setScissor=function(l,z,t,n){e.scissor(l,z,t,n)};this.enableScissorTest=function(l){l?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite= function(l){e.depthMask(l)};this.setClearColorHex=function(l,z){var t=new THREE.Color(l);e.clearColor(t.r,t.g,t.b,z)};this.setClearColor=function(l,z){e.clearColor(l.r,l.g,l.b,z)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,z,t,n){var p,C,A;if(l instanceof THREE.MeshDepthMaterial)b(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)b(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)b(l,THREE.ShaderLib.basic); else if(l instanceof THREE.MeshLambertMaterial)b(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)b(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)b(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&b(l,THREE.ShaderLib.particle_basic);var D,O,X,E;A=X=E=0;for(D=z.length;A0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+D.maxPointLights,"#define MAX_BONES "+D.maxBones,D.map?"#define USE_MAP":"",D.envMap?"#define USE_ENVMAP": "",D.lightMap?"#define USE_LIGHTMAP":"",D.vertexColors?"#define USE_COLOR":"",D.skinning?"#define USE_SKINNING":"",D.morphTargets?"#define USE_MORPHTARGETS":"",D.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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); e.attachShader(t,L("fragment",A+E));e.attachShader(t,L("vertex",D+z));e.linkProgram(t);e.getProgramParameter(t,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(t,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");t.uniforms={};t.attributes={};l.program=t;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(p in l.uniforms)t.push(p);p= l.program;E=0;for(z=t.length;E=0&&e.enableVertexAttribArray(C.color);C.normal>=0&&e.enableVertexAttribArray(C.normal); C.tangent>=0&&e.enableVertexAttribArray(C.tangent);if(l.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0){e.enableVertexAttribArray(C.skinVertexA);e.enableVertexAttribArray(C.skinVertexB);e.enableVertexAttribArray(C.skinIndex);e.enableVertexAttribArray(C.skinWeight)}if(l.morphTargets){l.numSupportedMorphTargets=0;if(C.morphTarget0>=0){e.enableVertexAttribArray(C.morphTarget0);l.numSupportedMorphTargets++}if(C.morphTarget1>=0){e.enableVertexAttribArray(C.morphTarget1); l.numSupportedMorphTargets++}if(C.morphTarget2>=0){e.enableVertexAttribArray(C.morphTarget2);l.numSupportedMorphTargets++}if(C.morphTarget3>=0){e.enableVertexAttribArray(C.morphTarget3);l.numSupportedMorphTargets++}if(C.morphTarget4>=0){e.enableVertexAttribArray(C.morphTarget4);l.numSupportedMorphTargets++}if(C.morphTarget5>=0){e.enableVertexAttribArray(C.morphTarget5);l.numSupportedMorphTargets++}if(C.morphTarget6>=0){e.enableVertexAttribArray(C.morphTarget6);l.numSupportedMorphTargets++}if(C.morphTarget7>= 0){e.enableVertexAttribArray(C.morphTarget7);l.numSupportedMorphTargets++}n.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(p=0;p=0;p--){n=t.__webglObjects[p].object;z==n&&t.__webglObjects.splice(p,1)}l.__objectsRemoved.splice(0,1)}z=0;for(t=l.__webglObjects.length;z0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,P,D)}if($a&&na>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,oa,D)}if(ab){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,La,D);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, A.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ka,D)}if(H>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,fa,D);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,pa,D);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,sa,D);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ua,D)}}}p.__dirtyVertices=!1;p.__dirtyMorphTargets=!1;p.__dirtyElements=!1;p.__dirtyUvs= !1;p.__dirtyNormals=!1;p.__dirtyTangents=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;C=e.DYNAMIC_DRAW;E=void 0;E=void 0;aa=void 0;A=void 0;X=n.vertices;D=n.colors;na=X.length;O=D.length;wa=n.__vertexArray;ka=n.__colorArray;Da=n.__dirtyColors;if(n.__dirtyVertices){for(E=0;E0}}; 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 d,f=b.length;for(d=0;d= 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=d=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.dragToLook&&!this.mouseDragOn&&(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 d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.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(m,q,y,u){var o={name:y,fps:0.6,length:u,hierarchy:[]},v,B=q.getControlPointsArray(),F=q.getLength(),w=B.length,G=0;v=w-1;q={parent:-1,keys:[]};q.keys[0]={time:0,pos:B[0],rot:[0,0,0,1],scl:[1,1,1]};q.keys[v]={time:u,pos:B[v],rot:[0,0,0,1],scl:[1,1,1]};for(v=1;v=0?u:u+f;u=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange; this.phi=(this.phi-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.target.position;u.x=100*Math.sin(this.phi)*Math.cos(this.theta);u.y=100*Math.cos(this.phi);u.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,m,q,y)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.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),k=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,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&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(m,q){return function(){q.apply(m,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; THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null}; THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML= c},loadAsciiOld:function(a,c){var b=document.createElement("script");b.type="text/javascript";b.onload=c;b.src=a;document.getElementsByTagName("head")[0].appendChild(b)},loadAscii:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,b,d)};c.postMessage(a)},loadBinary:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path: THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,f,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,f,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0; h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,b,f,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)}, createBinModel:function(a,c,b,d){var f=function(g){function h(t,n){var p=q(t,n),C=q(t,n+1),A=q(t,n+2),D=q(t,n+3),O=(D<<1&255|A>>7)-127;p|=(A&127)<<16|C<<8;if(p==0&&O==-127)return 0;return(1-2*(D>>7))*(1+p*Math.pow(2,-23))*Math.pow(2,O)}function j(t,n){var p=q(t,n),C=q(t,n+1),A=q(t,n+2);return(q(t,n+3)<<24)+(A<<16)+(C<<8)+p}function k(t,n){var p=q(t,n);return(q(t,n+1)<<8)+p}function m(t,n){var p=q(t,n);return p>127?p-256:p}function q(t,n){return t.charCodeAt(n)&255}function y(t){var n,p,C;n=j(a,t); p=j(a,t+Y);C=j(a,t+N);t=k(a,t+e);THREE.Loader.prototype.f3(w,n,p,C,t)}function u(t){var n,p,C,A,D,O;n=j(a,t);p=j(a,t+Y);C=j(a,t+N);A=k(a,t+e);D=j(a,t+W);O=j(a,t+R);t=j(a,t+da);THREE.Loader.prototype.f3n(w,L,n,p,C,A,D,O,t)}function o(t){var n,p,C,A;n=j(a,t);p=j(a,t+ga);C=j(a,t+I);A=j(a,t+ca);t=k(a,t+za);THREE.Loader.prototype.f4(w,n,p,C,A,t)}function v(t){var n,p,C,A,D,O,X,E;n=j(a,t);p=j(a,t+ga);C=j(a,t+I);A=j(a,t+ca);D=k(a,t+za);O=j(a,t+ea);X=j(a,t+xa);E=j(a,t+ja);t=j(a,t+ha);THREE.Loader.prototype.f4n(w, L,n,p,C,A,D,O,X,E,t)}function B(t){var n,p;n=j(a,t);p=j(a,t+va);t=j(a,t+Aa);THREE.Loader.prototype.uv3(w.uvs,J[n*2],J[n*2+1],J[p*2],J[p*2+1],J[t*2],J[t*2+1])}function F(t){var n,p,C;n=j(a,t);p=j(a,t+ia);C=j(a,t+$);t=j(a,t+qa);THREE.Loader.prototype.uv4(w.uvs,J[n*2],J[n*2+1],J[p*2],J[p*2+1],J[C*2],J[C*2+1],J[t*2],J[t*2+1])}var w=this,G=0,x,L=[],J=[],Y,N,e,W,R,da,ga,I,ca,za,ea,xa,ja,ha,va,Aa,ia,$,qa,ra,Q,ma,ta,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,d,g);x={signature:a.substr(G, 8),header_bytes:q(a,G+8),vertex_coordinate_bytes:q(a,G+9),normal_coordinate_bytes:q(a,G+10),uv_coordinate_bytes:q(a,G+11),vertex_index_bytes:q(a,G+12),normal_index_bytes:q(a,G+13),uv_index_bytes:q(a,G+14),material_index_bytes:q(a,G+15),nvertices:j(a,G+16),nnormals:j(a,G+16+4),nuvs:j(a,G+16+8),ntri_flat:j(a,G+16+12),ntri_smooth:j(a,G+16+16),ntri_flat_uv:j(a,G+16+20),ntri_smooth_uv:j(a,G+16+24),nquad_flat:j(a,G+16+28),nquad_smooth:j(a,G+16+32),nquad_flat_uv:j(a,G+16+36),nquad_smooth_uv:j(a,G+16+40)}; G+=x.header_bytes;Y=x.vertex_index_bytes;N=x.vertex_index_bytes*2;e=x.vertex_index_bytes*3;W=x.vertex_index_bytes*3+x.material_index_bytes;R=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;da=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;ga=x.vertex_index_bytes;I=x.vertex_index_bytes*2;ca=x.vertex_index_bytes*3;za=x.vertex_index_bytes*4;ea=x.vertex_index_bytes*4+x.material_index_bytes;xa=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes;ja= x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*2;ha=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*3;va=x.uv_index_bytes;Aa=x.uv_index_bytes*2;ia=x.uv_index_bytes;$=x.uv_index_bytes*2;qa=x.uv_index_bytes*3;g=x.vertex_index_bytes*3+x.material_index_bytes;z=x.vertex_index_bytes*4+x.material_index_bytes;ra=x.ntri_flat*g;Q=x.ntri_smooth*(g+x.normal_index_bytes*3);ma=x.ntri_flat_uv*(g+x.uv_index_bytes*3);ta=x.ntri_smooth_uv*(g+x.normal_index_bytes*3+x.uv_index_bytes* 3);l=x.nquad_flat*z;g=x.nquad_smooth*(z+x.normal_index_bytes*4);z=x.nquad_flat_uv*(z+x.uv_index_bytes*4);G+=function(t){for(var n,p,C,A=x.vertex_coordinate_bytes*3,D=t+x.nvertices*A;t=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 d=this.count*3;dthis.size-1&&(k=this.size-1);var u=Math.floor(m-j);u<1&&(u=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var o=Math.floor(q-j);o<1&&(o=1);j=Math.floor(q+j); j>this.size-1&&(j=this.size-1);for(var v,B,F,w,G,x;y0&&(this.field[F+v]+=w)}}}};this.addPlaneX=function(b,d){var f,g,h,j,k,m=this.size,q=this.yd,y=this.zd,u=this.field,o=m*Math.sqrt(b/d);o>m&&(o=m);for(f=0;f0)for(g=0;gq&&(v=q);for(g=0;g0){k=g*y;for(f=0;fsize&&(dist=size);for(h=0;h0){k=zd*h;for(g=0;g0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,j,u)))-1);m.push(q)}c.push(m)}var o,v,B;f=c.length;for(b=0;b0)for(d=0;d1){o=this.vertices[h].position.clone(); v=this.vertices[k].position.clone();B=this.vertices[m].position.clone();o.normalize();v.normalize();B.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([q,y,F])}}}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,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=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(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),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){d=(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(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][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 Icosahedron=function(a){function c(y,u,o){var v=Math.sqrt(y*y+u*u+o*o);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(y/v,u/v,o/v)))-1}function b(y,u,o,v){v.faces.push(new THREE.Face3(y,u,o))}function d(y,u){var o=f.vertices[y].position,v=f.vertices[u].position;return c((o.x+v.x)/2,(o.y+v.y)/2,(o.z+v.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;a