diff --git a/build/Three.js b/build/Three.js index 401f99d99a4fcb4e501522d3afd8fe3ef27b14dc..327bd2df73701f02a0a59d09afe60e8a94f60745 100755 --- a/build/Three.js +++ b/build/Three.js @@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)}; THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a0&&E>0&&J+E<1}var b,d,e,g,h,j,k,m,q,w, -u,o=a.geometry,v=o.vertices,A=[];b=0;for(d=o.faces.length;bk?d:k;e=e>m?e:m}a()}; -this.add3Points=function(k,m,q,w,u,o){if(j){j=!1;c=kq?k>u?k:u:q>u?q:u;e=m>w?m>o?m:o:w>o?w:o}else{c=kq?k>u?k>d?k:d:u>d?u:d:q>u?q>d?q:d:u>d?u:d;e=m>w?m>o?m>e?m:e:o>e?o:e:w>o?w>e?w:e:o>e?o:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=ck.getRight()? +THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a0&&F>0&&J+F<1}var b,d,e,g,h,j,k,m,t,w, +u,o=a.geometry,v=o.vertices,B=[];b=0;for(d=o.faces.length;bk?d:k;e=e>m?e:m}a()}; +this.add3Points=function(k,m,t,w,u,o){if(j){j=!1;c=kt?k>u?k:u:t>u?t:u;e=m>w?m>o?m:o:w>o?w:o}else{c=kt?k>u?k>d?k:d:u>d?u:d:t>u?t>d?t:d:u>d?u:d;e=m>w?m>o?m>e?m:e:o>e?o:e:w>o?w>e?w:e:o>e?o:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=ck.getRight()? d:k.getRight();e=e>k.getBottom()?e:k.getBottom()}a()};this.inflate=function(k){c-=k;b-=k;d+=k;e+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();b=b>k.getTop()?b:k.getTop();d=d=0&&Math.min(e,k.getBottom())-Math.max(b,k.getTop())>=0};this.empty=function(){j=!0;e=d=b=c=0;a()};this.isEmpty=function(){return j}}; THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}}; -THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,m,q,w,u,o,v,A){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,m||0,q||1,w||0,u||0,o||0,v||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,m,q,w,u,o,v,A){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=m;this.n33=q;this.n34=w;this.n41=u;this.n42=o;this.n43=v;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1, +THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,m,t,w,u,o,v,B){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,m||0,t||1,w||0,u||0,o||0,v||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,m,t,w,u,o,v,B){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=m;this.n33=t;this.n34=w;this.n41=u;this.n42=o;this.n43=v;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1, e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23* d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize(); -return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,q=a.n31,w=a.n32,u=a.n33,o=a.n34,v=a.n41,A=a.n42,E=a.n43,x=a.n44,G=c.n11,y=c.n12,L=c.n13,J=c.n14,Y=c.n21,N=c.n22, -f=c.n23,W=c.n24,R=c.n31,da=c.n32,ga=c.n33,I=c.n34;this.n11=b*G+d*Y+e*R;this.n12=b*y+d*N+e*da;this.n13=b*L+d*f+e*ga;this.n14=b*J+d*W+e*I+g;this.n21=h*G+j*Y+k*R;this.n22=h*y+j*N+k*da;this.n23=h*L+j*f+k*ga;this.n24=h*J+j*W+k*I+m;this.n31=q*G+w*Y+u*R;this.n32=q*y+w*N+u*da;this.n33=q*L+w*f+u*ga;this.n34=q*J+w*W+u*I+o;this.n41=v*G+A*Y+E*R;this.n42=v*y+A*N+E*da;this.n43=v*L+A*f+E*ga;this.n44=v*J+A*W+E*I+x;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31; +return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,t=a.n31,w=a.n32,u=a.n33,o=a.n34,v=a.n41,B=a.n42,F=a.n43,x=a.n44,G=c.n11,y=c.n12,L=c.n13,J=c.n14,Y=c.n21,N=c.n22, +f=c.n23,X=c.n24,R=c.n31,da=c.n32,ga=c.n33,I=c.n34;this.n11=b*G+d*Y+e*R;this.n12=b*y+d*N+e*da;this.n13=b*L+d*f+e*ga;this.n14=b*J+d*X+e*I+g;this.n21=h*G+j*Y+k*R;this.n22=h*y+j*N+k*da;this.n23=h*L+j*f+k*ga;this.n24=h*J+j*X+k*I+m;this.n31=t*G+w*Y+u*R;this.n32=t*y+w*N+u*da;this.n33=t*L+w*f+u*ga;this.n34=t*J+w*X+u*I+o;this.n41=v*G+B*Y+F*R;this.n42=v*y+B*N+F*da;this.n43=v*L+B*f+F*ga;this.n44=v*J+B*X+F*I+x;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31; b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a= -this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,m=this.n32,q=this.n33,w=this.n34,u=this.n41,o=this.n42,v=this.n43,A=this.n44;return d*h*m*u-b*j*m*u-d*g*q*u+c*j*q*u+b*g*w*u-c*h*w*u-d*h*k*o+b*j*k*o+d*e*q*o-a*j*q*o-b*e*w*o+a*h*w*o+d*g*k*v-c*j*k*v-d*e*m*v+a*j*m*v+c*e*w*v-a*g*w*v-b*g*k*A+c*h*k*A+b*e*m*A-a*h*m*A-c*e*q*A+a*g*q*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32= +this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,m=this.n32,t=this.n33,w=this.n34,u=this.n41,o=this.n42,v=this.n43,B=this.n44;return d*h*m*u-b*j*m*u-d*g*t*u+c*j*t*u+b*g*w*u-c*h*w*u-d*h*k*o+b*j*k*o+d*e*t*o-a*j*t*o-b*e*w*o+a*h*w*o+d*g*k*v-c*j*k*v-d*e*m*v+a*j*m*v+c*e*w*v-a*g*w*v-b*g*k*B+c*h*k*B+b*e*m*B-a*h*m*B-c*e*t*B+a*g*t*B},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32= this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21; this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]= this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a, @@ -34,9 +34,9 @@ c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:functio g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,m*h+b,m*j-d*g,0,k*j-d*h,m*j+d*g,e*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,j=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var c= a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var m=b*h;b*=j;d*=j;g*=e;h*=e;e*=j;this.n11=1-(m+d);this.n12=k-e;this.n13=c+h;this.n21=k+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+m);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34= a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}}; -THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,q=a.n31,w=a.n32,u=a.n33,o=a.n34,v=a.n41,A=a.n42,E=a.n43,x=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*o*A-m*u*A+m*w*E-j*o*E-k*w*x+j*u*x;c.n12=g*u*A-e*o*A-g*w*E+d*o*E+e*w*x-d*u*x;c.n13=e*m*A-g*k*A+g*j*E-d*m*E-e*j*x+d*k*x;c.n14=g*k*w-e*m*w-g*j*u+d*m*u+e*j*o-d*k*o;c.n21=m*u*v-k*o*v-m*q*E+h*o*E+k*q*x-h*u*x;c.n22=e*o*v-g*u*v+g*q*E-b*o*E-e*q*x+b*u*x;c.n23=g*k*v-e*m*v-g*h*E+b*m*E+e*h*x-b*k*x; -c.n24=e*m*q-g*k*q+g*h*u-b*m*u-e*h*o+b*k*o;c.n31=j*o*v-m*w*v+m*q*A-h*o*A-j*q*x+h*w*x;c.n32=g*w*v-d*o*v-g*q*A+b*o*A+d*q*x-b*w*x;c.n33=e*m*v-g*j*v+g*h*A-b*m*A-d*h*x+b*j*x;c.n34=g*j*q-d*m*q-g*h*w+b*m*w+d*h*o-b*j*o;c.n41=k*w*v-j*u*v-k*q*A+h*u*A+j*q*E-h*w*E;c.n42=d*u*v-e*w*v+e*q*A-b*u*A-d*q*E+b*w*E;c.n43=e*j*v-d*k*v-e*h*A+b*k*A+d*h*E-b*j*E;c.n44=d*k*q-e*j*q+e*h*w-b*k*w-d*h*u+b*j*u;c.multiplyScalar(1/a.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,q=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*m;b[7]=a*q;b[8]=a*w;return c}; +THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,t=a.n31,w=a.n32,u=a.n33,o=a.n34,v=a.n41,B=a.n42,F=a.n43,x=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*o*B-m*u*B+m*w*F-j*o*F-k*w*x+j*u*x;c.n12=g*u*B-e*o*B-g*w*F+d*o*F+e*w*x-d*u*x;c.n13=e*m*B-g*k*B+g*j*F-d*m*F-e*j*x+d*k*x;c.n14=g*k*w-e*m*w-g*j*u+d*m*u+e*j*o-d*k*o;c.n21=m*u*v-k*o*v-m*t*F+h*o*F+k*t*x-h*u*x;c.n22=e*o*v-g*u*v+g*t*F-b*o*F-e*t*x+b*u*x;c.n23=g*k*v-e*m*v-g*h*F+b*m*F+e*h*x-b*k*x; +c.n24=e*m*t-g*k*t+g*h*u-b*m*u-e*h*o+b*k*o;c.n31=j*o*v-m*w*v+m*t*B-h*o*B-j*t*x+h*w*x;c.n32=g*w*v-d*o*v-g*t*B+b*o*B+d*t*x-b*w*x;c.n33=e*m*v-g*j*v+g*h*B-b*m*B-d*h*x+b*j*x;c.n34=g*j*t-d*m*t-g*h*w+b*m*w+d*h*o-b*j*o;c.n41=k*w*v-j*u*v-k*t*B+h*u*B+j*t*F-h*w*F;c.n42=d*u*v-e*w*v+e*t*B-b*u*B-d*t*F+b*w*F;c.n43=e*j*v-d*k*v-e*h*B+b*k*B+d*h*F-b*j*F;c.n44=d*k*t-e*j*t+e*h*w-b*k*w-d*h*u+b*j*u;c.multiplyScalar(1/a.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*m;b[7]=a*t;b[8]=a*w;return c}; THREE.Matrix4.makeFrustum=function(a,c,b,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*e/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)}; THREE.Matrix4.makeOrtho=function(a,c,b,d,e,g){var h,j,k,m;h=new THREE.Matrix4;j=c-a;k=b-d;m=g-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((b+d)/k);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+e)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible= @@ -47,8 +47,8 @@ undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c d;a++)this.children[a].update(this.matrixWorld,c,b)}}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)}; THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*e;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*= -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+e*g+b*j-d*h;this.y=b*a+e*h+d*g-c*j;this.z=d*a+e*j+c*h-b*g;this.w=e*a-c*g-b*h-d*j;return this}, -multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,m=k*b+h*e-j*d,q=k*d+j*b-g*e,w=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=m*k+b*-g+q*-j-w*-h;c.y=q*k+b*-h+w*-g-m*-j;c.z=w*k+b*-j+m*-h-q*-g;return c}}; -THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b}; +multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,m=k*b+h*e-j*d,t=k*d+j*b-g*e,w=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=m*k+b*-g+t*-j-w*-h;c.y=t*k+b*-h+w*-g-m*-j;c.z=w*k+b*-j+m*-h-t*-g;return c}}; +THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b}; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; THREE.Face3=function(a,c,b,d,e){this.a=a;this.b=c;this.c=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]}; THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; @@ -56,30 +56,30 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.f b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(e=this.vertices.length;d0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;cthis.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;m=this.points[b[0]];q=this.points[b[1]]; -w=this.points[b[2]];u=this.points[b[3]];j=h*h;k=h*j;d.x=c(m.x,q.x,w.x,u.x,h,j,k);d.y=c(m.y,q.y,w.y,u.y,h,j,k);d.z=c(m.z,q.z,w.z,u.z,h,j,k);return d};this.getControlPointsArray=function(){var o,v,A=this.points.length,E=[];for(o=0;othis.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;m=this.points[b[0]];t=this.points[b[1]]; +w=this.points[b[2]];u=this.points[b[3]];j=h*h;k=h*j;d.x=c(m.x,t.x,w.x,u.x,h,j,k);d.y=c(m.y,t.y,w.y,u.y,h,j,k);d.z=c(m.z,t.z,w.z,u.z,h,j,k);return d};this.getControlPointsArray=function(){var o,v,B=this.points.length,F=[];for(o=0;o1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]= this.getPrevKeyWith("pos",o,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",o,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b=== -"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&q[0][m]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;oa.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];m=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],j[0],k[0],m[0],e,b,h);d[1]=this.interpolate(g[1],j[1],k[1],m[1],e,b,h);d[2]=this.interpolate(g[2],j[2],k[2],m[2],e,b,h);return d}; THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]}; @@ -107,9 +107,9 @@ THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.o undefined)this.wireframeLinewidth=a.wireframeLinewidth}}; THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!== undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){}; -THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==undefined)this.vertexShader= -a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!== -undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}}; +THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=!1;this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!== +undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap; +if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}}; THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation= a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Texture=function(a,c,b,d,e,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1}; @@ -119,8 +119,8 @@ THREE.RenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS var Uniforms={clone:function(a){var c,b,d,e={};for(c in a){e[c]={};for(b in a[c]){d=a[c][b];e[c][b]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return e},merge:function(a){var c,b,d,e={};for(c=0;c=0&&ga>=0&&I>=0&&ca>=0)return!0;else if(da<0&&ga<0||I<0&&ca<0)return!1;else{if(da<0)W=Math.max(W,da/(da-ga));else ga<0&&(R=Math.min(R,da/(da-ga)));if(I<0)W=Math.max(W,I/(I-ca));else ca<0&&(R=Math.min(R,I/(I-ca)));if(R=0&&ga>=0&&I>=0&&ca>=0)return!0;else if(da<0&&ga<0||I<0&&ca<0)return!1;else{if(da<0)X=Math.max(X,da/(da-ga));else ga<0&&(R=Math.min(R,da/(da-ga)));if(I<0)X=Math.max(X,I/(I-ca));else ca<0&&(R=Math.min(R,I/(I-ca)));if(Rda&&ea.z0&& -E.z<1){u=v[o]=v[o]||new THREE.RenderableParticle;u.x=E.x/E.w;u.y=E.y/E.w;u.z=E.z;u.rotation=ha.rotation.z;u.scale.x=ha.scale.x*Math.abs(u.x-(E.x+f.projectionMatrix.n11)/(E.w+f.projectionMatrix.n14));u.scale.y=ha.scale.y*Math.abs(u.y-(E.y+f.projectionMatrix.n22)/(E.w+f.projectionMatrix.n24));u.materials=ha.materials;R.push(u);o++}}}}W&&R.sort(a);return R};this.unprojectVector=function(N,f){var W=f.matrixWorld.clone();W.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));W.multiplyVector3(N); +za;ca++){ea=ra[ca];ea.positionScreen.copy(ea.position);G.multiplyVector4(ea.positionScreen);xa=ra[ca-1];L.copy(ea.positionScreen);J.copy(xa.positionScreen);if(c(L,J)){L.multiplyScalar(1/L.w);J.multiplyScalar(1/J.w);m=w[t]=w[t]||new THREE.RenderableLine;m.v1.positionScreen.copy(L);m.v2.positionScreen.copy(J);m.z=Math.max(L.z,J.z);m.materials=ha.materials;R.push(m);t++}}}else if(ha instanceof THREE.Particle){F.set(ha.position.x,ha.position.y,ha.position.z,1);x.multiplyVector4(F);F.z/=F.w;if(F.z>0&& +F.z<1){u=v[o]=v[o]||new THREE.RenderableParticle;u.x=F.x/F.w;u.y=F.y/F.w;u.z=F.z;u.rotation=ha.rotation.z;u.scale.x=ha.scale.x*Math.abs(u.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14));u.scale.y=ha.scale.y*Math.abs(u.y-(F.y+f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24));u.materials=ha.materials;R.push(u);o++}}}}X&&R.sort(a);return R};this.unprojectVector=function(N,f){var X=f.matrixWorld.clone();X.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));X.multiplyVector3(N); return N}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,m,q,w,u,o,v,A;a=c.projectScene(h,j);k=0;for(m=a.length;k0){K.r+=pa.r*fa;K.g+=pa.g*fa;K.b+=pa.b*fa}}else if(fa instanceof THREE.PointLight){p.sub(fa.position,oa);p.normalize();fa=Z.dot(p)*sa;if(fa>0){K.r+=pa.r*fa;K.g+=pa.g*fa;K.b+=pa.b*fa}}}}function Ca(P,oa,Z){if(Z.opacity!=0){a(Z.opacity); -c(Z.blending);var K,T,fa,pa,sa,ua;if(Z instanceof THREE.ParticleBasicMaterial){if(Z.map){pa=Z.map.image;sa=pa.width>>1;ua=pa.height>>1;T=oa.scale.x*j;fa=oa.scale.y*k;Z=T*sa;K=fa*ua;Q.set(P.x-Z,P.y-K,P.x+Z,P.y+K);if(qa.instersects(Q)){m.save();m.translate(P.x,P.y);m.rotate(-oa.rotation);m.scale(T,-fa);m.translate(-sa,-ua);m.drawImage(pa,0,0);m.restore()}}}else if(Z instanceof THREE.ParticleCircleMaterial){if(ma){ta.r=l.r+z.r+t.r;ta.g=l.g+z.g+t.g;ta.b=l.b+z.b+t.b;R.r=Z.color.r*ta.r;R.g=Z.color.g*ta.g; -R.b=Z.color.b*ta.b;R.updateStyleString()}else R.__styleString=Z.color.__styleString;Z=oa.scale.x*j;K=oa.scale.y*k;Q.set(P.x-Z,P.y-K,P.x+Z,P.y+K);if(qa.instersects(Q)){T=R.__styleString;if(A!=T)m.fillStyle=A=T;m.save();m.translate(P.x,P.y);m.rotate(-oa.rotation);m.scale(Z,K);m.beginPath();m.arc(0,0,1,0,n,!0);m.closePath();m.fill();m.restore()}}}}function Da(P,oa,Z,K){if(K.opacity!=0){a(K.opacity);c(K.blending);m.beginPath();m.moveTo(P.positionScreen.x,P.positionScreen.y);m.lineTo(oa.positionScreen.x, -oa.positionScreen.y);m.closePath();if(K instanceof THREE.LineBasicMaterial){R.__styleString=K.color.__styleString;P=K.linewidth;if(E!=P)m.lineWidth=E=P;P=R.__styleString;if(v!=P)m.strokeStyle=v=P;m.stroke();Q.inflate(K.linewidth*2)}}}function Pa(P,oa,Z,K,T,fa){if(T.opacity!=0){a(T.opacity);c(T.blending);L=P.positionScreen.x;J=P.positionScreen.y;Y=oa.positionScreen.x;N=oa.positionScreen.y;f=Z.positionScreen.x;W=Z.positionScreen.y;m.beginPath();m.moveTo(L,J);m.lineTo(Y,N);m.lineTo(f,W);m.lineTo(L,J); -m.closePath();if(T instanceof THREE.MeshBasicMaterial)if(T.map)T.map.mapping instanceof THREE.UVMapping&&Ia(L,J,Y,N,f,W,T.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);else if(T.envMap){if(T.envMap.mapping instanceof THREE.SphericalReflectionMapping){P=na.matrixWorldInverse;p.copy(K.vertexNormalsWorld[0]);ja=(p.x*P.n11+p.y*P.n12+p.z*P.n13)*0.5+0.5;ha=-(p.x*P.n21+p.y*P.n22+p.z*P.n23)*0.5+0.5;p.copy(K.vertexNormalsWorld[1]);va=(p.x*P.n11+p.y*P.n12+p.z*P.n13)*0.5+0.5;Aa= --(p.x*P.n21+p.y*P.n22+p.z*P.n23)*0.5+0.5;p.copy(K.vertexNormalsWorld[2]);ia=(p.x*P.n11+p.y*P.n12+p.z*P.n13)*0.5+0.5;$=-(p.x*P.n21+p.y*P.n22+p.z*P.n23)*0.5+0.5;Ia(L,J,Y,N,f,W,T.envMap.image,ja,ha,va,Aa,ia,$)}}else T.wireframe?M(T.color.__styleString,T.wireframeLinewidth):Na(T.color.__styleString);else if(T instanceof THREE.MeshLambertMaterial){if(T.map&&!T.wireframe){T.map.mapping instanceof THREE.UVMapping&&Ia(L,J,Y,N,f,W,T.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v); -c(THREE.SubtractiveBlending)}if(ma)if(!T.wireframe&&T.shading==THREE.SmoothShading&&K.vertexNormalsWorld.length==3){da.r=ga.r=I.r=l.r;da.g=ga.g=I.g=l.g;da.b=ga.b=I.b=l.b;la(fa,K.v1.positionWorld,K.vertexNormalsWorld[0],da);la(fa,K.v2.positionWorld,K.vertexNormalsWorld[1],ga);la(fa,K.v3.positionWorld,K.vertexNormalsWorld[2],I);ca.r=(ga.r+I.r)*0.5;ca.g=(ga.g+I.g)*0.5;ca.b=(ga.b+I.b)*0.5;xa=Oa(da,ga,I,ca);Ia(L,J,Y,N,f,W,xa,0,0,1,0,0,1)}else{ta.r=l.r;ta.g=l.g;ta.b=l.b;la(fa,K.centroidWorld,K.normalWorld, -ta);R.r=T.color.r*ta.r;R.g=T.color.g*ta.g;R.b=T.color.b*ta.b;R.updateStyleString();T.wireframe?M(R.__styleString,T.wireframeLinewidth):Na(R.__styleString)}else T.wireframe?M(T.color.__styleString,T.wireframeLinewidth):Na(T.color.__styleString)}else if(T instanceof THREE.MeshDepthMaterial){za=na.near;ea=na.far;da.r=da.g=da.b=1-S(P.positionScreen.z,za,ea);ga.r=ga.g=ga.b=1-S(oa.positionScreen.z,za,ea);I.r=I.g=I.b=1-S(Z.positionScreen.z,za,ea);ca.r=(ga.r+I.r)*0.5;ca.g=(ga.g+I.g)*0.5;ca.b=(ga.b+I.b)*0.5; -xa=Oa(da,ga,I,ca);Ia(L,J,Y,N,f,W,xa,0,0,1,0,0,1)}else if(T instanceof THREE.MeshNormalMaterial){R.r=U(K.normalWorld.x);R.g=U(K.normalWorld.y);R.b=U(K.normalWorld.z);R.updateStyleString();T.wireframe?M(R.__styleString,T.wireframeLinewidth):Na(R.__styleString)}}}function M(P,oa){if(v!=P)m.strokeStyle=v=P;if(E!=oa)m.lineWidth=E=oa;m.stroke();Q.inflate(oa*2)}function Na(P){if(A!=P)m.fillStyle=A=P;m.fill()}function Ia(P,oa,Z,K,T,fa,pa,sa,ua,Ra,La,Ka,Wa){var Ea,Sa;Ea=pa.width-1;Sa=pa.height-1;sa*=Ea;ua*= -Sa;Ra*=Ea;La*=Sa;Ka*=Ea;Wa*=Sa;Z-=P;K-=oa;T-=P;fa-=oa;Ra-=sa;La-=ua;Ka-=sa;Wa-=ua;Ea=Ra*Wa-Ka*La;if(Ea!=0){Sa=1/Ea;Ea=(Wa*Z-La*T)*Sa;La=(Wa*K-La*fa)*Sa;Z=(Ra*T-Ka*Z)*Sa;K=(Ra*fa-Ka*K)*Sa;P=P-Ea*sa-Z*ua;oa=oa-La*sa-K*ua;m.save();m.transform(Ea,La,Z,K,P,oa);m.clip();m.drawImage(pa,0,0);m.restore()}}function Oa(P,oa,Z,K){var T=~~(P.r*255),fa=~~(P.g*255);P=~~(P.b*255);var pa=~~(oa.r*255),sa=~~(oa.g*255);oa=~~(oa.b*255);var ua=~~(Z.r*255),Ra=~~(Z.g*255);Z=~~(Z.b*255);var La=~~(K.r*255),Ka=~~(K.g*255); -K=~~(K.b*255);O[0]=T<0?0:T>255?255:T;O[1]=fa<0?0:fa>255?255:fa;O[2]=P<0?0:P>255?255:P;O[4]=pa<0?0:pa>255?255:pa;O[5]=sa<0?0:sa>255?255:sa;O[6]=oa<0?0:oa>255?255:oa;O[8]=ua<0?0:ua>255?255:ua;O[9]=Ra<0?0:Ra>255?255:Ra;O[10]=Z<0?0:Z>255?255:Z;O[12]=La<0?0:La>255?255:La;O[13]=Ka<0?0:Ka>255?255:Ka;O[14]=K<0?0:K>255?255:K;B.putImageData(D,0,0);F.drawImage(C,0,0);return X}function S(P,oa,Z){P=(P-oa)/(Z-oa);return P*P*(3-2*P)}function U(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function V(P,oa){var Z=oa.x-P.x, -K=oa.y-P.y,T=1/Math.sqrt(Z*Z+K*K);Z*=T;K*=T;oa.x+=Z;oa.y+=K;P.x-=Z;P.y-=K}var ya,Ma,Fa,Ba,Ga,H,Ja,Ha;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,k);b=d.projectScene(ka,na,this.sortElements);(ma=ka.lights.length>0)&&wa(ka);ya=0;for(Ma=b.length;ya0){va.r+=$.color.r*qa;va.g+=$.color.g*qa;va.b+=$.color.b*qa}}else if($ instanceof THREE.PointLight){W.sub($.position,ha.centroidWorld);W.normalize();qa=ha.normalWorld.dot(W)*$.intensity;if(qa>0){va.r+=$.color.r*qa;va.g+=$.color.g*qa;va.b+=$.color.b*qa}}}}function c(ja,ha,va,Aa,ia,$){I=d(ca++); -I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)y.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a($,Aa,L);y.r=ia.color.r*L.r;y.g=ia.color.g*L.g;y.b=ia.color.b*L.b;y.updateStyleString()}else y.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshDepthMaterial){f= -1-ia.__2near/(ia.__farPlusNear-Aa.z*ia.__farMinusNear);y.setRGB(f,f,f)}else ia instanceof THREE.MeshNormalMaterial&&y.setRGB(e(Aa.normalWorld.x),e(Aa.normalWorld.y),e(Aa.normalWorld.z));ia.wireframe?I.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+ia.wireframeLinewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.wireframeLinecap+"; stroke-linejoin: "+ia.wireframeLinejoin):I.setAttribute("style","fill: "+y.__styleString+"; fill-opacity: "+ia.opacity);j.appendChild(I)} -function b(ja,ha,va,Aa,ia,$,qa){I=d(ca++);I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Aa.positionScreen.x+","+Aa.positionScreen.y+"z");if($ instanceof THREE.MeshBasicMaterial)y.__styleString=$.color.__styleString;else if($ instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a(qa,ia,L);y.r=$.color.r*L.r;y.g=$.color.g*L.g;y.b=$.color.b*L.b;y.updateStyleString()}else y.__styleString= -$.color.__styleString;else if($ instanceof THREE.MeshDepthMaterial){f=1-$.__2near/($.__farPlusNear-ia.z*$.__farMinusNear);y.setRGB(f,f,f)}else $ instanceof THREE.MeshNormalMaterial&&y.setRGB(e(ia.normalWorld.x),e(ia.normalWorld.y),e(ia.normalWorld.z));$.wireframe?I.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+$.wireframeLinewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.wireframeLinecap+"; stroke-linejoin: "+$.wireframeLinejoin):I.setAttribute("style", -"fill: "+y.__styleString+"; fill-opacity: "+$.opacity);j.appendChild(I)}function d(ja){if(R[ja]==null){R[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");xa==0&&R[ja].setAttribute("shape-rendering","crispEdges")}return R[ja]}function e(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,q,w,u,o,v,A,E=new THREE.Rectangle,x=new THREE.Rectangle,G=!1,y=new THREE.Color(16777215), -L=new THREE.Color(16777215),J=new THREE.Color(0),Y=new THREE.Color(0),N=new THREE.Color(0),f,W=new THREE.Vector3,R=[],da=[],ga=[],I,ca,za,ea,xa=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ja){switch(ja){case "high":xa=1;break;case "low":xa=0}};this.setSize=function(ja,ha){k=ja;m=ha;q=k/2;w=m/2;j.setAttribute("viewBox",-q+" "+-w+" "+k+" "+m);j.setAttribute("width",k);j.setAttribute("height",m);E.set(-q,-w,q,w)};this.clear=function(){for(;j.childNodes.length> -0;)j.removeChild(j.childNodes[0])};this.render=function(ja,ha){var va,Aa,ia,$,qa,ra,Q,ma;this.autoClear&&this.clear();g=h.projectScene(ja,ha,this.sortElements);ea=za=ca=0;if(G=ja.lights.length>0){Q=ja.lights;J.setRGB(0,0,0);Y.setRGB(0,0,0);N.setRGB(0,0,0);va=0;for(Aa=Q.length;va0){K.r+=pa.r*fa;K.g+=pa.g*fa;K.b+=pa.b*fa}}else if(fa instanceof THREE.PointLight){q.sub(fa.position,oa);q.normalize();fa=$.dot(q)*sa;if(fa>0){K.r+=pa.r*fa;K.g+=pa.g*fa;K.b+=pa.b*fa}}}}function Ca(O,oa,$){if($.opacity!=0){a($.opacity); +c($.blending);var K,T,fa,pa,sa,ua;if($ instanceof THREE.ParticleBasicMaterial){if($.map){pa=$.map.image;sa=pa.width>>1;ua=pa.height>>1;T=oa.scale.x*j;fa=oa.scale.y*k;$=T*sa;K=fa*ua;Q.set(O.x-$,O.y-K,O.x+$,O.y+K);if(qa.instersects(Q)){m.save();m.translate(O.x,O.y);m.rotate(-oa.rotation);m.scale(T,-fa);m.translate(-sa,-ua);m.drawImage(pa,0,0);m.restore()}}}else if($ instanceof THREE.ParticleCircleMaterial){if(ma){ta.r=l.r+z.r+p.r;ta.g=l.g+z.g+p.g;ta.b=l.b+z.b+p.b;R.r=$.color.r*ta.r;R.g=$.color.g*ta.g; +R.b=$.color.b*ta.b;R.updateStyleString()}else R.__styleString=$.color.__styleString;$=oa.scale.x*j;K=oa.scale.y*k;Q.set(O.x-$,O.y-K,O.x+$,O.y+K);if(qa.instersects(Q)){T=R.__styleString;if(B!=T)m.fillStyle=B=T;m.save();m.translate(O.x,O.y);m.rotate(-oa.rotation);m.scale($,K);m.beginPath();m.arc(0,0,1,0,n,!0);m.closePath();m.fill();m.restore()}}}}function Da(O,oa,$,K){if(K.opacity!=0){a(K.opacity);c(K.blending);m.beginPath();m.moveTo(O.positionScreen.x,O.positionScreen.y);m.lineTo(oa.positionScreen.x, +oa.positionScreen.y);m.closePath();if(K instanceof THREE.LineBasicMaterial){R.__styleString=K.color.__styleString;O=K.linewidth;if(F!=O)m.lineWidth=F=O;O=R.__styleString;if(v!=O)m.strokeStyle=v=O;m.stroke();Q.inflate(K.linewidth*2)}}}function Pa(O,oa,$,K,T,fa){if(T.opacity!=0){a(T.opacity);c(T.blending);L=O.positionScreen.x;J=O.positionScreen.y;Y=oa.positionScreen.x;N=oa.positionScreen.y;f=$.positionScreen.x;X=$.positionScreen.y;m.beginPath();m.moveTo(L,J);m.lineTo(Y,N);m.lineTo(f,X);m.lineTo(L,J); +m.closePath();if(T instanceof THREE.MeshBasicMaterial)if(T.map)T.map.mapping instanceof THREE.UVMapping&&Ia(L,J,Y,N,f,X,T.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);else if(T.envMap){if(T.envMap.mapping instanceof THREE.SphericalReflectionMapping){O=na.matrixWorldInverse;q.copy(K.vertexNormalsWorld[0]);ja=(q.x*O.n11+q.y*O.n12+q.z*O.n13)*0.5+0.5;ha=-(q.x*O.n21+q.y*O.n22+q.z*O.n23)*0.5+0.5;q.copy(K.vertexNormalsWorld[1]);va=(q.x*O.n11+q.y*O.n12+q.z*O.n13)*0.5+0.5;Aa= +-(q.x*O.n21+q.y*O.n22+q.z*O.n23)*0.5+0.5;q.copy(K.vertexNormalsWorld[2]);ia=(q.x*O.n11+q.y*O.n12+q.z*O.n13)*0.5+0.5;aa=-(q.x*O.n21+q.y*O.n22+q.z*O.n23)*0.5+0.5;Ia(L,J,Y,N,f,X,T.envMap.image,ja,ha,va,Aa,ia,aa)}}else T.wireframe?M(T.color.__styleString,T.wireframeLinewidth):Na(T.color.__styleString);else if(T instanceof THREE.MeshLambertMaterial){if(T.map&&!T.wireframe){T.map.mapping instanceof THREE.UVMapping&&Ia(L,J,Y,N,f,X,T.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v); +c(THREE.SubtractiveBlending)}if(ma)if(!T.wireframe&&T.shading==THREE.SmoothShading&&K.vertexNormalsWorld.length==3){da.r=ga.r=I.r=l.r;da.g=ga.g=I.g=l.g;da.b=ga.b=I.b=l.b;la(fa,K.v1.positionWorld,K.vertexNormalsWorld[0],da);la(fa,K.v2.positionWorld,K.vertexNormalsWorld[1],ga);la(fa,K.v3.positionWorld,K.vertexNormalsWorld[2],I);ca.r=(ga.r+I.r)*0.5;ca.g=(ga.g+I.g)*0.5;ca.b=(ga.b+I.b)*0.5;xa=Oa(da,ga,I,ca);Ia(L,J,Y,N,f,X,xa,0,0,1,0,0,1)}else{ta.r=l.r;ta.g=l.g;ta.b=l.b;la(fa,K.centroidWorld,K.normalWorld, +ta);R.r=T.color.r*ta.r;R.g=T.color.g*ta.g;R.b=T.color.b*ta.b;R.updateStyleString();T.wireframe?M(R.__styleString,T.wireframeLinewidth):Na(R.__styleString)}else T.wireframe?M(T.color.__styleString,T.wireframeLinewidth):Na(T.color.__styleString)}else if(T instanceof THREE.MeshDepthMaterial){za=na.near;ea=na.far;da.r=da.g=da.b=1-S(O.positionScreen.z,za,ea);ga.r=ga.g=ga.b=1-S(oa.positionScreen.z,za,ea);I.r=I.g=I.b=1-S($.positionScreen.z,za,ea);ca.r=(ga.r+I.r)*0.5;ca.g=(ga.g+I.g)*0.5;ca.b=(ga.b+I.b)*0.5; +xa=Oa(da,ga,I,ca);Ia(L,J,Y,N,f,X,xa,0,0,1,0,0,1)}else if(T instanceof THREE.MeshNormalMaterial){R.r=V(K.normalWorld.x);R.g=V(K.normalWorld.y);R.b=V(K.normalWorld.z);R.updateStyleString();T.wireframe?M(R.__styleString,T.wireframeLinewidth):Na(R.__styleString)}}}function M(O,oa){if(v!=O)m.strokeStyle=v=O;if(F!=oa)m.lineWidth=F=oa;m.stroke();Q.inflate(oa*2)}function Na(O){if(B!=O)m.fillStyle=B=O;m.fill()}function Ia(O,oa,$,K,T,fa,pa,sa,ua,Ra,La,Ka,Wa){var Ea,Sa;Ea=pa.width-1;Sa=pa.height-1;sa*=Ea;ua*= +Sa;Ra*=Ea;La*=Sa;Ka*=Ea;Wa*=Sa;$-=O;K-=oa;T-=O;fa-=oa;Ra-=sa;La-=ua;Ka-=sa;Wa-=ua;Ea=Ra*Wa-Ka*La;if(Ea!=0){Sa=1/Ea;Ea=(Wa*$-La*T)*Sa;La=(Wa*K-La*fa)*Sa;$=(Ra*T-Ka*$)*Sa;K=(Ra*fa-Ka*K)*Sa;O=O-Ea*sa-$*ua;oa=oa-La*sa-K*ua;m.save();m.transform(Ea,La,$,K,O,oa);m.clip();m.drawImage(pa,0,0);m.restore()}}function Oa(O,oa,$,K){var T=~~(O.r*255),fa=~~(O.g*255);O=~~(O.b*255);var pa=~~(oa.r*255),sa=~~(oa.g*255);oa=~~(oa.b*255);var ua=~~($.r*255),Ra=~~($.g*255);$=~~($.b*255);var La=~~(K.r*255),Ka=~~(K.g*255); +K=~~(K.b*255);P[0]=T<0?0:T>255?255:T;P[1]=fa<0?0:fa>255?255:fa;P[2]=O<0?0:O>255?255:O;P[4]=pa<0?0:pa>255?255:pa;P[5]=sa<0?0:sa>255?255:sa;P[6]=oa<0?0:oa>255?255:oa;P[8]=ua<0?0:ua>255?255:ua;P[9]=Ra<0?0:Ra>255?255:Ra;P[10]=$<0?0:$>255?255:$;P[12]=La<0?0:La>255?255:La;P[13]=Ka<0?0:Ka>255?255:Ka;P[14]=K<0?0:K>255?255:K;A.putImageData(D,0,0);E.drawImage(C,0,0);return U}function S(O,oa,$){O=(O-oa)/($-oa);return O*O*(3-2*O)}function V(O){O=(O+1)*0.5;return O<0?0:O>1?1:O}function W(O,oa){var $=oa.x-O.x, +K=oa.y-O.y,T=1/Math.sqrt($*$+K*K);$*=T;K*=T;oa.x+=$;oa.y+=K;O.x-=$;O.y-=K}var ya,Ma,Fa,Ba,Ga,H,Ja,Ha;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,k);b=d.projectScene(ka,na,this.sortElements);(ma=ka.lights.length>0)&&wa(ka);ya=0;for(Ma=b.length;ya0){va.r+=aa.color.r*qa;va.g+=aa.color.g*qa;va.b+=aa.color.b*qa}}else if(aa instanceof THREE.PointLight){X.sub(aa.position,ha.centroidWorld);X.normalize();qa=ha.normalWorld.dot(X)*aa.intensity;if(qa>0){va.r+=aa.color.r*qa;va.g+=aa.color.g*qa;va.b+=aa.color.b*qa}}}}function c(ja,ha,va, +Aa,ia,aa){I=d(ca++);I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)y.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a(aa,Aa,L);y.r=ia.color.r*L.r;y.g=ia.color.g*L.g;y.b=ia.color.b*L.b;y.updateStyleString()}else y.__styleString=ia.color.__styleString;else if(ia instanceof +THREE.MeshDepthMaterial){f=1-ia.__2near/(ia.__farPlusNear-Aa.z*ia.__farMinusNear);y.setRGB(f,f,f)}else ia instanceof THREE.MeshNormalMaterial&&y.setRGB(e(Aa.normalWorld.x),e(Aa.normalWorld.y),e(Aa.normalWorld.z));ia.wireframe?I.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+ia.wireframeLinewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.wireframeLinecap+"; stroke-linejoin: "+ia.wireframeLinejoin):I.setAttribute("style","fill: "+y.__styleString+"; fill-opacity: "+ +ia.opacity);j.appendChild(I)}function b(ja,ha,va,Aa,ia,aa,qa){I=d(ca++);I.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+Aa.positionScreen.x+","+Aa.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)y.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(G){L.r=J.r;L.g=J.g;L.b=J.b;a(qa,ia,L);y.r=aa.color.r*L.r;y.g=aa.color.g*L.g; +y.b=aa.color.b*L.b;y.updateStyleString()}else y.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){f=1-aa.__2near/(aa.__farPlusNear-ia.z*aa.__farMinusNear);y.setRGB(f,f,f)}else aa instanceof THREE.MeshNormalMaterial&&y.setRGB(e(ia.normalWorld.x),e(ia.normalWorld.y),e(ia.normalWorld.z));aa.wireframe?I.setAttribute("style","fill: none; stroke: "+y.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+ +"; stroke-linejoin: "+aa.wireframeLinejoin):I.setAttribute("style","fill: "+y.__styleString+"; fill-opacity: "+aa.opacity);j.appendChild(I)}function d(ja){if(R[ja]==null){R[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");xa==0&&R[ja].setAttribute("shape-rendering","crispEdges")}return R[ja]}function e(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,t,w,u,o,v,B,F= +new THREE.Rectangle,x=new THREE.Rectangle,G=!1,y=new THREE.Color(16777215),L=new THREE.Color(16777215),J=new THREE.Color(0),Y=new THREE.Color(0),N=new THREE.Color(0),f,X=new THREE.Vector3,R=[],da=[],ga=[],I,ca,za,ea,xa=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ja){switch(ja){case "high":xa=1;break;case "low":xa=0}};this.setSize=function(ja,ha){k=ja;m=ha;t=k/2;w=m/2;j.setAttribute("viewBox",-t+" "+-w+" "+k+" "+m);j.setAttribute("width", +k);j.setAttribute("height",m);F.set(-t,-w,t,w)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(ja,ha){var va,Aa,ia,aa,qa,ra,Q,ma;this.autoClear&&this.clear();g=h.projectScene(ja,ha,this.sortElements);ea=za=ca=0;if(G=ja.lights.length>0){Q=ja.lights;J.setRGB(0,0,0);Y.setRGB(0,0,0);N.setRGB(0,0,0);va=0;for(Aa=Q.length;va 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif", morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif", -default_vertex:"#ifndef USE_MORPHTARGETS || USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif"}; +default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif"}; THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f", value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f", value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}}; @@ -213,90 +213,91 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE. vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex, THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;", THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}}; -THREE.WebGLRenderer=function(a){function c(l,z,t){var n,p,C,B=l.vertices,D=B.length,O=l.colors,X=O.length,F=l.__vertexArray,aa=l.__colorArray,ka=l.__sortArray,na=l.__dirtyVertices,wa=l.__dirtyColors;if(t.sortParticles){Aa.multiplySelf(t.matrixWorld);for(n=0;nt){B=O;t=D[B]}f.bindBuffer(f.ARRAY_BUFFER,p.__webGLMorphTargetsBuffers[B]);f.vertexAttribPointer(l["morphTarget"+F],3,f.FLOAT,!1,0,0);C.__webGLMorphTargetInfluences[F]=t;z[B]=1;t=-1;F++}f.uniform1fv(n.program.uniforms.morphTargetInfluences,C.__webGLMorphTargetInfluences)}else{f.bindBuffer(f.ARRAY_BUFFER,p.__webGLVertexBuffer);f.vertexAttribPointer(l.position,3,f.FLOAT,!1,0,0)}if(l.color>=0){f.bindBuffer(f.ARRAY_BUFFER,p.__webGLColorBuffer);f.vertexAttribPointer(l.color,3, -f.FLOAT,!1,0,0)}if(l.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,p.__webGLNormalBuffer);f.vertexAttribPointer(l.normal,3,f.FLOAT,!1,0,0)}if(l.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,p.__webGLTangentBuffer);f.vertexAttribPointer(l.tangent,4,f.FLOAT,!1,0,0)}if(l.uv>=0)if(p.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,p.__webGLUVBuffer);f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv)}else f.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(p.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER, -p.__webGLUV2Buffer);f.vertexAttribPointer(l.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv2)}else f.disableVertexAttribArray(l.uv2);if(n.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);f.vertexAttribPointer(l.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);f.vertexAttribPointer(l.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);f.vertexAttribPointer(l.skinIndex, -4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);f.vertexAttribPointer(l.skinWeight,4,f.FLOAT,!1,0,0)}if(C instanceof THREE.Mesh)if(n.wireframe){f.lineWidth(n.wireframeLinewidth);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);f.drawElements(f.LINES,p.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,p.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(C instanceof THREE.Line){C=C.type==THREE.LineStrip? -f.LINE_STRIP:f.LINES;f.lineWidth(n.linewidth);f.drawArrays(C,0,p.__webGLLineCount)}else if(C instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,0,p.__webGLParticleCount);else C instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,0,p.__webGLVertexCount)}}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=f.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=f.createBuffer();if(l.hasPos){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,l.positionArray, -f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.position);f.vertexAttribPointer(z.attributes.position,3,f.FLOAT,!1,0,0)}if(l.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,l.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.normal);f.vertexAttribPointer(z.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,l.count);l.count=0}function h(l){if(ga!=l.doubleSided){l.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);ga= -l.doubleSided}if(I!=l.flipSided){l.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);I=l.flipSided}}function j(l){if(za!=l){l?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);za=l}}function k(l){va[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);va[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);va[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);va[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);va[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);va[5].set(l.n41+ -l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=va[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function m(l){for(var z=l.matrixWorld,t=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=va[n].x*z.n14+va[n].y*z.n24+va[n].z*z.n34+va[n].w;if(l<=t)return!1}return!0}function q(l,z){l.list[l.count]=z;l.count+=1}function w(l){var z,t,n=l.object,p=l.opaque,C=l.transparent;C.count=0;l=p.count=0;for(z=n.materials.length;l65535){F[O].counter+=1;X=F[O].hash+"_"+F[O].counter;l.geometryGroups[X]==undefined&&(l.geometryGroups[X]={faces:[],materials:D,vertices:0,numMorphTargets:aa})}l.geometryGroups[X].faces.push(p);l.geometryGroups[X].vertices+=B}}function E(l,z,t){l.push({buffer:z, -object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function x(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD); -f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ca=l}}function G(l,z,t){if((t.width&t.width-1)==0&&(t.height&t.height-1)==0){f.texParameteri(l,f.TEXTURE_WRAP_S,Y(z.wrapS));f.texParameteri(l,f.TEXTURE_WRAP_T,Y(z.wrapT));f.texParameteri(l,f.TEXTURE_MAG_FILTER,Y(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,Y(z.minFilter));f.generateMipmap(l)}else{f.texParameteri(l,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_MAG_FILTER,J(z.magFilter)); -f.texParameteri(l,f.TEXTURE_MIN_FILTER,J(z.minFilter))}}function y(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=f.createFramebuffer();l.__webGLRenderbuffer=f.createRenderbuffer();l.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,l.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,l.width,l.height);f.bindTexture(f.TEXTURE_2D,l.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Y(l.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T, -Y(l.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Y(l.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Y(l.minFilter));f.texImage2D(f.TEXTURE_2D,0,Y(l.format),l.width,l.height,0,Y(l.format),Y(l.type),null);f.bindFramebuffer(f.FRAMEBUFFER,l.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,l.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,l.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null); -f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var z,t;if(l){z=l.__webGLFramebuffer;t=l.width;l=l.height}else{z=null;t=ja;l=ha}if(z!=R){f.bindFramebuffer(f.FRAMEBUFFER,z);f.viewport(ea,xa,t,l);R=z}}function L(l,z){var t;if(l=="fragment")t=f.createShader(f.FRAGMENT_SHADER);else l=="vertex"&&(t=f.createShader(f.VERTEX_SHADER));f.shaderSource(t,z);f.compileShader(t);if(!f.getShaderParameter(t,f.COMPILE_STATUS)){alert(f.getShaderInfoLog(t));return null}return t}function J(l){switch(l){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST; -case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}function Y(l){switch(l){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR; -case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA; -case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var N=document.createElement("canvas"),f,W=null,R=null,da=this,ga=null,I=null,ca=null,za=null,ea=0,xa=0,ja=0,ha=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,ia=new Float32Array(16),$=new Float32Array(16),qa=new THREE.Vector4,ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0, -colors:[],positions:[]}},Q=!0,ma=new THREE.Color(0),ta=0;if(a){if(a.antialias!==undefined)Q=a.antialias;a.clearColor!==undefined&&ma.setHex(a.clearColor);if(a.clearAlpha!==undefined)ta=a.clearAlpha}this.maxMorphTargets=8;this.domElement=N;this.autoClear=!0;this.sortObjects=!0;(function(l,z,t){try{if(!(f=N.getContext("experimental-webgl",{antialias:l})))throw"Error creating WebGL context.";}catch(n){console.error(n)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL); -f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);f.clearColor(z.r,z.g,z.b,t);_cullEnabled=!0})(Q,ma,ta);this.context=f;this.setSize=function(l,z){N.width=l;N.height=z;this.setViewport(0,0,N.width,N.height)};this.setViewport=function(l,z,t,n){ea=l;xa=z;ja=t;ha=n;f.viewport(ea,xa,ja,ha)};this.setScissor=function(l,z,t,n){f.scissor(l,z,t,n)};this.enableScissorTest=function(l){l?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite= -function(l){f.depthMask(l)};this.setClearColorHex=function(l,z){var t=new THREE.Color(l);f.clearColor(t.r,t.g,t.b,z)};this.setClearColor=function(l,z){f.clearColor(l.r,l.g,l.b,z)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,z,t,n){var p,C,B;if(l instanceof THREE.MeshDepthMaterial)b(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)b(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)b(l,THREE.ShaderLib.basic); -else if(l instanceof THREE.MeshLambertMaterial)b(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)b(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)b(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&b(l,THREE.ShaderLib.particle_basic);var D,O,X,F;B=X=F=0;for(D=z.length;B0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+D.maxPointLights,"#define MAX_BONES "+D.maxBones,D.map?"#define USE_MAP":"",D.envMap?"#define USE_ENVMAP": -"",D.lightMap?"#define USE_LIGHTMAP":"",D.vertexColors?"#define USE_COLOR":"",D.skinning?"#define USE_SKINNING":"",D.morphTargets?"#define USE_MORPHTARGETS":"",D.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); -f.attachShader(t,L("fragment",B+F));f.attachShader(t,L("vertex",D+z));f.linkProgram(t);f.getProgramParameter(t,f.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+f.getProgramParameter(t,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");t.uniforms={};t.attributes={};l.program=t;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(p in l.uniforms)t.push(p);p= -l.program;F=0;for(z=t.length;F=0&&f.enableVertexAttribArray(C.color);C.normal>=0&&f.enableVertexAttribArray(C.normal); +2;D.map.texture=n.map}else if(n instanceof THREE.MeshPhongMaterial){D.ambient.value.setRGB(n.ambient.r,n.ambient.g,n.ambient.b);D.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);D.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){D.mNear.value=l.near;D.mFar.value=l.far;D.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)D.opacity.value=n.opacity;for(var S in D)if(E=C.uniforms[S]){p=D[S];P=p.type;z=p.value;if(P=="i")f.uniform1i(E,z);else if(P== +"f")f.uniform1f(E,z);else if(P=="fv1")f.uniform1fv(E,z);else if(P=="fv")f.uniform3fv(E,z);else if(P=="v2")f.uniform2f(E,z.x,z.y);else if(P=="v3")f.uniform3f(E,z.x,z.y,z.z);else if(P=="c")f.uniform3f(E,z.r,z.g,z.b);else if(P=="t"){f.uniform1i(E,z);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(P=0;P<6;++P)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+P,0,0,0,f.RGBA, +f.UNSIGNED_BYTE,p.image[P])}else{p.image.__webGLTextureCube=f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(P=0;P<6;++P)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+P,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[P]);p.__wasSetOnce=!0}G(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D, +p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}G(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(A.modelViewMatrix,!1,q._modelViewMatrixArray);f.uniformMatrix3fv(A.normalMatrix, +!1,q._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||n instanceof THREE.MeshPhongMaterial||n.envMap)&&f.uniform3f(A.cameraPosition,l.position.x,l.position.y,l.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&f.uniformMatrix4fv(A.objectMatrix,!1,q._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&f.uniformMatrix4fv(A.viewMatrix,!1,aa);if(n.skinning){f.uniformMatrix4fv(A.cameraInverseMatrix, +!1,aa);f.uniformMatrix4fv(A.boneGlobalMatrices,!1,q.boneMatrices)}return C}function e(l,z,p,n,q,C){if(n.opacity!=0){l=d(l,z,p,n,C).attributes;if(n.morphTargets){z=n.program.attributes;C.morphTargetBase!==-1?f.bindBuffer(f.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[C.morphTargetBase]):f.bindBuffer(f.ARRAY_BUFFER,q.__webGLVertexBuffer);f.vertexAttribPointer(z.position,3,f.FLOAT,!1,0,0);if(C.morphTargetForcedOrder.length){p=0;for(var A=C.morphTargetForcedOrder,D=C.morphTargetInfluences;pP){U=E;P=D[U]}f.bindBuffer(f.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[U]);f.vertexAttribPointer(z["morphTarget"+p],3,f.FLOAT,!1,0,0); +C.__webGLMorphTargetInfluences[p]=P;A[U]=1;P=-1;p++}}f.uniform1fv(n.program.uniforms.morphTargetInfluences,C.__webGLMorphTargetInfluences)}else{f.bindBuffer(f.ARRAY_BUFFER,q.__webGLVertexBuffer);f.vertexAttribPointer(l.position,3,f.FLOAT,!1,0,0)}if(l.color>=0){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLColorBuffer);f.vertexAttribPointer(l.color,3,f.FLOAT,!1,0,0)}if(l.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLNormalBuffer);f.vertexAttribPointer(l.normal,3,f.FLOAT,!1,0,0)}if(l.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER, +q.__webGLTangentBuffer);f.vertexAttribPointer(l.tangent,4,f.FLOAT,!1,0,0)}if(l.uv>=0)if(q.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLUVBuffer);f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv)}else f.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(q.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLUV2Buffer);f.vertexAttribPointer(l.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv2)}else f.disableVertexAttribArray(l.uv2);if(n.skinning&&l.skinVertexA>=0&& +l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);f.vertexAttribPointer(l.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);f.vertexAttribPointer(l.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);f.vertexAttribPointer(l.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);f.vertexAttribPointer(l.skinWeight,4,f.FLOAT,!1,0,0)}if(C instanceof +THREE.Mesh)if(n.wireframe){f.lineWidth(n.wireframeLinewidth);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);f.drawElements(f.LINES,q.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,q.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(C instanceof THREE.Line){C=C.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(n.linewidth);f.drawArrays(C,0,q.__webGLLineCount)}else if(C instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS, +0,q.__webGLParticleCount);else C instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,0,q.__webGLVertexCount)}}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=f.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=f.createBuffer();if(l.hasPos){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,l.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.position);f.vertexAttribPointer(z.attributes.position,3,f.FLOAT,!1,0,0)}if(l.hasNormal){f.bindBuffer(f.ARRAY_BUFFER, +l.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,l.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.normal);f.vertexAttribPointer(z.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,l.count);l.count=0}function h(l){if(ga!=l.doubleSided){l.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);ga=l.doubleSided}if(I!=l.flipSided){l.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);I=l.flipSided}}function j(l){if(za!=l){l?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST); +za=l}}function k(l){va[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);va[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);va[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);va[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);va[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);va[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=va[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function m(l){for(var z=l.matrixWorld,p=-l.geometry.boundingSphere.radius* +Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=va[n].x*z.n14+va[n].y*z.n24+va[n].z*z.n34+va[n].w;if(l<=p)return!1}return!0}function t(l,z){l.list[l.count]=z;l.count+=1}function w(l){var z,p,n=l.object,q=l.opaque,C=l.transparent;C.count=0;l=q.count=0;for(z=n.materials.length;l65535){E[P].counter+=1;U=E[P].hash+"_"+E[P].counter;l.geometryGroups[U]==undefined&&(l.geometryGroups[U]={faces:[],materials:D,vertices:0,numMorphTargets:Z})}l.geometryGroups[U].faces.push(q);l.geometryGroups[U].vertices+=A}}function F(l,z,p){l.push({buffer:z,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function x(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR, +f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ca=l}}function G(l,z,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(l,f.TEXTURE_WRAP_S,Y(z.wrapS));f.texParameteri(l,f.TEXTURE_WRAP_T,Y(z.wrapT));f.texParameteri(l,f.TEXTURE_MAG_FILTER, +Y(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,Y(z.minFilter));f.generateMipmap(l)}else{f.texParameteri(l,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_MAG_FILTER,J(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,J(z.minFilter))}}function y(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=f.createFramebuffer();l.__webGLRenderbuffer=f.createRenderbuffer();l.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER, +l.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,l.width,l.height);f.bindTexture(f.TEXTURE_2D,l.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Y(l.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,Y(l.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Y(l.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Y(l.minFilter));f.texImage2D(f.TEXTURE_2D,0,Y(l.format),l.width,l.height,0,Y(l.format),Y(l.type),null);f.bindFramebuffer(f.FRAMEBUFFER, +l.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,l.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,l.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var z,p;if(l){z=l.__webGLFramebuffer;p=l.width;l=l.height}else{z=null;p=ja;l=ha}if(z!=R){f.bindFramebuffer(f.FRAMEBUFFER,z);f.viewport(ea,xa,p,l);R=z}}function L(l,z){var p;if(l=="fragment")p= +f.createShader(f.FRAGMENT_SHADER);else l=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,z);f.compileShader(p);if(!f.getShaderParameter(p,f.COMPILE_STATUS)){alert(f.getShaderInfoLog(p));return null}return p}function J(l){switch(l){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}function Y(l){switch(l){case THREE.RepeatWrapping:return f.REPEAT; +case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE; +case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var N=document.createElement("canvas"), +f,X=null,R=null,da=this,ga=null,I=null,ca=null,za=null,ea=0,xa=0,ja=0,ha=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,ia=new Float32Array(16),aa=new Float32Array(16),qa=new THREE.Vector4,ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Q=!0,ma=new THREE.Color(0),ta=0;if(a){if(a.antialias!==undefined)Q=a.antialias;a.clearColor!==undefined&&ma.setHex(a.clearColor); +if(a.clearAlpha!==undefined)ta=a.clearAlpha}this.maxMorphTargets=8;this.domElement=N;this.autoClear=!0;this.sortObjects=!0;(function(l,z,p){try{if(!(f=N.getContext("experimental-webgl",{antialias:l})))throw"Error creating WebGL context.";}catch(n){console.error(n)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);f.clearColor(z.r,z.g,z.b,p);_cullEnabled= +!0})(Q,ma,ta);this.context=f;this.setSize=function(l,z){N.width=l;N.height=z;this.setViewport(0,0,N.width,N.height)};this.setViewport=function(l,z,p,n){ea=l;xa=z;ja=p;ha=n;f.viewport(ea,xa,ja,ha)};this.setScissor=function(l,z,p,n){f.scissor(l,z,p,n)};this.enableScissorTest=function(l){l?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(l){f.depthMask(l)};this.setClearColorHex=function(l,z){var p=new THREE.Color(l);f.clearColor(p.r,p.g,p.b,z)};this.setClearColor= +function(l,z){f.clearColor(l.r,l.g,l.b,z)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,z,p,n){var q,C,A;if(l instanceof THREE.MeshDepthMaterial)b(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)b(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)b(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)b(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)b(l,THREE.ShaderLib.phong); +else if(l instanceof THREE.LineBasicMaterial)b(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&b(l,THREE.ShaderLib.particle_basic);var D,P,U,E;A=U=E=0;for(D=z.length;A0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+D.maxPointLights,"#define MAX_BONES "+D.maxBones,D.map?"#define USE_MAP":"",D.envMap?"#define USE_ENVMAP":"",D.lightMap?"#define USE_LIGHTMAP":"",D.vertexColors?"#define USE_COLOR":"",D.skinning?"#define USE_SKINNING":"",D.morphTargets?"#define USE_MORPHTARGETS": +"",D.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); +f.attachShader(p,L("fragment",A+E));f.attachShader(p,L("vertex",D+z));f.linkProgram(p);f.getProgramParameter(p,f.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+f.getProgramParameter(p,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");p.uniforms={};p.attributes={};l.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in l.uniforms)p.push(q);q= +l.program;E=0;for(z=p.length;E=0&&f.enableVertexAttribArray(C.color);C.normal>=0&&f.enableVertexAttribArray(C.normal); C.tangent>=0&&f.enableVertexAttribArray(C.tangent);if(l.skinning&&C.skinVertexA>=0&&C.skinVertexB>=0&&C.skinIndex>=0&&C.skinWeight>=0){f.enableVertexAttribArray(C.skinVertexA);f.enableVertexAttribArray(C.skinVertexB);f.enableVertexAttribArray(C.skinIndex);f.enableVertexAttribArray(C.skinWeight)}if(l.morphTargets){l.numSupportedMorphTargets=0;if(C.morphTarget0>=0){f.enableVertexAttribArray(C.morphTarget0);l.numSupportedMorphTargets++}if(C.morphTarget1>=0){f.enableVertexAttribArray(C.morphTarget1); l.numSupportedMorphTargets++}if(C.morphTarget2>=0){f.enableVertexAttribArray(C.morphTarget2);l.numSupportedMorphTargets++}if(C.morphTarget3>=0){f.enableVertexAttribArray(C.morphTarget3);l.numSupportedMorphTargets++}if(C.morphTarget4>=0){f.enableVertexAttribArray(C.morphTarget4);l.numSupportedMorphTargets++}if(C.morphTarget5>=0){f.enableVertexAttribArray(C.morphTarget5);l.numSupportedMorphTargets++}if(C.morphTarget6>=0){f.enableVertexAttribArray(C.morphTarget6);l.numSupportedMorphTargets++}if(C.morphTarget7>= -0){f.enableVertexAttribArray(C.morphTarget7);l.numSupportedMorphTargets++}n.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(p=0;p=0;p--){n=t.__webglObjects[p].object;z==n&&t.__webglObjects.splice(p,1)}l.__objectsRemoved.splice(0,1)}z=0;for(t=l.__webglObjects.length;z0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,P,D)}if($a&&na>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,oa,D)}if(ab){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,La,D);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER, -B.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ka,D)}if(H>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,fa,D);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,pa,D);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,sa,D);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,ua,D)}}}p.__dirtyVertices=!1;p.__dirtyMorphTargets=!1;p.__dirtyElements=!1;p.__dirtyUvs= -!1;p.__dirtyNormals=!1;p.__dirtyTangents=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;C=f.DYNAMIC_DRAW;F=void 0;F=void 0;aa=void 0;B=void 0;X=n.vertices;D=n.colors;na=X.length;O=D.length;wa=n.__vertexArray;ka=n.__colorArray;Da=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F0}}; +0){f.enableVertexAttribArray(C.morphTarget7);l.numSupportedMorphTargets++}n.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(q=0;q=0;q--){n=p.__webglObjects[q].object;z==n&&p.__webglObjects.splice(q,1)}l.__objectsRemoved.splice(0,1)}z=0;for(p=l.__webglObjects.length;z0){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,O,D)}if($a&&na>0){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,oa,D)}if(ab){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,La,D);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER, +Ka,D)}if(H>0){f.bindBuffer(f.ARRAY_BUFFER,A.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,fa,D);f.bindBuffer(f.ARRAY_BUFFER,A.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,pa,D);f.bindBuffer(f.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,sa,D);f.bindBuffer(f.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,ua,D)}}}q.__dirtyVertices=!1;q.__dirtyMorphTargets=!1;q.__dirtyElements=!1;q.__dirtyUvs=!1;q.__dirtyNormals=!1;q.__dirtyTangents=!1;q.__dirtyColors= +!1}else if(n instanceof THREE.Ribbon){q=n.geometry;if(q.__dirtyVertices||q.__dirtyColors){n=q;C=f.DYNAMIC_DRAW;E=void 0;E=void 0;Z=void 0;A=void 0;U=n.vertices;D=n.colors;na=U.length;P=D.length;wa=n.__vertexArray;ka=n.__colorArray;Da=n.__dirtyColors;if(n.__dirtyVertices){for(E=0;E0}}; THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c=0?u:u+e;u=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange; -this.phi=(this.phi-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.target.position;u.x=100*Math.sin(this.phi)*Math.cos(this.theta);u.y=100*Math.cos(this.phi);u.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,m,q,w)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); +this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.update=function(m,t,w){var u,o;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;u=this.phi%e;this.phi=u>=0?u:u+e;u=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange; +this.phi=(this.phi-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.target.position;u.x=100*Math.sin(this.phi)*Math.cos(this.theta);u.y=100*Math.cos(this.phi);u.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,m,t,w)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints); this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),k=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation= -c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(m,q){return function(){q.apply(m,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; -var Cube=function(a,c,b,d,e,g,h,j,k){function m(E,x,G,y,L,J,Y,N){var f,W,R=d||1,da=e||1,ga=L/2,I=J/2,ca=q.vertices.length;if(E=="x"&&x=="y"||E=="y"&&x=="x")f="z";else if(E=="x"&&x=="z"||E=="z"&&x=="x"){f="y";da=g||1}else if(E=="z"&&x=="y"||E=="y"&&x=="z"){f="x";R=g||1}var za=R+1,ea=da+1;L/=R;var xa=J/da;for(W=0;W0){h(0,0,-m-(g||0));for(d=a;d0){h(0,0,m+(e||0)); +c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(m,t){return function(){t.apply(m,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; +var Cube=function(a,c,b,d,e,g,h,j,k){function m(F,x,G,y,L,J,Y,N){var f,X,R=d||1,da=e||1,ga=L/2,I=J/2,ca=t.vertices.length;if(F=="x"&&x=="y"||F=="y"&&x=="x")f="z";else if(F=="x"&&x=="z"||F=="z"&&x=="x"){f="y";da=g||1}else if(F=="z"&&x=="y"||F=="y"&&x=="z"){f="x";R=g||1}var za=R+1,ea=da+1;L/=R;var xa=J/da;for(X=0;X0){h(0,0,-m-(g||0));for(d=a;d0){h(0,0,m+(e||0)); for(d=a+a/2;d<2*a;d++)j.faces.push(new THREE.Face4((2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder; var Icosahedron=function(a){function c(w,u,o){var v=Math.sqrt(w*w+u*u+o*o);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(w/v,u/v,o/v)))-1}function b(w,u,o,v){v.faces.push(new THREE.Face3(w,u,o))}function d(w,u){var o=e.vertices[w].position,v=e.vertices[u].position;return c((o.x+v.x)/2,(o.y+v.y)/2,(o.z+v.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0, -1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,j,u)))-1);m.push(q)}c.push(m)}var o,v,A;e=c.length;for(b=0;b0)for(d=0;d1){o=this.vertices[h].position.clone(); -v=this.vertices[k].position.clone();A=this.vertices[m].position.clone();o.normalize();v.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,w,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,j,u)))-1);m.push(t)}c.push(m)}var o,v,B;e=c.length;for(b=0;b0)for(d=0;d1){o=this.vertices[h].position.clone(); +v=this.vertices[k].position.clone();B=this.vertices[m].position.clone();o.normalize();v.normalize();B.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([t,w,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b= 1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var TorusKnot=function(a,c,b,d,e,g,h){function j(w,u,o,v,A,E){u=o/v*w;o=Math.cos(u);return new THREE.Vector3(A*(2+o)*0.5*Math.cos(w),A*(2+o)*Math.sin(w)*0.5,E*A*Math.sin(u)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a>7)-127;p|=(B&127)<<16|C<<8;if(p==0&&O==-127)return 0;return(1-2*(D>>7))*(1+p*Math.pow(2,-23))*Math.pow(2,O)}function j(t,n){var p=q(t,n),C=q(t,n+1),B=q(t,n+2);return(q(t,n+3)<<24)+(B<<16)+(C<<8)+p}function k(t,n){var p=q(t,n);return(q(t,n+1)<<8)+p}function m(t,n){var p=q(t,n);return p>127?p-256:p}function q(t,n){return t.charCodeAt(n)&255}function w(t){var n,p,C;n=j(a,t); -p=j(a,t+Y);C=j(a,t+N);t=k(a,t+f);THREE.Loader.prototype.f3(x,n,p,C,t)}function u(t){var n,p,C,B,D,O;n=j(a,t);p=j(a,t+Y);C=j(a,t+N);B=k(a,t+f);D=j(a,t+W);O=j(a,t+R);t=j(a,t+da);THREE.Loader.prototype.f3n(x,L,n,p,C,B,D,O,t)}function o(t){var n,p,C,B;n=j(a,t);p=j(a,t+ga);C=j(a,t+I);B=j(a,t+ca);t=k(a,t+za);THREE.Loader.prototype.f4(x,n,p,C,B,t)}function v(t){var n,p,C,B,D,O,X,F;n=j(a,t);p=j(a,t+ga);C=j(a,t+I);B=j(a,t+ca);D=k(a,t+za);O=j(a,t+ea);X=j(a,t+xa);F=j(a,t+ja);t=j(a,t+ha);THREE.Loader.prototype.f4n(x, -L,n,p,C,B,D,O,X,F,t)}function A(t){var n,p;n=j(a,t);p=j(a,t+va);t=j(a,t+Aa);THREE.Loader.prototype.uv3(x.uvs,J[n*2],J[n*2+1],J[p*2],J[p*2+1],J[t*2],J[t*2+1])}function E(t){var n,p,C;n=j(a,t);p=j(a,t+ia);C=j(a,t+$);t=j(a,t+qa);THREE.Loader.prototype.uv4(x.uvs,J[n*2],J[n*2+1],J[p*2],J[p*2+1],J[C*2],J[C*2+1],J[t*2],J[t*2+1])}var x=this,G=0,y,L=[],J=[],Y,N,f,W,R,da,ga,I,ca,za,ea,xa,ja,ha,va,Aa,ia,$,qa,ra,Q,ma,ta,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,d,g);y={signature:a.substr(G, -8),header_bytes:q(a,G+8),vertex_coordinate_bytes:q(a,G+9),normal_coordinate_bytes:q(a,G+10),uv_coordinate_bytes:q(a,G+11),vertex_index_bytes:q(a,G+12),normal_index_bytes:q(a,G+13),uv_index_bytes:q(a,G+14),material_index_bytes:q(a,G+15),nvertices:j(a,G+16),nnormals:j(a,G+16+4),nuvs:j(a,G+16+8),ntri_flat:j(a,G+16+12),ntri_smooth:j(a,G+16+16),ntri_flat_uv:j(a,G+16+20),ntri_smooth_uv:j(a,G+16+24),nquad_flat:j(a,G+16+28),nquad_smooth:j(a,G+16+32),nquad_flat_uv:j(a,G+16+36),nquad_smooth_uv:j(a,G+16+40)}; -G+=y.header_bytes;Y=y.vertex_index_bytes;N=y.vertex_index_bytes*2;f=y.vertex_index_bytes*3;W=y.vertex_index_bytes*3+y.material_index_bytes;R=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes;da=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*2;ga=y.vertex_index_bytes;I=y.vertex_index_bytes*2;ca=y.vertex_index_bytes*3;za=y.vertex_index_bytes*4;ea=y.vertex_index_bytes*4+y.material_index_bytes;xa=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes;ja= -y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*2;ha=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*3;va=y.uv_index_bytes;Aa=y.uv_index_bytes*2;ia=y.uv_index_bytes;$=y.uv_index_bytes*2;qa=y.uv_index_bytes*3;g=y.vertex_index_bytes*3+y.material_index_bytes;z=y.vertex_index_bytes*4+y.material_index_bytes;ra=y.ntri_flat*g;Q=y.ntri_smooth*(g+y.normal_index_bytes*3);ma=y.ntri_flat_uv*(g+y.uv_index_bytes*3);ta=y.ntri_smooth_uv*(g+y.normal_index_bytes*3+y.uv_index_bytes* -3);l=y.nquad_flat*z;g=y.nquad_smooth*(z+y.normal_index_bytes*4);z=y.nquad_flat_uv*(z+y.uv_index_bytes*4);G+=function(t){for(var n,p,C,B=y.vertex_coordinate_bytes*3,D=t+y.nvertices*B;t>7)-127;q|=(A&127)<<16|C<<8;if(q==0&&P==-127)return 0;return(1-2*(D>>7))*(1+q*Math.pow(2,-23))*Math.pow(2,P)}function j(p,n){var q=t(p,n),C=t(p,n+1),A=t(p,n+2);return(t(p,n+3)<<24)+(A<<16)+(C<<8)+q}function k(p,n){var q=t(p,n);return(t(p,n+1)<<8)+q}function m(p,n){var q=t(p,n);return q>127?q-256:q}function t(p,n){return p.charCodeAt(n)&255}function w(p){var n,q,C;n=j(a,p); +q=j(a,p+Y);C=j(a,p+N);p=k(a,p+f);THREE.Loader.prototype.f3(x,n,q,C,p)}function u(p){var n,q,C,A,D,P;n=j(a,p);q=j(a,p+Y);C=j(a,p+N);A=k(a,p+f);D=j(a,p+X);P=j(a,p+R);p=j(a,p+da);THREE.Loader.prototype.f3n(x,L,n,q,C,A,D,P,p)}function o(p){var n,q,C,A;n=j(a,p);q=j(a,p+ga);C=j(a,p+I);A=j(a,p+ca);p=k(a,p+za);THREE.Loader.prototype.f4(x,n,q,C,A,p)}function v(p){var n,q,C,A,D,P,U,E;n=j(a,p);q=j(a,p+ga);C=j(a,p+I);A=j(a,p+ca);D=k(a,p+za);P=j(a,p+ea);U=j(a,p+xa);E=j(a,p+ja);p=j(a,p+ha);THREE.Loader.prototype.f4n(x, +L,n,q,C,A,D,P,U,E,p)}function B(p){var n,q;n=j(a,p);q=j(a,p+va);p=j(a,p+Aa);THREE.Loader.prototype.uv3(x.uvs,J[n*2],J[n*2+1],J[q*2],J[q*2+1],J[p*2],J[p*2+1])}function F(p){var n,q,C;n=j(a,p);q=j(a,p+ia);C=j(a,p+aa);p=j(a,p+qa);THREE.Loader.prototype.uv4(x.uvs,J[n*2],J[n*2+1],J[q*2],J[q*2+1],J[C*2],J[C*2+1],J[p*2],J[p*2+1])}var x=this,G=0,y,L=[],J=[],Y,N,f,X,R,da,ga,I,ca,za,ea,xa,ja,ha,va,Aa,ia,aa,qa,ra,Q,ma,ta,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,d,g);y={signature:a.substr(G, +8),header_bytes:t(a,G+8),vertex_coordinate_bytes:t(a,G+9),normal_coordinate_bytes:t(a,G+10),uv_coordinate_bytes:t(a,G+11),vertex_index_bytes:t(a,G+12),normal_index_bytes:t(a,G+13),uv_index_bytes:t(a,G+14),material_index_bytes:t(a,G+15),nvertices:j(a,G+16),nnormals:j(a,G+16+4),nuvs:j(a,G+16+8),ntri_flat:j(a,G+16+12),ntri_smooth:j(a,G+16+16),ntri_flat_uv:j(a,G+16+20),ntri_smooth_uv:j(a,G+16+24),nquad_flat:j(a,G+16+28),nquad_smooth:j(a,G+16+32),nquad_flat_uv:j(a,G+16+36),nquad_smooth_uv:j(a,G+16+40)}; +G+=y.header_bytes;Y=y.vertex_index_bytes;N=y.vertex_index_bytes*2;f=y.vertex_index_bytes*3;X=y.vertex_index_bytes*3+y.material_index_bytes;R=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes;da=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*2;ga=y.vertex_index_bytes;I=y.vertex_index_bytes*2;ca=y.vertex_index_bytes*3;za=y.vertex_index_bytes*4;ea=y.vertex_index_bytes*4+y.material_index_bytes;xa=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes;ja= +y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*2;ha=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*3;va=y.uv_index_bytes;Aa=y.uv_index_bytes*2;ia=y.uv_index_bytes;aa=y.uv_index_bytes*2;qa=y.uv_index_bytes*3;g=y.vertex_index_bytes*3+y.material_index_bytes;z=y.vertex_index_bytes*4+y.material_index_bytes;ra=y.ntri_flat*g;Q=y.ntri_smooth*(g+y.normal_index_bytes*3);ma=y.ntri_flat_uv*(g+y.uv_index_bytes*3);ta=y.ntri_smooth_uv*(g+y.normal_index_bytes*3+y.uv_index_bytes* +3);l=y.nquad_flat*z;g=y.nquad_smooth*(z+y.normal_index_bytes*4);z=y.nquad_flat_uv*(z+y.uv_index_bytes*4);G+=function(p){for(var n,q,C,A=y.vertex_coordinate_bytes*3,D=p+y.nvertices*A;p=this.maxCount-3&&j(this)};this.begin= -function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;dthis.size-1&&(k=this.size-1);var u=Math.floor(m-j);u<1&&(u=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var o=Math.floor(q-j);o<1&&(o=1);j=Math.floor(q+j); -j>this.size-1&&(j=this.size-1);for(var v,A,E,x,G,y;w0&&(this.field[E+v]+=x)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,m=this.size,q=this.yd,w=this.zd,u=this.field,o=m*Math.sqrt(b/d);o>m&&(o=m);for(e=0;e0)for(g=0;gq&&(v=q);for(g=0;g0){k=g*w;for(e=0;esize&&(dist=size);for(h=0;h0){k=zd*h;for(g=0;gthis.size-1&&(k=this.size-1);var u=Math.floor(m-j);u<1&&(u=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var o=Math.floor(t-j);o<1&&(o=1);j=Math.floor(t+j); +j>this.size-1&&(j=this.size-1);for(var v,B,F,x,G,y;w0&&(this.field[F+v]+=x)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,m=this.size,t=this.yd,w=this.zd,u=this.field,o=m*Math.sqrt(b/d);o>m&&(o=m);for(e=0;e0)for(g=0;gt&&(v=t);for(g=0;g0){k=g*w;for(e=0;esize&&(dist=size);for(h=0;h0){k=zd*h;for(g=0;g=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]}; THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; @@ -92,7 +92,7 @@ THREE.Texture=function(a,b,c,d,e,f){this.image=a;this.mapping=b!==undefined?b:ne THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17; THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D; THREE.Line.prototype.constructor=THREE.Line; -THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]}; THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index 19a7a052b1e192a40f23dd0037db8509fcf99be1..213f48b505b71cc7184aeb06393dda3fc11e4930 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -22,7 +22,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"}, screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}", fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var d,b,c,g,e=2*Math.ceil(a*3)+1;e>25&&(e=25);g=(e-1)*0.5;b=Array(e);for(d=c=0;d=0?n:n+g;n=this.verticalAngleMap.srcRange;m=this.verticalAngleMap.dstRange; @@ -48,7 +48,7 @@ for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4((2*c-2*a+2)%a+a,(2*c-2*a+1)%a var Icosahedron=function(a){function d(t,n,m){var p=Math.sqrt(t*t+n*n+m*m);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/p,n/p,m/p)))-1}function b(t,n,m,p){p.faces.push(new THREE.Face3(t,n,m))}function c(t,n){var m=g.vertices[t].position,p=g.vertices[n].position;return d((m.x+p.x)/2,(m.y+p.y)/2,(m.z+p.z)/2)}var g=this,e=new THREE.Geometry,f;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0, 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(a=0;a=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]}; THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; @@ -89,8 +89,8 @@ undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial= THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation= a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}}; THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line; -THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}}; THREE.Vector2=function(a,b){this.set(a||0,b||0)}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,d){this.set(a||0,b||0,d||0)}; THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a, -b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,d=this.y,f=this.z;this.set(d*a.z-f*a.y,f*a.x-b*a.z,b*a.y-d*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/ +b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.set(d*a.z-e*a.y,e*a.x-b*a.z,b*a.y-d*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/ a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a= this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)< -1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,f){this.set(a||0,b||0,d||0,f||1)}; -THREE.Vector4.prototype={set:function(a,b,d,f){this.x=a;this.y=b;this.z=d;this.w=f;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* +1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,e||1)}; +THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,d,f=a.objects,g=[];a=0;for(b=f.length;a0&&L>0&&ea+L<1}var d,f,g,l, -m,s,o,v,B,A,D,E=a.geometry,H=E.vertices,I=[];d=0;for(f=E.faces.length;do?f:o;g=g>v?g:v}a()}; -this.add3Points=function(o,v,B,A,D,E){if(s){s=!1;b=oB?o>D?o:D:B>D?B:D;g=v>A?v>E?v:E:A>E?A:E}else{b=oB?o>D?o>f?o:f:D>f?D:f:B>D?B>f?B:f:D>f?D:f;g=v>A?v>E?v>g?v:g:E>g?E:g:A>E?A>g?A:g:E>g?E:g}a()};this.addRectangle=function(o){if(s){s=!1;b=o.getLeft();d=o.getTop();f=o.getRight();g=o.getBottom()}else{b=bo.getRight()? -f:o.getRight();g=g>o.getBottom()?g:o.getBottom()}a()};this.inflate=function(o){b-=o;d-=o;f+=o;g+=o;a()};this.minSelf=function(o){b=b>o.getLeft()?b:o.getLeft();d=d>o.getTop()?d:o.getTop();f=f=0&&Math.min(g,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){s=!0;g=f=d=b=0;a()};this.isEmpty=function(){return s}}; +THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a0&&L>0&&ea+L<1}var d,e,g,l, +m,s,o,v,B,z,D,E=a.geometry,H=E.vertices,I=[];d=0;for(e=E.faces.length;do?e:o;g=g>v?g:v}a()}; +this.add3Points=function(o,v,B,z,D,E){if(s){s=!1;b=oB?o>D?o:D:B>D?B:D;g=v>z?v>E?v:E:z>E?z:E}else{b=oB?o>D?o>e?o:e:D>e?D:e:B>D?B>e?B:e:D>e?D:e;g=v>z?v>E?v>g?v:g:E>g?E:g:z>E?z>g?z:g:E>g?E:g}a()};this.addRectangle=function(o){if(s){s=!1;b=o.getLeft();d=o.getTop();e=o.getRight();g=o.getBottom()}else{b=bo.getRight()? +e:o.getRight();g=g>o.getBottom()?g:o.getBottom()}a()};this.inflate=function(o){b-=o;d-=o;e+=o;g+=o;a()};this.minSelf=function(o){b=b>o.getLeft()?b:o.getLeft();d=d>o.getTop()?d:o.getTop();e=e=0&&Math.min(g,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){s=!0;g=e=d=b=0;a()};this.isEmpty=function(){return s}}; THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}}; -THREE.Matrix4=function(a,b,d,f,g,l,m,s,o,v,B,A,D,E,H,I){this.set(a||1,b||0,d||0,f||0,g||0,l||1,m||0,s||0,o||0,v||0,B||1,A||0,D||0,E||0,H||0,I||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(a,b,d,f,g,l,m,s,o,v,B,A,D,E,H,I){this.n11=a;this.n12=b;this.n13=d;this.n14=f;this.n21=g;this.n22=l;this.n23=m;this.n24=s;this.n31=o;this.n32=v;this.n33=B;this.n34=A;this.n41=D;this.n42=E;this.n43=H;this.n44=I;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var f=THREE.Matrix4.__v1, -g=THREE.Matrix4.__v2,l=THREE.Matrix4.__v3;l.sub(a,b).normalize();if(l.length()===0)l.z=1;f.cross(d,l).normalize();if(f.length()===0){l.x+=1.0E-4;f.cross(d,l).normalize()}g.cross(l,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=l.x;this.n21=f.y;this.n22=g.y;this.n23=l.y;this.n31=f.z;this.n32=g.z;this.n33=l.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,f=a.z,g=1/(this.n41*b+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*f+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23* -f+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*f+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,d=a.y,f=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*f+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*f+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*f+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*f+this.n44*g;return a},rotateAxis:function(a){var b=a.x,d=a.y,f=a.z;a.x=b*this.n11+d*this.n12+f*this.n13;a.y=b*this.n21+d*this.n22+f*this.n23;a.z=b*this.n31+d*this.n32+f*this.n33;a.normalize(); -return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,f=a.n12,g=a.n13,l=a.n14,m=a.n21,s=a.n22,o=a.n23,v=a.n24,B=a.n31,A=a.n32,D=a.n33,E=a.n34,H=a.n41,I=a.n42,L=a.n43,M=a.n44,W=b.n11,$=b.n12,ia=b.n13,ea=b.n14,aa=b.n21,ja=b.n22, -c=b.n23,ra=b.n24,pa=b.n31,ya=b.n32,sa=b.n33,ta=b.n34;this.n11=d*W+f*aa+g*pa;this.n12=d*$+f*ja+g*ya;this.n13=d*ia+f*c+g*sa;this.n14=d*ea+f*ra+g*ta+l;this.n21=m*W+s*aa+o*pa;this.n22=m*$+s*ja+o*ya;this.n23=m*ia+s*c+o*sa;this.n24=m*ea+s*ra+o*ta+v;this.n31=B*W+A*aa+D*pa;this.n32=B*$+A*ja+D*ya;this.n33=B*ia+A*c+D*sa;this.n34=B*ea+A*ra+D*ta+E;this.n41=H*W+I*aa+L*pa;this.n42=H*$+I*ja+L*ya;this.n43=H*ia+I*c+L*sa;this.n44=H*ea+I*ra+L*ta+M;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]= +THREE.Matrix4=function(a,b,d,e,g,l,m,s,o,v,B,z,D,E,H,I){this.set(a||1,b||0,d||0,e||0,g||0,l||1,m||0,s||0,o||0,v||0,B||1,z||0,D||0,E||0,H||0,I||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(a,b,d,e,g,l,m,s,o,v,B,z,D,E,H,I){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=l;this.n23=m;this.n24=s;this.n31=o;this.n32=v;this.n33=B;this.n34=z;this.n41=D;this.n42=E;this.n43=H;this.n44=I;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__v1, +g=THREE.Matrix4.__v2,l=THREE.Matrix4.__v3;l.sub(a,b).normalize();if(l.length()===0)l.z=1;e.cross(d,l).normalize();if(e.length()===0){l.x+=1.0E-4;e.cross(d,l).normalize()}g.cross(l,e).normalize();this.n11=e.x;this.n12=g.x;this.n13=l.x;this.n21=e.y;this.n22=g.y;this.n23=l.y;this.n31=e.z;this.n32=g.z;this.n33=l.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23* +e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;return a},rotateAxis:function(a){var b=a.x,d=a.y,e=a.z;a.x=b*this.n11+d*this.n12+e*this.n13;a.y=b*this.n21+d*this.n22+e*this.n23;a.z=b*this.n31+d*this.n32+e*this.n33;a.normalize(); +return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,g=a.n13,l=a.n14,m=a.n21,s=a.n22,o=a.n23,v=a.n24,B=a.n31,z=a.n32,D=a.n33,E=a.n34,H=a.n41,I=a.n42,L=a.n43,M=a.n44,W=b.n11,$=b.n12,ia=b.n13,ea=b.n14,aa=b.n21,ja=b.n22, +c=b.n23,ra=b.n24,pa=b.n31,ya=b.n32,sa=b.n33,ta=b.n34;this.n11=d*W+e*aa+g*pa;this.n12=d*$+e*ja+g*ya;this.n13=d*ia+e*c+g*sa;this.n14=d*ea+e*ra+g*ta+l;this.n21=m*W+s*aa+o*pa;this.n22=m*$+s*ja+o*ya;this.n23=m*ia+s*c+o*sa;this.n24=m*ea+s*ra+o*ta+v;this.n31=B*W+z*aa+D*pa;this.n32=B*$+z*ja+D*ya;this.n33=B*ia+z*c+D*sa;this.n34=B*ea+z*ra+D*ta+E;this.n41=H*W+I*aa+L*pa;this.n42=H*$+I*ja+L*ya;this.n43=H*ia+I*c+L*sa;this.n44=H*ea+I*ra+L*ta+M;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);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(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*= -a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,f=this.n14,g=this.n21,l=this.n22,m=this.n23,s=this.n24,o=this.n31,v=this.n32,B=this.n33,A=this.n34,D=this.n41,E=this.n42,H=this.n43,I=this.n44;return f*m*v*D-d*s*v*D-f*l*B*D+b*s*B*D+d*l*A*D-b*m*A*D-f*m*o*E+d*s*o*E+f*g*B*E-a*s*B*E-d*g*A*E+a*m*A*E+f*l*o*H-b*s*o*H-f*g*v*H+a*s*v*H+b*g*A*H-a*l*A*H-d*l*o*I+b*m*o*I+d*g*v*I-a*m*v*I-b*g*B*I+a*l*B*I},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31; +a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,g=this.n21,l=this.n22,m=this.n23,s=this.n24,o=this.n31,v=this.n32,B=this.n33,z=this.n34,D=this.n41,E=this.n42,H=this.n43,I=this.n44;return e*m*v*D-d*s*v*D-e*l*B*D+b*s*B*D+d*l*z*D-b*m*z*D-e*m*o*E+d*s*o*E+e*g*B*E-a*s*B*E-d*g*z*E+a*m*z*E+e*l*o*H-b*s*o*H-e*g*v*H+a*s*v*H+b*g*z*H-a*l*z*H-d*l*o*I+b*m*o*I+d*g*v*I-a*m*v*I-b*g*B*I+a*l*B*I},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31; this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]= this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42; a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0, -0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),f=Math.sin(b),g= -1-d,l=a.x,m=a.y,s=a.z,o=g*l,v=g*m;this.set(o*l+d,o*m-f*s,o*s+f*m,0,o*m+f*s,v*m+d,v*s-f*l,0,o*s-f*m,v*s+f*l,g*s*s+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,f=a.z;a=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var l=Math.cos(f);f=Math.sin(f);var m=a*d,s=b*d;this.n11=g*l;this.n12=-g*f;this.n13=d;this.n21=s*l+a*f;this.n22=-s*f+a*l;this.n23=-b*g;this.n31=-m*l+b*f;this.n32=m*f+b*l;this.n33= -a*g;return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,f=a.z,g=a.w,l=b+b,m=d+d,s=f+f;a=b*l;var o=b*m;b*=s;var v=d*m;d*=s;f*=s;l*=g;m*=g;g*=s;this.n11=1-(v+f);this.n12=o-g;this.n13=b+m;this.n21=o+g;this.n22=1-(a+f);this.n23=d-l;this.n31=b-m;this.n32=d+l;this.n33=1-(a+v);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14= -a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var d=1/b.x,f=1/b.y,g=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*f;this.n22=a.n22*f;this.n32=a.n32*f;this.n13=a.n13*g;this.n23=a.n23*g;this.n33=a.n33*g}}; -THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,f=a.n12,g=a.n13,l=a.n14,m=a.n21,s=a.n22,o=a.n23,v=a.n24,B=a.n31,A=a.n32,D=a.n33,E=a.n34,H=a.n41,I=a.n42,L=a.n43,M=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=o*E*I-v*D*I+v*A*L-s*E*L-o*A*M+s*D*M;b.n12=l*D*I-g*E*I-l*A*L+f*E*L+g*A*M-f*D*M;b.n13=g*v*I-l*o*I+l*s*L-f*v*L-g*s*M+f*o*M;b.n14=l*o*A-g*v*A-l*s*D+f*v*D+g*s*E-f*o*E;b.n21=v*D*H-o*E*H-v*B*L+m*E*L+o*B*M-m*D*M;b.n22=g*E*H-l*D*H+l*B*L-d*E*L-g*B*M+d*D*M;b.n23=l*o*H-g*v*H-l*m*L+d*v*L+g*m*M-d*o*M; -b.n24=g*v*B-l*o*B+l*m*D-d*v*D-g*m*E+d*o*E;b.n31=s*E*H-v*A*H+v*B*I-m*E*I-s*B*M+m*A*M;b.n32=l*A*H-f*E*H-l*B*I+d*E*I+f*B*M-d*A*M;b.n33=g*v*H-l*s*H+l*m*I-d*v*I-f*m*M+d*s*M;b.n34=l*s*B-f*v*B-l*m*A+d*v*A+f*m*E-d*s*E;b.n41=o*A*H-s*D*H-o*B*I+m*D*I+s*B*L-m*A*L;b.n42=f*D*H-g*A*H+g*B*I-d*D*I-f*B*L+d*A*L;b.n43=g*s*H-f*o*H-g*m*I+d*o*I+f*m*L-d*s*L;b.n44=f*o*B-g*s*B+g*m*A-d*o*A-f*m*D+d*s*D;b.multiplyScalar(1/a.determinant());return b}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,f=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,l=a.n32*a.n21-a.n31*a.n22,m=-a.n33*a.n12+a.n32*a.n13,s=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,v=a.n23*a.n12-a.n22*a.n13,B=-a.n23*a.n11+a.n21*a.n13,A=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*m+a.n31*v;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*f;d[1]=a*g;d[2]=a*l;d[3]=a*m;d[4]=a*s;d[5]=a*o;d[6]=a*v;d[7]=a*B;d[8]=a*A;return b}; -THREE.Matrix4.makeFrustum=function(a,b,d,f,g,l){var m;m=new THREE.Matrix4;m.n11=2*g/(b-a);m.n12=0;m.n13=(b+a)/(b-a);m.n14=0;m.n21=0;m.n22=2*g/(f-d);m.n23=(f+d)/(f-d);m.n24=0;m.n31=0;m.n32=0;m.n33=-(l+g)/(l-g);m.n34=-2*l*g/(l-g);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,b,d,f){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,f)}; -THREE.Matrix4.makeOrtho=function(a,b,d,f,g,l){var m,s,o,v;m=new THREE.Matrix4;s=b-a;o=d-f;v=l-g;m.n11=2/s;m.n12=0;m.n13=0;m.n14=-((b+a)/s);m.n21=0;m.n22=2/o;m.n23=0;m.n24=-((d+f)/o);m.n31=0;m.n32=0;m.n33=-2/v;m.n34=-((l+g)/v);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; +0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),g= +1-d,l=a.x,m=a.y,s=a.z,o=g*l,v=g*m;this.set(o*l+d,o*m-e*s,o*s+e*m,0,o*m+e*s,v*m+d,v*s-e*l,0,o*s-e*m,v*s+e*l,g*s*s+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var l=Math.cos(e);e=Math.sin(e);var m=a*d,s=b*d;this.n11=g*l;this.n12=-g*e;this.n13=d;this.n21=s*l+a*e;this.n22=-s*e+a*l;this.n23=-b*g;this.n31=-m*l+b*e;this.n32=m*e+b*l;this.n33= +a*g;return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,g=a.w,l=b+b,m=d+d,s=e+e;a=b*l;var o=b*m;b*=s;var v=d*m;d*=s;e*=s;l*=g;m*=g;g*=s;this.n11=1-(v+e);this.n12=o-g;this.n13=b+m;this.n21=o+g;this.n22=1-(a+e);this.n23=d-l;this.n31=b-m;this.n32=d+l;this.n33=1-(a+v);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14= +a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var d=1/b.x,e=1/b.y,g=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*g;this.n23=a.n23*g;this.n33=a.n33*g}}; +THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,l=a.n14,m=a.n21,s=a.n22,o=a.n23,v=a.n24,B=a.n31,z=a.n32,D=a.n33,E=a.n34,H=a.n41,I=a.n42,L=a.n43,M=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=o*E*I-v*D*I+v*z*L-s*E*L-o*z*M+s*D*M;b.n12=l*D*I-g*E*I-l*z*L+e*E*L+g*z*M-e*D*M;b.n13=g*v*I-l*o*I+l*s*L-e*v*L-g*s*M+e*o*M;b.n14=l*o*z-g*v*z-l*s*D+e*v*D+g*s*E-e*o*E;b.n21=v*D*H-o*E*H-v*B*L+m*E*L+o*B*M-m*D*M;b.n22=g*E*H-l*D*H+l*B*L-d*E*L-g*B*M+d*D*M;b.n23=l*o*H-g*v*H-l*m*L+d*v*L+g*m*M-d*o*M; +b.n24=g*v*B-l*o*B+l*m*D-d*v*D-g*m*E+d*o*E;b.n31=s*E*H-v*z*H+v*B*I-m*E*I-s*B*M+m*z*M;b.n32=l*z*H-e*E*H-l*B*I+d*E*I+e*B*M-d*z*M;b.n33=g*v*H-l*s*H+l*m*I-d*v*I-e*m*M+d*s*M;b.n34=l*s*B-e*v*B-l*m*z+d*v*z+e*m*E-d*s*E;b.n41=o*z*H-s*D*H-o*B*I+m*D*I+s*B*L-m*z*L;b.n42=e*D*H-g*z*H+g*B*I-d*D*I-e*B*L+d*z*L;b.n43=g*s*H-e*o*H-g*m*I+d*o*I+e*m*L-d*s*L;b.n44=e*o*B-g*s*B+g*m*z-d*o*z-e*m*D+d*s*D;b.multiplyScalar(1/a.determinant());return b}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,l=a.n32*a.n21-a.n31*a.n22,m=-a.n33*a.n12+a.n32*a.n13,s=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,v=a.n23*a.n12-a.n22*a.n13,B=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*m+a.n31*v;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*l;d[3]=a*m;d[4]=a*s;d[5]=a*o;d[6]=a*v;d[7]=a*B;d[8]=a*z;return b}; +THREE.Matrix4.makeFrustum=function(a,b,d,e,g,l){var m;m=new THREE.Matrix4;m.n11=2*g/(b-a);m.n12=0;m.n13=(b+a)/(b-a);m.n14=0;m.n21=0;m.n22=2*g/(e-d);m.n23=(e+d)/(e-d);m.n24=0;m.n31=0;m.n32=0;m.n33=-(l+g)/(l-g);m.n34=-2*l*g/(l-g);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,b,d,e,g,l){var m,s,o,v;m=new THREE.Matrix4;s=b-a;o=d-e;v=l-g;m.n11=2/s;m.n12=0;m.n13=0;m.n14=-((b+a)/s);m.n21=0;m.n22=2/o;m.n23=0;m.n24=-((d+e)/o);m.n31=0;m.n32=0;m.n33=-2/v;m.n34=-((l+g)/v);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible= !0;this._vector=new THREE.Vector3}; THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!== undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!== -1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,d){if(this.visible){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var f=this.children.length;a< -f;a++)this.children[a].update(this.matrixWorld,b,d)}}};THREE.Quaternion=function(a,b,d,f){this.set(a||0,b||0,d||0,f!==undefined?f:1)}; -THREE.Quaternion.prototype={set:function(a,b,d,f){this.x=a;this.y=b;this.z=d;this.w=f;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,f=a.y*b,g=a.z*b;a=Math.cos(f);f=Math.sin(f);b=Math.cos(-g);g=Math.sin(-g);var l=Math.cos(d);d=Math.sin(d);var m=a*b,s=f*g;this.w=m*l-s*d;this.x=m*d+s*l;this.y=f*b*l+a*g*d;this.z=a*g*l-f*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*= --1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,f=this.z,g=this.w,l=a.x,m=a.y,s=a.z;a=a.w;this.x=b*a+g*l+d*s-f*m;this.y=d*a+g*m+f*l-b*s;this.z=f*a+g*s+b*m-d*l;this.w=g*a-b*l-d*m-f*s;return this}, -multiplyVector3:function(a,b){b||(b=a);var d=a.x,f=a.y,g=a.z,l=this.x,m=this.y,s=this.z,o=this.w,v=o*d+m*g-s*f,B=o*f+s*d-l*g,A=o*g+l*f-m*d;d=-l*d-m*f-s*g;b.x=v*o+d*-l+B*-s-A*-m;b.y=B*o+d*-m+A*-l-v*-s;b.z=A*o+d*-s+v*-m-B*-l;return b}}; -THREE.Quaternion.slerp=function(a,b,d,f){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var l=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-f)*l)/m;f=Math.sin(f*l)/m;d.w=a.w*g+b.w*f;d.x=a.x*g+b.x*f;d.y=a.y*g+b.y*f;d.z=a.z*g+b.z*f;return d}; +1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,d){if(this.visible){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a< +e;a++)this.children[a].update(this.matrixWorld,b,d)}}};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)}; +THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var l=Math.cos(d);d=Math.sin(d);var m=a*b,s=e*g;this.w=m*l-s*d;this.x=m*d+s*l;this.y=e*b*l+a*g*d;this.z=a*g*l-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*= +-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,g=this.w,l=a.x,m=a.y,s=a.z;a=a.w;this.x=b*a+g*l+d*s-e*m;this.y=d*a+g*m+e*l-b*s;this.z=e*a+g*s+b*m-d*l;this.w=g*a-b*l-d*m-e*s;return this}, +multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,g=a.z,l=this.x,m=this.y,s=this.z,o=this.w,v=o*d+m*g-s*e,B=o*e+s*d-l*g,z=o*g+l*e-m*d;d=-l*d-m*e-s*g;b.x=v*o+d*-l+B*-s-z*-m;b.y=B*o+d*-m+z*-l-v*-s;b.z=z*o+d*-s+v*-m-B*-l;return b}}; +THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var l=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*l)/m;e=Math.sin(e*l)/m;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0}; -THREE.Face3=function(a,b,d,f,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]};THREE.Face4=function(a,b,d,f,g,l){this.a=a;this.b=b;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=l instanceof Array?l:[l]}; +THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face4=function(a,b,d,e,g,l){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=l instanceof Array?l:[l]}; THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x], +d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,g,l,m,s=new THREE.Vector3,o=new THREE.Vector3;e=0;for(g=this.vertices.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 b=1,d=this.vertices.length;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z< this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b1){a=d.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible= -!1;this.LODs[f].object3D.visible=!0}else break;for(;f1){a=d.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e=this.LODs[e].visibleAtDistance){this.LODs[e-1].object3D.visible= +!1;this.LODs[e].object3D.visible=!0}else break;for(;e 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif", morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif", -default_vertex:"#ifndef USE_MORPHTARGETS || USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif"}; +default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif"}; THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f", value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f", value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}}; @@ -146,76 +146,76 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE. vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex, THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;", THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}}; -THREE.WebGLRenderer=function(a){function b(e,j,k){var h,i,r,n=e.vertices,q=n.length,x=e.colors,C=x.length,p=e.__vertexArray,F=e.__colorArray,N=e.__sortArray,K=e.__dirtyVertices,J=e.__dirtyColors;if(k.sortParticles){Ma.multiplySelf(k.matrixWorld);for(h=0;hk){n=x;k=q[n]}c.bindBuffer(c.ARRAY_BUFFER,i.__webGLMorphTargetsBuffers[n]);c.vertexAttribPointer(e["morphTarget"+ -p],3,c.FLOAT,!1,0,0);r.__webGLMorphTargetInfluences[p]=k;j[n]=1;k=-1;p++}c.uniform1fv(h.program.uniforms.morphTargetInfluences,r.__webGLMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,i.__webGLVertexBuffer);c.vertexAttribPointer(e.position,3,c.FLOAT,!1,0,0)}if(e.color>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLColorBuffer);c.vertexAttribPointer(e.color,3,c.FLOAT,!1,0,0)}if(e.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLNormalBuffer);c.vertexAttribPointer(e.normal,3,c.FLOAT,!1,0,0)}if(e.tangent>= -0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLTangentBuffer);c.vertexAttribPointer(e.tangent,4,c.FLOAT,!1,0,0)}if(e.uv>=0)if(i.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUVBuffer);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(e.uv)}else c.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(i.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUV2Buffer);c.vertexAttribPointer(e.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(e.uv2)}else c.disableVertexAttribArray(e.uv2); -if(h.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);c.vertexAttribPointer(e.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);c.vertexAttribPointer(e.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);c.vertexAttribPointer(e.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);c.vertexAttribPointer(e.skinWeight, -4,c.FLOAT,!1,0,0)}if(r instanceof THREE.Mesh)if(h.wireframe){c.lineWidth(h.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);c.drawElements(c.LINES,i.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,i.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(r instanceof THREE.Line){r=r.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(h.linewidth);c.drawArrays(r,0,i.__webGLLineCount)}else if(r instanceof -THREE.ParticleSystem)c.drawArrays(c.POINTS,0,i.__webGLParticleCount);else r instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,i.__webGLVertexCount)}}function l(e,j){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=c.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=c.createBuffer();if(e.hasPos){c.bindBuffer(c.ARRAY_BUFFER,e.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,e.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.position);c.vertexAttribPointer(j.attributes.position, -3,c.FLOAT,!1,0,0)}if(e.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,e.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,e.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.normal);c.vertexAttribPointer(j.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,e.count);e.count=0}function m(e){if(sa!=e.doubleSided){e.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);sa=e.doubleSided}if(ta!=e.flipSided){e.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);ta=e.flipSided}}function s(e){if(Fa!= -e){e?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Fa=e}}function o(e){ua[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);ua[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);ua[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);ua[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);ua[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);ua[5].set(e.n41+e.n31,e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var j;for(e=0;e<6;e++){j=ua[e];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z* -j.z))}}function v(e){for(var j=e.matrixWorld,k=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),h=0;h<6;h++){e=ua[h].x*j.n14+ua[h].y*j.n24+ua[h].z*j.n34+ua[h].w;if(e<=k)return!1}return!0}function B(e,j){e.list[e.count]=j;e.count+=1}function A(e){var j,k,h=e.object,i=e.opaque,r=e.transparent;r.count=0;e=i.count=0;for(j=h.materials.length;e65535){p[x].counter+=1;C=p[x].hash+"_"+p[x].counter;e.geometryGroups[C]==undefined&&(e.geometryGroups[C]={faces:[],materials:q,vertices:0,numMorphTargets:F})}e.geometryGroups[C].faces.push(i);e.geometryGroups[C].vertices+=n}}function L(e,j,k){e.push({buffer:j,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(e){if(e!=Ea){switch(e){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD); -c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}Ea=e}}function W(e,j,k){if((k.width&k.width-1)==0&&(k.height&k.height-1)==0){c.texParameteri(e,c.TEXTURE_WRAP_S, -aa(j.wrapS));c.texParameteri(e,c.TEXTURE_WRAP_T,aa(j.wrapT));c.texParameteri(e,c.TEXTURE_MAG_FILTER,aa(j.magFilter));c.texParameteri(e,c.TEXTURE_MIN_FILTER,aa(j.minFilter));c.generateMipmap(e)}else{c.texParameteri(e,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(e,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(e,c.TEXTURE_MAG_FILTER,ea(j.magFilter));c.texParameteri(e,c.TEXTURE_MIN_FILTER,ea(j.minFilter))}}function $(e){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=c.createFramebuffer(); -e.__webGLRenderbuffer=c.createRenderbuffer();e.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,e.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,e.width,e.height);c.bindTexture(c.TEXTURE_2D,e.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,aa(e.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,aa(e.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,aa(e.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,aa(e.minFilter)); -c.texImage2D(c.TEXTURE_2D,0,aa(e.format),e.width,e.height,0,aa(e.format),aa(e.type),null);c.bindFramebuffer(c.FRAMEBUFFER,e.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,e.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,e.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var j,k;if(e){j=e.__webGLFramebuffer;k=e.width;e=e.height}else{j= -null;k=Ka;e=La}if(j!=pa){c.bindFramebuffer(c.FRAMEBUFFER,j);c.viewport(Aa,Ja,k,e);pa=j}}function ia(e,j){var k;if(e=="fragment")k=c.createShader(c.FRAGMENT_SHADER);else e=="vertex"&&(k=c.createShader(c.VERTEX_SHADER));c.shaderSource(k,j);c.compileShader(k);if(!c.getShaderParameter(k,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(k));return null}return k}function ea(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}} -function aa(e){switch(e){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 ja=document.createElement("canvas"),c,ra=null,pa=null,ya=this,sa=null,ta=null,Ea=null,Fa=null,Aa=0,Ja=0,Ka=0,La=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ma=new THREE.Matrix4,Xa=new Float32Array(16),Pa=new Float32Array(16),Ga=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Za=!0,$a=new THREE.Color(0),ab=0;if(a){if(a.antialias!==undefined)Za=a.antialias; -a.clearColor!==undefined&&$a.setHex(a.clearColor);if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=ja;this.autoClear=!0;this.sortObjects=!0;(function(e,j,k){try{if(!(c=ja.getContext("experimental-webgl",{antialias:e})))throw"Error creating WebGL context.";}catch(h){console.error(h)}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.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA); -c.clearColor(j.r,j.g,j.b,k);_cullEnabled=!0})(Za,$a,ab);this.context=c;this.setSize=function(e,j){ja.width=e;ja.height=j;this.setViewport(0,0,ja.width,ja.height)};this.setViewport=function(e,j,k,h){Aa=e;Ja=j;Ka=k;La=h;c.viewport(Aa,Ja,Ka,La)};this.setScissor=function(e,j,k,h){c.scissor(e,j,k,h)};this.enableScissorTest=function(e){e?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(e){c.depthMask(e)};this.setClearColorHex=function(e,j){var k=new THREE.Color(e); -c.clearColor(k.r,k.g,k.b,j)};this.setClearColor=function(e,j){c.clearColor(e.r,e.g,e.b,j)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(e,j,k,h){var i,r,n;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.MeshNormalMaterial)d(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)d(e,THREE.ShaderLib.lambert);else if(e instanceof -THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);var q,x,C,p;n=C=p=0;for(q=j.length;n0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,"#define MAX_BONES "+q.maxBones,q.map?"#define USE_MAP":"",q.envMap?"#define USE_ENVMAP":"",q.lightMap?"#define USE_LIGHTMAP":"",q.vertexColors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING": -"",q.morphTargets?"#define USE_MORPHTARGETS":"",q.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); -c.attachShader(k,ia("fragment",n+p));c.attachShader(k,ia("vertex",q+j));c.linkProgram(k);c.getProgramParameter(k,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(k,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");k.uniforms={};k.attributes={};e.program=k;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(i in e.uniforms)k.push(i); -i=e.program;p=0;for(j=k.length;p=0&&c.enableVertexAttribArray(r.color);r.normal>=0&&c.enableVertexAttribArray(r.normal); -r.tangent>=0&&c.enableVertexAttribArray(r.tangent);if(e.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){c.enableVertexAttribArray(r.skinVertexA);c.enableVertexAttribArray(r.skinVertexB);c.enableVertexAttribArray(r.skinIndex);c.enableVertexAttribArray(r.skinWeight)}if(e.morphTargets){e.numSupportedMorphTargets=0;if(r.morphTarget0>=0){c.enableVertexAttribArray(r.morphTarget0);e.numSupportedMorphTargets++}if(r.morphTarget1>=0){c.enableVertexAttribArray(r.morphTarget1); -e.numSupportedMorphTargets++}if(r.morphTarget2>=0){c.enableVertexAttribArray(r.morphTarget2);e.numSupportedMorphTargets++}if(r.morphTarget3>=0){c.enableVertexAttribArray(r.morphTarget3);e.numSupportedMorphTargets++}if(r.morphTarget4>=0){c.enableVertexAttribArray(r.morphTarget4);e.numSupportedMorphTargets++}if(r.morphTarget5>=0){c.enableVertexAttribArray(r.morphTarget5);e.numSupportedMorphTargets++}if(r.morphTarget6>=0){c.enableVertexAttribArray(r.morphTarget6);e.numSupportedMorphTargets++}if(r.morphTarget7>= -0){c.enableVertexAttribArray(r.morphTarget7);e.numSupportedMorphTargets++}h.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(i=0;iA){C=p;A=q[C]}c.bindBuffer(c.ARRAY_BUFFER,i.__webGLMorphTargetsBuffers[C]);c.vertexAttribPointer(j["morphTarget"+k],3,c.FLOAT,!1,0,0);r.__webGLMorphTargetInfluences[k]=A;n[C]=1;A=-1;k++}}c.uniform1fv(h.program.uniforms.morphTargetInfluences, +r.__webGLMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,i.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(i.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER, +i.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(h.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA, +4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(r instanceof THREE.Mesh)if(h.wireframe){c.lineWidth(h.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);c.drawElements(c.LINES, +i.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,i.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(r instanceof THREE.Line){r=r.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(h.linewidth);c.drawArrays(r,0,i.__webGLLineCount)}else if(r instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,i.__webGLParticleCount);else r instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,i.__webGLVertexCount)}}function l(f,j){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer= +c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.position);c.vertexAttribPointer(j.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.normal);c.vertexAttribPointer(j.attributes.normal, +3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function m(f){if(sa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);sa=f.doubleSided}if(ta!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);ta=f.flipSided}}function s(f){if(Fa!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Fa=f}}function o(f){ua[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);ua[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);ua[2].set(f.n41+f.n21,f.n42+f.n22, +f.n43+f.n23,f.n44+f.n24);ua[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);ua[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);ua[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var j;for(f=0;f<6;f++){j=ua[f];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function v(f){for(var j=f.matrixWorld,k=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),h=0;h<6;h++){f=ua[h].x*j.n14+ua[h].y*j.n24+ua[h].z*j.n34+ua[h].w;if(f<=k)return!1}return!0}function B(f, +j){f.list[f.count]=j;f.count+=1}function z(f){var j,k,h=f.object,i=f.opaque,r=f.transparent;r.count=0;f=i.count=0;for(j=h.materials.length;f65535){p[A].counter+=1;C=p[A].hash+"_"+p[A].counter;f.geometryGroups[C]==undefined&&(f.geometryGroups[C]= +{faces:[],materials:q,vertices:0,numMorphTargets:F})}f.geometryGroups[C].faces.push(i);f.geometryGroups[C].vertices+=n}}function L(f,j,k){f.push({buffer:j,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(f){if(f!=Ea){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA); +break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}Ea=f}}function W(f,j,k){if((k.width&k.width-1)==0&&(k.height&k.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,aa(j.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,aa(j.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,aa(j.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,aa(j.minFilter));c.generateMipmap(f)}else{c.texParameteri(f, +c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,ea(j.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ea(j.minFilter))}}function $(f){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.bindTexture(c.TEXTURE_2D, +f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,aa(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,aa(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,aa(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,aa(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,aa(f.format),f.width,f.height,0,aa(f.format),aa(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webGLTexture, +0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var j,k;if(f){j=f.__webGLFramebuffer;k=f.width;f=f.height}else{j=null;k=Ka;f=La}if(j!=pa){c.bindFramebuffer(c.FRAMEBUFFER,j);c.viewport(Aa,Ja,k,f);pa=j}}function ia(f,j){var k;if(f=="fragment")k=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(k=c.createShader(c.VERTEX_SHADER));c.shaderSource(k, +j);c.compileShader(k);if(!c.getShaderParameter(k,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(k));return null}return k}function ea(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function aa(f){switch(f){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 ja=document.createElement("canvas"),c,ra=null,pa=null,ya=this,sa=null,ta=null,Ea=null,Fa=null,Aa=0,Ja=0,Ka=0,La=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, +new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ma=new THREE.Matrix4,Xa=new Float32Array(16),Pa=new Float32Array(16),Ga=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Za=!0,$a=new THREE.Color(0),ab=0;if(a){if(a.antialias!==undefined)Za=a.antialias;a.clearColor!==undefined&&$a.setHex(a.clearColor);if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=ja;this.autoClear=!0;this.sortObjects= +!0;(function(f,j,k){try{if(!(c=ja.getContext("experimental-webgl",{antialias:f})))throw"Error creating WebGL context.";}catch(h){console.error(h)}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.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(j.r,j.g,j.b,k);_cullEnabled=!0})(Za,$a,ab);this.context=c;this.setSize=function(f,j){ja.width=f;ja.height=j;this.setViewport(0,0,ja.width,ja.height)}; +this.setViewport=function(f,j,k,h){Aa=f;Ja=j;Ka=k;La=h;c.viewport(Aa,Ja,Ka,La)};this.setScissor=function(f,j,k,h){c.scissor(f,j,k,h)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){c.depthMask(f)};this.setClearColorHex=function(f,j){var k=new THREE.Color(f);c.clearColor(k.r,k.g,k.b,j)};this.setClearColor=function(f,j){c.clearColor(f.r,f.g,f.b,j)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)}; +this.initMaterial=function(f,j,k,h){var i,r,n;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&& +d(f,THREE.ShaderLib.particle_basic);var q,A,C,p;n=C=p=0;for(q=j.length;n0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,"#define MAX_BONES "+q.maxBones,q.map?"#define USE_MAP":"",q.envMap?"#define USE_ENVMAP":"",q.lightMap?"#define USE_LIGHTMAP":"",q.vertexColors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"",q.morphTargets?"#define USE_MORPHTARGETS":"",q.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); +c.attachShader(k,ia("fragment",n+p));c.attachShader(k,ia("vertex",q+j));c.linkProgram(k);c.getProgramParameter(k,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(k,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");k.uniforms={};k.attributes={};f.program=k;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(i in f.uniforms)k.push(i); +i=f.program;p=0;for(j=k.length;p=0&&c.enableVertexAttribArray(r.color);r.normal>=0&&c.enableVertexAttribArray(r.normal); +r.tangent>=0&&c.enableVertexAttribArray(r.tangent);if(f.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){c.enableVertexAttribArray(r.skinVertexA);c.enableVertexAttribArray(r.skinVertexB);c.enableVertexAttribArray(r.skinIndex);c.enableVertexAttribArray(r.skinWeight)}if(f.morphTargets){f.numSupportedMorphTargets=0;if(r.morphTarget0>=0){c.enableVertexAttribArray(r.morphTarget0);f.numSupportedMorphTargets++}if(r.morphTarget1>=0){c.enableVertexAttribArray(r.morphTarget1); +f.numSupportedMorphTargets++}if(r.morphTarget2>=0){c.enableVertexAttribArray(r.morphTarget2);f.numSupportedMorphTargets++}if(r.morphTarget3>=0){c.enableVertexAttribArray(r.morphTarget3);f.numSupportedMorphTargets++}if(r.morphTarget4>=0){c.enableVertexAttribArray(r.morphTarget4);f.numSupportedMorphTargets++}if(r.morphTarget5>=0){c.enableVertexAttribArray(r.morphTarget5);f.numSupportedMorphTargets++}if(r.morphTarget6>=0){c.enableVertexAttribArray(r.morphTarget6);f.numSupportedMorphTargets++}if(r.morphTarget7>= +0){c.enableVertexAttribArray(r.morphTarget7);f.numSupportedMorphTargets++}h.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(i=0;i=0;i--){h=k.__webglObjects[i].object;j==h&& -k.__webglObjects.splice(i,1)}e.__objectsRemoved.splice(0,1)}j=0;for(k=e.__webglObjects.length;j=0;i--){h=k.__webglObjects[i].object;j==h&& +k.__webglObjects.splice(i,1)}f.__objectsRemoved.splice(0,1)}j=0;for(k=f.__webglObjects.length;j0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Na,q)}if(Ia&&K>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER, Oa,q)}if(Sa){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,va,q);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ma,q)}if(t>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,S,q);c.bindBuffer(c.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,T,q);c.bindBuffer(c.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,U,q);c.bindBuffer(c.ARRAY_BUFFER, -n.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,V,q)}}}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){i=h.geometry;if(i.__dirtyVertices||i.__dirtyColors){h=i;r=c.DYNAMIC_DRAW;p=void 0;p=void 0;F=void 0;n=void 0;C=h.vertices;q=h.colors;K=C.length;x=q.length;J=h.__vertexArray;N=h.__colorArray;Q=h.__dirtyColors;if(h.__dirtyVertices){for(p=0;p0}}; +n.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,V,q)}}}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){i=h.geometry;if(i.__dirtyVertices||i.__dirtyColors){h=i;r=c.DYNAMIC_DRAW;p=void 0;p=void 0;F=void 0;n=void 0;C=h.vertices;q=h.colors;K=C.length;A=q.length;J=h.__vertexArray;N=h.__colorArray;Q=h.__dirtyColors;if(h.__dirtyVertices){for(p=0;p0}}; diff --git a/src/materials/MeshShaderMaterial.js b/src/materials/MeshShaderMaterial.js index aea33d4b3008bcb499e9d30f069620a1ceba9aea..2d5eb3b17e0c47ed3890af47b9f2d53a683c0ced 100644 --- a/src/materials/MeshShaderMaterial.js +++ b/src/materials/MeshShaderMaterial.js @@ -14,8 +14,10 @@ * wireframe: , * wireframeLinewidth: , + * lights: , * vertexColors: , - * skinning: + * skinning: , + * morphTargets: , * } */ @@ -36,11 +38,12 @@ THREE.MeshShaderMaterial = function ( parameters ) { this.wireframe = false; this.wireframeLinewidth = 1.0; this.wireframeLinecap = 'round'; // doesn't make sense here - this.wireframeLinejoin = 'round'; // not implemented in WebGLRenderer (and this material doesn't make sense in CanvasRenderer) + this.wireframeLinejoin = 'round'; // not implemented in WebGLRenderer (and this material doesn't make sense in CanvasRenderer) - this.vertexColors = false; // must set this if shader wants to use "color" attribute stream - this.skinning = false; // must set this is shader wants to use skinning attribute streams - this.morphTargets = false; + this.lights = false; // set to use scene lights + this.vertexColors = false; // set to use "color" attribute stream + this.skinning = false; // set to use skinning attribute streams + this.morphTargets = false; // set to use morph targets if ( parameters ) { @@ -60,6 +63,7 @@ THREE.MeshShaderMaterial = function ( parameters ) { if ( parameters.wireframeLinecap !== undefined ) this.wireframeLinecap = parameters.wireframeLinecap; if ( parameters.wireframeLinejoin !== undefined ) this.wireframeLinejoin = parameters.wireframeLinejoin; + if ( parameters.lights !== undefined ) this.lights = parameters.lights; if ( parameters.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors; if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning; if ( parameters.morphTargets !== undefined ) this.morphTargets = parameters.morphTargets; diff --git a/src/objects/Mesh.js b/src/objects/Mesh.js index 2599f2984a2e8b67635fbbaaabbdf90ab5358fef..79b2649ce083153cef64b84cb5212ac1dbcecf8a 100644 --- a/src/objects/Mesh.js +++ b/src/objects/Mesh.js @@ -35,6 +35,7 @@ THREE.Mesh = function ( geometry, materials ) { if( this.geometry.morphTargets.length ) { this.morphTargetBase = -1; + this.morphTargetForcedOrder = []; this.morphTargetInfluences = []; this.morphTargetDictionary = {}; @@ -42,6 +43,7 @@ THREE.Mesh = function ( geometry, materials ) { this.morphTargetInfluences.push( 0 ); this.morphTargetDictionary[ this.geometry.morphTargets[ m ].name ] = m; + } } diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 290880a86f400cb89d0c22d35e57766676d5af93..a3efaa1e53568835d223460d40e2e732cef98f98 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -1610,7 +1610,8 @@ THREE.WebGLRenderer = function ( parameters ) { } if ( material instanceof THREE.MeshPhongMaterial || - material instanceof THREE.MeshLambertMaterial ) { + material instanceof THREE.MeshLambertMaterial || + material.lights ) { setupLights( program, lights ); refreshUniformsLights( m_uniforms, _lights ); @@ -1648,7 +1649,6 @@ THREE.WebGLRenderer = function ( parameters ) { } else if ( material instanceof THREE.MeshNormalMaterial ) { m_uniforms.opacity.value = material.opacity; - } // load common uniforms @@ -1712,65 +1712,11 @@ THREE.WebGLRenderer = function ( parameters ) { _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); } else { + + setupMorphTargets( material, geometryGroup, object ); - // set base - - if( object.morphTargetBase !== -1 ) { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLMorphTargetsBuffers[ object.morphTargetBase ] ); - _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } else { - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLVertexBuffer ); - _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); - - } - - - // find most influencing - - var used = []; - var candidateInfluence = -1; - var candidate = 0; - var influences = object.morphTargetInfluences; - var i, il = influences.length; - var m = 0; - - if( object.morphTargetBase !== -1 ) { - - used[ object.morphTargetBase ] = true; - - } - - while( m < material.numSupportedMorphTargets ) { - - for( i = 0; i < il; i++ ) { - - if( !used[ i ] && influences[ i ] > candidateInfluence ) { - - candidate = i; - candidateInfluence = influences[ candidate ]; - } - } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLMorphTargetsBuffers[ candidate ] ); - _gl.vertexAttribPointer( attributes[ "morphTarget" + m ], 3, _gl.FLOAT, false, 0, 0 ); - - object.__webGLMorphTargetInfluences[ m ] = candidateInfluence; - - used[ candidate ] = 1; - candidateInfluence = -1; - m++; - } - - - // load updated influences uniform - - _gl.uniform1fv( material.program.uniforms.morphTargetInfluences, object.__webGLMorphTargetInfluences ); } - // colors if ( attributes.color >= 0 ) { @@ -1870,7 +1816,6 @@ THREE.WebGLRenderer = function ( parameters ) { _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webGLFaceBuffer ); _gl.drawElements( _gl.TRIANGLES, geometryGroup.__webGLFaceCount, _gl.UNSIGNED_SHORT, 0 ); - } // render lines @@ -1898,6 +1843,90 @@ THREE.WebGLRenderer = function ( parameters ) { }; + + function setupMorphTargets( material, geometryGroup, object ) { + + // set base + + var attributes = material.program.attributes; + + if( object.morphTargetBase !== -1 ) { + + _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLMorphTargetsBuffers[ object.morphTargetBase ] ); + _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); + + } else { + + _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLVertexBuffer ); + _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); + + } + + + if( object.morphTargetForcedOrder.length ) { + + // set forced order + + var m = 0; + var order = object.morphTargetForcedOrder; + var influences = object.morphTargetInfluences; + + while( m < material.numSupportedMorphTargets && m < order.length ) { + + _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLMorphTargetsBuffers[ order[ m ] ] ); + _gl.vertexAttribPointer( attributes[ "morphTarget" + m ], 3, _gl.FLOAT, false, 0, 0 ); + + object.__webGLMorphTargetInfluences[ m ] = influences[ order[ m ]]; + + m++; + } + + } else { + + // find most influencing + + var used = []; + var candidateInfluence = -1; + var candidate = 0; + var influences = object.morphTargetInfluences; + var i, il = influences.length; + var m = 0; + + if( object.morphTargetBase !== -1 ) { + + used[ object.morphTargetBase ] = true; + + } + + while( m < material.numSupportedMorphTargets ) { + + for( i = 0; i < il; i++ ) { + + if( !used[ i ] && influences[ i ] > candidateInfluence ) { + + candidate = i; + candidateInfluence = influences[ candidate ]; + } + } + + _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLMorphTargetsBuffers[ candidate ] ); + _gl.vertexAttribPointer( attributes[ "morphTarget" + m ], 3, _gl.FLOAT, false, 0, 0 ); + + object.__webGLMorphTargetInfluences[ m ] = candidateInfluence; + + used[ candidate ] = 1; + candidateInfluence = -1; + m++; + } + } + + + // load updated influences uniform + + _gl.uniform1fv( material.program.uniforms.morphTargetInfluences, object.__webGLMorphTargetInfluences ); + } + + function renderBufferImmediate ( object, program ) { if ( ! object.__webGLVertexBuffer ) object.__webGLVertexBuffer = _gl.createBuffer(); @@ -3408,5 +3437,5 @@ THREE.WebGLRenderer = function ( parameters ) { return str; } */ +}; -}; \ No newline at end of file diff --git a/src/renderers/WebGLShaders.js b/src/renderers/WebGLShaders.js index a4dfb38614f84fb2081a756da1bf4bce8b74d2db..42dcc3edd17af8d6276f934f602b0269d9f3b367 100644 --- a/src/renderers/WebGLShaders.js +++ b/src/renderers/WebGLShaders.js @@ -488,10 +488,12 @@ THREE.ShaderChunk = { default_vertex : [ - "#ifndef USE_MORPHTARGETS || USE_SKINNING", + "#ifndef USE_MORPHTARGETS", + "#ifndef USE_SKINNING", "gl_Position = projectionMatrix * mvPosition;", + "#endif", "#endif" ].join("\n")