// 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,e,g,h,j,k;if(b==0)d=e=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;e=b;g=a;break;case 2:d=a;e=b;g=c;break;case 3:d=a;e=k;g=b;break;case 4:d=c;e=a;g=b;break;case 5:d=b;e=a;g=k;break;case 6:case 0:d=b;e=c;g=a}}this.r=d;this.g=e;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,e=[];a=0;for(c=d.length;a0&&J>0&&Q+J<1}var b,d,e,g,h,j,k,o,t,x, y,q=a.geometry,A=q.vertices,H=[];b=0;for(d=q.faces.length;bk?d:k;e=e>o?e:o}a()}; this.add3Points=function(k,o,t,x,y,q){if(j){j=!1;c=kt?k>y?k:y:t>y?t:y;e=o>x?o>q?o:q:x>q?x:q}else{c=kt?k>y?k>d?k:d:y>d?y:d:t>y?t>d?t:d:y>d?y:d;e=o>x?o>q?o>e?o:e:q>e?q:e:x>q?x>e?x:e:q>e?q:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=ck.getRight()? d:k.getRight();e=e>k.getBottom()?e:k.getBottom()}a()};this.inflate=function(k){c-=k;b-=k;d+=k;e+=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(e,k.getBottom())-Math.max(b,k.getTop())>=0};this.empty=function(){j=!0;e=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,e,g,h,j,k,o,t,x,y,q,A,H){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,o||0,t||1,x||0,y||0,q||0,A||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,o,t,x,y,q,A,H){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=o;this.n33=t;this.n34=x;this.n41=y;this.n42=q;this.n43=A;this.n44=H;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, e=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()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=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)*e;a.y=(this.n21*c+this.n22*b+this.n23* d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;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,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,o=a.n24,t=a.n31,x=a.n32,y=a.n33,q=a.n34,A=a.n41,H=a.n42,J=a.n43,F=a.n44,K=c.n11,z=c.n12,I=c.n13,Q=c.n14,Z=c.n21,V=c.n22, f=c.n23,fa=c.n24,R=c.n31,W=c.n32,na=c.n33,N=c.n34;this.n11=b*K+d*Z+e*R;this.n12=b*z+d*V+e*W;this.n13=b*I+d*f+e*na;this.n14=b*Q+d*fa+e*N+g;this.n21=h*K+j*Z+k*R;this.n22=h*z+j*V+k*W;this.n23=h*I+j*f+k*na;this.n24=h*Q+j*fa+k*N+o;this.n31=t*K+x*Z+y*R;this.n32=t*z+x*V+y*W;this.n33=t*I+x*f+y*na;this.n34=t*Q+x*fa+y*N+q;this.n41=A*K+H*Z+J*R;this.n42=A*z+H*V+J*W;this.n43=A*I+H*f+J*na;this.n44=A*Q+H*fa+J*N+F;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,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,t=this.n33,x=this.n34,y=this.n41,q=this.n42,A=this.n43,H=this.n44;return d*h*o*y-b*j*o*y-d*g*t*y+c*j*t*y+b*g*x*y-c*h*x*y-d*h*k*q+b*j*k*q+d*e*t*q-a*j*t*q-b*e*x*q+a*h*x*q+d*g*k*A-c*j*k*A-d*e*o*A+a*j*o*A+c*e*x*A-a*g*x*A-b*g*k*H+c*h*k*H+b*e*o*H-a*h*o*H-c*e*t*H+a*g*t*H},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),e=1-b,g=a.x,h=a.y,j=a.z,k=e*g,o=e*h;this.set(k* g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,o*h+b,o*j-d*g,0,k*j-d*h,o*j+d*g,e*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 e=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=e*g;this.n12=-e*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var c= a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var o=b*h;b*=j;d*=j;g*=e;h*=e;e*=j;this.n11=1-(o+d);this.n12=k-e;this.n13=c+h;this.n21=k+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+o);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34= a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=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*e;this.n23=a.n23*e;this.n33=a.n33*e}}; THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,o=a.n24,t=a.n31,x=a.n32,y=a.n33,q=a.n34,A=a.n41,H=a.n42,J=a.n43,F=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*q*H-o*y*H+o*x*J-j*q*J-k*x*F+j*y*F;c.n12=g*y*H-e*q*H-g*x*J+d*q*J+e*x*F-d*y*F;c.n13=e*o*H-g*k*H+g*j*J-d*o*J-e*j*F+d*k*F;c.n14=g*k*x-e*o*x-g*j*y+d*o*y+e*j*q-d*k*q;c.n21=o*y*A-k*q*A-o*t*J+h*q*J+k*t*F-h*y*F;c.n22=e*q*A-g*y*A+g*t*J-b*q*J-e*t*F+b*y*F;c.n23=g*k*A-e*o*A-g*h*J+b*o*J+e*h*F-b*k*F; c.n24=e*o*t-g*k*t+g*h*y-b*o*y-e*h*q+b*k*q;c.n31=j*q*A-o*x*A+o*t*H-h*q*H-j*t*F+h*x*F;c.n32=g*x*A-d*q*A-g*t*H+b*q*H+d*t*F-b*x*F;c.n33=e*o*A-g*j*A+g*h*H-b*o*H-d*h*F+b*j*F;c.n34=g*j*t-d*o*t-g*h*x+b*o*x+d*h*q-b*j*q;c.n41=k*x*A-j*y*A-k*t*H+h*y*H+j*t*J-h*x*J;c.n42=d*y*A-e*x*A+e*t*H-b*y*H-d*t*J+b*x*J;c.n43=e*j*A-d*k*A-e*h*H+b*k*H+d*h*J-b*j*J;c.n44=d*k*t-e*j*t+e*h*x-b*k*x-d*h*y+b*j*y;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,e=-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,o=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*o;b[7]=a*t;b[8]=a*x;return c}; THREE.Matrix4.makeFrustum=function(a,c,b,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*e/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)}; THREE.Matrix4.makeOrtho=function(a,c,b,d,e,g){var h,j,k,o;h=new THREE.Matrix4;j=c-a;k=b-d;o=g-e;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/o;h.n34=-((g+e)/o);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible= !0;this._vector=new THREE.Vector3}; THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!== undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!== 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var d=this.children.length;a=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);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}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,c,b,d,e,g,h){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}}; THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]}; for(var c=1,b=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.zthis.boundingBox.z[1])this.boundingBox.z[1]= a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;cthis.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;o=this.points[b[0]];t=this.points[b[1]]; x=this.points[b[2]];y=this.points[b[3]];j=h*h;k=h*j;d.x=c(o.x,t.x,x.x,y.x,h,j,k);d.y=c(o.y,t.y,x.y,y.y,h,j,k);d.z=c(o.z,t.z,x.z,y.z,h,j,k);return d};this.getControlPointsArray=function(){var q,A,H=this.points.length,J=[];for(q=0;q1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+q);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= this.getPrevKeyWith("pos",q,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",q,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[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(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&t[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(q=0;qa.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]];o=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],j[0],k[0],o[0],e,b,h);d[1]=this.interpolate(g[1],j[1],k[1],o[1],e,b,h);d[2]=this.interpolate(g[2],j[2],k[2],o[2],e,b,h);return d}; THREE.Animation.prototype.interpolate=function(a,c,b,d,e,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*e+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,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=e||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&&ta>=0&&qa>=0&&ua>=0)return!0;else if(xa<0&&ta<0||qa<0&&ua<0)return!1;else{if(xa<0)na=Math.max(na,xa/(xa-ta));else ta<0&&(N=Math.min(N,xa/(xa-ta)));if(qa<0)na=Math.max(na,qa/(qa-ua));else ua<0&&(N=Math.min(N,qa/(qa-ua)));if(Nxa&&h.positionScreen.z0&&z.z<1){ea=F[J]=F[J]||new THREE.RenderableParticle;J++;H=ea;H.x=z.x/z.w;H.y=z.y/z.w;H.z=z.z;H.rotation=pa.rotation.z;H.scale.x=pa.scale.x*Math.abs(H.x-(z.x+W.projectionMatrix.n11)/(z.w+W.projectionMatrix.n14)); H.scale.y=pa.scale.y*Math.abs(H.y-(z.y+W.projectionMatrix.n22)/(z.w+W.projectionMatrix.n24));H.materials=pa.materials;N.push(H)}}}}na&&N.sort(c);return N}}; THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,o,t,x,y,q,A,H;a=c.projectScene(h,j);k=0;for(o=a.length;k0){B.r+=Na.r*ja;B.g+=Na.g*ja;B.b+=Na.b*ja}}else if(ja instanceof THREE.PointLight){n.sub(ja.position,ga);n.normalize();ja=X.dot(n)*Pa;if(ja>0){B.r+=Na.r*ja;B.g+=Na.g*ja;B.b+=Na.b*ja}}}}function ia(L,ga,X){if(X.opacity!=0){a(X.opacity);c(X.blending);var B,T,ja,Na,Pa,La; if(X instanceof THREE.ParticleBasicMaterial){if(X.map){Na=X.map.image;Pa=Na.width>>1;La=Na.height>>1;X=ga.scale.x*j;ja=ga.scale.y*k;B=X*Pa;T=ja*La;Y.set(L.x-B,L.y-T,L.x+B,L.y+T);if(sa.instersects(Y)){o.save();o.translate(L.x,L.y);o.rotate(-ga.rotation);o.scale(X,-ja);o.translate(-Pa,-La);o.drawImage(Na,0,0);o.restore()}}}else if(X instanceof THREE.ParticleCanvasMaterial){if(ya){za.r=m.r+D.r+p.r;za.g=m.g+D.g+p.g;za.b=m.b+D.b+p.b;R.r=X.color.r*za.r;R.g=X.color.g*za.g;R.b=X.color.b*za.b;R.updateStyleString()}else R.__styleString= X.color.__styleString;B=ga.scale.x*j;T=ga.scale.y*k;Y.set(L.x-B,L.y-T,L.x+B,L.y+T);if(sa.instersects(Y)){o.save();o.translate(L.x,L.y);o.rotate(-ga.rotation);o.scale(B,T);X.program(o,R);o.restore()}}}}function Ja(L,ga,X,B){if(B.opacity!=0){a(B.opacity);c(B.blending);o.beginPath();o.moveTo(L.positionScreen.x,L.positionScreen.y);o.lineTo(ga.positionScreen.x,ga.positionScreen.y);o.closePath();if(B instanceof THREE.LineBasicMaterial){R.__styleString=B.color.__styleString;L=B.linewidth;if(J!=L)o.lineWidth= J=L;L=R.__styleString;if(A!=L)o.strokeStyle=A=L;o.stroke();Y.inflate(B.linewidth*2)}}}function Ra(L,ga,X,B,T,ja){if(T.opacity!=0){a(T.opacity);c(T.blending);I=L.positionScreen.x;Q=L.positionScreen.y;Z=ga.positionScreen.x;V=ga.positionScreen.y;f=X.positionScreen.x;fa=X.positionScreen.y;o.beginPath();o.moveTo(I,Q);o.lineTo(Z,V);o.lineTo(f,fa);o.lineTo(I,Q);o.closePath();if(T instanceof THREE.MeshBasicMaterial)if(T.map)T.map.mapping instanceof THREE.UVMapping&&O(I,Q,Z,V,f,fa,T.map.image,B.uvs[0].u,B.uvs[0].v, B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(T.envMap){if(T.envMap.mapping instanceof THREE.SphericalReflectionMapping){L=va.matrixWorldInverse;n.copy(B.vertexNormalsWorld[0]);la=(n.x*L.n11+n.y*L.n12+n.z*L.n13)*0.5+0.5;ka=-(n.x*L.n21+n.y*L.n22+n.z*L.n23)*0.5+0.5;n.copy(B.vertexNormalsWorld[1]);oa=(n.x*L.n11+n.y*L.n12+n.z*L.n13)*0.5+0.5;pa=-(n.x*L.n21+n.y*L.n22+n.z*L.n23)*0.5+0.5;n.copy(B.vertexNormalsWorld[2]);ea=(n.x*L.n11+n.y*L.n12+n.z*L.n13)*0.5+0.5;da=-(n.x*L.n21+n.y*L.n22+n.z*L.n23)* 0.5+0.5;O(I,Q,Z,V,f,fa,T.envMap.image,la,ka,oa,pa,ea,da)}}else T.wireframe?ra(T.color.__styleString,T.wireframeLinewidth):Ga(T.color.__styleString);else if(T instanceof THREE.MeshLambertMaterial){if(T.map&&!T.wireframe){T.map.mapping instanceof THREE.UVMapping&&O(I,Q,Z,V,f,fa,T.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);c(THREE.SubtractiveBlending)}if(ya)if(!T.wireframe&&T.shading==THREE.SmoothShading&&B.vertexNormalsWorld.length==3){W.r=na.r=N.r=m.r;W.g=na.g=N.g= m.g;W.b=na.b=N.b=m.b;wa(ja,B.v1.positionWorld,B.vertexNormalsWorld[0],W);wa(ja,B.v2.positionWorld,B.vertexNormalsWorld[1],na);wa(ja,B.v3.positionWorld,B.vertexNormalsWorld[2],N);xa.r=(na.r+N.r)*0.5;xa.g=(na.g+N.g)*0.5;xa.b=(na.b+N.b)*0.5;ua=Oa(W,na,N,xa);O(I,Q,Z,V,f,fa,ua,0,0,1,0,0,1)}else{za.r=m.r;za.g=m.g;za.b=m.b;wa(ja,B.centroidWorld,B.normalWorld,za);R.r=T.color.r*za.r;R.g=T.color.g*za.g;R.b=T.color.b*za.b;R.updateStyleString();T.wireframe?ra(R.__styleString,T.wireframeLinewidth):Ga(R.__styleString)}else T.wireframe? ra(T.color.__styleString,T.wireframeLinewidth):Ga(T.color.__styleString)}else if(T instanceof THREE.MeshDepthMaterial){ta=va.near;qa=va.far;W.r=W.g=W.b=1-Fa(L.positionScreen.z,ta,qa);na.r=na.g=na.b=1-Fa(ga.positionScreen.z,ta,qa);N.r=N.g=N.b=1-Fa(X.positionScreen.z,ta,qa);xa.r=(na.r+N.r)*0.5;xa.g=(na.g+N.g)*0.5;xa.b=(na.b+N.b)*0.5;ua=Oa(W,na,N,xa);O(I,Q,Z,V,f,fa,ua,0,0,1,0,0,1)}else if(T instanceof THREE.MeshNormalMaterial){R.r=Sa(B.normalWorld.x);R.g=Sa(B.normalWorld.y);R.b=Sa(B.normalWorld.z);R.updateStyleString(); T.wireframe?ra(R.__styleString,T.wireframeLinewidth):Ga(R.__styleString)}}}function ra(L,ga){if(A!=L)o.strokeStyle=A=L;if(J!=ga)o.lineWidth=J=ga;o.stroke();Y.inflate(ga*2)}function Ga(L){if(H!=L)o.fillStyle=H=L;o.fill()}function O(L,ga,X,B,T,ja,Na,Pa,La,Ba,Ha,Ca,Ia){var Aa,Da;Aa=Na.width-1;Da=Na.height-1;Pa*=Aa;La*=Da;Ba*=Aa;Ha*=Da;Ca*=Aa;Ia*=Da;X-=L;B-=ga;T-=L;ja-=ga;Ba-=Pa;Ha-=La;Ca-=Pa;Ia-=La;Aa=Ba*Ia-Ca*Ha;if(Aa!=0){Da=1/Aa;Aa=(Ia*X-Ha*T)*Da;Ha=(Ia*B-Ha*ja)*Da;X=(Ba*T-Ca*X)*Da;B=(Ba*ja-Ca*B)* Da;L=L-Aa*Pa-X*La;ga=ga-Ha*Pa-B*La;o.save();o.transform(Aa,Ha,X,B,L,ga);o.clip();o.drawImage(Na,0,0);o.restore()}}function Oa(L,ga,X,B){var T=~~(L.r*255),ja=~~(L.g*255);L=~~(L.b*255);var Na=~~(ga.r*255),Pa=~~(ga.g*255);ga=~~(ga.b*255);var La=~~(X.r*255),Ba=~~(X.g*255);X=~~(X.b*255);var Ha=~~(B.r*255),Ca=~~(B.g*255);B=~~(B.b*255);G[0]=T<0?0:T>255?255:T;G[1]=ja<0?0:ja>255?255:ja;G[2]=L<0?0:L>255?255:L;G[4]=Na<0?0:Na>255?255:Na;G[5]=Pa<0?0:Pa>255?255:Pa;G[6]=ga<0?0:ga>255?255:ga;G[8]=La<0?0:La>255?255: La;G[9]=Ba<0?0:Ba>255?255:Ba;G[10]=X<0?0:X>255?255:X;G[12]=Ha<0?0:Ha>255?255:Ha;G[13]=Ca<0?0:Ca>255?255:Ca;G[14]=B<0?0:B>255?255:B;E.putImageData(C,0,0);P.drawImage(w,0,0);return S}function Fa(L,ga,X){L=(L-ga)/(X-ga);return L*L*(3-2*L)}function Sa(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function U(L,ga){var X=ga.x-L.x,B=ga.y-L.y,T=1/Math.sqrt(X*X+B*B);X*=T;B*=T;ga.x+=X;ga.y+=B;L.x-=X;L.y-=B}var $,aa,ma,Ka,Xa,Ma,Va,Qa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,j,k);b=d.projectScene(ca,va,this.sortElements); (ya=ca.lights.length>0)&&ha(ca);$=0;for(aa=b.length;$0){oa.r+=da.color.r*sa;oa.g+=da.color.g*sa;oa.b+=da.color.b*sa}}else if(da instanceof THREE.PointLight){fa.sub(da.position,ka.centroidWorld);fa.normalize();sa=ka.normalWorld.dot(fa)*da.intensity;if(sa>0){oa.r+=da.color.r*sa;oa.g+=da.color.g*sa;oa.b+=da.color.b*sa}}}}function c(la,ka, oa,pa,ea,da){N=d(xa++);N.setAttribute("d","M "+la.positionScreen.x+" "+la.positionScreen.y+" L "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+oa.positionScreen.x+","+oa.positionScreen.y+"z");if(ea instanceof THREE.MeshBasicMaterial)z.__styleString=ea.color.__styleString;else if(ea instanceof THREE.MeshLambertMaterial)if(K){I.r=Q.r;I.g=Q.g;I.b=Q.b;a(da,pa,I);z.r=ea.color.r*I.r;z.g=ea.color.g*I.g;z.b=ea.color.b*I.b;z.updateStyleString()}else z.__styleString=ea.color.__styleString;else if(ea instanceof THREE.MeshDepthMaterial){f=1-ea.__2near/(ea.__farPlusNear-pa.z*ea.__farMinusNear);z.setRGB(f,f,f)}else ea instanceof THREE.MeshNormalMaterial&&z.setRGB(e(pa.normalWorld.x),e(pa.normalWorld.y),e(pa.normalWorld.z));ea.wireframe?N.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ea.wireframeLinewidth+"; stroke-opacity: "+ea.opacity+"; stroke-linecap: "+ea.wireframeLinecap+"; stroke-linejoin: "+ea.wireframeLinejoin):N.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+ ea.opacity);j.appendChild(N)}function b(la,ka,oa,pa,ea,da,sa){N=d(xa++);N.setAttribute("d","M "+la.positionScreen.x+" "+la.positionScreen.y+" L "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+oa.positionScreen.x+","+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(da instanceof THREE.MeshBasicMaterial)z.__styleString=da.color.__styleString;else if(da instanceof THREE.MeshLambertMaterial)if(K){I.r=Q.r;I.g=Q.g;I.b=Q.b;a(sa,ea,I);z.r=da.color.r*I.r;z.g=da.color.g*I.g; z.b=da.color.b*I.b;z.updateStyleString()}else z.__styleString=da.color.__styleString;else if(da instanceof THREE.MeshDepthMaterial){f=1-da.__2near/(da.__farPlusNear-ea.z*da.__farMinusNear);z.setRGB(f,f,f)}else da instanceof THREE.MeshNormalMaterial&&z.setRGB(e(ea.normalWorld.x),e(ea.normalWorld.y),e(ea.normalWorld.z));da.wireframe?N.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+da.wireframeLinewidth+"; stroke-opacity: "+da.opacity+"; stroke-linecap: "+da.wireframeLinecap+ "; stroke-linejoin: "+da.wireframeLinejoin):N.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+da.opacity);j.appendChild(N)}function d(la){if(R[la]==null){R[la]=document.createElementNS("http://www.w3.org/2000/svg","path");ua==0&&R[la].setAttribute("shape-rendering","crispEdges")}return R[la]}function e(la){return la<0?Math.min((1+la)*0.5,0.5):0.5+Math.min(la*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,o,t,x,y,q,A,H,J= new THREE.Rectangle,F=new THREE.Rectangle,K=!1,z=new THREE.Color(16777215),I=new THREE.Color(16777215),Q=new THREE.Color(0),Z=new THREE.Color(0),V=new THREE.Color(0),f,fa=new THREE.Vector3,R=[],W=[],na=[],N,xa,ta,qa,ua=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(la){switch(la){case "high":ua=1;break;case "low":ua=0}};this.setSize=function(la,ka){k=la;o=ka;t=k/2;x=o/2;j.setAttribute("viewBox",-t+" "+-x+" "+k+" "+o);j.setAttribute("width", k);j.setAttribute("height",o);J.set(-t,-x,t,x)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(la,ka){var oa,pa,ea,da,sa,Ea,Y,ya;this.autoClear&&this.clear();g=h.projectScene(la,ka,this.sortElements);qa=ta=xa=0;if(K=la.lights.length>0){Y=la.lights;Q.setRGB(0,0,0);Z.setRGB(0,0,0);V.setRGB(0,0,0);oa=0;for(pa=Y.length;oa 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\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:[]},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(m,D,p){var n,w,E,C=m.vertices,G=C.length,S=m.colors,P=S.length,M=m.__vertexArray,ca=m.__colorArray,va=m.__sortArray,ha=m.__dirtyVertices,wa=m.__dirtyColors;if(p.sortParticles){pa.multiplySelf(p.matrixWorld);for(n=0;nS){P=M;S=G[P]}f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[P]);f.vertexAttribPointer(D["morphTarget"+p],3,f.FLOAT,!1,0, 0);E.__webGLMorphTargetInfluences[p]=S;C[P]=1;S=-1;p++}}f.uniform1fv(n.program.uniforms.morphTargetInfluences,E.__webGLMorphTargetInfluences)}else{f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(m.position,3,f.FLOAT,!1,0,0)}if(m.color>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLColorBuffer);f.vertexAttribPointer(m.color,3,f.FLOAT,!1,0,0)}if(m.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLNormalBuffer);f.vertexAttribPointer(m.normal,3,f.FLOAT,!1,0,0)}if(m.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER, w.__webGLTangentBuffer);f.vertexAttribPointer(m.tangent,4,f.FLOAT,!1,0,0)}if(m.uv>=0)if(w.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUVBuffer);f.vertexAttribPointer(m.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(m.uv)}else f.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(w.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUV2Buffer);f.vertexAttribPointer(m.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(m.uv2)}else f.disableVertexAttribArray(m.uv2);if(n.skinning&&m.skinVertexA>=0&& m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexABuffer);f.vertexAttribPointer(m.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexBBuffer);f.vertexAttribPointer(m.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinIndicesBuffer);f.vertexAttribPointer(m.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinWeightsBuffer);f.vertexAttribPointer(m.skinWeight,4,f.FLOAT,!1,0,0)}if(E instanceof THREE.Mesh)if(n.wireframe){f.lineWidth(n.wireframeLinewidth);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLLineBuffer);f.drawElements(f.LINES,w.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,w.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(n.linewidth);f.drawArrays(E,0,w.__webGLLineCount)}else if(E instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS, 0,w.__webGLParticleCount);else E instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,0,w.__webGLVertexCount)}}function g(m,D){if(!m.__webGLVertexBuffer)m.__webGLVertexBuffer=f.createBuffer();if(!m.__webGLNormalBuffer)m.__webGLNormalBuffer=f.createBuffer();if(m.hasPos){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,m.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(D.attributes.position);f.vertexAttribPointer(D.attributes.position,3,f.FLOAT,!1,0,0)}if(m.hasNormal){f.bindBuffer(f.ARRAY_BUFFER, m.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,m.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(D.attributes.normal);f.vertexAttribPointer(D.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,m.count);m.count=0}function h(m){if(na!=m.doubleSided){m.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);na=m.doubleSided}if(N!=m.flipSided){m.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);N=m.flipSided}}function j(m){if(ta!=m){m?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST); ta=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 D;for(m=0;m<6;m++){D=oa[m];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function o(m){for(var D=m.matrixWorld,p=-m.geometry.boundingSphere.radius* Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),n=0;n<6;n++){m=oa[n].x*D.n14+oa[n].y*D.n24+oa[n].z*D.n34+oa[n].w;if(m<=p)return!1}return!0}function t(m,D){m.list[m.count]=D;m.count+=1}function x(m){var D,p,n=m.object,w=m.opaque,E=m.transparent;E.count=0;m=w.count=0;for(D=n.materials.length;m65535){M[S].counter+=1;P=M[S].hash+"_"+M[S].counter;m.geometryGroups[P]==undefined&&(m.geometryGroups[P]={faces:[],materials:G,vertices:0,numMorphTargets:ca})}m.geometryGroups[P].faces.push(w);m.geometryGroups[P].vertices+=C}}function J(m,D,p){m.push({buffer:D,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(m){if(m!=xa){switch(m){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR, f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}xa=m}}function K(m,D,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(m,f.TEXTURE_WRAP_S,Z(D.wrapS));f.texParameteri(m,f.TEXTURE_WRAP_T,Z(D.wrapT));f.texParameteri(m,f.TEXTURE_MAG_FILTER, Z(D.magFilter));f.texParameteri(m,f.TEXTURE_MIN_FILTER,Z(D.minFilter));f.generateMipmap(m)}else{f.texParameteri(m,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(m,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(m,f.TEXTURE_MAG_FILTER,Q(D.magFilter));f.texParameteri(m,f.TEXTURE_MIN_FILTER,Q(D.minFilter))}}function z(m){if(m&&!m.__webGLFramebuffer){m.__webGLFramebuffer=f.createFramebuffer();m.__webGLRenderbuffer=f.createRenderbuffer();m.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER, m.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,m.width,m.height);f.bindTexture(f.TEXTURE_2D,m.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Z(m.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,Z(m.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Z(m.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Z(m.minFilter));f.texImage2D(f.TEXTURE_2D,0,Z(m.format),m.width,m.height,0,Z(m.format),Z(m.type),null);f.bindFramebuffer(f.FRAMEBUFFER, m.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,m.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,m.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var D,p;if(m){D=m.__webGLFramebuffer;p=m.width;m=m.height}else{D=null;p=la;m=ka}if(D!=R){f.bindFramebuffer(f.FRAMEBUFFER,D);f.viewport(qa,ua,p,m);R=D}}function I(m,D){var p;if(m=="fragment")p= f.createShader(f.FRAGMENT_SHADER);else m=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,D);f.compileShader(p);if(!f.getShaderParameter(p,f.COMPILE_STATUS)){console.error(f.getShaderInfoLog(p));console.error(D);return null}return p}function Q(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}} function Z(m){switch(m){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR; case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0} var V=document.createElement("canvas"),f,fa=null,R=null,W=this,na=null,N=null,xa=null,ta=null,qa=0,ua=0,la=0,ka=0,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],pa=new THREE.Matrix4,ea=new Float32Array(16),da=new Float32Array(16),sa=new THREE.Vector4,Ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Y=!0,ya=new THREE.Color(0),za=0;if(a){if(a.antialias!==undefined)Y=a.antialias; a.clearColor!==undefined&&ya.setHex(a.clearColor);if(a.clearAlpha!==undefined)za=a.clearAlpha}this.maxMorphTargets=8;this.domElement=V;this.autoClear=!0;this.sortObjects=!0;(function(m,D,p){try{if(!(f=V.getContext("experimental-webgl",{antialias:m})))throw"Error creating WebGL context.";}catch(n){console.error(n)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA); f.clearColor(D.r,D.g,D.b,p);_cullEnabled=!0})(Y,ya,za);this.context=f;this.setSize=function(m,D){V.width=m;V.height=D;this.setViewport(0,0,V.width,V.height)};this.setViewport=function(m,D,p,n){qa=m;ua=D;la=p;ka=n;f.viewport(qa,ua,la,ka)};this.setScissor=function(m,D,p,n){f.scissor(m,D,p,n)};this.enableScissorTest=function(m){m?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){f.depthMask(m)};this.setClearColorHex=function(m,D){var p=new THREE.Color(m);f.clearColor(p.r, p.g,p.b,D)};this.setClearColor=function(m,D){f.clearColor(m.r,m.g,m.b,D)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(m,D,p,n){var w,E,C;if(m instanceof THREE.MeshDepthMaterial)b(m,THREE.ShaderLib.depth);else if(m instanceof THREE.MeshNormalMaterial)b(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)b(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)b(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)b(m, THREE.ShaderLib.phong);else if(m instanceof THREE.LineBasicMaterial)b(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&b(m,THREE.ShaderLib.particle_basic);var G,S,P,M;C=P=M=0;for(G=D.length;C0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+G.maxDirLights,"#define MAX_POINT_LIGHTS "+G.maxPointLights,"#define MAX_BONES "+G.maxBones,G.map?"#define USE_MAP":"",G.envMap?"#define USE_ENVMAP":"",G.lightMap?"#define USE_LIGHTMAP":"",G.vertexColors?"#define USE_COLOR":"",G.skinning?"#define USE_SKINNING": "",G.morphTargets?"#define USE_MORPHTARGETS":"",G.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"); f.attachShader(p,I("fragment",C+M));f.attachShader(p,I("vertex",G+D));f.linkProgram(p);f.getProgramParameter(p,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(p,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");p.uniforms={};p.attributes={};m.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m.uniforms)p.push(w); w=m.program;M=0;for(D=p.length;M=0&&f.enableVertexAttribArray(E.color);E.normal>=0&&f.enableVertexAttribArray(E.normal); E.tangent>=0&&f.enableVertexAttribArray(E.tangent);if(m.skinning&&E.skinVertexA>=0&&E.skinVertexB>=0&&E.skinIndex>=0&&E.skinWeight>=0){f.enableVertexAttribArray(E.skinVertexA);f.enableVertexAttribArray(E.skinVertexB);f.enableVertexAttribArray(E.skinIndex);f.enableVertexAttribArray(E.skinWeight)}if(m.morphTargets){m.numSupportedMorphTargets=0;if(E.morphTarget0>=0){f.enableVertexAttribArray(E.morphTarget0);m.numSupportedMorphTargets++}if(E.morphTarget1>=0){f.enableVertexAttribArray(E.morphTarget1); m.numSupportedMorphTargets++}if(E.morphTarget2>=0){f.enableVertexAttribArray(E.morphTarget2);m.numSupportedMorphTargets++}if(E.morphTarget3>=0){f.enableVertexAttribArray(E.morphTarget3);m.numSupportedMorphTargets++}if(E.morphTarget4>=0){f.enableVertexAttribArray(E.morphTarget4);m.numSupportedMorphTargets++}if(E.morphTarget5>=0){f.enableVertexAttribArray(E.morphTarget5);m.numSupportedMorphTargets++}if(E.morphTarget6>=0){f.enableVertexAttribArray(E.morphTarget6);m.numSupportedMorphTargets++}if(E.morphTarget7>= 0){f.enableVertexAttribArray(E.morphTarget7);m.numSupportedMorphTargets++}n.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(w=0;w0||wa.faceVertexUvs.length> 0)C.__uvArray=new Float32Array(G*2);if(wa.faceUvs.length>1||wa.faceVertexUvs.length>1)C.__uv2Array=new Float32Array(G*2)}if(P.geometry.skinWeights.length&&P.geometry.skinIndices.length){C.__skinVertexAArray=new Float32Array(G*4);C.__skinVertexBArray=new Float32Array(G*4);C.__skinIndexArray=new Float32Array(G*4);C.__skinWeightArray=new Float32Array(G*4)}C.__faceArray=new Uint16Array(S*3);C.__lineArray=new Uint16Array(va*2);if(C.numMorphTargets){P=void 0;wa=void 0;C.__morphTargetsArrays=[];P=0;for(wa= C.numMorphTargets;P=0;w--){n=p.__webglObjects[w].object;D==n&&p.__webglObjects.splice(w,1)}m.__objectsRemoved.splice(0,1)}D=0;for(p=m.__webglObjects.length;D0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ha,G)}if(hb){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,La,G)}if(ib&&Ta.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,G)}if(db&&Ja>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Na,G)}if(db&&Ra>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Pa,G)}if(gb){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER, C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ya,G);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ua,G)}if(B>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Ca,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,Ia,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,Aa,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER, Da,G)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;E=f.DYNAMIC_DRAW;P=void 0;P=void 0;wa=void 0;C=void 0;M=n.vertices;G=n.colors;ca=M.length;S=G.length;ha=n.__vertexArray;va=n.__colorArray;ia=n.__dirtyColors;if(n.__dirtyVertices){for(P=0;P0}}; 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,e=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);e=(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(o,t,x,y){var q={name:x,fps:0.6,length:y,hierarchy:[]},A,H=t.getControlPointsArray(),J=t.getLength(),F=H.length,K=0;A=F-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:H[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[A]={time:y,pos:H[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A=0?y:y+e;y=this.verticalAngleMap.srcRange;q=this.verticalAngleMap.dstRange; this.phi=(this.phi-y[0])*(q[1]-q[0])/(y[1]-y[0])+q[0];y=this.horizontalAngleMap.srcRange;q=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(q[1]-q[0])/(y[1]-y[0])+q[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,t,x)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),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(o,t){return function(){t.apply(o,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; var Cube=function(a,c,b,d,e,g,h,j,k){function o(J,F,K,z,I,Q,Z,V){var f,fa,R=d||1,W=e||1,na=I/2,N=Q/2,xa=t.vertices.length;if(J=="x"&&F=="y"||J=="y"&&F=="x")f="z";else if(J=="x"&&F=="z"||J=="z"&&F=="x"){f="y";W=g||1}else if(J=="z"&&F=="y"||J=="y"&&F=="z"){f="x";R=g||1}var ta=R+1,qa=W+1;I/=R;var ua=Q/W;for(fa=0;fa0){h(0,0,-o-(g||0));for(d=a;d0){h(0,0,o+(e||0)); for(d=a+a/2;d<2*a;d++)j.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder; var Icosahedron=function(a){function c(x,y,q){var A=Math.sqrt(x*x+y*y+q*q);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(x/A,y/A,q/A)))-1}function b(x,y,q,A){A.faces.push(new THREE.Face3(x,y,q))}function d(x,y){var q=e.vertices[x].position,A=e.vertices[y].position;return c((q.x+A.x)/2,(q.y+A.y)/2,(q.z+A.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0, 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,j,y)))-1);o.push(t)}c.push(o)}var q,A,H;e=c.length;for(b=0;b0)for(d=0;d1){q=this.vertices[h].position.clone(); A=this.vertices[k].position.clone();H=this.vertices[o].position.clone();q.normalize();A.normalize();H.normalize();this.faces.push(new THREE.Face3(h,k,o,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([t,x,J])}}}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 e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));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;e=(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,e,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; var TorusKnot=function(a,c,b,d,e,g,h){function j(x,y,q,A,H,J){y=q/A*x;q=Math.cos(y);return new THREE.Vector3(H*(2+q)*0.5*Math.cos(x),H*(2+q)*Math.sin(x)*0.5,J*H*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a>7)-127;w|=(C&127)<<16|E<<8;if(w==0&&S==-127)return 0;return(1-2*(G>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,S)}function j(p,n){var w=t(p,n),E=t(p,n+1),C=t(p,n+2);return(t(p,n+3)<<24)+(C<<16)+(E<<8)+w}function k(p,n){var w=t(p,n);return(t(p,n+1)<<8)+w}function o(p,n){var w=t(p,n);return w>127?w-256:w}function t(p, n){return p.charCodeAt(n)&255}function x(p){var n,w,E;n=j(a,p);w=j(a,p+Z);E=j(a,p+V);p=k(a,p+f);THREE.BinaryLoader.prototype.f3(F,n,w,E,p)}function y(p){var n,w,E,C,G,S;n=j(a,p);w=j(a,p+Z);E=j(a,p+V);C=k(a,p+f);G=j(a,p+fa);S=j(a,p+R);p=j(a,p+W);THREE.BinaryLoader.prototype.f3n(F,I,n,w,E,C,G,S,p)}function q(p){var n,w,E,C;n=j(a,p);w=j(a,p+na);E=j(a,p+N);C=j(a,p+xa);p=k(a,p+ta);THREE.BinaryLoader.prototype.f4(F,n,w,E,C,p)}function A(p){var n,w,E,C,G,S,P,M;n=j(a,p);w=j(a,p+na);E=j(a,p+N);C=j(a,p+xa); G=k(a,p+ta);S=j(a,p+qa);P=j(a,p+ua);M=j(a,p+la);p=j(a,p+ka);THREE.BinaryLoader.prototype.f4n(F,I,n,w,E,C,G,S,P,M,p)}function H(p){var n,w;n=j(a,p);w=j(a,p+oa);p=j(a,p+pa);THREE.BinaryLoader.prototype.uv3(F.faceVertexUvs[0],Q[n*2],Q[n*2+1],Q[w*2],Q[w*2+1],Q[p*2],Q[p*2+1])}function J(p){var n,w,E;n=j(a,p);w=j(a,p+ea);E=j(a,p+da);p=j(a,p+sa);THREE.BinaryLoader.prototype.uv4(F.faceVertexUvs[0],Q[n*2],Q[n*2+1],Q[w*2],Q[w*2+1],Q[E*2],Q[E*2+1],Q[p*2],Q[p*2+1])}var F=this,K=0,z,I=[],Q=[],Z,V,f,fa,R,W,na, N,xa,ta,qa,ua,la,ka,oa,pa,ea,da,sa,Ea,Y,ya,za,m,D;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,d,g);z={signature:a.substr(K,8),header_bytes:t(a,K+8),vertex_coordinate_bytes:t(a,K+9),normal_coordinate_bytes:t(a,K+10),uv_coordinate_bytes:t(a,K+11),vertex_index_bytes:t(a,K+12),normal_index_bytes:t(a,K+13),uv_index_bytes:t(a,K+14),material_index_bytes:t(a,K+15),nvertices:j(a,K+16),nnormals:j(a,K+16+4),nuvs:j(a,K+16+8),ntri_flat:j(a,K+16+12),ntri_smooth:j(a,K+16+16),ntri_flat_uv:j(a, K+16+20),ntri_smooth_uv:j(a,K+16+24),nquad_flat:j(a,K+16+28),nquad_smooth:j(a,K+16+32),nquad_flat_uv:j(a,K+16+36),nquad_smooth_uv:j(a,K+16+40)};K+=z.header_bytes;Z=z.vertex_index_bytes;V=z.vertex_index_bytes*2;f=z.vertex_index_bytes*3;fa=z.vertex_index_bytes*3+z.material_index_bytes;R=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;W=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;na=z.vertex_index_bytes;N=z.vertex_index_bytes*2;xa=z.vertex_index_bytes*3;ta= z.vertex_index_bytes*4;qa=z.vertex_index_bytes*4+z.material_index_bytes;ua=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;la=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;ka=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;oa=z.uv_index_bytes;pa=z.uv_index_bytes*2;ea=z.uv_index_bytes;da=z.uv_index_bytes*2;sa=z.uv_index_bytes*3;g=z.vertex_index_bytes*3+z.material_index_bytes;D=z.vertex_index_bytes*4+z.material_index_bytes;Ea=z.ntri_flat* g;Y=z.ntri_smooth*(g+z.normal_index_bytes*3);ya=z.ntri_flat_uv*(g+z.uv_index_bytes*3);za=z.ntri_smooth_uv*(g+z.normal_index_bytes*3+z.uv_index_bytes*3);m=z.nquad_flat*D;g=z.nquad_smooth*(D+z.normal_index_bytes*4);D=z.nquad_flat_uv*(D+z.uv_index_bytes*4);K+=function(p){for(var n,w,E,C=z.vertex_coordinate_bytes*3,G=p+z.nvertices*C;p= 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 y=Math.floor(o-j);y<1&&(y=1);o=Math.floor(o+j);o>this.size-1&&(o=this.size-1);var q=Math.floor(t- j);q<1&&(q=1);j=Math.floor(t+j);j>this.size-1&&(j=this.size-1);for(var A,H,J,F,K,z;x0&&(this.field[J+A]+=F)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,o=this.size,t=this.yd,x=this.zd,y=this.field,q=o*Math.sqrt(b/d);q>o&&(q=o);for(e=0;e0)for(g=0;gt&&(A=t);for(g=0;g0){k=g*x;for(e=0;esize&&(dist=size);for(h=0;h0){k=zd*h;for(g=0;g