// ThreeWebGL.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,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,f,i,j,p,n;if(c==0)e=f=i=0;else{j=Math.floor(a*6);p=a*6-j;a=c*(1-b);n=c*(1-b*p);b=c*(1-b*(1-p));switch(j){case 1:e=n;f=c;i=a;break;case 2:e=a;f=c;i=b;break;case 3:e=a;f=n;i=c;break;case 4:e=b;f=a;i=c;break;case 5:e=c;f=a;i=n;break;case 6:case 0:e=c;f=b;i=a}}this.r=e;this.g=f;this.b=i;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,b){this.set(a||0,b||0)}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;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,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.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,b,c){this.set(a||0,b||0,c||0)}; THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.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,b){this.set(a.x-b.x,a.y-b.y,a.z-b.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, b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.set(c*a.z-e*a.y,e*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.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 b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+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 b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}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,b,c,e){this.set(a||0,b||0,c||0,e||1)}; THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.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,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.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,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,f=[];a=0;for(b=e.length;a0&&O>0&&R+O< 1}var c,e,f,i,j,p,n,s,y,A,D,z=a.geometry,J=z.vertices,K=[];c=0;for(e=z.faces.length;cn?e:n;f=f>s?f:s}a()}; this.add3Points=function(n,s,y,A,D,z){if(p){p=!1;b=ny?n>D?n:D:y>D?y:D;f=s>A?s>z?s:z:A>z?A:z}else{b=ny?n>D?n>e?n:e:D>e?D:e:y>D?y>e?y:e:D>e?D:e;f=s>A?s>z?s>f?s:f:z>f?z:f:A>z?A>f?A:f:z>f?z:f}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();c=n.getTop();e=n.getRight();f=n.getBottom()}else{b=bn.getRight()? e:n.getRight();f=f>n.getBottom()?f:n.getBottom()}a()};this.inflate=function(n){b-=n;c-=n;e+=n;f+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();c=c>n.getTop()?c:n.getTop();e=e=0&&Math.min(f,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){p=!0;f=e=c=b=0;a()};this.isEmpty=function(){return p}}; THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}}; THREE.Matrix4=function(a,b,c,e,f,i,j,p,n,s,y,A,D,z,J,K){this.set(a||1,b||0,c||0,e||0,f||0,i||1,j||0,p||0,n||0,s||0,y||1,A||0,D||0,z||0,J||0,K||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4.prototype={set:function(a,b,c,e,f,i,j,p,n,s,y,A,D,z,J,K){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=i;this.n23=j;this.n24=p;this.n31=n;this.n32=s;this.n33=y;this.n34=A;this.n41=D;this.n42=z;this.n43=J;this.n44=K;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,b,c){var e=THREE.Matrix4.__v1, f=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(a,b).normalize();if(i.length()===0)i.z=1;e.cross(c,i).normalize();if(e.length()===0){i.x+=1.0E-4;e.cross(c,i).normalize()}f.cross(i,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=i.x;this.n21=e.y;this.n22=f.y;this.n23=i.y;this.n31=e.z;this.n32=f.z;this.n33=i.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23* e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize(); return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,y=a.n31,A=a.n32,D=a.n33,z=a.n34,J=a.n41,K=a.n42,O=a.n43,L=a.n44,ha=b.n11,ma=b.n12,pa=b.n13,R=b.n14,B=b.n21,sa=b.n22, d=b.n23,Da=b.n24,Aa=b.n31,Q=b.n32,N=b.n33,ta=b.n34;this.n11=c*ha+e*B+f*Aa;this.n12=c*ma+e*sa+f*Q;this.n13=c*pa+e*d+f*N;this.n14=c*R+e*Da+f*ta+i;this.n21=j*ha+p*B+n*Aa;this.n22=j*ma+p*sa+n*Q;this.n23=j*pa+p*d+n*N;this.n24=j*R+p*Da+n*ta+s;this.n31=y*ha+A*B+D*Aa;this.n32=y*ma+A*sa+D*Q;this.n33=y*pa+A*d+D*N;this.n34=y*R+A*Da+D*ta+z;this.n41=J*ha+K*B+O*Aa;this.n42=J*ma+K*sa+O*Q;this.n43=J*pa+K*d+O*N;this.n44=J*R+K*Da+O*ta+L;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11; c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(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,b=this.n12,c=this.n13,e=this.n14,f=this.n21,i=this.n22,j=this.n23,p=this.n24,n=this.n31,s=this.n32,y=this.n33,A=this.n34,D=this.n41,z=this.n42,J=this.n43,K=this.n44;return e*j*s*D-c*p*s*D-e*i*y*D+b*p*y*D+c*i*A*D-b*j*A*D-e*j*n*z+c*p*n*z+e*f*y*z-a*p*y*z-c*f*A*z+a*j*A*z+e*i*n*J-b*p*n*J-e*f*s*J+a*p*s*J+b*f*A*J-a*i*A*J-c*i*n*K+b*j*n*K+c*f*s*K-a*j*s*K-b*f*y*K+a*i*y*K},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,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0, 0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f= 1-c,i=a.x,j=a.y,p=a.z,n=f*i,s=f*j;this.set(n*i+c,n*j-e*p,n*p+e*j,0,n*j+e*p,s*j+c,s*p-e*i,0,n*p-e*j,s*p+e*i,f*p*p+c,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 b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var i=Math.cos(e);e=Math.sin(e);var j=a*c,p=b*c;this.n11=f*i;this.n12=-f*e;this.n13=c;this.n21=p*i+a*e;this.n22=-p*e+a*i;this.n23=-b*f;this.n31=-j*i+b*e;this.n32=j*e+b*i;this.n33= a*f;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,i=b+b,j=c+c,p=e+e;a=b*i;var n=b*j;b*=p;var s=c*j;c*=p;e*=p;i*=f;j*=f;f*=p;this.n11=1-(s+e);this.n12=n-f;this.n13=b+j;this.n21=n+f;this.n22=1-(a+e);this.n23=c-i;this.n31=b-j;this.n32=c+i;this.n33=1-(a+s);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14= a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}}; THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,y=a.n31,A=a.n32,D=a.n33,z=a.n34,J=a.n41,K=a.n42,O=a.n43,L=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*z*K-s*D*K+s*A*O-p*z*O-n*A*L+p*D*L;b.n12=i*D*K-f*z*K-i*A*O+e*z*O+f*A*L-e*D*L;b.n13=f*s*K-i*n*K+i*p*O-e*s*O-f*p*L+e*n*L;b.n14=i*n*A-f*s*A-i*p*D+e*s*D+f*p*z-e*n*z;b.n21=s*D*J-n*z*J-s*y*O+j*z*O+n*y*L-j*D*L;b.n22=f*z*J-i*D*J+i*y*O-c*z*O-f*y*L+c*D*L;b.n23=i*n*J-f*s*J-i*j*O+c*s*O+f*j*L-c*n*L; b.n24=f*s*y-i*n*y+i*j*D-c*s*D-f*j*z+c*n*z;b.n31=p*z*J-s*A*J+s*y*K-j*z*K-p*y*L+j*A*L;b.n32=i*A*J-e*z*J-i*y*K+c*z*K+e*y*L-c*A*L;b.n33=f*s*J-i*p*J+i*j*K-c*s*K-e*j*L+c*p*L;b.n34=i*p*y-e*s*y-i*j*A+c*s*A+e*j*z-c*p*z;b.n41=n*A*J-p*D*J-n*y*K+j*D*K+p*y*O-j*A*O;b.n42=e*D*J-f*A*J+f*y*K-c*D*K-e*y*O+c*A*O;b.n43=f*p*J-e*n*J-f*j*K+c*n*K+e*j*O-c*p*O;b.n44=e*n*y-f*p*y+f*j*A-c*n*A-e*j*D+c*p*D;b.multiplyScalar(1/a.determinant());return b}; THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,s=a.n23*a.n12-a.n22*a.n13,y=-a.n23*a.n11+a.n21*a.n13,A=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*s;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*i;c[3]=a*j;c[4]=a*p;c[5]=a*n;c[6]=a*s;c[7]=a*y;c[8]=a*A;return b}; THREE.Matrix4.makeFrustum=function(a,b,c,e,f,i){var j;j=new THREE.Matrix4;j.n11=2*f/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*f/(e-c);j.n23=(e+c)/(e-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+f)/(i-f);j.n34=-2*i*f/(i-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,c,e){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)}; THREE.Matrix4.makeOrtho=function(a,b,c,e,f,i){var j,p,n,s;j=new THREE.Matrix4;p=b-a;n=c-e;s=i-f;j.n11=2/p;j.n12=0;j.n13=0;j.n14=-((b+a)/p);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+e)/n);j.n31=0;j.n32=0;j.n33=-2/s;j.n34=-((i+f)/s);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible= !0;this._vector=new THREE.Vector3}; THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.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 b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,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,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var i=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-e)*i)/j;e=Math.sin(e*i)/j;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,e,f,i){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,e,f,i,j){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;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,b,c;a=0;for(b=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 b=1,c=this.vertices.length;bthis.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,b=0,c=this.vertices.length;b1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+z);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+(i[0]-f[0])*e;c.y=f[1]+(i[1]-f[1])*e;c.z=f[2]+(i[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= this.getPrevKeyWith("pos",z,j.index-1).pos;this.points[1]=f;this.points[2]=i;this.points[3]=this.getNextKeyWith("pos",z,p.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);c.x=f[0];c.y=f[1];c.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c=== "rot")THREE.Quaternion.slerp(f,i,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=f[0]+(i[0]-f[0])*e;c.y=f[1]+(i[1]-f[1])*e;c.z=f[2]+(i[2]-f[2])*e}}}}if(this.JITCompile&&y[0][s]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;za.length-2?i:i+1;c[3]=i>a.length-3?i:i+2;i=a[c[0]];p=a[c[1]];n=a[c[2]];s=a[c[3]];c=f*f;j=f*c;e[0]=this.interpolate(i[0],p[0],n[0],s[0],f,c,j);e[1]=this.interpolate(i[1],p[1],n[1],s[1],f,c,j);e[2]=this.interpolate(i[2],p[2],n[2],s[2],f,c,j);return e}; THREE.Animation.prototype.interpolate=function(a,b,c,e,f,i,j){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*j+(-3*(b-c)-2*a-e)*i+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]}; THREE.Camera=function(a,b,c,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype; THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.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,b,c){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);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate= !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e=this.LODs[e].visibleAtDistance){this.LODs[e-1].object3D.visible= !1;this.LODs[e].object3D.visible=!0}else break;for(;e=0&&ia>=0&&V>=0&&ja>=0)return!0;else if(Ba<0&&ia<0||V<0&&ja<0)return!1;else{if(Ba<0)ta=Math.max(ta,Ba/(Ba-ia));else ia<0&&(ua=Math.min(ua,Ba/(Ba-ia)));if(V<0)ta=Math.max(ta,V/(V-ja));else ja<0&&(ua=Math.min(ua,V/(V-ja)));if(uaBa&&j.positionScreen.z0&&R.z<1){Na=ma[ha]=ma[ha]||new THREE.RenderableParticle;ha++;L=Na;L.x=R.x/R.w;L.y=R.y/R.w;L.z=R.z;L.rotation=la.rotation.z;L.scale.x=la.scale.x*Math.abs(L.x-(R.x+N.projectionMatrix.n11)/(R.w+N.projectionMatrix.n14));L.scale.y=la.scale.y*Math.abs(L.y-(R.y+N.projectionMatrix.n22)/(R.w+N.projectionMatrix.n24));L.materials=la.materials;ua.push(L)}}}}ta&&ua.sort(b);return ua}}; 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,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,f=c.length;for(e=0;e 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 b(g,m,o){var h,k,t,q=g.vertices,r=q.length,E=g.colors,x=E.length,v=g.__vertexArray,M=g.__colorArray,U=g.__sortArray,H=g.__dirtyVertices,P=g.__dirtyColors;if(o.sortParticles){S.multiplySelf(o.matrixWorld);for(h=0;hE){x=v;E=r[x]}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[x]);d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=E;q[x]=1;E=-1;o++}}d.uniform1fv(h.program.uniforms.morphTargetInfluences, t.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(g.position,3,d.FLOAT,!1,0,0)}if(g.color>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLColorBuffer);d.vertexAttribPointer(g.color,3,d.FLOAT,!1,0,0)}if(g.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLNormalBuffer);d.vertexAttribPointer(g.normal,3,d.FLOAT,!1,0,0)}if(g.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLTangentBuffer);d.vertexAttribPointer(g.tangent,4,d.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER, k.__webGLUVBuffer);d.vertexAttribPointer(g.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv)}else d.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLUV2Buffer);d.vertexAttribPointer(g.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv2)}else d.disableVertexAttribArray(g.uv2);if(h.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);d.vertexAttribPointer(g.skinVertexA, 4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);d.vertexAttribPointer(g.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);d.vertexAttribPointer(g.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);d.vertexAttribPointer(g.skinWeight,4,d.FLOAT,!1,0,0)}if(t instanceof THREE.Mesh)if(h.wireframe){d.lineWidth(h.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);d.drawElements(d.LINES, k.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,k.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(h.linewidth);d.drawArrays(t,0,k.__webGLLineCount)}else if(t instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,k.__webGLParticleCount);else t instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function i(g,m){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer= d.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=d.createBuffer();if(g.hasPos){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,g.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.position);d.vertexAttribPointer(m.attributes.position,3,d.FLOAT,!1,0,0)}if(g.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,g.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.normal);d.vertexAttribPointer(m.attributes.normal, 3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,g.count);g.count=0}function j(g){if(N!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);N=g.doubleSided}if(ta!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);ta=g.flipSided}}function p(g){if(Ba!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);Ba=g}}function n(g){X[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);X[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);X[2].set(g.n41+g.n21,g.n42+g.n22, g.n43+g.n23,g.n44+g.n24);X[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);X[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);X[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=X[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function s(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),h=0;h<6;h++){g=X[h].x*m.n14+X[h].y*m.n24+X[h].z*m.n34+X[h].w;if(g<=o)return!1}return!0}function y(g, m){g.list[g.count]=m;g.count+=1}function A(g){var m,o,h=g.object,k=g.opaque,t=g.transparent;t.count=0;g=k.count=0;for(m=h.materials.length;g65535){v[E].counter+=1;x=v[E].hash+"_"+v[E].counter;g.geometryGroups[x]==undefined&&(g.geometryGroups[x]= {faces:[],materials:r,vertices:0,numMorphTargets:M})}g.geometryGroups[x].faces.push(k);g.geometryGroups[x].vertices+=q}}function O(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(g){if(g!=ua){switch(g){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA); break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}ua=g}}function ha(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){d.texParameteri(g,d.TEXTURE_WRAP_S,B(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,B(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,B(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,B(m.minFilter));d.generateMipmap(g)}else{d.texParameteri(g, d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_MAG_FILTER,R(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,R(m.minFilter))}}function ma(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=d.createFramebuffer();g.__webGLRenderbuffer=d.createRenderbuffer();g.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,g.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,g.width,g.height);d.bindTexture(d.TEXTURE_2D, g.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,B(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,B(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,B(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,B(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,B(g.format),g.width,g.height,0,B(g.format),B(g.type),null);d.bindFramebuffer(d.FRAMEBUFFER,g.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,g.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER, d.DEPTH_ATTACHMENT,d.RENDERBUFFER,g.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=ja;g=ka}if(m!=Aa){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(ia,V,o,g);Aa=m}}function pa(g,m){var o;if(g=="fragment")o=d.createShader(d.FRAGMENT_SHADER);else g=="vertex"&&(o=d.createShader(d.VERTEX_SHADER));d.shaderSource(o,m);d.compileShader(o);if(!d.getShaderParameter(o, d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(o));console.error(m);return null}return o}function R(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return d.LINEAR}}function B(g){switch(g){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT; case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT; case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var sa=document.createElement("canvas"),d,Da=null,Aa=null,Q=this,N=null,ta=null,ua=null,Ba=null,ia=0,V=0,ja=0,ka=0,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Matrix4,xa=new Float32Array(16),na=new Float32Array(16),ya=new THREE.Vector4,Ka={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},la=!0,Na=new THREE.Color(0),Va=0;if(a){if(a.antialias!==undefined)la=a.antialias;a.clearColor!==undefined&&Na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Va=a.clearAlpha}this.maxMorphTargets=8;this.domElement=sa;this.autoClear=!0;this.sortObjects= !0;(function(g,m,o){try{if(!(d=sa.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(h){console.error(h)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(la,Na,Va);this.context=d;this.setSize=function(g,m){sa.width=g;sa.height=m;this.setViewport(0,0,sa.width,sa.height)}; this.setViewport=function(g,m,o,h){ia=g;V=m;ja=o;ka=h;d.viewport(ia,V,ja,ka)};this.setScissor=function(g,m,o,h){d.scissor(g,m,o,h)};this.enableScissorTest=function(g){g?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){d.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);d.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){d.clearColor(g.r,g.g,g.b,m)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial= function(g,m,o,h){var k,t,q;if(g instanceof THREE.MeshDepthMaterial)c(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)c(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)c(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)c(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)c(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)c(g,THREE.ShaderLib.basic);else g instanceof THREE.ParticleBasicMaterial&& c(g,THREE.ShaderLib.particle_basic);var r,E,x,v;q=x=v=0;for(r=m.length;q0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.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"); d.attachShader(o,pa("fragment",q+v));d.attachShader(o,pa("vertex",r+m));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k); k=g.program;v=0;for(m=o.length;v=0&&d.enableVertexAttribArray(t.color);t.normal>=0&&d.enableVertexAttribArray(t.normal); t.tangent>=0&&d.enableVertexAttribArray(t.tangent);if(g.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0){d.enableVertexAttribArray(t.skinVertexA);d.enableVertexAttribArray(t.skinVertexB);d.enableVertexAttribArray(t.skinIndex);d.enableVertexAttribArray(t.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(t.morphTarget0>=0){d.enableVertexAttribArray(t.morphTarget0);g.numSupportedMorphTargets++}if(t.morphTarget1>=0){d.enableVertexAttribArray(t.morphTarget1); g.numSupportedMorphTargets++}if(t.morphTarget2>=0){d.enableVertexAttribArray(t.morphTarget2);g.numSupportedMorphTargets++}if(t.morphTarget3>=0){d.enableVertexAttribArray(t.morphTarget3);g.numSupportedMorphTargets++}if(t.morphTarget4>=0){d.enableVertexAttribArray(t.morphTarget4);g.numSupportedMorphTargets++}if(t.morphTarget5>=0){d.enableVertexAttribArray(t.morphTarget5);g.numSupportedMorphTargets++}if(t.morphTarget6>=0){d.enableVertexAttribArray(t.morphTarget6);g.numSupportedMorphTargets++}if(t.morphTarget7>= 0){d.enableVertexAttribArray(t.morphTarget7);g.numSupportedMorphTargets++}h.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k0||P.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(P.faceUvs.length>1||P.faceVertexUvs.length> 1)q.__uv2Array=new Float32Array(r*2)}if(x.geometry.skinWeights.length&&x.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(E*3);q.__lineArray=new Uint16Array(U*2);if(q.numMorphTargets){x=void 0;P=void 0;q.__morphTargetsArrays=[];x=0;for(P=q.numMorphTargets;x=0;k--){h=o.__webglObjects[k].object;m==h&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,wa,r)}if(cb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,r)}if(db&&Ea.hasTangents){d.bindBuffer(d.ARRAY_BUFFER, q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,r)}if(Xa&&Y>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ya,r)}if(Xa&&Fa>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(bb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Pa,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ja,r)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer); d.bufferData(d.ARRAY_BUFFER,da,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ea,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,fa,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ga,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices|| k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;x=void 0;P=void 0;q=void 0;v=h.vertices;r=h.colors;M=v.length;E=r.length;H=h.__vertexArray;U=h.__colorArray;I=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x0}};