diff --git a/build/Three.js b/build/Three.js index 8069b0a65a397818fb0add9cafb80ed39babc4c4..a9f786f7c525a3214ca9a785fe650ecfeee84ad4 100755 --- a/build/Three.js +++ b/build/Three.js @@ -24,8 +24,8 @@ THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[ THREE.Matrix4.prototype={set:function(b,c,d,e,f,g,j,k,m,o,n,p,t,u,v,z){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=n;this.n34=p;this.n41=t;this.n42=u;this.n43=v;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var e=THREE.Matrix4.__v1, f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(b,c).normalize();if(g.length()===0)g.z=1;e.cross(d,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(d,g).normalize());f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,f=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*f;b.y=(this.n21*c+this.n22*d+this.n23* e+this.n24)*f;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*f;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,f=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*f;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*f;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+d*this.n32+e*this.n33;b.normalize(); -return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,n=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,z=b.n42,A=b.n43,x=b.n44,G=c.n11,y=c.n12,D=c.n13,F=c.n14,B=c.n21,P=c.n22, -K=c.n23,L=c.n24,E=c.n31,M=c.n32,T=c.n33,h=c.n34;this.n11=d*G+e*B+f*E;this.n12=d*y+e*P+f*M;this.n13=d*D+e*K+f*T;this.n14=d*F+e*L+f*h+g;this.n21=j*G+k*B+m*E;this.n22=j*y+k*P+m*M;this.n23=j*D+k*K+m*T;this.n24=j*F+k*L+m*h+o;this.n31=n*G+p*B+t*E;this.n32=n*y+p*P+t*M;this.n33=n*D+p*K+t*T;this.n34=n*F+p*L+t*h+u;this.n41=v*G+z*B+A*E;this.n42=v*y+z*P+A*M;this.n43=v*D+z*K+A*T;this.n44=v*F+z*L+A*h+x;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]= +return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,n=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,z=b.n42,A=b.n43,y=b.n44,F=c.n11,x=c.n12,D=c.n13,G=c.n14,B=c.n21,Q=c.n22, +K=c.n23,L=c.n24,E=c.n31,M=c.n32,U=c.n33,h=c.n34;this.n11=d*F+e*B+f*E;this.n12=d*x+e*Q+f*M;this.n13=d*D+e*K+f*U;this.n14=d*G+e*L+f*h+g;this.n21=j*F+k*B+m*E;this.n22=j*x+k*Q+m*M;this.n23=j*D+k*K+m*U;this.n24=j*G+k*L+m*h+o;this.n31=n*F+p*B+t*E;this.n32=n*x+p*Q+t*M;this.n33=n*D+p*K+t*U;this.n34=n*G+p*L+t*h+u;this.n41=v*F+z*B+A*E;this.n42=v*x+z*Q+A*M;this.n43=v*D+z*K+A*U;this.n44=v*G+z*L+A*h+y;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]= this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b= this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,n=this.n33,p=this.n34,t=this.n41,u=this.n42,v=this.n43,z=this.n44;return e*j*o*t-d*k*o*t-e*g*n*t+c*k*n*t+d*g*p*t-c*j*p*t-e*j*m*u+d*k*m*u+e*f*n*u-b*k*n*u-d*f*p*u+b*j*p*u+e*g*m*v-c*k*m*v-e*f*o*v+b*k*o*v+c*f*p*v-b*g*p*v-d*g*m*z+c*j*m*z+d*f*o*z-b*j*o*z-c*f*n*z+b*g*n*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32= this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21; @@ -36,8 +36,8 @@ g+d,m*j-e*k,m*k+e*j,0,m*j+e*k,o*j+d,o*k-e*g,0,m*k-e*j,o*k+e*g,f*k*k+d,0,0,0,0,1) this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var c=b.x,d=b.y,e=b.z,b=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),j=b*d,k=c*d;this.n11=f*g;this.n12=-f*e;this.n13=d;this.n21=k*g+b*e;this.n22=-k*e+b*g;this.n23=-c*f;this.n31=-j*g+c*e;this.n32=j*e+c*g;this.n33=b*f;return this}, setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,f=b.w,g=c+c,j=d+d,k=e+e,b=c*g,m=c*j;c*=k;var o=d*j;d*=k;e*=k;g*=f;j*=f;f*=k;this.n11=1-(o+e);this.n12=m-f;this.n13=c+j;this.n21=m+f;this.n22=1-(b+e);this.n23=d-g;this.n31=c-j;this.n32=d+g;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14= b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,f=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*f;this.n23=b.n23*f;this.n33=b.n33*f}}; -THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,n=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,z=b.n42,A=b.n43,x=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*u*z-o*t*z+o*p*A-k*u*A-m*p*x+k*t*x;c.n12=g*t*z-f*u*z-g*p*A+e*u*A+f*p*x-e*t*x;c.n13=f*o*z-g*m*z+g*k*A-e*o*A-f*k*x+e*m*x;c.n14=g*m*p-f*o*p-g*k*t+e*o*t+f*k*u-e*m*u;c.n21=o*t*v-m*u*v-o*n*A+j*u*A+m*n*x-j*t*x;c.n22=f*u*v-g*t*v+g*n*A-d*u*A-f*n*x+d*t*x;c.n23=g*m*v-f*o*v-g*j*A+d*o*A+f*j*x-d*m*x;c.n24= -f*o*n-g*m*n+g*j*t-d*o*t-f*j*u+d*m*u;c.n31=k*u*v-o*p*v+o*n*z-j*u*z-k*n*x+j*p*x;c.n32=g*p*v-e*u*v-g*n*z+d*u*z+e*n*x-d*p*x;c.n33=f*o*v-g*k*v+g*j*z-d*o*z-e*j*x+d*k*x;c.n34=g*k*n-e*o*n-g*j*p+d*o*p+e*j*u-d*k*u;c.n41=m*p*v-k*t*v-m*n*z+j*t*z+k*n*A-j*p*A;c.n42=e*t*v-f*p*v+f*n*z-d*t*z-e*n*A+d*p*A;c.n43=f*k*v-e*m*v-f*j*z+d*m*z+e*j*A-d*k*A;c.n44=e*m*n-f*k*n+f*j*p-d*m*p-e*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,n=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,z=b.n42,A=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*u*z-o*t*z+o*p*A-k*u*A-m*p*y+k*t*y;c.n12=g*t*z-f*u*z-g*p*A+e*u*A+f*p*y-e*t*y;c.n13=f*o*z-g*m*z+g*k*A-e*o*A-f*k*y+e*m*y;c.n14=g*m*p-f*o*p-g*k*t+e*o*t+f*k*u-e*m*u;c.n21=o*t*v-m*u*v-o*n*A+j*u*A+m*n*y-j*t*y;c.n22=f*u*v-g*t*v+g*n*A-d*u*A-f*n*y+d*t*y;c.n23=g*m*v-f*o*v-g*j*A+d*o*A+f*j*y-d*m*y;c.n24= +f*o*n-g*m*n+g*j*t-d*o*t-f*j*u+d*m*u;c.n31=k*u*v-o*p*v+o*n*z-j*u*z-k*n*y+j*p*y;c.n32=g*p*v-e*u*v-g*n*z+d*u*z+e*n*y-d*p*y;c.n33=f*o*v-g*k*v+g*j*z-d*o*z-e*j*y+d*k*y;c.n34=g*k*n-e*o*n-g*j*p+d*o*p+e*j*u-d*k*u;c.n41=m*p*v-k*t*v-m*n*z+j*t*z+k*n*A-j*p*A;c.n42=e*t*v-f*p*v+f*n*z-d*t*z-e*n*A+d*p*A;c.n43=f*k*v-e*m*v-f*j*z+d*m*z+e*j*A-d*k*A;c.n44=e*m*n-f*k*n+f*j*p-d*m*p-e*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c}; THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,f=-b.n33*b.n21+b.n31*b.n23,g=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*g;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*o;d[7]=b*n;d[8]=b*p;return c}; THREE.Matrix4.makeFrustum=function(b,c,d,e,f,g){var j;j=new THREE.Matrix4;j.n11=2*f/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*f/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+f)/(g-f);j.n34=-2*g*f/(g-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var f,b=d*Math.tan(b*Math.PI/360);f=-b;return THREE.Matrix4.makeFrustum(f*c,b*c,f,b,d,e)}; THREE.Matrix4.makeOrtho=function(b,c,d,e,f,g){var j,k,m,o;j=new THREE.Matrix4;k=c-b;m=d-e;o=g-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+e)/m);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((g+f)/o);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; @@ -59,9 +59,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,d;b=0;for(c=this.f d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,f,g,j,k=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e0){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,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1, this.LODs[e].object3D.visible=!0;else break;for(;ep&&(d=n,n=p,p=d):nu&&(d=t,t=u,u=d):tp&&(d=n,n=p,p=d):nu&&(d=t,t=u,u=d):t=0&&g>=0&&j>=0&&k>=0?!0:f<0&&g<0||j<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),j<0?c=Math.max(c,j/(j-k)):k<0&&(e=Math.min(e,j/(j-k))),e=0&&g>=0&&j>=0&&k>=0?!0:f<0&&g<0||j<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),j<0?c=Math.max(c,j/(j-k)):k<0&&(e=Math.min(e,j/(j-k))),eD&&j.positionScreen.z0&&F.z<1))S=y[G]=y[G]||new THREE.RenderableParticle,G++,x=S,x.x=F.x/F.w,x.y=F.y/F.w,x.z=F.z,x.rotation=I.rotation.z,x.scale.x=I.scale.x*Math.abs(x.x-(F.x+f.projectionMatrix.n11)/(F.w+ -f.projectionMatrix.n14)),x.scale.y=I.scale.y*Math.abs(x.y-(F.y+f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24)),x.materials=I.materials,g.push(x);h&&g.sort(c);return g}}; +D=f.near,O=f.far,aa,V,W,ga,Y,da,ea,ka,fa,I,T,Z,$,ia,X,H,ha;F=z=t=n=0;f.matrixAutoUpdate&&f.update(void 0,!0);e.update(void 0,!1,f);B.multiply(f.projectionMatrix,f.matrixWorldInverse);K[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);K[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);K[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);K[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);K[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);K[5].set(B.n41+B.n31,B.n42+B.n32, +B.n43+B.n33,B.n44+B.n34);for(aa=0;aa<6;aa++)fa=K[aa],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(e,f,!0);e=0;for(aa=fa.length;eD&&j.positionScreen.z0&&G.z<1))T=x[F]=x[F]||new THREE.RenderableParticle,F++,y=T,y.x=G.x/G.w,y.y=G.y/G.w,y.z=G.z,y.rotation=I.rotation.z,y.scale.x=I.scale.x*Math.abs(y.x-(G.x+f.projectionMatrix.n11)/(G.w+ +f.projectionMatrix.n14)),y.scale.y=I.scale.y*Math.abs(y.y-(G.y+f.projectionMatrix.n22)/(G.w+f.projectionMatrix.n24)),y.materials=I.materials,g.push(y);h&&g.sort(c);return g}}; THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,e,f,g;this.domElement=document.createElement("div");this.setSize=function(b,c){d=b;e=c;f=d/2;g=e/2};this.render=function(d,e){var m,o,n,p,t,u,v,z;b=c.projectScene(d,e);m=0;for(o=b.length;m>1,qa=o.height>> -1,g=h.scale.x*t,m=h.scale.y*u,j=g*p,k=m*qa,X.set(b.x-j,b.y-k,b.x+j,b.y+k),sa.instersects(X)&&(v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(g,-m),v.translate(-p,-qa),v.drawImage(o,0,0),v.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*t,k=h.scale.y*u,X.set(b.x-j,b.y-k,b.x+j,b.y+k),sa.instersects(X)&&(e(g.color),f(g.color),v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(j,k),g.program(v),v.restore()))}function x(b,h,f,g){c(g.opacity);d(g.blending); -v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(h.positionScreen.x,h.positionScreen.y);v.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(F!=b)v.lineWidth=F=b;b=g.linecap;if(B!=b)v.lineCap=B=b;b=g.linejoin;if(P!=b)v.lineJoin=P=b;e(g.color);v.stroke();X.inflate(g.linewidth*2)}}function z(b,e,h,f,k,m,o,X,n){j.data.vertices+=3;j.data.faces++;c(X.opacity);d(X.blending);Q=b.positionScreen.x;R=b.positionScreen.y;N=e.positionScreen.x;aa=e.positionScreen.y;U=h.positionScreen.x; -V=h.positionScreen.y;A(Q,R,N,aa,U,V);if(X instanceof THREE.MeshBasicMaterial)if(X.map)X.map.mapping instanceof THREE.UVMapping&&(ma=o.uvs[0],va(Q,R,N,aa,U,V,X.map.image,ma[f].u,ma[f].v,ma[k].u,ma[k].v,ma[m].u,ma[m].v));else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=g.matrixWorldInverse,oa.copy(o.vertexNormalsWorld[0]),ja=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,na=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(o.vertexNormalsWorld[1]),Aa=(oa.x*b.n11+oa.y* -b.n12+oa.z*b.n13)*0.5+0.5,ya=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(o.vertexNormalsWorld[2]),ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,O=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,va(Q,R,N,aa,U,V,X.envMap.image,ja,na,Aa,ya,ca,O)}else X.wireframe?D(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):C(X.color);else if(X instanceof THREE.MeshLambertMaterial)X.map&&!X.wireframe&&(X.map.mapping instanceof THREE.UVMapping&&(ma=o.uvs[0],va(Q,R,N,aa,U,V,X.map.image,ma[f].u, -ma[f].v,ma[k].u,ma[k].v,ma[m].u,ma[m].v)),d(THREE.SubtractiveBlending)),Ta?!X.wireframe&&X.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(S.r=Z.r=$.r=qa.r,S.g=Z.g=$.g=qa.g,S.b=Z.b=$.b=qa.b,p(n,o.v1.positionWorld,o.vertexNormalsWorld[0],S),p(n,o.v2.positionWorld,o.vertexNormalsWorld[1],Z),p(n,o.v3.positionWorld,o.vertexNormalsWorld[2],$),ia.r=(Z.r+$.r)*0.5,ia.g=(Z.g+$.g)*0.5,ia.b=(Z.b+$.b)*0.5,ha=w(S,Z,$,ia),va(Q,R,N,aa,U,V,ha,0,0,1,0,0,1)):(ta.r=qa.r,ta.g=qa.g,ta.b=qa.b,p(n,o.centroidWorld, -o.normalWorld,ta),I.r=Math.max(0,Math.min(X.color.r*ta.r,1)),I.g=Math.max(0,Math.min(X.color.g*ta.g,1)),I.b=Math.max(0,Math.min(X.color.b*ta.b,1)),I.updateHex(),X.wireframe?D(I,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):C(I)):X.wireframe?D(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):C(X.color);else if(X instanceof THREE.MeshDepthMaterial)Y=g.near,H=g.far,S.r=S.g=S.b=1-Ea(b.positionScreen.z,Y,H),Z.r=Z.g=Z.b=1-Ea(e.positionScreen.z,Y,H),$.r=$.g=$.b=1-Ea(h.positionScreen.z, -Y,H),ia.r=(Z.r+$.r)*0.5,ia.g=(Z.g+$.g)*0.5,ia.b=(Z.b+$.b)*0.5,ha=w(S,Z,$,ia),va(Q,R,N,aa,U,V,ha,0,0,1,0,0,1);else if(X instanceof THREE.MeshNormalMaterial)I.r=Ja(o.normalWorld.x),I.g=Ja(o.normalWorld.y),I.b=Ja(o.normalWorld.z),I.updateHex(),X.wireframe?D(I,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):C(I)}function y(b,e,h,f,k,X,o,m,n){j.data.vertices+=4;j.data.faces++;c(m.opacity);d(m.blending);if(m.map||m.envMap)z(b,e,f,0,1,3,o,m,n),z(k,h,X,1,2,3,o,m,n);else if(Q=b.positionScreen.x, -R=b.positionScreen.y,N=e.positionScreen.x,aa=e.positionScreen.y,U=h.positionScreen.x,V=h.positionScreen.y,ga=f.positionScreen.x,W=f.positionScreen.y,da=k.positionScreen.x,ea=k.positionScreen.y,ka=X.positionScreen.x,fa=X.positionScreen.y,m instanceof THREE.MeshBasicMaterial)G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(m.color);else if(m instanceof THREE.MeshLambertMaterial)Ta?!m.wireframe&&m.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length== -4?(S.r=Z.r=$.r=ia.r=qa.r,S.g=Z.g=$.g=ia.g=qa.g,S.b=Z.b=$.b=ia.b=qa.b,p(n,o.v1.positionWorld,o.vertexNormalsWorld[0],S),p(n,o.v2.positionWorld,o.vertexNormalsWorld[1],Z),p(n,o.v4.positionWorld,o.vertexNormalsWorld[3],$),p(n,o.v3.positionWorld,o.vertexNormalsWorld[2],ia),ha=w(S,Z,$,ia),A(Q,R,N,aa,ga,W),va(Q,R,N,aa,ga,W,ha,0,0,1,0,0,1),A(da,ea,U,V,ka,fa),va(da,ea,U,V,ka,fa,ha,1,0,1,1,0,1)):(ta.r=qa.r,ta.g=qa.g,ta.b=qa.b,p(n,o.centroidWorld,o.normalWorld,ta),I.r=Math.max(0,Math.min(m.color.r*ta.r,1)), -I.g=Math.max(0,Math.min(m.color.g*ta.g,1)),I.b=Math.max(0,Math.min(m.color.b*ta.b,1)),I.updateHex(),G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(I,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(I)):(G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(m.color));else if(m instanceof THREE.MeshNormalMaterial)I.r=Ja(o.normalWorld.x),I.g=Ja(o.normalWorld.y),I.b=Ja(o.normalWorld.z),I.updateHex(),G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(I,m.wireframeLinewidth, -m.wireframeLinecap,m.wireframeLinejoin):C(I);else if(m instanceof THREE.MeshDepthMaterial)Y=g.near,H=g.far,S.r=S.g=S.b=1-Ea(b.positionScreen.z,Y,H),Z.r=Z.g=Z.b=1-Ea(e.positionScreen.z,Y,H),$.r=$.g=$.b=1-Ea(f.positionScreen.z,Y,H),ia.r=ia.g=ia.b=1-Ea(h.positionScreen.z,Y,H),ha=w(S,Z,$,ia),A(Q,R,N,aa,ga,W),va(Q,R,N,aa,ga,W,ha,0,0,1,0,0,1),A(da,ea,U,V,ka,fa),va(da,ea,U,V,ka,fa,ha,1,0,1,1,0,1)}function A(b,d,c,e,h,f){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(b,d);v.closePath()} -function G(b,d,c,e,h,f,g,j){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(g,j);v.lineTo(b,d);v.closePath()}function D(b,d,c,h){if(F!=d)v.lineWidth=F=d;if(B!=c)v.lineCap=B=c;if(P!=h)v.lineJoin=P=h;e(b);v.stroke();X.inflate(d*2)}function C(b){f(b);v.fill()}function va(b,d,c,e,h,f,g,j,k,m,o,X,p){var n,t;n=g.width-1;t=g.height-1;j*=n;k*=t;m*=n;o*=t;X*=n;p*=t;c-=b;e-=d;h-=b;f-=d;m-=j;o-=k;X-=j;p-=k;n=m*p-X*o;n!=0&&(t=1/n,n=(p*c-o*h)*t,o=(p*e-o*f)*t,c=(m*h-X*c)*t,e=(m*f-X*e)*t,b=b-n* -j-c*k,d=d-o*j-e*k,v.save(),v.transform(n,o,c,e,b,d),v.clip(),v.drawImage(g,0,0),v.restore())}function w(b,d,c,e){var h=~~(b.r*255),f=~~(b.g*255),b=~~(b.b*255),g=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255),k=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),o=~~(e.r*255),X=~~(e.g*255),e=~~(e.b*255);ua[0]=h<0?0:h>255?255:h;ua[1]=f<0?0:f>255?255:f;ua[2]=b<0?0:b>255?255:b;ua[4]=g<0?0:g>255?255:g;ua[5]=j<0?0:j>255?255:j;ua[6]=d<0?0:d>255?255:d;ua[8]=k<0?0:k>255?255:k;ua[9]=m<0?0:m>255?255:m;ua[10]=c<0?0:c>255?255:c; -ua[12]=o<0?0:o>255?255:o;ua[13]=X<0?0:X>255?255:X;ua[14]=e<0?0:e>255?255:e;Ma.putImageData(Ua,0,0);Qa.drawImage(La,0,0);return Na}function Ea(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function Ja(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ba(b,d){var c=d.x-b.x,e=d.y-b.y,h=1/Math.sqrt(c*c+e*e);c*=h;e*=h;d.x+=c;d.y+=e;b.x-=c;b.y-=e}var Ra,Ya,la,wa,Ca,Ka,Sa,ra;this.autoClear?this.clear():v.setTransform(1,0,0,-1,t,u);j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,g,this.sortElements);(Ta=b.lights.length> -0)&&o(b);Ra=0;for(Ya=k.length;Ra0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(M.sub(f.position,d.centroidWorld),M.normalize(),g=d.normalWorld.dot(M)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function c(d,c,h,k,m,p){j.data.vertices+=3;j.data.faces++;Q=e(R++);Q.setAttribute("d", -"M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?F.hex=m.color.hex:m instanceof THREE.MeshLambertMaterial?D?(B.r=P.r,B.g=P.g,B.b=P.b,b(p,k,B),F.r=Math.max(0,Math.min(m.color.r*B.r,1)),F.g=Math.max(0,Math.min(m.color.g*B.g,1)),F.b=Math.max(0,Math.min(m.color.b*B.b,1)),F.updateHex()):F.hex=m.color.hex:m instanceof THREE.MeshDepthMaterial?(E=1-m.__2near/(m.__farPlusNear- -k.z*m.__farMinusNear),F.setRGB(E,E,E)):m instanceof THREE.MeshNormalMaterial&&F.setRGB(f(k.normalWorld.x),f(k.normalWorld.y),f(k.normalWorld.z));m.wireframe?Q.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):Q.setAttribute("style","fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+m.opacity);o.appendChild(Q)}function d(d,c,h,k, -m,p,n){j.data.vertices+=4;j.data.faces++;Q=e(R++);Q.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?F.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?D?(B.r=P.r,B.g=P.g,B.b=P.b,b(n,m,B),F.r=Math.max(0,Math.min(p.color.r*B.r,1)),F.g=Math.max(0,Math.min(p.color.g*B.g,1)),F.b=Math.max(0,Math.min(p.color.b* -B.b,1)),F.updateHex()):F.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(E=1-p.__2near/(p.__farPlusNear-m.z*p.__farMinusNear),F.setRGB(E,E,E)):p instanceof THREE.MeshNormalMaterial&&F.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));p.wireframe?Q.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):Q.setAttribute("style", -"fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(Q)}function e(b){T[b]==null&&(T[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),aa==0&&T[b].setAttribute("shape-rendering","crispEdges"));return T[b]}function f(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function g(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,m=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,t,u,v,z,A,x,G=new THREE.Rectangle,y=new THREE.Rectangle, -D=!1,F=new THREE.Color(16777215),B=new THREE.Color(16777215),P=new THREE.Color(0),K=new THREE.Color(0),L=new THREE.Color(0),E,M=new THREE.Vector3,T=[],h=[],Q,R,N,aa=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":aa=1;break;case "low":aa=0}};this.setSize=function(b,d){n=b;p=d;t=n/2;u=p/2;o.setAttribute("viewBox",-t+" "+-u+" "+n+" "+p);o.setAttribute("width",n);o.setAttribute("height",p);G.set(-t, --u,t,u)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,e){var f,p,n,F,B,E,I,S;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,e,this.sortElements);N=R=0;if(D=b.lights.length>0){I=b.lights;P.setRGB(0,0,0);K.setRGB(0,0,0);L.setRGB(0,0,0);f=0;for(p=I.length;f>1,sa=o.height>> +1,g=h.scale.x*t,m=h.scale.y*u,j=g*p,k=m*sa,N.set(b.x-j,b.y-k,b.x+j,b.y+k),ta.instersects(N)&&(v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(g,-m),v.translate(-p,-sa),v.drawImage(o,0,0),v.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*t,k=h.scale.y*u,N.set(b.x-j,b.y-k,b.x+j,b.y+k),ta.instersects(N)&&(e(g.color),f(g.color),v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(j,k),g.program(v),v.restore()))}function y(b,h,f,g){c(g.opacity);d(g.blending); +v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(h.positionScreen.x,h.positionScreen.y);v.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(G!=b)v.lineWidth=G=b;b=g.linecap;if(B!=b)v.lineCap=B=b;b=g.linejoin;if(Q!=b)v.lineJoin=Q=b;e(g.color);v.stroke();N.inflate(g.linewidth*2)}}function z(b,e,h,f,k,m,o,N,n){j.data.vertices+=3;j.data.faces++;c(N.opacity);d(N.blending);R=b.positionScreen.x;S=b.positionScreen.y;O=e.positionScreen.x;aa=e.positionScreen.y;V=h.positionScreen.x; +W=h.positionScreen.y;A(R,S,O,aa,V,W);if(N instanceof THREE.MeshBasicMaterial)if(N.map)N.map.mapping instanceof THREE.UVMapping&&(ma=o.uvs[0],wa(R,S,O,aa,V,W,N.map.image,ma[f].u,ma[f].v,ma[k].u,ma[k].v,ma[m].u,ma[m].v));else if(N.envMap){if(N.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=g.matrixWorldInverse,oa.copy(o.vertexNormalsWorld[0]),ja=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,na=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(o.vertexNormalsWorld[1]),Ba=(oa.x*b.n11+oa.y* +b.n12+oa.z*b.n13)*0.5+0.5,za=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(o.vertexNormalsWorld[2]),ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,P=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,wa(R,S,O,aa,V,W,N.envMap.image,ja,na,Ba,za,ca,P)}else N.wireframe?D(N.color,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):C(N.color);else if(N instanceof THREE.MeshLambertMaterial)N.map&&!N.wireframe&&(N.map.mapping instanceof THREE.UVMapping&&(ma=o.uvs[0],wa(R,S,O,aa,V,W,N.map.image,ma[f].u, +ma[f].v,ma[k].u,ma[k].v,ma[m].u,ma[m].v)),d(THREE.SubtractiveBlending)),Ua?!N.wireframe&&N.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(T.r=Z.r=$.r=ua.r,T.g=Z.g=$.g=ua.g,T.b=Z.b=$.b=ua.b,p(n,o.v1.positionWorld,o.vertexNormalsWorld[0],T),p(n,o.v2.positionWorld,o.vertexNormalsWorld[1],Z),p(n,o.v3.positionWorld,o.vertexNormalsWorld[2],$),ia.r=(Z.r+$.r)*0.5,ia.g=(Z.g+$.g)*0.5,ia.b=(Z.b+$.b)*0.5,ha=w(T,Z,$,ia),wa(R,S,O,aa,V,W,ha,0,0,1,0,0,1)):(sa.r=ua.r,sa.g=ua.g,sa.b=ua.b,p(n,o.centroidWorld, +o.normalWorld,sa),I.r=Math.max(0,Math.min(N.color.r*sa.r,1)),I.g=Math.max(0,Math.min(N.color.g*sa.g,1)),I.b=Math.max(0,Math.min(N.color.b*sa.b,1)),I.updateHex(),N.wireframe?D(I,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):C(I)):N.wireframe?D(N.color,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):C(N.color);else if(N instanceof THREE.MeshDepthMaterial)X=g.near,H=g.far,T.r=T.g=T.b=1-Fa(b.positionScreen.z,X,H),Z.r=Z.g=Z.b=1-Fa(e.positionScreen.z,X,H),$.r=$.g=$.b=1-Fa(h.positionScreen.z, +X,H),ia.r=(Z.r+$.r)*0.5,ia.g=(Z.g+$.g)*0.5,ia.b=(Z.b+$.b)*0.5,ha=w(T,Z,$,ia),wa(R,S,O,aa,V,W,ha,0,0,1,0,0,1);else if(N instanceof THREE.MeshNormalMaterial)I.r=Ka(o.normalWorld.x),I.g=Ka(o.normalWorld.y),I.b=Ka(o.normalWorld.z),I.updateHex(),N.wireframe?D(I,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):C(I)}function x(b,e,h,f,k,o,N,m,n){j.data.vertices+=4;j.data.faces++;c(m.opacity);d(m.blending);if(m.map||m.envMap)z(b,e,f,0,1,3,N,m,n),z(k,h,o,1,2,3,N,m,n);else if(R=b.positionScreen.x, +S=b.positionScreen.y,O=e.positionScreen.x,aa=e.positionScreen.y,V=h.positionScreen.x,W=h.positionScreen.y,ga=f.positionScreen.x,Y=f.positionScreen.y,da=k.positionScreen.x,ea=k.positionScreen.y,ka=o.positionScreen.x,fa=o.positionScreen.y,m instanceof THREE.MeshBasicMaterial)F(R,S,O,aa,V,W,ga,Y),m.wireframe?D(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(m.color);else if(m instanceof THREE.MeshLambertMaterial)Ua?!m.wireframe&&m.shading==THREE.SmoothShading&&N.vertexNormalsWorld.length== +4?(T.r=Z.r=$.r=ia.r=ua.r,T.g=Z.g=$.g=ia.g=ua.g,T.b=Z.b=$.b=ia.b=ua.b,p(n,N.v1.positionWorld,N.vertexNormalsWorld[0],T),p(n,N.v2.positionWorld,N.vertexNormalsWorld[1],Z),p(n,N.v4.positionWorld,N.vertexNormalsWorld[3],$),p(n,N.v3.positionWorld,N.vertexNormalsWorld[2],ia),ha=w(T,Z,$,ia),A(R,S,O,aa,ga,Y),wa(R,S,O,aa,ga,Y,ha,0,0,1,0,0,1),A(da,ea,V,W,ka,fa),wa(da,ea,V,W,ka,fa,ha,1,0,1,1,0,1)):(sa.r=ua.r,sa.g=ua.g,sa.b=ua.b,p(n,N.centroidWorld,N.normalWorld,sa),I.r=Math.max(0,Math.min(m.color.r*sa.r,1)), +I.g=Math.max(0,Math.min(m.color.g*sa.g,1)),I.b=Math.max(0,Math.min(m.color.b*sa.b,1)),I.updateHex(),F(R,S,O,aa,V,W,ga,Y),m.wireframe?D(I,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(I)):(F(R,S,O,aa,V,W,ga,Y),m.wireframe?D(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(m.color));else if(m instanceof THREE.MeshNormalMaterial)I.r=Ka(N.normalWorld.x),I.g=Ka(N.normalWorld.y),I.b=Ka(N.normalWorld.z),I.updateHex(),F(R,S,O,aa,V,W,ga,Y),m.wireframe?D(I,m.wireframeLinewidth, +m.wireframeLinecap,m.wireframeLinejoin):C(I);else if(m instanceof THREE.MeshDepthMaterial)X=g.near,H=g.far,T.r=T.g=T.b=1-Fa(b.positionScreen.z,X,H),Z.r=Z.g=Z.b=1-Fa(e.positionScreen.z,X,H),$.r=$.g=$.b=1-Fa(f.positionScreen.z,X,H),ia.r=ia.g=ia.b=1-Fa(h.positionScreen.z,X,H),ha=w(T,Z,$,ia),A(R,S,O,aa,ga,Y),wa(R,S,O,aa,ga,Y,ha,0,0,1,0,0,1),A(da,ea,V,W,ka,fa),wa(da,ea,V,W,ka,fa,ha,1,0,1,1,0,1)}function A(b,d,c,e,h,f){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(b,d);v.closePath()} +function F(b,d,c,e,h,f,g,j){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(g,j);v.lineTo(b,d);v.closePath()}function D(b,d,c,h){if(G!=d)v.lineWidth=G=d;if(B!=c)v.lineCap=B=c;if(Q!=h)v.lineJoin=Q=h;e(b);v.stroke();N.inflate(d*2)}function C(b){f(b);v.fill()}function wa(b,d,c,e,h,f,g,j,k,m,N,o,p){var n,t;n=g.width-1;t=g.height-1;j*=n;k*=t;m*=n;N*=t;o*=n;p*=t;c-=b;e-=d;h-=b;f-=d;m-=j;N-=k;o-=j;p-=k;n=m*p-o*N;n!=0&&(t=1/n,n=(p*c-N*h)*t,N=(p*e-N*f)*t,c=(m*h-o*c)*t,e=(m*f-o*e)*t,b=b-n* +j-c*k,d=d-N*j-e*k,v.save(),v.transform(n,N,c,e,b,d),v.clip(),v.drawImage(g,0,0),v.restore())}function w(b,d,c,e){var h=~~(b.r*255),f=~~(b.g*255),b=~~(b.b*255),g=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255),k=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),N=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255);va[0]=h<0?0:h>255?255:h;va[1]=f<0?0:f>255?255:f;va[2]=b<0?0:b>255?255:b;va[4]=g<0?0:g>255?255:g;va[5]=j<0?0:j>255?255:j;va[6]=d<0?0:d>255?255:d;va[8]=k<0?0:k>255?255:k;va[9]=m<0?0:m>255?255:m;va[10]=c<0?0:c>255?255:c; +va[12]=N<0?0:N>255?255:N;va[13]=o<0?0:o>255?255:o;va[14]=e<0?0:e>255?255:e;Na.putImageData(Va,0,0);Ra.drawImage(Ma,0,0);return Oa}function Fa(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function Ka(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ca(b,d){var c=d.x-b.x,e=d.y-b.y,h=1/Math.sqrt(c*c+e*e);c*=h;e*=h;d.x+=c;d.y+=e;b.x-=c;b.y-=e}var Sa,Za,la,xa,Da,La,Ta,qa;this.autoClear?this.clear():v.setTransform(1,0,0,-1,t,u);j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,g,this.sortElements);(Ua=b.lights.length> +0)&&o(b);Sa=0;for(Za=k.length;Sa0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(M.sub(f.position,d.centroidWorld),M.normalize(),g=d.normalWorld.dot(M)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function c(d,c,h,k,m,p){j.data.vertices+=3;j.data.faces++;R=e(S++);R.setAttribute("d", +"M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?G.hex=m.color.hex:m instanceof THREE.MeshLambertMaterial?D?(B.r=Q.r,B.g=Q.g,B.b=Q.b,b(p,k,B),G.r=Math.max(0,Math.min(m.color.r*B.r,1)),G.g=Math.max(0,Math.min(m.color.g*B.g,1)),G.b=Math.max(0,Math.min(m.color.b*B.b,1)),G.updateHex()):G.hex=m.color.hex:m instanceof THREE.MeshDepthMaterial?(E=1-m.__2near/(m.__farPlusNear- +k.z*m.__farMinusNear),G.setRGB(E,E,E)):m instanceof THREE.MeshNormalMaterial&&G.setRGB(f(k.normalWorld.x),f(k.normalWorld.y),f(k.normalWorld.z));m.wireframe?R.setAttribute("style","fill: none; stroke: #"+g(G.hex.toString(16))+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):R.setAttribute("style","fill: #"+g(G.hex.toString(16))+"; fill-opacity: "+m.opacity);o.appendChild(R)}function d(d,c,h,k, +m,p,n){j.data.vertices+=4;j.data.faces++;R=e(S++);R.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?G.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?D?(B.r=Q.r,B.g=Q.g,B.b=Q.b,b(n,m,B),G.r=Math.max(0,Math.min(p.color.r*B.r,1)),G.g=Math.max(0,Math.min(p.color.g*B.g,1)),G.b=Math.max(0,Math.min(p.color.b* +B.b,1)),G.updateHex()):G.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(E=1-p.__2near/(p.__farPlusNear-m.z*p.__farMinusNear),G.setRGB(E,E,E)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));p.wireframe?R.setAttribute("style","fill: none; stroke: #"+g(G.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):R.setAttribute("style", +"fill: #"+g(G.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(R)}function e(b){U[b]==null&&(U[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),aa==0&&U[b].setAttribute("shape-rendering","crispEdges"));return U[b]}function f(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function g(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,m=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,t,u,v,z,A,y,F=new THREE.Rectangle,x=new THREE.Rectangle, +D=!1,G=new THREE.Color(16777215),B=new THREE.Color(16777215),Q=new THREE.Color(0),K=new THREE.Color(0),L=new THREE.Color(0),E,M=new THREE.Vector3,U=[],h=[],R,S,O,aa=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":aa=1;break;case "low":aa=0}};this.setSize=function(b,d){n=b;p=d;t=n/2;u=p/2;o.setAttribute("viewBox",-t+" "+-u+" "+n+" "+p);o.setAttribute("width",n);o.setAttribute("height",p);F.set(-t, +-u,t,u)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,e){var f,p,n,G,B,E,I,T;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,e,this.sortElements);O=S=0;if(D=b.lights.length>0){I=b.lights;Q.setRGB(0,0,0);K.setRGB(0,0,0);L.setRGB(0,0,0);f=0;for(p=I.length;f=0)h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(b.position,3,h.FLOAT,!1,0,0);else{c=f.program.attributes;j.morphTargetBase!==-1?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]), h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0)):c.position>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,m=j.morphTargetForcedOrder,o=j.morphTargetInfluences;e=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglColorBuffer),h.vertexAttribPointer(b.color,3,h.FLOAT,!1,0,0));b.normal>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglNormalBuffer),h.vertexAttribPointer(b.normal,3,h.FLOAT,!1,0,0));b.tangent>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglTangentBuffer),h.vertexAttribPointer(b.tangent,4,h.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(h.bindBuffer(h.ARRAY_BUFFER, g.__webglUVBuffer),h.vertexAttribPointer(b.uv,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(b.uv)):h.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUV2Buffer),h.vertexAttribPointer(b.uv2,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(b.uv2)):h.disableVertexAttribArray(b.uv2));f.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexABuffer),h.vertexAttribPointer(b.skinVertexA,4, h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),h.vertexAttribPointer(b.skinVertexB,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),h.vertexAttribPointer(b.skinIndex,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),h.vertexAttribPointer(b.skinWeight,4,h.FLOAT,!1,0,0));j instanceof THREE.Mesh?(f.wireframe?(h.lineWidth(f.wireframeLinewidth),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),h.drawElements(h.LINES,g.__webglLineCount, -h.UNSIGNED_SHORT,0)):(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),h.drawElements(h.TRIANGLES,g.__webglFaceCount,h.UNSIGNED_SHORT,0)),T.data.vertices+=g.__webglFaceCount,T.data.faces+=g.__webglFaceCount/3,T.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?h.LINE_STRIP:h.LINES,h.lineWidth(f.linewidth),h.drawArrays(j,0,g.__webglLineCount),T.data.drawCalls++):j instanceof THREE.ParticleSystem?(h.drawArrays(h.POINTS,0,g.__webglParticleCount),T.data.drawCalls++):j instanceof -THREE.Ribbon&&(h.drawArrays(h.TRIANGLE_STRIP,0,g.__webglVertexCount),T.data.drawCalls++)}}function f(b,d,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=h.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=h.createBuffer();b.hasPos&&(h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,b.positionArray,h.DYNAMIC_DRAW),h.enableVertexAttribArray(d.attributes.position),h.vertexAttribPointer(d.attributes.position,3,h.FLOAT,!1,0,0));if(b.hasNormal){h.bindBuffer(h.ARRAY_BUFFER, +h.UNSIGNED_SHORT,0)):(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),h.drawElements(h.TRIANGLES,g.__webglFaceCount,h.UNSIGNED_SHORT,0)),U.data.vertices+=g.__webglFaceCount,U.data.faces+=g.__webglFaceCount/3,U.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?h.LINE_STRIP:h.LINES,h.lineWidth(f.linewidth),h.drawArrays(j,0,g.__webglLineCount),U.data.drawCalls++):j instanceof THREE.ParticleSystem?(h.drawArrays(h.POINTS,0,g.__webglParticleCount),U.data.drawCalls++):j instanceof +THREE.Ribbon&&(h.drawArrays(h.TRIANGLE_STRIP,0,g.__webglVertexCount),U.data.drawCalls++)}}function f(b,d,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=h.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=h.createBuffer();b.hasPos&&(h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,b.positionArray,h.DYNAMIC_DRAW),h.enableVertexAttribArray(d.attributes.position),h.vertexAttribPointer(d.attributes.position,3,h.FLOAT,!1,0,0));if(b.hasNormal){h.bindBuffer(h.ARRAY_BUFFER, b.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,g,j,k,m,o,p,n,t,u=b.count*3;for(t=0;t0&&x[0]0&&x[1]0.0010&&k.scale>0.0010)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/fa,u[0]=t*o,u[1]=t,h.uniform3fv(z.screenPosition,v),h.uniform2fv(z.scale,u),h.uniform1f(z.rotation,k.rotation),h.uniform1f(z.opacity,k.opacity),F(k.blending),P(k.texture,1),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(aa)}function A(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)} -function x(b){var d,e,f,g,j;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];j=!1;for(g in f.__webglCustomAttributes)if(f.__webglCustomAttributes[g].needsUpdate){j=!0;break}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||j){j=b;var k=h.DYNAMIC_DRAW;if(f.__inittedArrays){var m=void 0,o=void 0,p=void 0,n=void 0,t=p=void 0,u=void 0,v=void 0,x=void 0,z=void 0,y=void 0,A=void 0, -F=void 0,G=void 0,B=void 0,D=void 0,Y=void 0,E=void 0,C=n=x=n=v=u=void 0,H=void 0,w=H=C=u=void 0,L=void 0,I=w=H=C=p=p=t=x=n=w=H=C=L=w=H=C=L=w=H=C=void 0,K=0,ha=0,N=0,O=0,P=0,ma=0,M=0,S=0,Q=0,J=0,W=0,H=C=0,V=f.__vertexArray,aa=f.__uvArray,ca=f.__uv2Array,ga=f.__normalArray,R=f.__tangentArray,ja=f.__colorArray,T=f.__skinVertexAArray,U=f.__skinVertexBArray,Z=f.__skinIndexArray,$=f.__skinWeightArray,ia=f.__morphTargetsArrays,fa=f.__webglCustomAttributes,w=void 0,da=f.__faceArray,ea=f.__lineArray,ka=f.__needsSmoothNormals, -y=f.__vertexColorType,z=f.__uvType,A=f.__normalType,na=j.geometry,pa=na.__dirtyVertices,Aa=na.__dirtyElements,sa=na.__dirtyUvs,ya=na.__dirtyNormals,Va=na.__dirtyTangents,Wa=na.__dirtyColors,Xa=na.__dirtyMorphTargets,Fa=na.vertices,Za=f.faces,bb=na.faces,$a=na.faceVertexUvs[0],ab=na.faceVertexUvs[1],Ga=na.skinVerticesA,Ha=na.skinVerticesB,Ia=na.skinIndices,za=na.skinWeights,Da=j instanceof THREE.ShadowVolume?na.edgeFaces:void 0,xa=na.morphTargets;if(fa)for(I in fa)fa[I].offset=0,fa[I].offsetSrc=0; -m=0;for(o=Za.length;m0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,ja,k));ya&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglNormalBuffer),h.bufferData(h.ARRAY_BUFFER,ga,k));Va&&na.hasTangents&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglTangentBuffer),h.bufferData(h.ARRAY_BUFFER,R,k));sa&&N>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglUVBuffer),h.bufferData(h.ARRAY_BUFFER,aa,k));sa&&O>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglUV2Buffer),h.bufferData(h.ARRAY_BUFFER,ca,k));Aa&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER, -f.__webglFaceBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,da,k),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ea,k));J>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinVertexABuffer),h.bufferData(h.ARRAY_BUFFER,T,k),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),h.bufferData(h.ARRAY_BUFFER,U,k),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),h.bufferData(h.ARRAY_BUFFER,Z,k),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),h.bufferData(h.ARRAY_BUFFER, -$,k));j.dynamic||(delete f.__inittedArrays,delete f.__colorArray,delete f.__normalArray,delete f.__tangentArray,delete f.__uvArray,delete f.__uv2Array,delete f.__faceArray,delete f.__vertexArray,delete f.__lineArray,delete f.__skinVertexAArray,delete f.__skinVertexBArray,delete f.__skinIndexArray,delete f.__skinWeightArray)}}}e.__dirtyVertices=!1;e.__dirtyMorphTargets=!1;e.__dirtyElements=!1;e.__dirtyUvs=!1;e.__dirtyNormals=!1;e.__dirtyTangents=!1;e.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){e= -b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=h.DYNAMIC_DRAW;z=b.vertices;f=b.colors;y=z.length;j=f.length;A=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m=0;c--)b[c].object==d&&b.splice(c,1)}function y(b){function d(b){var f=[];c=0;for(e=b.length;c65535&&(n[k].counter+=1,m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[], -materials:j,vertices:0,numMorphTargets:o})),b.geometryGroups[m].faces.push(f),b.geometryGroups[m].vertices+=h}function D(b,d,c){b.push({buffer:d,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(b){if(b!=ga){switch(b){case THREE.AdditiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE);break;case THREE.SubtractiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:h.blendEquation(h.FUNC_ADD); -h.blendFunc(h.ZERO,h.SRC_COLOR);break;default:h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)}ga=b}}function B(b,d,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(h.texParameteri(b,h.TEXTURE_WRAP_S,M(d.wrapS)),h.texParameteri(b,h.TEXTURE_WRAP_T,M(d.wrapT)),h.texParameteri(b,h.TEXTURE_MAG_FILTER,M(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,M(d.minFilter)),h.generateMipmap(b)):(h.texParameteri(b,h.TEXTURE_WRAP_S, -h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_MAG_FILTER,E(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,E(d.minFilter)))}function P(b,d){if(b.needsUpdate)b.__webglInit?(h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texSubImage2D(h.TEXTURE_2D,0,0,0,h.RGBA,h.UNSIGNED_BYTE,b.image)):(b.__webglTexture=h.createTexture(),h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,b.image),b.__webglInit= -!0),B(h.TEXTURE_2D,b,b.image),h.bindTexture(h.TEXTURE_2D,null),b.needsUpdate=!1;h.activeTexture(h.TEXTURE0+d);h.bindTexture(h.TEXTURE_2D,b.__webglTexture)}function K(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=h.createFramebuffer();b.__webglRenderbuffer=h.createRenderbuffer();b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S, -M(b.wrapS));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,M(b.wrapT));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,M(b.magFilter));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,M(b.minFilter));h.texImage2D(h.TEXTURE_2D,0,M(b.format),b.width,b.height,0,M(b.format),M(b.type),null);h.bindRenderbuffer(h.RENDERBUFFER,b.__webglRenderbuffer);h.bindFramebuffer(h.FRAMEBUFFER,b.__webglFramebuffer);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&& -!b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_COMPONENT16,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_STENCIL,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_STENCIL_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):h.renderbufferStorage(h.RENDERBUFFER,h.RGBA4,b.width,b.height);h.bindTexture(h.TEXTURE_2D,null);h.bindRenderbuffer(h.RENDERBUFFER, -null);h.bindFramebuffer(h.FRAMEBUFFER,null)}var d,c;b?(d=b.__webglFramebuffer,c=b.width,b=b.height):(d=null,c=ka,b=fa);d!=N&&(h.bindFramebuffer(h.FRAMEBUFFER,d),h.viewport(da,ea,c,b),N=d)}function L(b,d){var c;b=="fragment"?c=h.createShader(h.FRAGMENT_SHADER):b=="vertex"&&(c=h.createShader(h.VERTEX_SHADER));h.shaderSource(c,d);h.compileShader(c);if(!h.getShaderParameter(c,h.COMPILE_STATUS))return console.error(h.getShaderInfoLog(c)),console.error(d),null;return c}function E(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return h.NEAREST; -default:return h.LINEAR}}function M(b){switch(b){case THREE.RepeatWrapping:return h.REPEAT;case THREE.ClampToEdgeWrapping:return h.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return h.MIRRORED_REPEAT;case THREE.NearestFilter:return h.NEAREST;case THREE.NearestMipMapNearestFilter:return h.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return h.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return h.LINEAR;case THREE.LinearMipMapNearestFilter:return h.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return h.LINEAR_MIPMAP_LINEAR; -case THREE.ByteType:return h.BYTE;case THREE.UnsignedByteType:return h.UNSIGNED_BYTE;case THREE.ShortType:return h.SHORT;case THREE.UnsignedShortType:return h.UNSIGNED_SHORT;case THREE.IntType:return h.INT;case THREE.UnsignedShortType:return h.UNSIGNED_INT;case THREE.FloatType:return h.FLOAT;case THREE.AlphaFormat:return h.ALPHA;case THREE.RGBFormat:return h.RGB;case THREE.RGBAFormat:return h.RGBA;case THREE.LuminanceFormat:return h.LUMINANCE;case THREE.LuminanceAlphaFormat:return h.LUMINANCE_ALPHA}return 0} -var T=this,h,Q=[],R=null,N=null,aa=!0,U=null,V=null,ga=null,W=null,da=0,ea=0,ka=0,fa=0,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Matrix4,Z=new Float32Array(16),$=new Float32Array(16),ia=new THREE.Vector4,Y={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},H=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ha=b.stencil!==void 0?b.stencil: -!0,ma=b.antialias!==void 0?b.antialias:!1,ja=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),na=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=H;this.sortObjects=this.autoClear=!0;try{if(!(h=H.getContext("experimental-webgl",{antialias:ma,stencil:ha})))throw"Error creating WebGL context.";}catch(Aa){console.error(Aa)}console.log(navigator.userAgent+" | "+h.getParameter(h.VERSION)+" | "+h.getParameter(h.VENDOR)+ -" | "+h.getParameter(h.RENDERER)+" | "+h.getParameter(h.SHADING_LANGUAGE_VERSION));h.clearColor(0,0,0,1);h.clearDepth(1);h.enable(h.DEPTH_TEST);h.depthFunc(h.LEQUAL);h.frontFace(h.CCW);h.cullFace(h.BACK);h.enable(h.CULL_FACE);h.enable(h.BLEND);h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);h.clearColor(ja.r,ja.g,ja.b,na);this.context=h;var ya=h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ha){var ca={};ca.vertices=new Float32Array(12);ca.faces=new Uint16Array(6); -ca.darkness=0.5;ca.vertices[0]=-20;ca.vertices[1]=-20;ca.vertices[2]=-1;ca.vertices[3]=20;ca.vertices[4]=-20;ca.vertices[5]=-1;ca.vertices[6]=20;ca.vertices[7]=20;ca.vertices[8]=-1;ca.vertices[9]=-20;ca.vertices[10]=20;ca.vertices[11]=-1;ca.faces[0]=0;ca.faces[1]=1;ca.faces[2]=2;ca.faces[3]=0;ca.faces[4]=2;ca.faces[5]=3;ca.vertexBuffer=h.createBuffer();ca.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,ca.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,ca.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER, -ca.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,ca.faces,h.STATIC_DRAW);ca.program=h.createProgram();h.attachShader(ca.program,L("fragment",THREE.ShaderLib.shadowPost.fragmentShader));h.attachShader(ca.program,L("vertex",THREE.ShaderLib.shadowPost.vertexShader));h.linkProgram(ca.program);ca.vertexLocation=h.getAttribLocation(ca.program,"position");ca.projectionLocation=h.getUniformLocation(ca.program,"projectionMatrix");ca.darknessLocation=h.getUniformLocation(ca.program,"darkness")}var O={}; -O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);b=0;O.vertices[b++]=-1;O.vertices[b++]=-1;O.vertices[b++]=0;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;b=0;O.faces[b++]=0;O.faces[b++]=1;O.faces[b++]=2;O.faces[b++]=0;O.faces[b++]=2;O.faces[b++]=3;O.vertexBuffer=h.createBuffer();O.elementBuffer=h.createBuffer(); -O.tempTexture=h.createTexture();O.occlusionTexture=h.createTexture();h.bindBuffer(h.ARRAY_BUFFER,O.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,O.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,O.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,O.faces,h.STATIC_DRAW);h.bindTexture(h.TEXTURE_2D,O.tempTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGB,16,16,0,h.RGB,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE); -h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.bindTexture(h.TEXTURE_2D,O.occlusionTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGBA,16,16,0,h.RGBA,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<= -0?(O.hasVertexTexture=!1,O.program=h.createProgram(),h.attachShader(O.program,L("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),h.attachShader(O.program,L("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(O.hasVertexTexture=!0,O.program=h.createProgram(),h.attachShader(O.program,L("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),h.attachShader(O.program,L("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));h.linkProgram(O.program);O.attributes={};O.uniforms={}; -O.attributes.vertex=h.getAttribLocation(O.program,"position");O.attributes.uv=h.getAttribLocation(O.program,"UV");O.uniforms.renderType=h.getUniformLocation(O.program,"renderType");O.uniforms.map=h.getUniformLocation(O.program,"map");O.uniforms.occlusionMap=h.getUniformLocation(O.program,"occlusionMap");O.uniforms.opacity=h.getUniformLocation(O.program,"opacity");O.uniforms.scale=h.getUniformLocation(O.program,"scale");O.uniforms.rotation=h.getUniformLocation(O.program,"rotation");O.uniforms.screenPosition= -h.getUniformLocation(O.program,"screenPosition");var sa=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]= -0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=h.createBuffer();_sprite.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,_sprite.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,_sprite.faces,h.STATIC_DRAW);_sprite.program=h.createProgram(); -h.attachShader(_sprite.program,L("fragment",THREE.ShaderLib.sprite.fragmentShader));h.attachShader(_sprite.program,L("vertex",THREE.ShaderLib.sprite.vertexShader));h.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=h.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=h.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=h.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=h.getUniformLocation(_sprite.program, -"uvScale");_sprite.uniforms.rotation=h.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=h.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=h.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=h.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=h.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=h.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance= -h.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=h.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=h.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=h.getUniformLocation(_sprite.program,"projectionMatrix");var pa=!1;this.setSize=function(b,d){H.width=b;H.height=d;this.setViewport(0,0,H.width,H.height)};this.setViewport=function(b,d,c,e){da=b;ea=d;ka=c;fa=e;h.viewport(da,ea,ka,fa)}; -this.setScissor=function(b,d,c,e){h.scissor(b,d,c,e)};this.enableScissorTest=function(b){b?h.enable(h.SCISSOR_TEST):h.disable(h.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){aa=b;h.depthMask(b)};this.setClearColorHex=function(b,d){ja.setHex(b);na=d;h.clearColor(ja.r,ja.g,ja.b,na)};this.setClearColor=function(b,d){ja.copy(b);na=d;h.clearColor(ja.r,ja.g,ja.b,na)};this.clear=function(){h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT|h.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){ca.darkness= -b};this.getContext=function(){return h};this.initMaterial=function(b,d,c,e){var f,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic"); -if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,n,o;m=o=k=0;for(n=d.length;m=0&&h.enableVertexAttribArray(p.position);p.color>=0&&h.enableVertexAttribArray(p.color);p.normal>= -0&&h.enableVertexAttribArray(p.normal);p.tangent>=0&&h.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(h.enableVertexAttribArray(p.skinVertexA),h.enableVertexAttribArray(p.skinVertexB),h.enableVertexAttribArray(p.skinIndex),h.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(f in b.attributes)p[f]!==void 0&&p[f]>=0&&h.enableVertexAttribArray(p[f]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(h.enableVertexAttribArray(p.morphTarget0), +h.uniform1f(g.rotation,f.rotation),h.uniform2fv(g.scale,m),f.mergeWith3D&&!n?(h.enable(h.DEPTH_TEST),n=!0):!f.mergeWith3D&&n&&(h.disable(h.DEPTH_TEST),n=!1),G(f.blending),Q(f.map,0),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0));h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(aa)}function z(b,d){var c,e,f=b.__webglLensFlares.length,g,j,k,m=new THREE.Vector3,o=fa/ka,p=ka*0.5,n=fa*0.5,t=16/fa,u=[t*o,t],v=[1,1,0],y=[1,1],z=P.uniforms;c=P.attributes;h.useProgram(P.program);S=P.program;ga= +-1;ta||(h.enableVertexAttribArray(P.attributes.vertex),h.enableVertexAttribArray(P.attributes.uv),ta=!0);h.uniform1i(z.occlusionMap,0);h.uniform1i(z.map,1);h.bindBuffer(h.ARRAY_BUFFER,P.vertexBuffer);h.vertexAttribPointer(c.vertex,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,P.elementBuffer);h.disable(h.CULL_FACE);h.depthMask(!1);h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,P.occlusionTexture);h.activeTexture(h.TEXTURE1);for(e=0;e< +f;e++)if(c=b.__webglLensFlares[e].object,m.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),v[0]=m.x,v[1]=m.y,v[2]=m.z,y[0]=v[0]*p+p,y[1]=v[1]*n+n,P.hasVertexTexture||y[0]>0&&y[0]0&&y[1]0.0010&&k.scale>0.0010)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/fa,u[0]=t*o,u[1]=t,h.uniform3fv(z.screenPosition,v),h.uniform2fv(z.scale,u),h.uniform1f(z.rotation,k.rotation),h.uniform1f(z.opacity,k.opacity),G(k.blending),Q(k.texture,1),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(aa)}function A(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)} +function y(b){var d,e,f,g;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];a:{for(var j=g=void 0,k=void 0,m=void 0,o=void 0,o=f.__materials,j=0,k=o.length;j0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,ja,k));za&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglNormalBuffer),h.bufferData(h.ARRAY_BUFFER,ga,k));Wa&&na.hasTangents&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglTangentBuffer),h.bufferData(h.ARRAY_BUFFER,S,k));ta&&O>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUVBuffer),h.bufferData(h.ARRAY_BUFFER,aa,k));ta&&P>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUV2Buffer), +h.bufferData(h.ARRAY_BUFFER,ca,k));Ba&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,da,k),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ea,k));J>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexABuffer),h.bufferData(h.ARRAY_BUFFER,U,k),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),h.bufferData(h.ARRAY_BUFFER,V,k),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),h.bufferData(h.ARRAY_BUFFER, +Z,k),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),h.bufferData(h.ARRAY_BUFFER,$,k));j.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}e.__dirtyVertices=!1;e.__dirtyMorphTargets=!1;e.__dirtyElements=!1;e.__dirtyUvs=!1;e.__dirtyNormals= +!1;e.__dirtyTangents=!1;e.__dirtyColors=!1;var ra;f=f.__materials;e=0;for(b=f.length;e=0;c--)b[c].object==d&&b.splice(c,1)}function x(b){function d(b){var g=[];c=0;for(e=b.length;c65535&&(n[k].counter+=1,m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j,vertices:0,numMorphTargets:o})),b.geometryGroups[m].faces.push(g),b.geometryGroups[m].vertices+=h}function D(b,d,c){b.push({buffer:d,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=ga){switch(b){case THREE.AdditiveBlending:h.blendEquation(h.FUNC_ADD); +h.blendFunc(h.SRC_ALPHA,h.ONE);break;case THREE.SubtractiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.SRC_COLOR);break;default:h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)}ga=b}}function B(b,d,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(h.texParameteri(b,h.TEXTURE_WRAP_S,M(d.wrapS)),h.texParameteri(b, +h.TEXTURE_WRAP_T,M(d.wrapT)),h.texParameteri(b,h.TEXTURE_MAG_FILTER,M(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,M(d.minFilter)),h.generateMipmap(b)):(h.texParameteri(b,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_MAG_FILTER,E(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,E(d.minFilter)))}function Q(b,d){if(b.needsUpdate)b.__webglInit?(h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texSubImage2D(h.TEXTURE_2D,0,0, +0,h.RGBA,h.UNSIGNED_BYTE,b.image)):(b.__webglTexture=h.createTexture(),h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,b.image),b.__webglInit=!0),B(h.TEXTURE_2D,b,b.image),h.bindTexture(h.TEXTURE_2D,null),b.needsUpdate=!1;h.activeTexture(h.TEXTURE0+d);h.bindTexture(h.TEXTURE_2D,b.__webglTexture)}function K(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer= +h.createFramebuffer();b.__webglRenderbuffer=h.createRenderbuffer();b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,M(b.wrapS));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,M(b.wrapT));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,M(b.magFilter));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,M(b.minFilter));h.texImage2D(h.TEXTURE_2D,0,M(b.format),b.width,b.height,0,M(b.format),M(b.type),null);h.bindRenderbuffer(h.RENDERBUFFER, +b.__webglRenderbuffer);h.bindFramebuffer(h.FRAMEBUFFER,b.__webglFramebuffer);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_COMPONENT16,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_STENCIL,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER, +h.DEPTH_STENCIL_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):h.renderbufferStorage(h.RENDERBUFFER,h.RGBA4,b.width,b.height);h.bindTexture(h.TEXTURE_2D,null);h.bindRenderbuffer(h.RENDERBUFFER,null);h.bindFramebuffer(h.FRAMEBUFFER,null)}var d,c;b?(d=b.__webglFramebuffer,c=b.width,b=b.height):(d=null,c=ka,b=fa);d!=O&&(h.bindFramebuffer(h.FRAMEBUFFER,d),h.viewport(da,ea,c,b),O=d)}function L(b,d){var c;b=="fragment"?c=h.createShader(h.FRAGMENT_SHADER):b=="vertex"&&(c=h.createShader(h.VERTEX_SHADER)); +h.shaderSource(c,d);h.compileShader(c);if(!h.getShaderParameter(c,h.COMPILE_STATUS))return console.error(h.getShaderInfoLog(c)),console.error(d),null;return c}function E(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return h.NEAREST;default:return h.LINEAR}}function M(b){switch(b){case THREE.RepeatWrapping:return h.REPEAT;case THREE.ClampToEdgeWrapping:return h.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return h.MIRRORED_REPEAT; +case THREE.NearestFilter:return h.NEAREST;case THREE.NearestMipMapNearestFilter:return h.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return h.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return h.LINEAR;case THREE.LinearMipMapNearestFilter:return h.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return h.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return h.BYTE;case THREE.UnsignedByteType:return h.UNSIGNED_BYTE;case THREE.ShortType:return h.SHORT;case THREE.UnsignedShortType:return h.UNSIGNED_SHORT; +case THREE.IntType:return h.INT;case THREE.UnsignedShortType:return h.UNSIGNED_INT;case THREE.FloatType:return h.FLOAT;case THREE.AlphaFormat:return h.ALPHA;case THREE.RGBFormat:return h.RGB;case THREE.RGBAFormat:return h.RGBA;case THREE.LuminanceFormat:return h.LUMINANCE;case THREE.LuminanceAlphaFormat:return h.LUMINANCE_ALPHA}return 0}var U=this,h,R=[],S=null,O=null,aa=!0,V=null,W=null,ga=null,Y=null,da=0,ea=0,ka=0,fa=0,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, +new THREE.Vector4,new THREE.Vector4],T=new THREE.Matrix4,Z=new Float32Array(16),$=new Float32Array(16),ia=new THREE.Vector4,X={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},H=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ha=b.stencil!==void 0?b.stencil:!0,ma=b.antialias!==void 0?b.antialias:!1,ja=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),na=b.clearAlpha!==void 0?b.clearAlpha:0; +this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=H;this.sortObjects=this.autoClear=!0;try{if(!(h=H.getContext("experimental-webgl",{antialias:ma,stencil:ha})))throw"Error creating WebGL context.";}catch(Ba){console.error(Ba)}console.log(navigator.userAgent+" | "+h.getParameter(h.VERSION)+" | "+h.getParameter(h.VENDOR)+" | "+h.getParameter(h.RENDERER)+" | "+h.getParameter(h.SHADING_LANGUAGE_VERSION));h.clearColor(0,0,0,1);h.clearDepth(1);h.enable(h.DEPTH_TEST);h.depthFunc(h.LEQUAL); +h.frontFace(h.CCW);h.cullFace(h.BACK);h.enable(h.CULL_FACE);h.enable(h.BLEND);h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);h.clearColor(ja.r,ja.g,ja.b,na);this.context=h;var za=h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ha){var ca={};ca.vertices=new Float32Array(12);ca.faces=new Uint16Array(6);ca.darkness=0.5;ca.vertices[0]=-20;ca.vertices[1]=-20;ca.vertices[2]=-1;ca.vertices[3]=20;ca.vertices[4]=-20;ca.vertices[5]=-1;ca.vertices[6]=20;ca.vertices[7]=20;ca.vertices[8]= +-1;ca.vertices[9]=-20;ca.vertices[10]=20;ca.vertices[11]=-1;ca.faces[0]=0;ca.faces[1]=1;ca.faces[2]=2;ca.faces[3]=0;ca.faces[4]=2;ca.faces[5]=3;ca.vertexBuffer=h.createBuffer();ca.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,ca.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,ca.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,ca.faces,h.STATIC_DRAW);ca.program=h.createProgram();h.attachShader(ca.program,L("fragment",THREE.ShaderLib.shadowPost.fragmentShader)); +h.attachShader(ca.program,L("vertex",THREE.ShaderLib.shadowPost.vertexShader));h.linkProgram(ca.program);ca.vertexLocation=h.getAttribLocation(ca.program,"position");ca.projectionLocation=h.getUniformLocation(ca.program,"projectionMatrix");ca.darknessLocation=h.getUniformLocation(ca.program,"darkness")}var P={};P.vertices=new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]= +1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=h.createBuffer();P.elementBuffer=h.createBuffer();P.tempTexture=h.createTexture();P.occlusionTexture=h.createTexture();h.bindBuffer(h.ARRAY_BUFFER,P.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,P.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER, +P.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,P.faces,h.STATIC_DRAW);h.bindTexture(h.TEXTURE_2D,P.tempTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGB,16,16,0,h.RGB,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.bindTexture(h.TEXTURE_2D,P.occlusionTexture);h.texImage2D(h.TEXTURE_2D, +0,h.RGBA,16,16,0,h.RGBA,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(P.hasVertexTexture=!1,P.program=h.createProgram(),h.attachShader(P.program,L("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),h.attachShader(P.program, +L("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(P.hasVertexTexture=!0,P.program=h.createProgram(),h.attachShader(P.program,L("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),h.attachShader(P.program,L("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));h.linkProgram(P.program);P.attributes={};P.uniforms={};P.attributes.vertex=h.getAttribLocation(P.program,"position");P.attributes.uv=h.getAttribLocation(P.program,"UV");P.uniforms.renderType=h.getUniformLocation(P.program, +"renderType");P.uniforms.map=h.getUniformLocation(P.program,"map");P.uniforms.occlusionMap=h.getUniformLocation(P.program,"occlusionMap");P.uniforms.opacity=h.getUniformLocation(P.program,"opacity");P.uniforms.scale=h.getUniformLocation(P.program,"scale");P.uniforms.rotation=h.getUniformLocation(P.program,"rotation");P.uniforms.screenPosition=h.getUniformLocation(P.program,"screenPosition");var ta=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]= +-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer= +h.createBuffer();_sprite.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,_sprite.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,_sprite.faces,h.STATIC_DRAW);_sprite.program=h.createProgram();h.attachShader(_sprite.program,L("fragment",THREE.ShaderLib.sprite.fragmentShader));h.attachShader(_sprite.program,L("vertex",THREE.ShaderLib.sprite.vertexShader));h.linkProgram(_sprite.program); +_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=h.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=h.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=h.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=h.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=h.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=h.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment= +h.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=h.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=h.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=h.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=h.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=h.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix= +h.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=h.getUniformLocation(_sprite.program,"projectionMatrix");var pa=!1;this.setSize=function(b,d){H.width=b;H.height=d;this.setViewport(0,0,H.width,H.height)};this.setViewport=function(b,d,c,e){da=b;ea=d;ka=c;fa=e;h.viewport(da,ea,ka,fa)};this.setScissor=function(b,d,c,e){h.scissor(b,d,c,e)};this.enableScissorTest=function(b){b?h.enable(h.SCISSOR_TEST):h.disable(h.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){aa= +b;h.depthMask(b)};this.setClearColorHex=function(b,d){ja.setHex(b);na=d;h.clearColor(ja.r,ja.g,ja.b,na)};this.setClearColor=function(b,d){ja.copy(b);na=d;h.clearColor(ja.r,ja.g,ja.b,na)};this.clear=function(){h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT|h.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){ca.darkness=b};this.getContext=function(){return h};this.initMaterial=function(b,d,c,e){var g,f,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial? +j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,n,o;m=o=k=0;for(n=d.length;m< +n;m++)f=d[m],f instanceof THREE.DirectionalLight&&o++,f instanceof THREE.PointLight&&k++;k+o<=4?d=o:(d=Math.ceil(4*o/(k+o)),k=4-d);f={directional:d,point:k};o=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)o=e.bones.length;var p;a:{m=b.fragmentShader;n=b.vertexShader;var k=b.uniforms,d=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets, +maxDirLights:f.directional,maxPointLights:f.point,maxBones:o},t;f=[];j?f.push(j):(f.push(m),f.push(n));for(t in c)f.push(t),f.push(c[t]);j=f.join();t=0;for(f=R.length;t=0&&h.enableVertexAttribArray(p.position);p.color>=0&&h.enableVertexAttribArray(p.color);p.normal>= +0&&h.enableVertexAttribArray(p.normal);p.tangent>=0&&h.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(h.enableVertexAttribArray(p.skinVertexA),h.enableVertexAttribArray(p.skinVertexB),h.enableVertexAttribArray(p.skinIndex),h.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&h.enableVertexAttribArray(p[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(h.enableVertexAttribArray(p.morphTarget0), b.numSupportedMorphTargets++);p.morphTarget1>=0&&(h.enableVertexAttribArray(p.morphTarget1),b.numSupportedMorphTargets++);p.morphTarget2>=0&&(h.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(h.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(h.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(h.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>= -0&&(h.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=0&&(h.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(f=this.maxMorphTargets;b=0&&(h.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray= -new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(z*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m* +4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(z*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t=0?e:e+f;e=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;var k=j[1]-j[0];this.phi= @@ -425,10 +426,10 @@ c(this,function(b){d&&(g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),k= b.stopPropagation();if(e===this.STATE.NONE)e=b.button,e===this.STATE.ROTATE?g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=m=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(o=n=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(e===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])e= this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(d=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype; THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2}; -THREE.CubeGeometry=function(b,c,d,e,f,g,j,k,m){function o(b,c,d,j,k,m,o,p){var t,u,v=e||1,z=f||1,T=k/2,h=m/2,Q=n.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",z=g||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",v=g||1;var R=v+1,N=z+1;k/=v;var aa=m/z;for(u=0;u0){j(0,0,-n-(g||0));for(m=b;m0){j(0,0,n+ (f||0));for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m0;){if(x){if(x.equals(j[k])){x=null;continue}}else x=j[k];o=m*2+k;t=o-1;e(o,t,t+n,o+n);for(p=0;p0;){if(x){if(x.equals(j[k])){x=null;continue}}else x=j[k];for(p=0;p0;){if(y){if(y.equals(j[k])){y=null;continue}}else y=j[k];o=m*2+k;t=o-1;e(o,t,t+n,o+n);for(p=0;p0;){if(y){if(y.equals(j[k])){y=null;continue}}else y=j[k];for(p=0;p0&&j.push({shape:f,holes:e}),f=p,e=[]):e.push(p):this.Triangulate.area(p)<0?(j.push({shape:p,holes:e}),e=[]):e.push(p);o++}n&&j.push({shape:f,holes:e})}var t,u,v,z,A,x;g=[];for(k=0;k=0?u-1:f.length-1;var p=t-1>=0?t-1:o.length-1,G=[];G.push(o[t]);G.push(f[u]);G.push(f[d]);v=this.Triangulate.area(G);var y=[];y.push(o[t]);y.push(o[p]);y.push(f[u]);A=this.Triangulate.area(y);z=u;x=t;u+=1;t+=-1;u<0&&(u+=f.length);u%=f.length;t<0&&(t+=o.length);t%=f.length;d=u-1>=0?u-1:f.length-1;p=t-1>=0?t-1:o.length- -1;G=[];G.push(o[t]);G.push(f[u]);G.push(f[d]);G=this.Triangulate.area(G);y=[];y.push(o[t]);y.push(o[p]);y.push(f[u]);y=this.Triangulate.area(y);v+A>G+y&&(u=z,t=x,u<0&&(u+=f.length),u%=f.length,t<0&&(t+=o.length),t%=f.length,d=u-1>=0?u-1:f.length-1,p=t-1>=0?t-1:o.length-1);v=f.slice(0,u);A=f.slice(u);z=o.slice(t);x=o.slice(0,t);g.push(o[t]);g.push(f[u]);g.push(f[d]);g.push(o[t]);g.push(o[p]);g.push(f[u]);f=v.concat(z).concat(x).concat(A)}m.shape=f}b=[];t=[];for(k=n=0;k0&&j.push({shape:f,holes:e}),f=p,e=[]):e.push(p):this.Triangulate.area(p)<0?(j.push({shape:p,holes:e}),e=[]):e.push(p);o++}n&&j.push({shape:f,holes:e})}var t,u,v,z,A,y;g=[];for(k=0;k=0?u-1:f.length-1;var p=t-1>=0?t-1:o.length-1,F=[];F.push(o[t]);F.push(f[u]);F.push(f[d]);v=this.Triangulate.area(F);var x=[];x.push(o[t]);x.push(o[p]);x.push(f[u]);A=this.Triangulate.area(x);z=u;y=t;u+=1;t+=-1;u<0&&(u+=f.length);u%=f.length;t<0&&(t+=o.length);t%=f.length;d=u-1>=0?u-1:f.length-1;p=t-1>=0?t-1:o.length- +1;F=[];F.push(o[t]);F.push(f[u]);F.push(f[d]);F=this.Triangulate.area(F);x=[];x.push(o[t]);x.push(o[p]);x.push(f[u]);x=this.Triangulate.area(x);v+A>F+x&&(u=z,t=y,u<0&&(u+=f.length),u%=f.length,t<0&&(t+=o.length),t%=f.length,d=u-1>=0?u-1:f.length-1,p=t-1>=0?t-1:o.length-1);v=f.slice(0,u);A=f.slice(u);z=o.slice(t);y=o.slice(0,t);g.push(o[t]);g.push(f[u]);g.push(f[d]);g.push(o[t]);g.push(o[p]);g.push(f[u]);f=v.concat(z).concat(y).concat(A)}m.shape=f}b=[];t=[];for(k=n=0;k=0;){if(o){if(o.equals(d[b])){o=null;m=this.Triangulate.area(e)>0;j.push(m);g.push(k.divideScalar(e.length));e=[];k=new THREE.Vector2;continue}}else o=d[b];k.addSelf(d[b]);e.push(d[b])}b=d.length;e=0;for(var n;--b>=0;)m=d[b],k=g[e],m=m.clone().subSelf(k),n=this.bezelSize/m.length(), j[e]?n+=1:n=1-n,n=m.multiplyScalar(n).addSelf(k),f.unshift(n),o?o.equals(d[b])&&(o=null,e++):o=d[b];c.bezel=f;return c},b2p0:function(b,c){var d=1-b;return d*d*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,d,e){return this.b2p0(b,c)+this.b2p1(b,d)+this.b2p2(b,e)},b3p0:function(b,c){var d=1-b;return d*d*d*c},b3p1:function(b,c){var d=1-b;return 3*d*d*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,d,e,f){return this.b3p0(b, c)+this.b3p1(b,d)+this.b3p2(b,e)+this.b3p3(b,f)},extractGlyphPoints:function(b,c,d,e){var f=[],g,j,k,m,o,n,p,t,u,v,z=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){c=z._cachedOutline||(z._cachedOutline=z.o.split(" "));k=c.length;for(b=0;b0)for(o=0;o2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return g}m=o;f<=m&&(m=0);o=m+1;f<=o&&(o=0);n=o+1;f<=n&&(n=0);var t;a:{t=b;var u=m,v=o,z=n,A=f,x=j,G=void 0,y=void 0,D=void 0, -F=void 0,B=void 0,P=void 0,K=void 0,L=void 0,E=void 0,y=t[x[u]].x,D=t[x[u]].y,F=t[x[v]].x,B=t[x[v]].y,P=t[x[z]].x,K=t[x[z]].y;if(1.0E-10>(F-y)*(K-D)-(B-D)*(P-y))t=!1;else{for(G=0;G=0&&h>=0&&R>=0){t=!1;break a}}t= +g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var A=g/divisions,y=THREE.FontUtils.b2(A,o,p,j),A=THREE.FontUtils.b2(A,n,t,m);f.push(new THREE.Vector2(y,A))}}break;case "b":if(j=c[b++]*d+e,m=c[b++]*d,p=c[b++]*d+e,t=c[b++]*-d,u=c[b++]*d+e,v=c[b++]*-d,g=f[f.length-1]){o=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)A=g/divisions,y=THREE.FontUtils.b3(A,o,p,u,j),A=THREE.FontUtils.b3(A,n,t,v,m),f.push(new THREE.Vector2(y,A))}}}return{offset:z.ha*d,points:f}}}}; +(function(b){var c=function(b){for(var c=b.length,f=0,g=c-1,j=0;j0)for(o=0;o2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return g}m=o;f<=m&&(m=0);o=m+1;f<=o&&(o=0);n=o+1;f<=n&&(n=0);var t;a:{t=b;var u=m,v=o,z=n,A=f,y=j,F=void 0,x=void 0,D=void 0, +G=void 0,B=void 0,Q=void 0,K=void 0,L=void 0,E=void 0,x=t[y[u]].x,D=t[y[u]].y,G=t[y[v]].x,B=t[y[v]].y,Q=t[y[z]].x,K=t[y[z]].y;if(1.0E-10>(G-x)*(K-D)-(B-D)*(Q-x))t=!1;else{for(F=0;F=0&&h>=0&&S>=0){t=!1;break a}}t= !0}}if(t){p=j[m];t=j[o];u=j[n];g.push(b[p]);g.push(b[t]);g.push(b[u]);k.push([j[m],j[o],j[n]]);m=o;for(n=o+1;n>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(b,c){var d=n(b,c),e=n(b,c+1),g=n(b,c+2);return(n(b,c+3)<<24)+(g<<16)+(e<<8)+d}function m(b,c){var d=n(b,c);return(n(b,c+1)<<8)+d}function o(b,c){var d=n(b,c);return d>127?d-256:d}function n(b, -c){return b.charCodeAt(c)&255}function p(c){var d,e,g;d=f(b,c);e=f(b,c+B);g=f(b,c+P);c=m(b,c+K);THREE.BinaryLoader.prototype.f3(x,d,e,g,c)}function t(c){var d,e,g,h,j,n;d=f(b,c);e=f(b,c+B);g=f(b,c+P);h=m(b,c+K);j=f(b,c+L);n=f(b,c+E);c=f(b,c+M);THREE.BinaryLoader.prototype.f3n(x,D,d,e,g,h,j,n,c)}function u(c){var d,e,g,j;d=f(b,c);e=f(b,c+T);g=f(b,c+h);j=f(b,c+Q);c=m(b,c+R);THREE.BinaryLoader.prototype.f4(x,d,e,g,j,c)}function v(c){var d,e,g,j,n,o,p,t;d=f(b,c);e=f(b,c+T);g=f(b,c+h);j=f(b,c+Q);n=m(b, -c+R);o=f(b,c+N);p=f(b,c+aa);t=f(b,c+U);c=f(b,c+V);THREE.BinaryLoader.prototype.f4n(x,D,d,e,g,j,n,o,p,t,c)}function z(c){var d,e;d=f(b,c);e=f(b,c+ga);c=f(b,c+W);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],F[d*2],F[d*2+1],F[e*2],F[e*2+1],F[c*2],F[c*2+1])}function A(c){var d,e,g;d=f(b,c);e=f(b,c+da);g=f(b,c+ea);c=f(b,c+ka);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],F[d*2],F[d*2+1],F[e*2],F[e*2+1],F[g*2],F[g*2+1],F[c*2],F[c*2+1])}var x=this,G=0,y,D=[],F=[],B,P,K,L,E,M,T,h,Q,R,N,aa,U, -V,ga,W,da,ea,ka,fa,I,S,Z,$,ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,e,c);y={signature:b.substr(G,8),header_bytes:n(b,G+8),vertex_coordinate_bytes:n(b,G+9),normal_coordinate_bytes:n(b,G+10),uv_coordinate_bytes:n(b,G+11),vertex_index_bytes:n(b,G+12),normal_index_bytes:n(b,G+13),uv_index_bytes:n(b,G+14),material_index_bytes:n(b,G+15),nvertices:f(b,G+16),nnormals:f(b,G+16+4),nuvs:f(b,G+16+8),ntri_flat:f(b,G+16+12),ntri_smooth:f(b,G+16+16),ntri_flat_uv:f(b,G+16+20),ntri_smooth_uv:f(b, -G+16+24),nquad_flat:f(b,G+16+28),nquad_smooth:f(b,G+16+32),nquad_flat_uv:f(b,G+16+36),nquad_smooth_uv:f(b,G+16+40)};G+=y.header_bytes;B=y.vertex_index_bytes;P=y.vertex_index_bytes*2;K=y.vertex_index_bytes*3;L=y.vertex_index_bytes*3+y.material_index_bytes;E=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes;M=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*2;T=y.vertex_index_bytes;h=y.vertex_index_bytes*2;Q=y.vertex_index_bytes*3;R=y.vertex_index_bytes*4;N=y.vertex_index_bytes* -4+y.material_index_bytes;aa=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes;U=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*2;V=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*3;ga=y.uv_index_bytes;W=y.uv_index_bytes*2;da=y.uv_index_bytes;ea=y.uv_index_bytes*2;ka=y.uv_index_bytes*3;c=y.vertex_index_bytes*3+y.material_index_bytes;ia=y.vertex_index_bytes*4+y.material_index_bytes;fa=y.ntri_flat*c;I=y.ntri_smooth*(c+y.normal_index_bytes*3);S= -y.ntri_flat_uv*(c+y.uv_index_bytes*3);Z=y.ntri_smooth_uv*(c+y.normal_index_bytes*3+y.uv_index_bytes*3);$=y.nquad_flat*ia;c=y.nquad_smooth*(ia+y.normal_index_bytes*4);ia=y.nquad_flat_uv*(ia+y.uv_index_bytes*4);G+=function(c){for(var e,f,g,h=y.vertex_coordinate_bytes*3,k=c+y.nvertices*h;c1&&(L=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,L);object.name=u;object.position.set(y[0],y[1],y[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;N.scene.addObject(object);N.objects[u]=object;if(G.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);N.scene.collisions.colliders.push(b)}if(G.castsShadow)b=new THREE.ShadowVolume(B),N.scene.addChild(b), -b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},N.triggers[object.name]=b)}}else y=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(y[0],y[1],y[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=G.visible!==void 0?G.visible:!1,N.scene.addObject(object), -N.objects[u]=object,N.empties[u]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},N.triggers[object.name]=b)}function m(b){return function(c){N.geometries[b]=c;k();T-=1;d.onLoadComplete();n()}}function o(b){return function(c){N.geometries[b]=c}}function n(){d.callbackProgress({totalModels:Q,totalTextures:R,loadedModels:Q-T,loadedTextures:R-h},N);d.onLoadProgress();T==0&&h==0&&c(N)}var p,t,u,v,z,A,x,G,y,D,F,B,P,K,L,E,M,T,h,Q,R,N;E=b.data;b=new THREE.BinaryLoader;M=new THREE.JSONLoader; -h=T=0;N={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var aa=!1;for(u in E.objects)if(G=E.objects[u],G.meshCollider){aa=!0;break}if(aa)N.scene.collisions=new THREE.CollisionSystem;if(E.transform){aa=E.transform.position;D=E.transform.rotation;var U=E.transform.scale;aa&&N.scene.position.set(aa[0],aa[1],aa[2]);D&&N.scene.rotation.set(D[0],D[1],D[2]);U&&N.scene.scale.set(U[0],U[1],U[2]);(aa||D||U)&&N.scene.updateMatrix()}aa= -function(){h-=1;n();d.onLoadComplete()};for(z in E.cameras){D=E.cameras[z];if(D.type=="perspective")P=new THREE.Camera(D.fov,D.aspect,D.near,D.far);else if(D.type=="ortho")P=new THREE.Camera,P.projectionMatrix=THREE.Matrix4.makeOrtho(D.left,D.right,D.top,D.bottom,D.near,D.far);y=D.position;D=D.target;P.position.set(y[0],y[1],y[2]);P.target.position.set(D[0],D[1],D[2]);N.cameras[z]=P}for(v in E.lights){z=E.lights[v];P=z.color!==void 0?z.color:16777215;D=z.intensity!==void 0?z.intensity:1;if(z.type== -"directional")y=z.direction,light=new THREE.DirectionalLight(P,D),light.position.set(y[0],y[1],y[2]),light.position.normalize();else if(z.type=="point")y=z.position,light=new THREE.PointLight(P,D),light.position.set(y[0],y[1],y[2]);N.scene.addLight(light);N.lights[v]=light}for(A in E.fogs)v=E.fogs[A],v.type=="linear"?K=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(K=new THREE.FogExp2(0,v.density)),D=v.color,K.color.setRGB(D[0],D[1],D[2]),N.fogs[A]=K;if(N.cameras&&E.defaults.camera)N.currentCamera= -N.cameras[E.defaults.camera];if(N.fogs&&E.defaults.fog)N.scene.fog=N.fogs[E.defaults.fog];D=E.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(D[0],D[1],D[2]);N.bgColorAlpha=E.defaults.bgalpha;for(p in E.geometries)if(A=E.geometries[p],A.type=="bin_mesh"||A.type=="ascii_mesh")T+=1,d.onLoadStart();Q=T;for(p in E.geometries)A=E.geometries[p],A.type=="cube"?(B=new THREE.CubeGeometry(A.width,A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),N.geometries[p]= -B):A.type=="plane"?(B=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),N.geometries[p]=B):A.type=="sphere"?(B=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),N.geometries[p]=B):A.type=="cylinder"?(B=new THREE.CylinderGeometry(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset),N.geometries[p]=B):A.type=="torus"?(B=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,A.segmentsT),N.geometries[p]=B):A.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(A.subdivisions), -N.geometries[p]=B):A.type=="bin_mesh"?b.load({model:e(A.url,E.urlBaseType),callback:m(p)}):A.type=="ascii_mesh"?M.load({model:e(A.url,E.urlBaseType),callback:m(p)}):A.type=="embedded_mesh"&&(A=E.embeds[A.id])&&M.createModel(A,o(p),"");for(x in E.textures)if(p=E.textures[x],p.url instanceof Array){h+=p.url.length;for(b=0;b1&&(L=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,L);object.name=u;object.position.set(x[0],x[1],x[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;O.scene.addObject(object);O.objects[u]=object;if(F.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);O.scene.collisions.colliders.push(b)}if(F.castsShadow)b=new THREE.ShadowVolume(B),O.scene.addChild(b), +b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},O.triggers[object.name]=b)}}else x=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(x[0],x[1],x[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,O.scene.addObject(object), +O.objects[u]=object,O.empties[u]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},O.triggers[object.name]=b)}function m(b){return function(c){O.geometries[b]=c;k();U-=1;d.onLoadComplete();n()}}function o(b){return function(c){O.geometries[b]=c}}function n(){d.callbackProgress({totalModels:R,totalTextures:S,loadedModels:R-U,loadedTextures:S-h},O);d.onLoadProgress();U==0&&h==0&&c(O)}var p,t,u,v,z,A,y,F,x,D,G,B,Q,K,L,E,M,U,h,R,S,O;E=b.data;b=new THREE.BinaryLoader;M=new THREE.JSONLoader; +h=U=0;O={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var aa=!1;for(u in E.objects)if(F=E.objects[u],F.meshCollider){aa=!0;break}if(aa)O.scene.collisions=new THREE.CollisionSystem;if(E.transform){aa=E.transform.position;D=E.transform.rotation;var V=E.transform.scale;aa&&O.scene.position.set(aa[0],aa[1],aa[2]);D&&O.scene.rotation.set(D[0],D[1],D[2]);V&&O.scene.scale.set(V[0],V[1],V[2]);(aa||D||V)&&O.scene.updateMatrix()}aa= +function(){h-=1;n();d.onLoadComplete()};for(z in E.cameras){D=E.cameras[z];if(D.type=="perspective")Q=new THREE.Camera(D.fov,D.aspect,D.near,D.far);else if(D.type=="ortho")Q=new THREE.Camera,Q.projectionMatrix=THREE.Matrix4.makeOrtho(D.left,D.right,D.top,D.bottom,D.near,D.far);x=D.position;D=D.target;Q.position.set(x[0],x[1],x[2]);Q.target.position.set(D[0],D[1],D[2]);O.cameras[z]=Q}for(v in E.lights){z=E.lights[v];Q=z.color!==void 0?z.color:16777215;D=z.intensity!==void 0?z.intensity:1;if(z.type== +"directional")x=z.direction,light=new THREE.DirectionalLight(Q,D),light.position.set(x[0],x[1],x[2]),light.position.normalize();else if(z.type=="point")x=z.position,light=new THREE.PointLight(Q,D),light.position.set(x[0],x[1],x[2]);O.scene.addLight(light);O.lights[v]=light}for(A in E.fogs)v=E.fogs[A],v.type=="linear"?K=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(K=new THREE.FogExp2(0,v.density)),D=v.color,K.color.setRGB(D[0],D[1],D[2]),O.fogs[A]=K;if(O.cameras&&E.defaults.camera)O.currentCamera= +O.cameras[E.defaults.camera];if(O.fogs&&E.defaults.fog)O.scene.fog=O.fogs[E.defaults.fog];D=E.defaults.bgcolor;O.bgColor=new THREE.Color;O.bgColor.setRGB(D[0],D[1],D[2]);O.bgColorAlpha=E.defaults.bgalpha;for(p in E.geometries)if(A=E.geometries[p],A.type=="bin_mesh"||A.type=="ascii_mesh")U+=1,d.onLoadStart();R=U;for(p in E.geometries)A=E.geometries[p],A.type=="cube"?(B=new THREE.CubeGeometry(A.width,A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),O.geometries[p]= +B):A.type=="plane"?(B=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),O.geometries[p]=B):A.type=="sphere"?(B=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),O.geometries[p]=B):A.type=="cylinder"?(B=new THREE.CylinderGeometry(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset),O.geometries[p]=B):A.type=="torus"?(B=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,A.segmentsT),O.geometries[p]=B):A.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(A.subdivisions), +O.geometries[p]=B):A.type=="bin_mesh"?b.load({model:e(A.url,E.urlBaseType),callback:m(p)}):A.type=="ascii_mesh"?M.load({model:e(A.url,E.urlBaseType),callback:m(p)}):A.type=="embedded_mesh"&&(A=E.embeds[A.id])&&M.createModel(A,o(p),"");for(y in E.textures)if(p=E.textures[y],p.url instanceof Array){h+=p.url.length;for(b=0;b=this.maxCount-3&&k(this)};this.begin=function(){this.count=0; this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(m=this.size-1);var t=Math.floor(o-k);t<1&&(t=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size- -1);for(var v,z,A,x,G,y;p0&&(this.field[A+v]+=x)}}};this.addPlaneX=function(b,c){var f,g,j,k,m,o=this.size,n=this.yd,p=this.zd,t=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(f=0;f0)for(g=0;g0&&(this.field[A+v]+=y)}}};this.addPlaneX=function(b,c){var f,g,j,k,m,o=this.size,n=this.yd,p=this.zd,t=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(f=0;f0)for(g=0;gn&&(v=n);for(g=0;g0){m=g*p;for(f=0;fsize&&(dist=size);for(j=0;j0){m=zd*j;for(g=0;g>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)}; +THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;this.updateHex()},setHSV:function(b,d,e){var f,g,i,h,j,o;if(e==0)f=g=i=0;else switch(h=Math.floor(b*6),j=b*6-h,b=e*(1-d),o=e*(1-d*j),d=e*(1-d*(1-j)),h){case 1:f=o;g=e;i=b;break;case 2:f=b;g=e;i=d;break;case 3:f=b;g=o;i=e;break;case 4:f=d;g=b;i=e;break;case 5:f=e;g=b;i=o;break;case 6:case 0:f=e,g=d,i=b}this.setRGB(f, +g,i)},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},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)}; THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,d){this.x=b.x+d.x;this.y=b.y+d.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,d){this.x=b.x-d.x;this.y=b.y-d.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b? (this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,b=this.y-b.y;return d*d+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)}, unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,d,e){this.set(b||0,d||0,e||0)}; @@ -14,71 +14,71 @@ THREE.Vector4.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())}, setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,d){this.x+=(b.x-this.x)*d;this.y+=(b.y-this.y)*d;this.z+=(b.z-this.z)*d;this.w+=(b.w-this.w)*d;return this}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3}; THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f=[];d=0;for(e=b.length;d0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var f=d(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=d(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var h,i,g,j,p,k,n,v,r,q,y=b.geometry, -B=y.vertices,D=[],f=0;for(h=y.faces.length;f0:v<0))if(n=n.dot((new THREE.Vector3).sub(g,r))/v,r=r.addSelf(q.multiplyScalar(n)), -i instanceof THREE.Face3)e(r,g,j,p)&&(i={distance:this.origin.distanceTo(r),point:r,face:i,object:b},D.push(i));else if(i instanceof THREE.Face4&&(e(r,g,j,k)||e(r,j,p,k)))i={distance:this.origin.distanceTo(r),point:r,face:i,object:b},D.push(i);return D}else return[]}}; -THREE.Rectangle=function(){function b(){i=f-d;g=h-e}var d,e,f,h,i,g,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return g};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(g,i,n,v){j=!1;d=g;e=i;f=n;h=v;b()};this.addPoint=function(g,i){j?(j=!1,d=g,e=i,f=g,h=i):(d=dg?f:g,h=h>i?h:i);b()};this.add3Points= -function(g,i,n,v,r,q){j?(j=!1,d=gn?g>r?g:r:n>r?n:r,h=i>v?i>q?i:q:v>q?v:q):(d=gn?g>r?g>f?g:f:r>f?r:f:n>r?n>f?n:f:r>f?r:f,h=i>v?i>q?i>h?i:h:q>h?q:h:v>q?v>h?v:h:q>h?q:h);b()};this.addRectangle=function(g){j?(j=!1,d=g.getLeft(),e=g.getTop(),f=g.getRight(),h=g.getBottom()):(d=dg.getRight()?f:g.getRight(),h=h> -g.getBottom()?h:g.getBottom());b()};this.inflate=function(g){d-=g;e-=g;f+=g;h+=g;b()};this.minSelf=function(g){d=d>g.getLeft()?d:g.getLeft();e=e>g.getTop()?e:g.getTop();f=f=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;h=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,h,i,g,j,p,k,n,v,r,q,y,B){this.set(b||1,d||0,e||0,f||0,h||0,i||1,g||0,j||0,p||0,k||0,n||1,v||0,r||0,q||0,y||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,d,e,f,h,i,g,j,p,k,n,v,r,q,y,B){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=h;this.n22=i;this.n23=g;this.n24=j;this.n31=p;this.n32=k;this.n33=n;this.n34=v;this.n41=r;this.n42=q;this.n43=y;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1, -h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());h.cross(i,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=i.x;this.n21=f.y;this.n22=h.y;this.n23=i.y;this.n31=f.z;this.n32=h.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,h=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*h;b.y=(this.n21*d+this.n22*e+this.n23* -f+this.n24)*h;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+e*this.n32+f*this.n33;b.normalize(); -return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,p=b.n23,k=b.n24,n=b.n31,v=b.n32,r=b.n33,q=b.n34,y=b.n41,B=b.n42,D=b.n43,A=b.n44,O=d.n11,ha=d.n12,T=d.n13,E=d.n14,x=d.n21,ca=d.n22, -M=d.n23,C=d.n24,Q=d.n31,$=d.n32,aa=d.n33,c=d.n34;this.n11=e*O+f*x+h*Q;this.n12=e*ha+f*ca+h*$;this.n13=e*T+f*M+h*aa;this.n14=e*E+f*C+h*c+i;this.n21=g*O+j*x+p*Q;this.n22=g*ha+j*ca+p*$;this.n23=g*T+j*M+p*aa;this.n24=g*E+j*C+p*c+k;this.n31=n*O+v*x+r*Q;this.n32=n*ha+v*ca+r*$;this.n33=n*T+v*M+r*aa;this.n34=n*E+v*C+r*c+q;this.n41=y*O+B*x+D*Q;this.n42=y*ha+B*ca+D*$;this.n43=y*T+B*M+D*aa;this.n44=y*E+B*C+D*c+A;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]= +g=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-d*d),h=(h*f-d*e)*g,b=(b*e-d*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=d(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=d(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,i,h,j,o,k,n,v,q,r,y=b.geometry, +B=y.vertices,D=[],f=0;for(g=y.faces.length;f0:v<0))if(n=n.dot((new THREE.Vector3).sub(h,q))/v,q=q.addSelf(r.multiplyScalar(n)), +i instanceof THREE.Face3)e(q,h,j,o)&&(i={distance:this.origin.distanceTo(q),point:q,face:i,object:b},D.push(i));else if(i instanceof THREE.Face4&&(e(q,h,j,k)||e(q,j,o,k)))i={distance:this.origin.distanceTo(q),point:q,face:i,object:b},D.push(i);return D}else return[]}}; +THREE.Rectangle=function(){function b(){i=f-d;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,n,v){j=!1;d=h;e=i;f=n;g=v;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=dh?f:h,g=g>i?g:i);b()};this.add3Points= +function(h,i,n,v,q,r){j?(j=!1,d=hn?h>q?h:q:n>q?n:q,g=i>v?i>r?i:r:v>r?v:r):(d=hn?h>q?h>f?h:f:q>f?q:f:n>q?n>f?n:f:q>f?q:f,g=i>v?i>r?i>g?i:g:r>g?r:g:v>r?v>g?v:g:r>g?r:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=dh.getRight()?f:h.getRight(),g=g> +h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){d-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){d=d>h.getLeft()?d:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;g=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]}; +THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,g,i,h,j,o,k,n,v,q,r,y,B){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,o||0,k||0,n||1,v||0,q||0,r||0,y||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,o,k,n,v,q,r,y,B){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=o;this.n32=k;this.n33=n;this.n34=v;this.n41=q;this.n42=r;this.n43=y;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1, +g=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());g.cross(i,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=i.x;this.n21=f.y;this.n22=g.y;this.n23=i.y;this.n31=f.z;this.n32=g.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,g=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23* +f+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+e*this.n32+f*this.n33;b.normalize(); +return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,o=b.n23,k=b.n24,n=b.n31,v=b.n32,q=b.n33,r=b.n34,y=b.n41,B=b.n42,D=b.n43,A=b.n44,O=d.n11,ia=d.n12,T=d.n13,E=d.n14,t=d.n21,ca=d.n22, +M=d.n23,C=d.n24,Q=d.n31,$=d.n32,aa=d.n33,c=d.n34;this.n11=e*O+f*t+g*Q;this.n12=e*ia+f*ca+g*$;this.n13=e*T+f*M+g*aa;this.n14=e*E+f*C+g*c+i;this.n21=h*O+j*t+o*Q;this.n22=h*ia+j*ca+o*$;this.n23=h*T+j*M+o*aa;this.n24=h*E+j*C+o*c+k;this.n31=n*O+v*t+q*Q;this.n32=n*ia+v*ca+q*$;this.n33=n*T+v*M+q*aa;this.n34=n*E+v*C+q*c+r;this.n41=y*O+B*t+D*Q;this.n42=y*ia+B*ca+D*$;this.n43=y*T+B*M+D*aa;this.n44=y*E+B*C+D*c+A;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]= this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this}, -determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,h=this.n21,i=this.n22,g=this.n23,j=this.n24,p=this.n31,k=this.n32,n=this.n33,v=this.n34,r=this.n41,q=this.n42,y=this.n43,B=this.n44;return f*g*k*r-e*j*k*r-f*i*n*r+d*j*n*r+e*i*v*r-d*g*v*r-f*g*p*q+e*j*p*q+f*h*n*q-b*j*n*q-e*h*v*q+b*g*v*q+f*i*p*y-d*j*p*y-f*h*k*y+b*j*k*y+d*h*v*y-b*i*v*y-e*i*p*B+d*g*p*B+e*h*k*B-b*g*k*B-d*h*n*B+b*i*n*B},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13= +determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,o=this.n31,k=this.n32,n=this.n33,v=this.n34,q=this.n41,r=this.n42,y=this.n43,B=this.n44;return f*h*k*q-e*j*k*q-f*i*n*q+d*j*n*q+e*i*v*q-d*h*v*q-f*h*o*r+e*j*o*r+f*g*n*r-b*j*n*r-e*g*v*r+b*h*v*r+f*i*o*y-d*j*o*y-f*g*k*y+b*j*k*y+d*g*v*y-b*i*v*y-e*i*o*B+d*h*o*B+e*g*k*B-b*h*k*B-d*g*n*B+b*i*n*B},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13= b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11; this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13; b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this}, -setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),f=Math.sin(d),h=1-e,i=b.x,g=b.y,j= -b.z,p=h*i,k=h*g;this.set(p*i+e,p*g-f*j,p*j+f*g,0,p*g+f*j,k*g+e,k*j-f*i,0,p*j-f*g,k*j+f*i,h*j*j+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY= -new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,e=b.y,f=b.z,b=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),g=b*e,j=d*e;this.n11=h*i;this.n12=-h*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*h;this.n31=-g*i+d*f;this.n32=g*f+d*i;this.n33= -b*h;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,h=b.w,i=d+d,g=e+e,j=f+f,b=d*i,p=d*g;d*=j;var k=e*g;e*=j;f*=j;i*=h;g*=h;h*=j;this.n11=1-(k+f);this.n12=p-h;this.n13=d+g;this.n21=p+h;this.n22=1-(b+f);this.n23=e-i;this.n31=d-g;this.n32=e+i;this.n33=1-(b+k);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14= -b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,h=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}}; -THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,p=b.n23,k=b.n24,n=b.n31,v=b.n32,r=b.n33,q=b.n34,y=b.n41,B=b.n42,D=b.n43,A=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=p*q*B-k*r*B+k*v*D-j*q*D-p*v*A+j*r*A;d.n12=i*r*B-h*q*B-i*v*D+f*q*D+h*v*A-f*r*A;d.n13=h*k*B-i*p*B+i*j*D-f*k*D-h*j*A+f*p*A;d.n14=i*p*v-h*k*v-i*j*r+f*k*r+h*j*q-f*p*q;d.n21=k*r*y-p*q*y-k*n*D+g*q*D+p*n*A-g*r*A;d.n22=h*q*y-i*r*y+i*n*D-e*q*D-h*n*A+e*r*A;d.n23=i*p*y-h*k*y-i*g*D+e*k*D+h*g*A-e*p*A;d.n24= -h*k*n-i*p*n+i*g*r-e*k*r-h*g*q+e*p*q;d.n31=j*q*y-k*v*y+k*n*B-g*q*B-j*n*A+g*v*A;d.n32=i*v*y-f*q*y-i*n*B+e*q*B+f*n*A-e*v*A;d.n33=h*k*y-i*j*y+i*g*B-e*k*B-f*g*A+e*j*A;d.n34=i*j*n-f*k*n-i*g*v+e*k*v+f*g*q-e*j*q;d.n41=p*v*y-j*r*y-p*n*B+g*r*B+j*n*D-g*v*D;d.n42=f*r*y-h*v*y+h*n*B-e*r*B-f*n*D+e*v*D;d.n43=h*j*y-f*p*y-h*g*B+e*p*B+f*g*D-e*j*D;d.n44=f*p*n-h*j*n+h*g*v-e*p*v-f*g*r+e*j*r;d.multiplyScalar(1/b.determinant());return d}; -THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,g=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,k=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*g+b.n31*k;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*i;e[3]=b*g;e[4]=b*j;e[5]=b*p;e[6]=b*k;e[7]=b*n;e[8]=b*v;return d}; -THREE.Matrix4.makeFrustum=function(b,d,e,f,h,i){var g;g=new THREE.Matrix4;g.n11=2*h/(d-b);g.n12=0;g.n13=(d+b)/(d-b);g.n14=0;g.n21=0;g.n22=2*h/(f-e);g.n23=(f+e)/(f-e);g.n24=0;g.n31=0;g.n32=0;g.n33=-(i+h)/(i-h);g.n34=-2*i*h/(i-h);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(b,d,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*d,b*d,h,b,e,f)}; -THREE.Matrix4.makeOrtho=function(b,d,e,f,h,i){var g,j,p,k;g=new THREE.Matrix4;j=d-b;p=e-f;k=i-h;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((d+b)/j);g.n21=0;g.n22=2/p;g.n23=0;g.n24=-((e+f)/p);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((i+h)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; +setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),f=Math.sin(d),g=1-e,i=b.x,h=b.y,j= +b.z,o=g*i,k=g*h;this.set(o*i+e,o*h-f*j,o*j+f*h,0,o*h+f*j,k*h+e,k*j-f*i,0,o*j-f*h,k*j+f*i,g*j*j+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY= +new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,e=b.y,f=b.z,b=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),h=b*e,j=d*e;this.n11=g*i;this.n12=-g*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*g;this.n31=-h*i+d*f;this.n32=h*f+d*i;this.n33= +b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,o=d*h;d*=j;var k=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(k+f);this.n12=o-g;this.n13=d+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;this.n32=e+i;this.n33=1-(b+k);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14= +b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; +THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,o=b.n23,k=b.n24,n=b.n31,v=b.n32,q=b.n33,r=b.n34,y=b.n41,B=b.n42,D=b.n43,A=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=o*r*B-k*q*B+k*v*D-j*r*D-o*v*A+j*q*A;d.n12=i*q*B-g*r*B-i*v*D+f*r*D+g*v*A-f*q*A;d.n13=g*k*B-i*o*B+i*j*D-f*k*D-g*j*A+f*o*A;d.n14=i*o*v-g*k*v-i*j*q+f*k*q+g*j*r-f*o*r;d.n21=k*q*y-o*r*y-k*n*D+h*r*D+o*n*A-h*q*A;d.n22=g*r*y-i*q*y+i*n*D-e*r*D-g*n*A+e*q*A;d.n23=i*o*y-g*k*y-i*h*D+e*k*D+g*h*A-e*o*A;d.n24= +g*k*n-i*o*n+i*h*q-e*k*q-g*h*r+e*o*r;d.n31=j*r*y-k*v*y+k*n*B-h*r*B-j*n*A+h*v*A;d.n32=i*v*y-f*r*y-i*n*B+e*r*B+f*n*A-e*v*A;d.n33=g*k*y-i*j*y+i*h*B-e*k*B-f*h*A+e*j*A;d.n34=i*j*n-f*k*n-i*h*v+e*k*v+f*h*r-e*j*r;d.n41=o*v*y-j*q*y-o*n*B+h*q*B+j*n*D-h*v*D;d.n42=f*q*y-g*v*y+g*n*B-e*q*B-f*n*D+e*v*D;d.n43=g*j*y-f*o*y-g*h*B+e*o*B+f*h*D-e*j*D;d.n44=f*o*n-g*j*n+g*h*v-e*o*v-f*h*q+e*j*q;d.multiplyScalar(1/b.determinant());return d}; +THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,k=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*k;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*o;e[6]=b*k;e[7]=b*n;e[8]=b*v;return d}; +THREE.Matrix4.makeFrustum=function(b,d,e,f,g,i){var h;h=new THREE.Matrix4;h.n11=2*g/(d-b);h.n12=0;h.n13=(d+b)/(d-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(i+g)/(i-g);h.n34=-2*i*g/(i-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,d,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,f)}; +THREE.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,o,k;h=new THREE.Matrix4;j=d-b;o=e-f;k=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/o;h.n23=0;h.n24=-((e+f)/o);h.n31=0;h.n32=0;h.n33=-2/k;h.n34=-((i+g)/k);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=void 0;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.flipSided=this.doubleSided=this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius= 0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)=== --1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d.parent!==void 0;)d=d.parent;d!==void 0&&d instanceof THREE.Scene&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1)b.parent=void 0,this.children.splice(d,1)},getChildByName:function(b,d){var e,f,h;e=0;for(f=this.children.length;e=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.0010)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;h=Math.sin((1-f)*i)/g;f=Math.sin(f*i)/g;e.w=b.w*h+d.w*f;e.x=b.x*h+d.x*f;e.y=b.y*h+d.y*f;e.z=b.z*h+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; -THREE.Face3=function(b,d,e,f,h,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3}; -THREE.Face4=function(b,d,e,f,h,i,g){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; +multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,g=this.w,i=b.x,h=b.y,j=b.z,b=b.w;this.x=d*b+g*i+e*j-f*h;this.y=e*b+g*h+f*i-d*j;this.z=f*b+g*j+d*h-e*i;this.w=g*b-d*i-e*h-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,g=b.z,i=this.x,h=this.y,j=this.z,o=this.w,k=o*e+h*g-j*f,n= +o*f+j*e-i*g,v=o*g+i*f-h*e,e=-i*e-h*f-j*g;d.x=k*o+e*-i+n*-j-v*-h;d.y=n*o+e*-h+v*-i-k*-j;d.z=v*o+e*-j+k*-h-n*-i;return d}}; +THREE.Quaternion.slerp=function(b,d,e,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;g=Math.sin((1-f)*i)/h;f=Math.sin(f*i)/h;e.w=b.w*g+d.w*f;e.x=b.x*g+d.x*f;e.y=b.y*g+d.y*f;e.z=b.z*g+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; +THREE.Face3=function(b,d,e,f,g,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3}; +THREE.Face4=function(b,d,e,f,g,i,h){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;dthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,d=0,e=this.vertices.length;dthis.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;k=this.points[e[0]];n=this.points[e[1]]; -v=this.points[e[2]];r=this.points[e[3]];j=g*g;p=g*j;f.x=d(k.x,n.x,v.x,r.x,g,j,p);f.y=d(k.y,n.y,v.y,r.y,g,j,p);f.z=d(k.z,n.z,v.z,r.z,g,j,p);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;bthis.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;k=this.points[e[0]];n=this.points[e[1]]; +v=this.points[e[2]];q=this.points[e[3]];j=h*h;o=h*j;f.x=d(k.x,n.x,v.x,q.x,h,j,o);f.y=d(k.y,n.y,v.y,q.y,h,j,o);f.z=d(k.z,n.z,v.z,q.z,h,j,o);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1, this.LODs[f].object3D.visible=!0;else break;for(;fv&&(e=n,n=v,v=e):nq&&(e=r,r=q,q=e):rv&&(e=n,n=v,v=e):nr&&(e=q,q=r,r=e):q=0&&h>=0&&g>=0&&i>=0?!0:f<0&&h<0||g<0&&i<0?!1:(f<0?c=Math.max(c,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),g<0?c=Math.max(c,g/(g-i)):i<0&&(e=Math.min(e,g/(g-i))),eT&&g.positionScreen.z0&&E.z<1))ja=ha[O]=ha[O]||new THREE.RenderableParticle,O++,A=ja,A.x=E.x/E.w,A.y=E.y/E.w,A.z=E.z,A.rotation=F.rotation.z,A.scale.x=F.scale.x*Math.abs(A.x-(E.x+h.projectionMatrix.n11)/ -(E.w+h.projectionMatrix.n14)),A.scale.y=F.scale.y*Math.abs(A.y-(E.y+h.projectionMatrix.n22)/(E.w+h.projectionMatrix.n24)),A.materials=F.materials,i.push(A);c&&i.sort(d);return i}}; -THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,e){e&&b.update(void 0,!1,d);var e=b.sounds,f,h=e.length;for(f=0;f=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),h<0?c=Math.max(c,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),eT&&h.positionScreen.z0&&E.z<1))ka=ia[O]=ia[O]||new THREE.RenderableParticle,O++,A=ka,A.x=E.x/E.w,A.y=E.y/E.w,A.z=E.z,A.rotation=F.rotation.z,A.scale.x=F.scale.x*Math.abs(A.x-(E.x+g.projectionMatrix.n11)/ +(E.w+g.projectionMatrix.n14)),A.scale.y=F.scale.y*Math.abs(A.y-(E.y+g.projectionMatrix.n22)/(E.w+g.projectionMatrix.n24)),A.materials=F.materials,i.push(A);c&&i.sort(d);return i}}; +THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,e){e&&b.update(void 0,!1,d);var e=b.sounds,f,g=e.length;for(f=0;f 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + vViewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif", morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif", -default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif"};THREE.UniformsUtils={merge:function(b){var d,e,f,h={};for(d=0;d=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]), -c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,p=i.morphTargetInfluences;fn&&(o=G,n=p[o]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[o]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[o]=1;n=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(j in g.__webglCustomAttributes)b[j]>= -0&&(d=g.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER, -g.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4, -c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount, -c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.drawElements(c.TRIANGLES,g.__webglFaceCount,c.UNSIGNED_SHORT,0)),aa.data.vertices+=g.__webglFaceCount,aa.data.faces+=g.__webglFaceCount/3,aa.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(h.linewidth),c.drawArrays(i,0,g.__webglLineCount),aa.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,g.__webglParticleCount),aa.data.drawCalls++):i instanceof -THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,g.__webglVertexCount),aa.data.drawCalls++)}}function h(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER, -b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,i,j,k,p,o,G,n,r=b.count*3;for(n=0;n0&&x[0]0&&x[1]0.0010&&j.scale>0.0010)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/N,v[0]=r*p,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),E(j.blending),ca(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ia)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)} -function A(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,p=void 0,n=void 0,o=void 0,G=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,x=void 0,y=void 0, -A=void 0,B=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=o=q=o=v=r=void 0,z=void 0,m=z=s=r=void 0,F=void 0,J=m=z=s=n=n=G=q=o=m=z=s=F=m=z=s=F=m=z=s=void 0,E=0,C=0,S=0,T=0,M=0,L=0,U=0,N=0,da=0,w=0,ea=0,z=s=0,H=g.__vertexArray,$=g.__uvArray,aa=g.__uv2Array,P=g.__normalArray,V=g.__tangentArray,fa=g.__colorArray,W=g.__skinVertexAArray,X=g.__skinVertexBArray,Y=g.__skinIndexArray,Z=g.__skinWeightArray,ca=g.__morphTargetsArrays,Q=g.__webglCustomAttributes,m=void 0,O=g.__faceArray,R=g.__lineArray,ha=g.__needsSmoothNormals, -x=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ja=ga.__dirtyVertices,ka=ga.__dirtyElements,ia=ga.__dirtyUvs,ma=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,sa=ga.faces,ra=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],ya=ga.skinVerticesA,za=ga.skinVerticesB,Aa=ga.skinIndices,wa=ga.skinWeights,xa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0,ua=ga.morphTargets;if(Q)for(J in Q)Q[J].offset=0,Q[J].offsetSrc=0;k=0; -for(p=qa.length;k0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer), -c.bufferData(c.ARRAY_BUFFER,fa,j));ma&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,P,j));na&&ga.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,V,j));ia&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));ia&&T>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,aa,j));ka&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER, -O,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,R,j));w>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,W,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j));i.dynamic||(delete g.__inittedArrays, -delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b= -f;e=c.DYNAMIC_DRAW;t=b.vertices;g=b.colors;x=t.length;i=g.length;y=b.__vertexArray;j=b.__colorArray;A=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k=0;d--)b[d].object==c&&b.splice(d,1)}function ha(b){function c(b){var f=[];d=0;for(e=b.length;d65535&&(o[j].counter+=1,k=o[j].hash+"_"+o[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:p})),b.geometryGroups[k].faces.push(f), -b.geometryGroups[k].vertices+=h}function T(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function E(b){if(b!=R){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD, -c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}R=b}}function x(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,$(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,$(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,$(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,$(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b, -c.TEXTURE_MAG_FILTER,Q(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,Q(d.minFilter)))}function ca(b,d){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,b.image)):(b.__webglTexture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image),b.__webglInit=!0),x(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+ -d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function M(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,$(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,$(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER, -$(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,$(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,$(b.format),b.width,b.height,0,$(b.format),$(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER, -c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null, -e=L,b=N);d!=Ba&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(H,S,e,b),Ba=d)}function C(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}} -function $(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR; -case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0} -var aa=this,c,ta=[],ma=null,Ba=null,ia=!0,ka=null,P=null,R=null,J=null,H=0,S=0,L=0,N=0,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,la=new Float32Array(16),ra=new Float32Array(16),qa=new THREE.Vector4,pa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},na=b.canvas!==void 0?b.canvas:document.createElement("canvas"),sa=b.stencil!==void 0? -b.stencil:!0,Ga=b.antialias!==void 0?b.antialias:!1,oa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ca=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=na;this.sortObjects=this.autoClear=!0;try{if(!(c=na.getContext("experimental-webgl",{antialias:Ga,stencil:sa})))throw"Error creating WebGL context.";}catch(Ha){console.error(Ha)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+ -" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(oa.r,oa.g,oa.b,Ca);this.context=c;var Fa=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(sa){var u={};u.vertices=new Float32Array(12);u.faces=new Uint16Array(6);u.darkness= -0.5;u.vertices[0]=-20;u.vertices[1]=-20;u.vertices[2]=-1;u.vertices[3]=20;u.vertices[4]=-20;u.vertices[5]=-1;u.vertices[6]=20;u.vertices[7]=20;u.vertices[8]=-1;u.vertices[9]=-20;u.vertices[10]=20;u.vertices[11]=-1;u.faces[0]=0;u.faces[1]=1;u.faces[2]=2;u.faces[3]=0;u.faces[4]=2;u.faces[5]=3;u.vertexBuffer=c.createBuffer();u.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,u.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer); -c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);u.program=c.createProgram();c.attachShader(u.program,C("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(u.program,C("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(u.program);u.vertexLocation=c.getAttribLocation(u.program,"position");u.projectionLocation=c.getUniformLocation(u.program,"projectionMatrix");u.darknessLocation=c.getUniformLocation(u.program,"darkness")}var t={};t.vertices=new Float32Array(16); -t.faces=new Uint16Array(6);b=0;t.vertices[b++]=-1;t.vertices[b++]=-1;t.vertices[b++]=0;t.vertices[b++]=0;t.vertices[b++]=1;t.vertices[b++]=-1;t.vertices[b++]=1;t.vertices[b++]=0;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=-1;t.vertices[b++]=1;t.vertices[b++]=0;t.vertices[b++]=1;b=0;t.faces[b++]=0;t.faces[b++]=1;t.faces[b++]=2;t.faces[b++]=0;t.faces[b++]=2;t.faces[b++]=3;t.vertexBuffer=c.createBuffer();t.elementBuffer=c.createBuffer();t.tempTexture=c.createTexture(); -t.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,t.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,t.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D, -c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<= -0?(t.hasVertexTexture=!1,t.program=c.createProgram(),c.attachShader(t.program,C("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(t.program,C("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(t.hasVertexTexture=!0,t.program=c.createProgram(),c.attachShader(t.program,C("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(t.program,C("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(t.program);t.attributes={};t.uniforms={}; -t.attributes.vertex=c.getAttribLocation(t.program,"position");t.attributes.uv=c.getAttribLocation(t.program,"UV");t.uniforms.renderType=c.getUniformLocation(t.program,"renderType");t.uniforms.map=c.getUniformLocation(t.program,"map");t.uniforms.occlusionMap=c.getUniformLocation(t.program,"occlusionMap");t.uniforms.opacity=c.getUniformLocation(t.program,"opacity");t.uniforms.scale=c.getUniformLocation(t.program,"scale");t.uniforms.rotation=c.getUniformLocation(t.program,"rotation");t.uniforms.screenPosition= -c.getUniformLocation(t.program,"screenPosition");var Ea=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]= -0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram(); -c.attachShader(_sprite.program,C("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,C("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program, -"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance= -c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var Da=!1;this.setSize=function(b,c){na.width=b;na.height=c;this.setViewport(0,0,na.width,na.height)};this.setViewport=function(b,d,e,f){H=b;S=d;L=e;N=f;c.viewport(H,S,L,N)};this.setScissor= -function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ia=b;c.depthMask(b)};this.setClearColorHex=function(b,d){oa.setHex(b);Ca=d;c.clearColor(oa.r,oa.g,oa.b,Ca)};this.setClearColor=function(b,d){oa.copy(b);Ca=d;c.clearColor(oa.r,oa.g,oa.b,Ca)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){u.darkness= -b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var g,h,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic"); -if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,p,o;k=o=j=0;for(p=d.length;k=0&&c.enableVertexAttribArray(n.position);n.color>=0&&c.enableVertexAttribArray(n.color);n.normal>= +THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=oa.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value= +f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;for(var z in j)if(G=h.uniforms[z])if(k=j[z],p=k.type,e=k.value,p=="i")c.uniform1i(G,e);else if(p=="f")c.uniform1f(G,e);else if(p=="fv1")c.uniform1fv(G,e);else if(p=="fv")c.uniform3fv(G,e);else if(p=="v2")c.uniform2f(G,e.x,e.y);else if(p=="v3")c.uniform3f(G,e.x,e.y,e.z);else if(p=="v4")c.uniform4f(G,e.x,e.y,e.z,e.w);else if(p=="c")c.uniform3f(G,e.r,e.g,e.b);else if(p=="t"&&(c.uniform1i(G,e),k=k.texture))if(k.image instanceof +Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(p=0;p<6;++p)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[p])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(p=0;p<6;++p)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[p]);k.__webglInit=!0}t(c.TEXTURE_CUBE_MAP, +k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}}else ca(k,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,g._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial|| +f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,sa);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix, +!1,g._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,sa);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,sa),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,d,f,g,h,i){if(g.opacity!=0){var j,b=e(b,d,f,g,i).attributes;if(!g.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=g.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[i.morphTargetBase]), +c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;fn&&(p=G,n=o[p]);c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[p]=1;n=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(g.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(j in h.__webglCustomAttributes)b[j]>= +0&&(d=h.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER, +h.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4, +c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(g.wireframe?(c.lineWidth(g.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.drawElements(c.LINES,h.__webglLineCount, +c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),aa.data.vertices+=h.__webglFaceCount,aa.data.faces+=h.__webglFaceCount/3,aa.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(g.linewidth),c.drawArrays(i,0,h.__webglLineCount),aa.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),aa.data.drawCalls++):i instanceof +THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount),aa.data.drawCalls++)}}function g(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER, +b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,g,i,j,k,o,p,G,n,q=b.count*3;for(n=0;n0&&t[0]0&&t[1]0.0010&&j.scale>0.0010)r[0]=j.x,r[1]=j.y,r[2]=j.z,q=j.size*j.scale/N,v[0]=q*o,v[1]=q,c.uniform3fv(y.screenPosition,r),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),E(j.blending),ca(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ja)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)} +function A(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){h=f.geometryGroups[e];a:{for(var i=g=void 0,j=void 0,k=void 0,o=void 0,o=h.__materials,i=0,j=o.length;i0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,fa,j));na&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,P,j));oa&&ga.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,V,j));ja&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));ja&&T>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,aa,j));la&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, +g.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,O,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,R,j));w>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,W,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER, +Z,j));i.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var ha;h=h.__materials;f=0;for(b= +h.length;f=0;e--)b[e].object==c&&b.splice(e, +1)}function ia(b){function c(b){var f=[];e=0;for(d=b.length;e65535&&(p[j].counter+=1,k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:o})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=h}function T(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function E(b){if(b!=R){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD); +c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}R=b}}function t(b,e,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,$(e.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,$(e.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,$(e.magFilter)), +c.texParameteri(b,c.TEXTURE_MIN_FILTER,$(e.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,Q(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,Q(e.minFilter)))}function ca(b,e){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,b.image)):(b.__webglTexture=c.createTexture(),c.bindTexture(c.TEXTURE_2D, +b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image),b.__webglInit=!0),t(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function M(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture(); +c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,$(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,$(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,$(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,$(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,$(b.format),b.width,b.height,0,$(b.format),$(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER, +c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER, +c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var e,d;b?(e=b.__webglFramebuffer,d=b.width,b=b.height):(e=null,d=L,b=N);e!=Ca&&(c.bindFramebuffer(c.FRAMEBUFFER,e),c.viewport(H,S,d,b),Ca=e)}function C(b,e){var d;b=="fragment"?d=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(d=c.createShader(c.VERTEX_SHADER));c.shaderSource(d,e);c.compileShader(d);if(!c.getShaderParameter(d,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(d)), +console.error(e),null;return d}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function $(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR; +case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA; +case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var aa=this,c,ua=[],na=null,Ca=null,ja=!0,la=null,P=null,R=null,J=null,H=0,S=0,L=0,N=0,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,ma=new Float32Array(16),sa=new Float32Array(16),ra=new THREE.Vector4,qa={ambient:[0,0,0],directional:{length:0, +colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},oa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ta=b.stencil!==void 0?b.stencil:!0,Ha=b.antialias!==void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Da=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.sortObjects=this.autoClear=!0;try{if(!(c=oa.getContext("experimental-webgl", +{antialias:Ha,stencil:ta})))throw"Error creating WebGL context.";}catch(Ia){console.error(Ia)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA); +c.clearColor(pa.r,pa.g,pa.b,Da);this.context=c;var Ga=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ta){var u={};u.vertices=new Float32Array(12);u.faces=new Uint16Array(6);u.darkness=0.5;u.vertices[0]=-20;u.vertices[1]=-20;u.vertices[2]=-1;u.vertices[3]=20;u.vertices[4]=-20;u.vertices[5]=-1;u.vertices[6]=20;u.vertices[7]=20;u.vertices[8]=-1;u.vertices[9]=-20;u.vertices[10]=20;u.vertices[11]=-1;u.faces[0]=0;u.faces[1]=1;u.faces[2]=2;u.faces[3]=0;u.faces[4]=2;u.faces[5]=3;u.vertexBuffer=c.createBuffer(); +u.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,u.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);u.program=c.createProgram();c.attachShader(u.program,C("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(u.program,C("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(u.program);u.vertexLocation=c.getAttribLocation(u.program, +"position");u.projectionLocation=c.getUniformLocation(u.program,"projectionMatrix");u.darknessLocation=c.getUniformLocation(u.program,"darkness")}var x={};x.vertices=new Float32Array(16);x.faces=new Uint16Array(6);b=0;x.vertices[b++]=-1;x.vertices[b++]=-1;x.vertices[b++]=0;x.vertices[b++]=0;x.vertices[b++]=1;x.vertices[b++]=-1;x.vertices[b++]=1;x.vertices[b++]=0;x.vertices[b++]=1;x.vertices[b++]=1;x.vertices[b++]=1;x.vertices[b++]=1;x.vertices[b++]=-1;x.vertices[b++]=1;x.vertices[b++]=0;x.vertices[b++]= +1;b=0;x.faces[b++]=0;x.faces[b++]=1;x.faces[b++]=2;x.faces[b++]=0;x.faces[b++]=2;x.faces[b++]=3;x.vertexBuffer=c.createBuffer();x.elementBuffer=c.createBuffer();x.tempTexture=c.createTexture();x.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,x.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,x.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,x.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,x.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,x.tempTexture);c.texImage2D(c.TEXTURE_2D, +0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,x.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D, +c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(x.hasVertexTexture=!1,x.program=c.createProgram(),c.attachShader(x.program,C("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(x.program,C("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(x.hasVertexTexture=!0,x.program=c.createProgram(),c.attachShader(x.program,C("fragment", +THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(x.program,C("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(x.program);x.attributes={};x.uniforms={};x.attributes.vertex=c.getAttribLocation(x.program,"position");x.attributes.uv=c.getAttribLocation(x.program,"UV");x.uniforms.renderType=c.getUniformLocation(x.program,"renderType");x.uniforms.map=c.getUniformLocation(x.program,"map");x.uniforms.occlusionMap=c.getUniformLocation(x.program,"occlusionMap"); +x.uniforms.opacity=c.getUniformLocation(x.program,"opacity");x.uniforms.scale=c.getUniformLocation(x.program,"scale");x.uniforms.rotation=c.getUniformLocation(x.program,"rotation");x.uniforms.screenPosition=c.getUniformLocation(x.program,"screenPosition");var Fa=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]= +1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER, +_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,C("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,C("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position"); +_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity= +c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix"); +var Ea=!1;this.setSize=function(b,c){oa.width=b;oa.height=c;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(b,e,d,f){H=b;S=e;L=d;N=f;c.viewport(H,S,L,N)};this.setScissor=function(b,e,d,f){c.scissor(b,e,d,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ja=b;c.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);Da=e;c.clearColor(pa.r,pa.g,pa.b,Da)};this.setClearColor=function(b,e){pa.copy(b); +Da=e;c.clearColor(pa.r,pa.g,pa.b,Da)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){u.darkness=b};this.getContext=function(){return c};this.initMaterial=function(b,e,d,f){var g,h,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial? +i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,o,p;k=p=j=0;for(o=e.length;k=0&&c.enableVertexAttribArray(n.position);n.color>=0&&c.enableVertexAttribArray(n.color);n.normal>= 0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=0&&(c.enableVertexAttribArray(n.morphTarget0), b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),b.numSupportedMorphTargets++);n.morphTarget6>= -0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b0||q.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(q.faceUvs.length>1||q.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4), -i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(v*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];q=0;for(r=i.numMorphTargets;q0||r.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(r.faceUvs.length>1||r.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4), +i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(u*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(v*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];r=0;for(q=i.numMorphTargets;r + + + + three.js webgl - custom attributes + + + + +
three.js - custom attributes example
+
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index cd80b35586267ee0aea9e7c46789d1b58f5121fd..d90b0a5976c85e28db2f2968f8873ecfc5e56a00 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -582,8 +582,8 @@ THREE.WebGLRenderer = function ( parameters ) { uvType, vertexColorType, normalType, - materials, - attribute, + materials, material, + attribute, property, originalAttribute, geometry = object.geometry, obj_faces = geometry.faces, @@ -611,6 +611,14 @@ THREE.WebGLRenderer = function ( parameters ) { } materials = unrollGroupMaterials( geometryGroup, object ); + + // this will not work if materials would change in run-time + // it should be refreshed every frame + // but need to do unrollGroupMaterials + // more properly without push to array + // like unrollBufferMaterials + + geometryGroup.__materials = materials; uvType = bufferGuessUVType( materials, geometryGroup, object ); normalType = bufferGuessNormalType( materials, geometryGroup, object ); @@ -692,17 +700,25 @@ THREE.WebGLRenderer = function ( parameters ) { for ( m = 0, ml = materials.length; m < ml; m ++ ) { - if ( materials[ m ].attributes ) { + material = materials[ m ]; + + if ( material.attributes ) { geometryGroup.__webglCustomAttributes = {}; - for ( a in materials[ m ].attributes ) { + for ( a in material.attributes ) { + + // Do a shallow copy of the attribute object so different geometryGroup chunks use different + // attribute buffers which are correctly indexed in the setMeshBuffers function + + originalAttribute = material.attributes[ a ]; - // Do a shallow copy of the attribute object so different geometryGroup chunks use different - // attribute buffers which are correctly indexed in the setMeshBuffers function attribute = {}; - for (prop in materials[ m ].attributes[ a ] ) { - attribute [ prop ] = materials[ m ].attributes[ a ][ prop ]; + + for ( property in originalAttribute ) { + + attribute[ property ] = originalAttribute[ property ]; + } if( !attribute.__webglInitialized || attribute.createUniqueBuffers ) { @@ -717,10 +733,12 @@ THREE.WebGLRenderer = function ( parameters ) { else if( attribute.type === "c" ) size = 3; attribute.size = size; - attribute.needsUpdate = true; attribute.array = new Float32Array( nvertices * size ); attribute.buffer = _gl.createBuffer(); attribute.buffer.belongsToAttribute = a; + + originalAttribute.needsUpdate = true; + attribute.__original = originalAttribute; } @@ -896,8 +914,8 @@ THREE.WebGLRenderer = function ( parameters ) { for ( a in customAttributes ) { customAttribute = customAttributes[ a ]; - - if ( customAttribute.needsUpdate ) { + + if ( customAttribute.__original.needsUpdate ) { offset_custom = customAttribute.offset; offset_customSrc = customAttribute.offsetSrc; @@ -1328,7 +1346,7 @@ THREE.WebGLRenderer = function ( parameters ) { customAttribute = customAttributes[ a ]; - if ( customAttribute.needsUpdate ) { + if ( customAttribute.__original.needsUpdate ) { offset_custom = customAttribute.offset; offset_customSrc = customAttribute.offsetSrc; @@ -1826,13 +1844,11 @@ THREE.WebGLRenderer = function ( parameters ) { customAttribute = customAttributes[ a ]; - if ( customAttribute.needsUpdate ) { + if ( customAttribute.__original.needsUpdate ) { _gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer ); _gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint ); - customAttribute.needsUpdate = false; - } } @@ -2578,7 +2594,8 @@ THREE.WebGLRenderer = function ( parameters ) { // custom attributes - // Use the per-geometryGroup custom attribute arrays which are setup in initMeshBuffers + // Use the per-geometryGroup custom attribute arrays which are setup in initMeshBuffers + if ( geometryGroup.__webglCustomAttributes ) { for( a in geometryGroup.__webglCustomAttributes ) { @@ -3396,7 +3413,7 @@ THREE.WebGLRenderer = function ( parameters ) { if ( !material.program ) _this.initMaterial( material, lights, undefined, object ); program = material.program, - p_uniforms = program.uniforms, + p_uniforms = program.uniforms, m_uniforms = material.uniforms, attributes = program.attributes; @@ -3557,8 +3574,8 @@ THREE.WebGLRenderer = function ( parameters ) { _gl.uniform1i( uniforms.useScreenCoordinates, 1 ); _gl.uniform3f( uniforms.screenPosition, ( object.position.x - halfViewportWidth ) / halfViewportWidth, - ( halfViewportHeight - object.position.y ) / halfViewportHeight, - Math.max( 0, Math.min( 1, object.position.z ))); + ( halfViewportHeight - object.position.y ) / halfViewportHeight, + Math.max( 0, Math.min( 1, object.position.z ))); } else { @@ -4013,6 +4030,57 @@ THREE.WebGLRenderer = function ( parameters ) { }; + function areCustomAttributesDirty( geometryGroup ) { + + var a, m, ml, material, materials; + + materials = geometryGroup.__materials; + + for ( m = 0, ml = materials.length; m < ml; m ++ ) { + + material = materials[ m ]; + + if ( material.attributes ) { + + for ( a in material.attributes ) { + + if ( material.attributes[ a ].needsUpdate ) return true; + + } + + } + + } + + + return false; + + }; + + function clearCustomAttributes( geometryGroup ) { + + var a, m, ml, material, materials; + + materials = geometryGroup.__materials; + + for ( m = 0, ml = materials.length; m < ml; m ++ ) { + + material = materials[ m ]; + + if ( material.attributes ) { + + for ( a in material.attributes ) { + + material.attributes[ a ].needsUpdate = false; + + } + + } + + } + + }; + function updateObject( object, scene ) { var g, geometry, geometryGroup, a, customAttributeDirty; @@ -4027,22 +4095,11 @@ THREE.WebGLRenderer = function ( parameters ) { geometryGroup = geometry.geometryGroups[ g ]; - customAttributeDirty = false; - - for ( a in geometryGroup.__webglCustomAttributes ) { - - if( geometryGroup.__webglCustomAttributes[ a ].needsUpdate ) { - - customAttributeDirty = true; - break; - - } - - } + customAttributeDirty = areCustomAttributesDirty( geometryGroup ); if ( geometry.__dirtyVertices || geometry.__dirtyMorphTargets || geometry.__dirtyElements || - geometry.__dirtyUvs || geometry.__dirtyNormals || - geometry.__dirtyColors || geometry.__dirtyTangents || customAttributeDirty ) { + geometry.__dirtyUvs || geometry.__dirtyNormals || + geometry.__dirtyColors || geometry.__dirtyTangents || customAttributeDirty ) { setMeshBuffers( geometryGroup, object, _gl.DYNAMIC_DRAW ); @@ -4058,6 +4115,8 @@ THREE.WebGLRenderer = function ( parameters ) { geometry.__dirtyTangents = false; geometry.__dirtyColors = false; + clearCustomAttributes( geometryGroup ); + } else if ( object instanceof THREE.Ribbon ) { geometry = object.geometry; @@ -4140,7 +4199,7 @@ THREE.WebGLRenderer = function ( parameters ) { } else if ( object instanceof THREE.Mesh || object instanceof THREE.ParticleSystem || object instanceof THREE.Ribbon || - object instanceof THREE.Line ) { + object instanceof THREE.Line ) { removeInstances( scene.__webglObjects, object ); diff --git a/utils/build.bat b/utils/build.bat index 276a88759985b9d586abf886213699ee8563cdce..4104be987ad5b5610c81cd623421958d55a50e5e 100644 --- a/utils/build.bat +++ b/utils/build.bat @@ -1 +1 @@ -python build.py --common --minified +python build.py --common --minified --includes