diff --git a/build/Three.js b/build/Three.js index 49be7c5c..43123dda 100644 --- a/build/Three.js +++ b/build/Three.js @@ -16,34 +16,34 @@ b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;thi normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c0&&b>0&&j+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x, -Math.max(b.scale.y,b.scale.z)))return[];var h,k,j,m,p,o,t,v,w,u,y=b.geometry,x=y.vertices,B=[],f=0;for(h=y.faces.length;f0:v<0)))if(v=t.dot((new THREE.Vector3).sub(j,w))/v,w=w.addSelf(u.multiplyScalar(v)),k instanceof THREE.Face3)e(w,j,m,p)&&(k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},B.push(k));else if(k instanceof THREE.Face4&&(e(w,j,m,o)||e(w,m,p,o)))k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},B.push(k);B.sort(function(b,e){return b.distance-e.distance});return B}else return[]}}; -THREE.Rectangle=function(){function b(){k=f-c;j=h-e}var c,e,f,h,k,j,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(j,k,t,v){m=!1;c=j;e=k;f=t;h=v;b()};this.addPoint=function(j,k){m?(m=!1,c=j,e=k,f=j,h=k):(c=cj?f:j,h=h>k?h:k);b()};this.add3Points= -function(j,k,t,v,w,u){m?(m=!1,c=jt?j>w?j:w:t>w?t:w,h=k>v?k>u?k:u:v>u?v:u):(c=jt?j>w?j>f?j:f:w>f?w:f:t>w?t>f?t:f:w>f?w:f,h=k>v?k>u?k>h?k:h:u>h?u:h:v>u?v>h?v:h:u>h?u:h);b()};this.addRectangle=function(j){m?(m=!1,c=j.getLeft(),e=j.getTop(),f=j.getRight(),h=j.getBottom()):(c=cj.getRight()?f:j.getRight(),h=h> +Math.max(b.scale.y,b.scale.z)))return[];var h,k,j,m,p,o,t,u,w,v,y=b.geometry,x=y.vertices,B=[],f=0;for(h=y.faces.length;f0:u<0)))if(u=t.dot((new THREE.Vector3).sub(j,w))/u,w=w.addSelf(v.multiplyScalar(u)),k instanceof THREE.Face3)e(w,j,m,p)&&(k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},B.push(k));else if(k instanceof THREE.Face4&&(e(w,j,m,o)||e(w,m,p,o)))k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},B.push(k);B.sort(function(b,e){return b.distance-e.distance});return B}else return[]}}; +THREE.Rectangle=function(){function b(){k=f-c;j=h-e}var c,e,f,h,k,j,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(j,k,t,u){m=!1;c=j;e=k;f=t;h=u;b()};this.addPoint=function(j,k){m?(m=!1,c=j,e=k,f=j,h=k):(c=cj?f:j,h=h>k?h:k);b()};this.add3Points= +function(j,k,t,u,w,v){m?(m=!1,c=jt?j>w?j:w:t>w?t:w,h=k>u?k>v?k:v:u>v?u:v):(c=jt?j>w?j>f?j:f:w>f?w:f:t>w?t>f?t:f:w>f?w:f,h=k>u?k>v?k>h?k:h:v>h?v:h:u>v?u>h?u:h:v>h?v:h);b()};this.addRectangle=function(j){m?(m=!1,c=j.getLeft(),e=j.getTop(),f=j.getRight(),h=j.getBottom()):(c=cj.getRight()?f:j.getRight(),h=h> j.getBottom()?h:j.getBottom());b()};this.inflate=function(j){c-=j;e-=j;f+=j;h+=j;b()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();e=e>j.getTop()?e:j.getTop();f=f=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;h=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,h,k,j,m,p,o,t,v,w,u,y,x){this.set(b||1,c||0,e||0,f||0,h||0,k||1,j||0,m||0,p||0,o||0,t||1,v||0,w||0,u||0,y||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,j,m,p,o,t,v,w,u,y,x){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=j;this.n24=m;this.n31=p;this.n32=o;this.n33=t;this.n34=v;this.n41=w;this.n42=u;this.n43=y;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, +THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,h,k,j,m,p,o,t,u,w,v,y,x){this.set(b||1,c||0,e||0,f||0,h||0,k||1,j||0,m||0,p||0,o||0,t||1,u||0,w||0,v||0,y||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,j,m,p,o,t,u,w,v,y,x){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=j;this.n24=m;this.n31=p;this.n32=o;this.n33=t;this.n34=u;this.n41=w;this.n42=v;this.n43=y;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h; b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+ -e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,j=b.n21,m=b.n22,p=b.n23,o=b.n24,t=b.n31,v=b.n32,w=b.n33,u=b.n34,y=b.n41,x=b.n42,B=b.n43,z=b.n44,D=c.n11,C=c.n12, -E=c.n13,J=c.n14,O=c.n21,K=c.n22,I=c.n23,F=c.n24,Y=c.n31,G=c.n32,M=c.n33,L=c.n34,S=c.n41,n=c.n42,V=c.n43,fa=c.n44;this.n11=e*D+f*O+h*Y+k*S;this.n12=e*C+f*K+h*G+k*n;this.n13=e*E+f*I+h*M+k*V;this.n14=e*J+f*F+h*L+k*fa;this.n21=j*D+m*O+p*Y+o*S;this.n22=j*C+m*K+p*G+o*n;this.n23=j*E+m*I+p*M+o*V;this.n24=j*J+m*F+p*L+o*fa;this.n31=t*D+v*O+w*Y+u*S;this.n32=t*C+v*K+w*G+u*n;this.n33=t*E+v*I+w*M+u*V;this.n34=t*J+v*F+w*L+u*fa;this.n41=y*D+x*O+B*Y+z*S;this.n42=y*C+x*K+B*G+z*n;this.n43=y*E+x*I+B*M+z*V;this.n44=y* -J+x*F+B*L+z*fa;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*= -b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,j=this.n23,m=this.n24,p=this.n31,o=this.n32,t=this.n33,v=this.n34,w=this.n41,u=this.n42,y=this.n43,x=this.n44;return f*j*o*w-e*m*o*w-f*k*t*w+c*m*t*w+e*k*v*w-c*j*v*w-f*j*p*u+e*m*p*u+f*h*t*u-b*m*t*u-e*h*v*u+b*j*v*u+f*k*p*y-c*m*p*y-f*h*o*y+b*m*o*y+c*h*v*y-b*k*v*y-e*k*p*x+c*j*p*x+e*h*o*x-b*j*o*x-c*h* +e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,j=b.n21,m=b.n22,p=b.n23,o=b.n24,t=b.n31,u=b.n32,w=b.n33,v=b.n34,y=b.n41,x=b.n42,B=b.n43,z=b.n44,D=c.n11,C=c.n12, +E=c.n13,J=c.n14,O=c.n21,K=c.n22,H=c.n23,F=c.n24,T=c.n31,G=c.n32,M=c.n33,L=c.n34,P=c.n41,n=c.n42,X=c.n43,la=c.n44;this.n11=e*D+f*O+h*T+k*P;this.n12=e*C+f*K+h*G+k*n;this.n13=e*E+f*H+h*M+k*X;this.n14=e*J+f*F+h*L+k*la;this.n21=j*D+m*O+p*T+o*P;this.n22=j*C+m*K+p*G+o*n;this.n23=j*E+m*H+p*M+o*X;this.n24=j*J+m*F+p*L+o*la;this.n31=t*D+u*O+w*T+v*P;this.n32=t*C+u*K+w*G+v*n;this.n33=t*E+u*H+w*M+v*X;this.n34=t*J+u*F+w*L+v*la;this.n41=y*D+x*O+B*T+z*P;this.n42=y*C+x*K+B*G+z*n;this.n43=y*E+x*H+B*M+z*X;this.n44=y* +J+x*F+B*L+z*la;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*= +b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,j=this.n23,m=this.n24,p=this.n31,o=this.n32,t=this.n33,u=this.n34,w=this.n41,v=this.n42,y=this.n43,x=this.n44;return f*j*o*w-e*m*o*w-f*k*t*w+c*m*t*w+e*k*u*w-c*j*u*w-f*j*p*v+e*m*p*v+f*h*t*v-b*m*t*v-e*h*u*v+b*j*u*v+f*k*p*y-c*m*p*y-f*h*o*y+b*m*o*y+c*h*u*y-b*k*u*y-e*k*p*x+c*j*p*x+e*h*o*x-b*j*o*x-c*h* t*x+b*k*t*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34= this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]= this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]= this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0, 0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,k=b.x,j=b.y,m=b.z,p=h*k,o=h*j;this.set(p*k+e,p*j-f*m,p*m+f*j,0,p*j+f*m,o*j+e,o*m-f*k,0,p*m-f*j,o*m+f*k,h*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,h=b.z,k=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f),m=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var p= -j*m,o=j*h,t=f*m,v=f*h;this.n11=p+v*e;this.n12=t*e-o;this.n13=k*f;this.n21=k*h;this.n22=k*m;this.n23=-e;this.n31=o*e-t;this.n32=v+p*e;this.n33=k*j;break;case "ZXY":p=j*m;o=j*h;t=f*m;v=f*h;this.n11=p-v*e;this.n12=-k*h;this.n13=t+o*e;this.n21=o+t*e;this.n22=k*m;this.n23=v-p*e;this.n31=-k*f;this.n32=e;this.n33=k*j;break;case "ZYX":p=k*m;o=k*h;t=e*m;v=e*h;this.n11=j*m;this.n12=t*f-o;this.n13=p*f+v;this.n21=j*h;this.n22=v*f+p;this.n23=o*f-t;this.n31=-f;this.n32=e*j;this.n33=k*j;break;case "YZX":p=k*j;o= -k*f;t=e*j;v=e*f;this.n11=j*m;this.n12=v-p*h;this.n13=t*h+o;this.n21=h;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=o*h+t;this.n33=p-v*h;break;case "XZY":p=k*j;o=k*f;t=e*j;v=e*f;this.n11=j*m;this.n12=-h;this.n13=f*m;this.n21=p*h+v;this.n22=k*m;this.n23=o*h-t;this.n31=t*h-o;this.n32=e*m;this.n33=v*h+p;break;default:p=k*m,o=k*h,t=e*m,v=e*h,this.n11=j*m,this.n12=-j*h,this.n13=f,this.n21=o+t*f,this.n22=p-v*f,this.n23=-e*j,this.n31=v-p*f,this.n32=t+o*f,this.n33=k*j}return this},setRotationFromQuaternion:function(b){var c= +j*m,o=j*h,t=f*m,u=f*h;this.n11=p+u*e;this.n12=t*e-o;this.n13=k*f;this.n21=k*h;this.n22=k*m;this.n23=-e;this.n31=o*e-t;this.n32=u+p*e;this.n33=k*j;break;case "ZXY":p=j*m;o=j*h;t=f*m;u=f*h;this.n11=p-u*e;this.n12=-k*h;this.n13=t+o*e;this.n21=o+t*e;this.n22=k*m;this.n23=u-p*e;this.n31=-k*f;this.n32=e;this.n33=k*j;break;case "ZYX":p=k*m;o=k*h;t=e*m;u=e*h;this.n11=j*m;this.n12=t*f-o;this.n13=p*f+u;this.n21=j*h;this.n22=u*f+p;this.n23=o*f-t;this.n31=-f;this.n32=e*j;this.n33=k*j;break;case "YZX":p=k*j;o= +k*f;t=e*j;u=e*f;this.n11=j*m;this.n12=u-p*h;this.n13=t*h+o;this.n21=h;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=o*h+t;this.n33=p-u*h;break;case "XZY":p=k*j;o=k*f;t=e*j;u=e*f;this.n11=j*m;this.n12=-h;this.n13=f*m;this.n21=p*h+u;this.n22=k*m;this.n23=o*h-t;this.n31=t*h-o;this.n32=e*m;this.n33=u*h+p;break;default:p=k*m,o=k*h,t=e*m,u=e*h,this.n11=j*m,this.n12=-j*h,this.n13=f,this.n21=o+t*f,this.n22=p-u*f,this.n23=-e*j,this.n31=u-p*f,this.n32=t+o*f,this.n33=k*j}return this},setRotationFromQuaternion:function(b){var c= b.x,e=b.y,f=b.z,h=b.w,k=c+c,j=e+e,m=f+f,b=c*k,p=c*j;c*=m;var o=e*j;e*=m;f*=m;k*=h;j*=h;h*=m;this.n11=1-(o+f);this.n12=p-h;this.n13=c+j;this.n21=p+h;this.n22=1-(b+f);this.n23=e-k;this.n31=c-j;this.n32=e+k;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2; f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);k.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); e.y=h.length();e.z=k.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23= b.n23*h;this.n33=b.n33*h}}; -THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,j=b.n21,m=b.n22,p=b.n23,o=b.n24,t=b.n31,v=b.n32,w=b.n33,u=b.n34,y=b.n41,x=b.n42,B=b.n43,z=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*u*x-o*w*x+o*v*B-m*u*B-p*v*z+m*w*z;c.n12=k*w*x-h*u*x-k*v*B+f*u*B+h*v*z-f*w*z;c.n13=h*o*x-k*p*x+k*m*B-f*o*B-h*m*z+f*p*z;c.n14=k*p*v-h*o*v-k*m*w+f*o*w+h*m*u-f*p*u;c.n21=o*w*y-p*u*y-o*t*B+j*u*B+p*t*z-j*w*z;c.n22=h*u*y-k*w*y+k*t*B-e*u*B-h*t*z+e*w*z;c.n23=k*p*y-h*o*y-k*j*B+e*o*B+h*j*z-e*p*z;c.n24= -h*o*t-k*p*t+k*j*w-e*o*w-h*j*u+e*p*u;c.n31=m*u*y-o*v*y+o*t*x-j*u*x-m*t*z+j*v*z;c.n32=k*v*y-f*u*y-k*t*x+e*u*x+f*t*z-e*v*z;c.n33=h*o*y-k*m*y+k*j*x-e*o*x-f*j*z+e*m*z;c.n34=k*m*t-f*o*t-k*j*v+e*o*v+f*j*u-e*m*u;c.n41=p*v*y-m*w*y-p*t*x+j*w*x+m*t*B-j*v*B;c.n42=f*w*y-h*v*y+h*t*x-e*w*x-f*t*B+e*v*B;c.n43=h*m*y-f*p*y-h*j*x+e*p*x+f*j*B-e*m*B;c.n44=f*p*t-h*m*t+h*j*v-e*p*v-f*j*w+e*m*w;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,t=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*j;e[4]=b*m;e[5]=b*p;e[6]=b*o;e[7]=b*t;e[8]=b*v;return c}; +THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,j=b.n21,m=b.n22,p=b.n23,o=b.n24,t=b.n31,u=b.n32,w=b.n33,v=b.n34,y=b.n41,x=b.n42,B=b.n43,z=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*x-o*w*x+o*u*B-m*v*B-p*u*z+m*w*z;c.n12=k*w*x-h*v*x-k*u*B+f*v*B+h*u*z-f*w*z;c.n13=h*o*x-k*p*x+k*m*B-f*o*B-h*m*z+f*p*z;c.n14=k*p*u-h*o*u-k*m*w+f*o*w+h*m*v-f*p*v;c.n21=o*w*y-p*v*y-o*t*B+j*v*B+p*t*z-j*w*z;c.n22=h*v*y-k*w*y+k*t*B-e*v*B-h*t*z+e*w*z;c.n23=k*p*y-h*o*y-k*j*B+e*o*B+h*j*z-e*p*z;c.n24= +h*o*t-k*p*t+k*j*w-e*o*w-h*j*v+e*p*v;c.n31=m*v*y-o*u*y+o*t*x-j*v*x-m*t*z+j*u*z;c.n32=k*u*y-f*v*y-k*t*x+e*v*x+f*t*z-e*u*z;c.n33=h*o*y-k*m*y+k*j*x-e*o*x-f*j*z+e*m*z;c.n34=k*m*t-f*o*t-k*j*u+e*o*u+f*j*v-e*m*v;c.n41=p*u*y-m*w*y-p*t*x+j*w*x+m*t*B-j*u*B;c.n42=f*w*y-h*u*y+h*t*x-e*w*x-f*t*B+e*u*B;c.n43=h*m*y-f*p*y-h*j*x+e*p*x+f*j*B-e*m*B;c.n44=f*p*t-h*m*t+h*j*u-e*p*u-f*j*w+e*m*w;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,t=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*j;e[4]=b*m;e[5]=b*p;e[6]=b*o;e[7]=b*t;e[8]=b*u;return c}; THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(f-e);j.n23=(f+e)/(f-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(k+h)/(k-h);j.n34=-2*k*h/(k-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)}; THREE.Matrix4.makeOrtho=function(b,c,e,f,h,k){var j,m,p,o;j=new THREE.Matrix4;m=c-b;p=e-f;o=k-h;j.n11=2/m;j.n12=0;j.n13=0;j.n14=-((c+b)/m);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((e+f)/p);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((k+h)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= @@ -55,8 +55,8 @@ this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matri THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),j=b*c,m=f*h;this.w=j*k-m*e;this.x=j*e+m*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e); this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c= -this.x,e=this.y,f=this.z,h=this.w,k=b.x,j=b.y,m=b.z,b=b.w;this.x=c*b+h*k+e*m-f*j;this.y=e*b+h*j+f*k-c*m;this.z=f*b+h*m+c*j-e*k;this.w=h*b-c*k-e*j-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,k=this.x,j=this.y,m=this.z,p=this.w,o=p*e+j*h-m*f,t=p*f+m*e-k*h,v=p*h+k*f-j*e,e=-k* -e-j*f-m*h;c.x=o*p+e*-k+t*-m-v*-j;c.y=t*p+e*-j+v*-k-o*-m;c.z=v*p+e*-m+o*-j-t*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*k)/j;f=Math.sin(f*k)/j;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; +this.x,e=this.y,f=this.z,h=this.w,k=b.x,j=b.y,m=b.z,b=b.w;this.x=c*b+h*k+e*m-f*j;this.y=e*b+h*j+f*k-c*m;this.z=f*b+h*m+c*j-e*k;this.w=h*b-c*k-e*j-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,k=this.x,j=this.y,m=this.z,p=this.w,o=p*e+j*h-m*f,t=p*f+m*e-k*h,u=p*h+k*f-j*e,e=-k* +e-j*f-m*h;c.x=o*p+e*-k+t*-m-u*-j;c.y=t*p+e*-j+u*-k-o*-m;c.z=u*p+e*-m+o*-j-t*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*k)/j;f=Math.sin(f*k)/j;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,k){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,c,e,f,h,k,j){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; @@ -65,16 +65,16 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function() e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,h,k,j,m=new THREE.Vector3,p=new THREE.Vector3;f=0;for(h=this.faces.length;f0){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,e=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;cthis.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;o=this.points[e[0]];t=this.points[e[1]]; -v=this.points[e[2]];w=this.points[e[3]];m=j*j;p=j*m;f.x=c(o.x,t.x,v.x,w.x,j,m,p);f.y=c(o.y,t.y,v.y,w.y,j,m,p);f.z=c(o.z,t.z,v.z,w.z,j,m,p);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;bthis.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;o=this.points[e[0]];t=this.points[e[1]]; +u=this.points[e[2]];w=this.points[e[3]];m=j*j;p=j*m;f.x=c(o.x,t.x,u.x,w.x,j,m,p);f.y=c(o.y,t.y,u.y,w.y,j,m,p);f.z=c(o.z,t.z,u.z,w.z,j,m,p);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b=0&&h>=0&&k>=0&&m>=0?!0:j<0&&h<0||k<0&&m<0?!1:(j<0?c=Math.max(c,j/(j-h)):h<0&&(f=Math.min(f,j/(j-h))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),fE&&j.positionScreen.z0&&K.z<1))ga=C[D]=C[D]||new THREE.RenderableParticle,D++,z=ga,z.x=K.x/K.w,z.y=K.y/K.w,z.z=K.z,z.rotation=ca.rotation.z,z.scale.x= -ca.scale.x*Math.abs(z.x-(K.x+h.projectionMatrix.n11)/(K.w+h.projectionMatrix.n14)),z.scale.y=ca.scale.y*Math.abs(z.y-(K.y+h.projectionMatrix.n22)/(K.w+h.projectionMatrix.n24)),z.materials=ca.materials,J.push(z);k&&J.sort(c);return J}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,o,t,v,w,u,y,x;b=c.projectScene(e,f);p=0;for(o=b.length;p0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b* -255)+","+x+")"),u.fillRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))),ta.empty())};this.render=function(b,p){function o(b){var e,c,f,j=b.lights;wa.setRGB(0,0,0);Ea.setRGB(0,0,0);Fa.setRGB(0,0,0);b=0;for(e=j.length;b>1,t=o.height>>1,k=j.scale.x*v,p=j.scale.y*w,n=k*W,m=p*t,ea.set(b.x-n,b.y-m,b.x+n,b.y+m),pa.instersects(ea)&&(u.save(),u.translate(b.x,b.y),u.rotate(-j.rotation),u.scale(k,-p),u.translate(-W,-t),u.drawImage(o,0,0),u.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(n=j.scale.x*v,m=j.scale.y*w,ea.set(b.x-n,b.y-m,b.x+n,b.y+m),pa.instersects(ea)&&(f(k.color.getContextStyle()),h(k.color.getContextStyle()),u.save(),u.translate(b.x,b.y),u.rotate(-j.rotation),u.scale(n,m), -k.program(u),u.restore()))}function B(b,j,h,k){c(k.opacity);e(k.blending);u.beginPath();u.moveTo(b.positionScreen.x,b.positionScreen.y);u.lineTo(j.positionScreen.x,j.positionScreen.y);u.closePath();if(k instanceof THREE.LineBasicMaterial){b=k.linewidth;if(E!=b)u.lineWidth=E=b;b=k.linecap;if(J!=b)u.lineCap=J=b;b=k.linejoin;if(O!=b)u.lineJoin=O=b;f(k.color.getContextStyle());u.stroke();ea.inflate(k.linewidth*2)}}function x(b,f,j,h,m,v,o,W,u){k.data.vertices+=3;k.data.faces++;c(W.opacity);e(W.blending); -L=b.positionScreen.x;S=b.positionScreen.y;n=f.positionScreen.x;V=f.positionScreen.y;fa=j.positionScreen.x;Q=j.positionScreen.y;D(L,S,n,V,fa,Q);if(W instanceof THREE.MeshBasicMaterial)if(W.map)W.map.mapping instanceof THREE.UVMapping&&(la=o.uvs[0],Ya(L,S,n,V,fa,Q,la[h].u,la[h].v,la[m].u,la[m].v,la[v].u,la[v].v,W.map));else if(W.envMap){if(W.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,na.copy(o.vertexNormalsWorld[0]),sa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5, -Ha=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(o.vertexNormalsWorld[1]),oa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,va=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(o.vertexNormalsWorld[2]),Ja=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,Da=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,Ya(L,S,n,V,fa,Q,sa,Ha,oa,va,Ja,Da,W.envMap)}else W.wireframe?Ka(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):La(W.color);else if(W instanceof THREE.MeshLambertMaterial)W.map&&!W.wireframe&& -(W.map.mapping instanceof THREE.UVMapping&&(la=o.uvs[0],Ya(L,S,n,V,fa,Q,la[h].u,la[h].v,la[m].u,la[m].v,la[v].u,la[v].v,W.map)),e(THREE.SubtractiveBlending)),ya?!W.wireframe&&W.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(X.r=ca.r=ga.r=wa.r,X.g=ca.g=ga.g=wa.g,X.b=ca.b=ga.b=wa.b,t(u,o.v1.positionWorld,o.vertexNormalsWorld[0],X),t(u,o.v2.positionWorld,o.vertexNormalsWorld[1],ca),t(u,o.v3.positionWorld,o.vertexNormalsWorld[2],ga),ia.r=(ca.r+ga.r)*0.5,ia.g=(ca.g+ga.g)*0.5,ia.b=(ca.b+ -ga.b)*0.5,ra=Wa(X,ca,ga,ia),Ta(L,S,n,V,fa,Q,0,0,1,0,0,1,ra)):(xa.r=wa.r,xa.g=wa.g,xa.b=wa.b,t(u,o.centroidWorld,o.normalWorld,xa),ha.r=Math.max(0,Math.min(W.color.r*xa.r,1)),ha.g=Math.max(0,Math.min(W.color.g*xa.g,1)),ha.b=Math.max(0,Math.min(W.color.b*xa.b,1)),W.wireframe?Ka(ha,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):La(ha)):W.wireframe?Ka(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):La(W.color);else if(W instanceof THREE.MeshDepthMaterial)Z=p.near,N= -p.far,X.r=X.g=X.b=1-Oa(b.positionScreen.z,Z,N),ca.r=ca.g=ca.b=1-Oa(f.positionScreen.z,Z,N),ga.r=ga.g=ga.b=1-Oa(j.positionScreen.z,Z,N),ia.r=(ca.r+ga.r)*0.5,ia.g=(ca.g+ga.g)*0.5,ia.b=(ca.b+ga.b)*0.5,ra=Wa(X,ca,ga,ia),Ta(L,S,n,V,fa,Q,0,0,1,0,0,1,ra);else if(W instanceof THREE.MeshNormalMaterial)ha.r=Ua(o.normalWorld.x),ha.g=Ua(o.normalWorld.y),ha.b=Ua(o.normalWorld.z),W.wireframe?Ka(ha,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):La(ha)}function z(b,f,j,h,m,v,W,o,u){k.data.vertices+= -4;k.data.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)x(b,f,h,0,1,3,W,o,u),x(m,j,v,1,2,3,W,o,u);else if(L=b.positionScreen.x,S=b.positionScreen.y,n=f.positionScreen.x,V=f.positionScreen.y,fa=j.positionScreen.x,Q=j.positionScreen.y,da=h.positionScreen.x,$=h.positionScreen.y,ka=m.positionScreen.x,U=m.positionScreen.y,aa=v.positionScreen.x,ja=v.positionScreen.y,o instanceof THREE.MeshBasicMaterial)C(L,S,n,V,fa,Q,da,$),o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin): -La(o.color);else if(o instanceof THREE.MeshLambertMaterial)ya?!o.wireframe&&o.shading==THREE.SmoothShading&&W.vertexNormalsWorld.length==4?(X.r=ca.r=ga.r=ia.r=wa.r,X.g=ca.g=ga.g=ia.g=wa.g,X.b=ca.b=ga.b=ia.b=wa.b,t(u,W.v1.positionWorld,W.vertexNormalsWorld[0],X),t(u,W.v2.positionWorld,W.vertexNormalsWorld[1],ca),t(u,W.v4.positionWorld,W.vertexNormalsWorld[3],ga),t(u,W.v3.positionWorld,W.vertexNormalsWorld[2],ia),ra=Wa(X,ca,ga,ia),D(L,S,n,V,da,$),Ta(L,S,n,V,da,$,0,0,1,0,0,1,ra),D(ka,U,fa,Q,aa,ja),Ta(ka, -U,fa,Q,aa,ja,1,0,1,1,0,1,ra)):(xa.r=wa.r,xa.g=wa.g,xa.b=wa.b,t(u,W.centroidWorld,W.normalWorld,xa),ha.r=Math.max(0,Math.min(o.color.r*xa.r,1)),ha.g=Math.max(0,Math.min(o.color.g*xa.g,1)),ha.b=Math.max(0,Math.min(o.color.b*xa.b,1)),C(L,S,n,V,fa,Q,da,$),o.wireframe?Ka(ha,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(ha)):(C(L,S,n,V,fa,Q,da,$),o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color));else if(o instanceof THREE.MeshNormalMaterial)ha.r= -Ua(W.normalWorld.x),ha.g=Ua(W.normalWorld.y),ha.b=Ua(W.normalWorld.z),C(L,S,n,V,fa,Q,da,$),o.wireframe?Ka(ha,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(ha);else if(o instanceof THREE.MeshDepthMaterial)Z=p.near,N=p.far,X.r=X.g=X.b=1-Oa(b.positionScreen.z,Z,N),ca.r=ca.g=ca.b=1-Oa(f.positionScreen.z,Z,N),ga.r=ga.g=ga.b=1-Oa(h.positionScreen.z,Z,N),ia.r=ia.g=ia.b=1-Oa(j.positionScreen.z,Z,N),ra=Wa(X,ca,ga,ia),D(L,S,n,V,da,$),Ta(L,S,n,V,da,$,0,0,1,0,0,1,ra),D(ka,U,fa,Q,aa,ja),Ta(ka, -U,fa,Q,aa,ja,1,0,1,1,0,1,ra)}function D(b,e,c,f,j,h){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(j,h);u.lineTo(b,e);u.closePath()}function C(b,e,c,f,j,h,k,n){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(j,h);u.lineTo(k,n);u.lineTo(b,e);u.closePath()}function Ka(b,e,c,j){if(E!=e)u.lineWidth=E=e;if(J!=c)u.lineCap=J=c;if(O!=j)u.lineJoin=O=j;f(b.getContextStyle());u.stroke();ea.inflate(e*2)}function La(b){h(b.getContextStyle());u.fill()}function Ya(b,e,c,f,j,k,n,m,o,W,p,v,t){if(t.image.width!= -0){if(t.needsUpdate==!0||ma[t.id]==void 0){var w=t.wrapS==THREE.RepeatWrapping,Ba=t.wrapT==THREE.RepeatWrapping;ma[t.id]=u.createPattern(t.image,w&&Ba?"repeat":w&&!Ba?"repeat-x":!w&&Ba?"repeat-y":"no-repeat");t.needsUpdate=!1}h(ma[t.id]);var w=t.offset.x/t.repeat.x,Ba=t.offset.y/t.repeat.y,y=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,n=(n+w)*y,m=(m+Ba)*t,o=(o+w)*y,W=(W+Ba)*t,p=(p+w)*y,v=(v+Ba)*t;c-=b;f-=e;j-=b;k-=e;o-=n;W-=m;p-=n;v-=m;w=1/(o*v-p*W);t=(v*c-W*j)*w;W=(v*f-W*k)*w;c= -(o*j-p*c)*w;f=(o*k-p*f)*w;b=b-t*n-c*m;e=e-W*n-f*m;u.save();u.transform(t,W,c,f,b,e);u.fill();u.restore()}}function Ta(b,e,c,f,j,h,k,n,m,o,W,p,v){var t,w;t=v.width-1;w=v.height-1;k*=t;n*=w;m*=t;o*=w;W*=t;p*=w;c-=b;f-=e;j-=b;h-=e;m-=k;o-=n;W-=k;p-=n;w=1/(m*p-W*o);t=(p*c-o*j)*w;o=(p*f-o*h)*w;c=(m*j-W*c)*w;f=(m*h-W*f)*w;b=b-t*k-c*n;e=e-o*k-f*n;u.save();u.transform(t,o,c,f,b,e);u.clip();u.drawImage(v,0,0);u.restore()}function Wa(b,e,c,f){var j=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),n=~~(e.g* -255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),v=~~(f.g*255),f=~~(f.b*255);za[0]=j<0?0:j>255?255:j;za[1]=h<0?0:h>255?255:h;za[2]=b<0?0:b>255?255:b;za[4]=k<0?0:k>255?255:k;za[5]=n<0?0:n>255?255:n;za[6]=e<0?0:e>255?255:e;za[8]=m<0?0:m>255?255:m;za[9]=o<0?0:o>255?255:o;za[10]=c<0?0:c>255?255:c;za[12]=p<0?0:p>255?255:p;za[13]=v<0?0:v>255?255:v;za[14]=f<0?0:f>255?255:f;Aa.putImageData(W,0,0);Ba.drawImage(T,0,0);return Va}function Oa(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ua(b){b= -(b+1)*0.5;return b<0?0:b>1?1:b}function Ma(b,e){var c=e.x-b.x,f=e.y-b.y,j=c*c+f*f;j!=0&&(j=1/Math.sqrt(j),c*=j,f*=j,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Xa,Za,qa,Ca,Na,H,A,P;this.autoClear?this.clear():u.setTransform(1,0,0,-1,v,w);k.data.vertices=0;k.data.faces=0;j=m.projectScene(b,p,this.sortElements);(ya=b.lights.length>0)&&o(b);Xa=0;for(Za=j.length;Xa0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k)):h instanceof THREE.PointLight&&(Y.sub(h.position,e.centroidWorld),Y.normalize(),k=e.normalWorld.dot(Y)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k))}function c(e,c,j,n,m,o){k.data.vertices+=3;k.data.faces++;L=f(S++);L.setAttribute("d", +THREE.Projector=function(){function b(){var b=p[m]=p[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,j=b.z+b.w,h=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return j>=0&&h>=0&&k>=0&&m>=0?!0:j<0&&h<0||k<0&&m<0?!1:(j<0?c=Math.max(c,j/(j-h)):h<0&&(f=Math.min(f,j/(j-h))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),fE&&j.positionScreen.z0&&K.z<1))ja=C[D]=C[D]||new THREE.RenderableParticle,D++,z=ja,z.x=K.x/K.w,z.y=K.y/K.w,z.z=K.z,z.rotation= +W.rotation.z,z.scale.x=W.scale.x*Math.abs(z.x-(K.x+h.projectionMatrix.n11)/(K.w+h.projectionMatrix.n14)),z.scale.y=W.scale.y*Math.abs(z.y-(K.y+h.projectionMatrix.n22)/(K.w+h.projectionMatrix.n24)),z.materials=W.materials,J.push(z);k&&J.sort(c);return J}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,o,t,u,w,v,y,x;b=c.projectScene(e,f);p=0;for(o=b.length;p0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+ +Math.floor(y.b*255)+","+x+")"),v.fillRect(Math.floor(sa.getX()),Math.floor(sa.getY()),Math.floor(sa.getWidth()),Math.floor(sa.getHeight()))),sa.empty())};this.render=function(b,p){function o(b){var e,c,f,j=b.lights;xa.setRGB(0,0,0);Fa.setRGB(0,0,0);Ga.setRGB(0,0,0);b=0;for(e=j.length;b>1,t=o.height>>1,k=j.scale.x*u,p=j.scale.y*w,n=k*fa,m=p*t,ea.set(b.x-n,b.y-m,b.x+n,b.y+m),pa.instersects(ea)&&(v.save(),v.translate(b.x,b.y),v.rotate(-j.rotation),v.scale(k,-p),v.translate(-fa,-t),v.drawImage(o,0,0),v.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(n=j.scale.x*u,m=j.scale.y*w,ea.set(b.x-n,b.y-m,b.x+n,b.y+m),pa.instersects(ea)&&(f(k.color.getContextStyle()),h(k.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-j.rotation),v.scale(n, +m),k.program(v),v.restore()))}function B(b,j,h,k){c(k.opacity);e(k.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(j.positionScreen.x,j.positionScreen.y);v.closePath();if(k instanceof THREE.LineBasicMaterial){b=k.linewidth;if(E!=b)v.lineWidth=E=b;b=k.linecap;if(J!=b)v.lineCap=J=b;b=k.linejoin;if(O!=b)v.lineJoin=O=b;f(k.color.getContextStyle());v.stroke();ea.inflate(k.linewidth*2)}}function x(b,f,j,h,m,u,o,fa,v){k.data.vertices+=3;k.data.faces++;c(fa.opacity);e(fa.blending); +L=b.positionScreen.x;P=b.positionScreen.y;n=f.positionScreen.x;X=f.positionScreen.y;la=j.positionScreen.x;R=j.positionScreen.y;D(L,P,n,X,la,R);if(fa instanceof THREE.MeshBasicMaterial)if(fa.map)fa.map.mapping instanceof THREE.UVMapping&&(aa=o.uvs[0],$a(L,P,n,X,la,R,aa[h].u,aa[h].v,aa[m].u,aa[m].v,aa[u].u,aa[u].v,fa.map));else if(fa.envMap){if(fa.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,na.copy(o.vertexNormalsWorld[0]),va=(na.x*b.n11+na.y*b.n12+na.z*b.n13)* +0.5+0.5,Ia=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(o.vertexNormalsWorld[1]),oa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,wa=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(o.vertexNormalsWorld[2]),Ka=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,Ea=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,$a(L,P,n,X,la,R,va,Ia,oa,wa,Ka,Ea,fa.envMap)}else fa.wireframe?La(fa.color,fa.wireframeLinewidth,fa.wireframeLinecap,fa.wireframeLinejoin):Ma(fa.color);else if(fa instanceof THREE.MeshLambertMaterial)fa.map&& +!fa.wireframe&&(fa.map.mapping instanceof THREE.UVMapping&&(aa=o.uvs[0],$a(L,P,n,X,la,R,aa[h].u,aa[h].v,aa[m].u,aa[m].v,aa[u].u,aa[u].v,fa.map)),e(THREE.SubtractiveBlending)),za?!fa.wireframe&&fa.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(U.r=W.r=ja.r=xa.r,U.g=W.g=ja.g=xa.g,U.b=W.b=ja.b=xa.b,t(v,o.v1.positionWorld,o.vertexNormalsWorld[0],U),t(v,o.v2.positionWorld,o.vertexNormalsWorld[1],W),t(v,o.v3.positionWorld,o.vertexNormalsWorld[2],ja),ia.r=(W.r+ja.r)*0.5,ia.g=(W.g+ja.g)*0.5, +ia.b=(W.b+ja.b)*0.5,ra=Ya(U,W,ja,ia),Ua(L,P,n,X,la,R,0,0,1,0,0,1,ra)):(ya.r=xa.r,ya.g=xa.g,ya.b=xa.b,t(v,o.centroidWorld,o.normalWorld,ya),$.r=Math.max(0,Math.min(fa.color.r*ya.r,1)),$.g=Math.max(0,Math.min(fa.color.g*ya.g,1)),$.b=Math.max(0,Math.min(fa.color.b*ya.b,1)),fa.wireframe?La($,fa.wireframeLinewidth,fa.wireframeLinecap,fa.wireframeLinejoin):Ma($)):fa.wireframe?La(fa.color,fa.wireframeLinewidth,fa.wireframeLinecap,fa.wireframeLinejoin):Ma(fa.color);else if(fa instanceof THREE.MeshDepthMaterial)Y= +p.near,N=p.far,U.r=U.g=U.b=1-Pa(b.positionScreen.z,Y,N),W.r=W.g=W.b=1-Pa(f.positionScreen.z,Y,N),ja.r=ja.g=ja.b=1-Pa(j.positionScreen.z,Y,N),ia.r=(W.r+ja.r)*0.5,ia.g=(W.g+ja.g)*0.5,ia.b=(W.b+ja.b)*0.5,ra=Ya(U,W,ja,ia),Ua(L,P,n,X,la,R,0,0,1,0,0,1,ra);else if(fa instanceof THREE.MeshNormalMaterial)$.r=Va(o.normalWorld.x),$.g=Va(o.normalWorld.y),$.b=Va(o.normalWorld.z),fa.wireframe?La($,fa.wireframeLinewidth,fa.wireframeLinecap,fa.wireframeLinejoin):Ma($)}function z(b,f,j,h,m,fa,u,o,v){k.data.vertices+= +4;k.data.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)x(b,f,h,0,1,3,u,o,v),x(m,j,fa,1,2,3,u,o,v);else if(L=b.positionScreen.x,P=b.positionScreen.y,n=f.positionScreen.x,X=f.positionScreen.y,la=j.positionScreen.x,R=j.positionScreen.y,ga=h.positionScreen.x,Z=h.positionScreen.y,da=m.positionScreen.x,ca=m.positionScreen.y,ha=fa.positionScreen.x,ka=fa.positionScreen.y,o instanceof THREE.MeshBasicMaterial)C(L,P,n,X,la,R,ga,Z),o.wireframe?La(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin): +Ma(o.color);else if(o instanceof THREE.MeshLambertMaterial)za?!o.wireframe&&o.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==4?(U.r=W.r=ja.r=ia.r=xa.r,U.g=W.g=ja.g=ia.g=xa.g,U.b=W.b=ja.b=ia.b=xa.b,t(v,u.v1.positionWorld,u.vertexNormalsWorld[0],U),t(v,u.v2.positionWorld,u.vertexNormalsWorld[1],W),t(v,u.v4.positionWorld,u.vertexNormalsWorld[3],ja),t(v,u.v3.positionWorld,u.vertexNormalsWorld[2],ia),ra=Ya(U,W,ja,ia),D(L,P,n,X,ga,Z),Ua(L,P,n,X,ga,Z,0,0,1,0,0,1,ra),D(da,ca,la,R,ha,ka),Ua(da, +ca,la,R,ha,ka,1,0,1,1,0,1,ra)):(ya.r=xa.r,ya.g=xa.g,ya.b=xa.b,t(v,u.centroidWorld,u.normalWorld,ya),$.r=Math.max(0,Math.min(o.color.r*ya.r,1)),$.g=Math.max(0,Math.min(o.color.g*ya.g,1)),$.b=Math.max(0,Math.min(o.color.b*ya.b,1)),C(L,P,n,X,la,R,ga,Z),o.wireframe?La($,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Ma($)):(C(L,P,n,X,la,R,ga,Z),o.wireframe?La(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Ma(o.color));else if(o instanceof THREE.MeshNormalMaterial)$.r= +Va(u.normalWorld.x),$.g=Va(u.normalWorld.y),$.b=Va(u.normalWorld.z),C(L,P,n,X,la,R,ga,Z),o.wireframe?La($,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Ma($);else if(o instanceof THREE.MeshDepthMaterial)Y=p.near,N=p.far,U.r=U.g=U.b=1-Pa(b.positionScreen.z,Y,N),W.r=W.g=W.b=1-Pa(f.positionScreen.z,Y,N),ja.r=ja.g=ja.b=1-Pa(h.positionScreen.z,Y,N),ia.r=ia.g=ia.b=1-Pa(j.positionScreen.z,Y,N),ra=Ya(U,W,ja,ia),D(L,P,n,X,ga,Z),Ua(L,P,n,X,ga,Z,0,0,1,0,0,1,ra),D(da,ca,la,R,ha,ka),Ua(da,ca,la, +R,ha,ka,1,0,1,1,0,1,ra)}function D(b,e,c,f,j,h){v.beginPath();v.moveTo(b,e);v.lineTo(c,f);v.lineTo(j,h);v.lineTo(b,e);v.closePath()}function C(b,e,c,f,j,h,k,n){v.beginPath();v.moveTo(b,e);v.lineTo(c,f);v.lineTo(j,h);v.lineTo(k,n);v.lineTo(b,e);v.closePath()}function La(b,e,c,j){if(E!=e)v.lineWidth=E=e;if(J!=c)v.lineCap=J=c;if(O!=j)v.lineJoin=O=j;f(b.getContextStyle());v.stroke();ea.inflate(e*2)}function Ma(b){h(b.getContextStyle());v.fill()}function $a(b,e,c,f,j,k,n,m,o,u,p,fa,t){if(t.image.width!= +0){if(t.needsUpdate==!0||ma[t.id]==void 0){var w=t.wrapS==THREE.RepeatWrapping,Ca=t.wrapT==THREE.RepeatWrapping;ma[t.id]=v.createPattern(t.image,w&&Ca?"repeat":w&&!Ca?"repeat-x":!w&&Ca?"repeat-y":"no-repeat");t.needsUpdate=!1}h(ma[t.id]);var w=t.offset.x/t.repeat.x,Ca=t.offset.y/t.repeat.y,y=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,n=(n+w)*y,m=(m+Ca)*t,o=(o+w)*y,u=(u+Ca)*t,p=(p+w)*y,fa=(fa+Ca)*t;c-=b;f-=e;j-=b;k-=e;o-=n;u-=m;p-=n;fa-=m;w=1/(o*fa-p*u);t=(fa*c-u*j)*w;u=(fa*f-u*k)* +w;c=(o*j-p*c)*w;f=(o*k-p*f)*w;b=b-t*n-c*m;e=e-u*n-f*m;v.save();v.transform(t,u,c,f,b,e);v.fill();v.restore()}}function Ua(b,e,c,f,j,h,k,n,m,o,u,p,fa){var t,w;t=fa.width-1;w=fa.height-1;k*=t;n*=w;m*=t;o*=w;u*=t;p*=w;c-=b;f-=e;j-=b;h-=e;m-=k;o-=n;u-=k;p-=n;w=1/(m*p-u*o);t=(p*c-o*j)*w;o=(p*f-o*h)*w;c=(m*j-u*c)*w;f=(m*h-u*f)*w;b=b-t*k-c*n;e=e-o*k-f*n;v.save();v.transform(t,o,c,f,b,e);v.clip();v.drawImage(fa,0,0);v.restore()}function Ya(b,e,c,f){var j=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255), +n=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),u=~~(f.r*255),p=~~(f.g*255),f=~~(f.b*255);Aa[0]=j<0?0:j>255?255:j;Aa[1]=h<0?0:h>255?255:h;Aa[2]=b<0?0:b>255?255:b;Aa[4]=k<0?0:k>255?255:k;Aa[5]=n<0?0:n>255?255:n;Aa[6]=e<0?0:e>255?255:e;Aa[8]=m<0?0:m>255?255:m;Aa[9]=o<0?0:o>255?255:o;Aa[10]=c<0?0:c>255?255:c;Aa[12]=u<0?0:u>255?255:u;Aa[13]=p<0?0:p>255?255:p;Aa[14]=f<0?0:f>255?255:f;Ba.putImageData(fa,0,0);Ca.drawImage(V,0,0);return Xa}function Pa(b,e,c){b=(b-e)/(c-e);return b*b* +(3-2*b)}function Va(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Na(b,e){var c=e.x-b.x,f=e.y-b.y,j=c*c+f*f;j!=0&&(j=1/Math.sqrt(j),c*=j,f*=j,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Za,ab,qa,Da,Oa,Wa,I,A;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,w);k.data.vertices=0;k.data.faces=0;j=m.projectScene(b,p,this.sortElements);(za=b.lights.length>0)&&o(b);Za=0;for(ab=j.length;Za0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k)):h instanceof THREE.PointLight&&(T.sub(h.position,e.centroidWorld),T.normalize(),k=e.normalWorld.dot(T)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k))}function c(e,c,j,n,m,o){k.data.vertices+=3;k.data.faces++;L=f(P++);L.setAttribute("d", "M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?E.copy(m.color):m instanceof THREE.MeshLambertMaterial?C?(J.r=O.r,J.g=O.g,J.b=O.b,b(o,n,J),E.r=Math.max(0,Math.min(m.color.r*J.r,1)),E.g=Math.max(0,Math.min(m.color.g*J.g,1)),E.b=Math.max(0,Math.min(m.color.b*J.b,1))):E.copy(m.color):m instanceof THREE.MeshDepthMaterial?(F=1-m.__2near/(m.__farPlusNear-n.z*m.__farMinusNear), -E.setRGB(F,F,F)):m instanceof THREE.MeshNormalMaterial&&E.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));m.wireframe?L.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):L.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+m.opacity);p.appendChild(L)}function e(e,c,j,n,m,o,v){k.data.vertices+=4;k.data.faces++; -L=f(S++);L.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?E.copy(o.color):o instanceof THREE.MeshLambertMaterial?C?(J.r=O.r,J.g=O.g,J.b=O.b,b(v,m,J),E.r=Math.max(0,Math.min(o.color.r*J.r,1)),E.g=Math.max(0,Math.min(o.color.g*J.g,1)),E.b=Math.max(0,Math.min(o.color.b*J.b,1))):E.copy(o.color):o instanceof +E.setRGB(F,F,F)):m instanceof THREE.MeshNormalMaterial&&E.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));m.wireframe?L.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):L.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+m.opacity);p.appendChild(L)}function e(e,c,j,n,m,o,u){k.data.vertices+=4;k.data.faces++; +L=f(P++);L.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?E.copy(o.color):o instanceof THREE.MeshLambertMaterial?C?(J.r=O.r,J.g=O.g,J.b=O.b,b(u,m,J),E.r=Math.max(0,Math.min(o.color.r*J.r,1)),E.g=Math.max(0,Math.min(o.color.g*J.g,1)),E.b=Math.max(0,Math.min(o.color.b*J.b,1))):E.copy(o.color):o instanceof THREE.MeshDepthMaterial?(F=1-o.__2near/(o.__farPlusNear-m.z*o.__farMinusNear),E.setRGB(F,F,F)):o instanceof THREE.MeshNormalMaterial&&E.setRGB(h(m.normalWorld.x),h(m.normalWorld.y),h(m.normalWorld.z));o.wireframe?L.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):L.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+ -o.opacity);p.appendChild(L)}function f(b){G[b]==null&&(G[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),V==0&&G[b].setAttribute("shape-rendering","crispEdges"));return G[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,j=null,m=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,v,w,u,y,x,B,z=new THREE.Rectangle,D=new THREE.Rectangle,C=!1,E=new THREE.Color(16777215),J=new THREE.Color(16777215),O=new THREE.Color(0),K=new THREE.Color(0), -I=new THREE.Color(0),F,Y=new THREE.Vector3,G=[],M=[],L,S,n,V=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":V=1;break;case "low":V=0}};this.setSize=function(b,e){o=b;t=e;v=o/2;w=t/2;p.setAttribute("viewBox",-v+" "+-w+" "+o+" "+t);p.setAttribute("width",o);p.setAttribute("height",t);z.set(-v,-w,v,w)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render= -function(b,f){var h,o,t,E,J,G,F,X;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;j=m.projectScene(b,f,this.sortElements);n=S=0;if(C=b.lights.length>0){F=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(o=F.length;h1?1:b}var k=this,j=null,m=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,u,w,v,y,x,B,z=new THREE.Rectangle,D=new THREE.Rectangle,C=!1,E=new THREE.Color(16777215),J=new THREE.Color(16777215),O=new THREE.Color(0),K=new THREE.Color(0), +H=new THREE.Color(0),F,T=new THREE.Vector3,G=[],M=[],L,P,n,X=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":X=1;break;case "low":X=0}};this.setSize=function(b,e){o=b;t=e;u=o/2;w=t/2;p.setAttribute("viewBox",-u+" "+-w+" "+o+" "+t);p.setAttribute("width",o);p.setAttribute("height",t);z.set(-u,-w,u,w)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render= +function(b,f){var h,o,t,E,J,G,F,U;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;j=m.projectScene(b,f,this.sortElements);n=P=0;if(C=b.lights.length>0){F=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(o=F.length;h=0)n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer),n.vertexAttribPointer(b.position, -3,n.FLOAT,!1,0,0);else if(k.morphTargetBase){c=h.program.attributes;k.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[k.morphTargetBase]),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0)):c.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,p=k.morphTargetInfluences;fv&&(t=u,v=p[t]);n.bindBuffer(n.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[t]);n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=v;o[t]=1;v= +f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(e=0;e=0)n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer),n.vertexAttribPointer(b.position, +3,n.FLOAT,!1,0,0);else if(k.morphTargetBase){c=h.program.attributes;k.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[k.morphTargetBase]),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0)):c.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,u=k.morphTargetInfluences;fp&&(t=v,p=u[t]);n.bindBuffer(n.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[t]);n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=p;o[t]=1;p= -1;f++}}h.program.uniforms.morphTargetInfluences!==null&&n.uniform1fv(h.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(j.__webglCustomAttributes)for(m in j.__webglCustomAttributes)b[m]>=0&&(c=j.__webglCustomAttributes[m],n.bindBuffer(n.ARRAY_BUFFER,c.buffer),n.vertexAttribPointer(b[m],c.size,n.FLOAT,!1,0,0));b.color>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglColorBuffer),n.vertexAttribPointer(b.color,3,n.FLOAT,!1,0,0));b.normal>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglNormalBuffer), n.vertexAttribPointer(b.normal,3,n.FLOAT,!1,0,0));b.tangent>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglTangentBuffer),n.vertexAttribPointer(b.tangent,4,n.FLOAT,!1,0,0));b.uv>=0&&(j.__webglUVBuffer?(n.bindBuffer(n.ARRAY_BUFFER,j.__webglUVBuffer),n.vertexAttribPointer(b.uv,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv)):n.disableVertexAttribArray(b.uv));b.uv2>=0&&(j.__webglUV2Buffer?(n.bindBuffer(n.ARRAY_BUFFER,j.__webglUV2Buffer),n.vertexAttribPointer(b.uv2,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv2)): n.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglSkinVertexABuffer),n.vertexAttribPointer(b.skinVertexA,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,j.__webglSkinVertexBBuffer),n.vertexAttribPointer(b.skinVertexB,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,j.__webglSkinIndicesBuffer),n.vertexAttribPointer(b.skinIndex,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,j.__webglSkinWeightsBuffer), -n.vertexAttribPointer(b.skinWeight,4,n.FLOAT,!1,0,0));k instanceof THREE.Mesh?(h.wireframe?(n.lineWidth(h.wireframeLinewidth),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,j.__webglLineBuffer),n.drawElements(n.LINES,j.__webglLineCount,n.UNSIGNED_SHORT,0)):(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),n.drawElements(n.TRIANGLES,j.__webglFaceCount,n.UNSIGNED_SHORT,0)),S.data.vertices+=j.__webglFaceCount,S.data.faces+=j.__webglFaceCount/3,S.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip? -n.LINE_STRIP:n.LINES,n.lineWidth(h.linewidth),n.drawArrays(k,0,j.__webglLineCount),S.data.drawCalls++):k instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,j.__webglParticleCount),S.data.drawCalls++):k instanceof THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,j.__webglVertexCount),S.data.drawCalls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=n.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=n.createBuffer();b.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer), -n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(e.attributes.position),n.vertexAttribPointer(e.attributes.position,3,n.FLOAT,!1,0,0));if(b.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,j,h,k,m,o,p,v,t,u,w=b.count*3;for(u=0;u=0;c--)b[c].object==e&&b.splice(c,1)}function E(b){function e(b){var j=[];c=0;for(f=b.length;c65535&&(p[n].counter+=1,o=p[n].hash+"_"+p[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[], -materials:m,vertices:0,numMorphTargets:v})),b.geometryGroups[o].faces.push(j),b.geometryGroups[o].vertices+=k}function J(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function O(b){if(b!=U){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO, -n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}U=b}}function K(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,L(e.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,L(e.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,L(e.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,L(e.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE), -n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,M(e.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,M(e.minFilter)))}function I(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=n.createTexture();n.activeTexture(n.TEXTURE0+e);n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?n.texImage2D(n.TEXTURE_2D,0,L(b.format),b.image.width,b.image.height,0,L(b.format),n.UNSIGNED_BYTE,b.image.data):n.texImage2D(n.TEXTURE_2D, -0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);K(n.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function F(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=n.createRenderbuffer();b.__webglTexture=n.createTexture();if(e){n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture);K(n.TEXTURE_CUBE_MAP, -b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=n.createFramebuffer(),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,L(b.format),b.width,b.height,0,L(b.format),L(b.type),null)}else b.__webglFramebuffer=n.createFramebuffer(),n.bindTexture(n.TEXTURE_2D,b.__webglTexture),K(n.TEXTURE_2D,b,b),n.texImage2D(n.TEXTURE_2D,0,L(b.format),b.width,b.height,0,L(b.format),L(b.type),null);n.bindRenderbuffer(n.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)n.bindFramebuffer(n.FRAMEBUFFER, -b.__webglFramebuffer[c]),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&& -b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,b.width,b.height);e?n.bindTexture(n.TEXTURE_CUBE_MAP,null):n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null)}var f,j;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height, -j=f=0):(e=null,c=ia,b=ma,f=ca,j=ga);e!=Q&&(n.bindFramebuffer(n.FRAMEBUFFER,e),n.viewport(f,j,c,b),Q=e)}function Y(b){b instanceof THREE.WebGLRenderTargetCube?(n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture),n.generateMipmap(n.TEXTURE_CUBE_MAP),n.bindTexture(n.TEXTURE_CUBE_MAP,null)):(n.bindTexture(n.TEXTURE_2D,b.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))}function G(b,e){var c;b=="fragment"?c=n.createShader(n.FRAGMENT_SHADER):b=="vertex"&&(c=n.createShader(n.VERTEX_SHADER)); -n.shaderSource(c,e);n.compileShader(c);if(!n.getShaderParameter(c,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(c)),console.error(e),null;return c}function M(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST;default:return n.LINEAR}}function L(b){switch(b){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT; -case THREE.NearestFilter:return n.NEAREST;case THREE.NearestMipMapNearestFilter:return n.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return n.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return n.LINEAR;case THREE.LinearMipMapNearestFilter:return n.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return n.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return n.BYTE;case THREE.UnsignedByteType:return n.UNSIGNED_BYTE;case THREE.ShortType:return n.SHORT;case THREE.UnsignedShortType:return n.UNSIGNED_SHORT; -case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0}var S=this,n,V=[],fa=null,Q=null,da=!0,$=null,ka=null,U=null,aa=null,ja=null,ha=null,X=null,ca=0,ga=0,ia=0,ma=0,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, -new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Matrix4,ra=new Float32Array(16),la=new Float32Array(16),sa=new THREE.Vector4,Ha={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},oa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),va=b.stencil!==void 0?b.stencil:!0,Ja=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Da=b.antialias!==void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor): -new THREE.Color(0),ta=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var ea,ya=[],b=THREE.ShaderLib.depthRGBA, -xa=THREE.UniformsUtils.clone(b.uniforms),wa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:xa}),Ea=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:xa,morphTargets:!0});wa._shadowPass=!0;Ea._shadowPass=!0;try{if(!(n=oa.getContext("experimental-webgl",{antialias:Da,stencil:va,preserveDrawingBuffer:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+ -" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Fa){console.error(Fa)}n.clearColor(0,0,0,1);n.clearDepth(1);n.clearStencil(0);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(pa.r,pa.g,pa.b,ta);this.context=n;var na=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0, -T={};T.vertices=new Float32Array(16);T.faces=new Uint16Array(6);i=0;T.vertices[i++]=-1;T.vertices[i++]=-1;T.vertices[i++]=0;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=-1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=0;T.vertices[i++]=-1;T.vertices[i++]=1;T.vertices[i++]=0;i=T.vertices[i++]=0;T.faces[i++]=0;T.faces[i++]=1;T.faces[i++]=2;T.faces[i++]=0;T.faces[i++]=2;T.faces[i++]=3;T.vertexBuffer=n.createBuffer();T.elementBuffer=n.createBuffer(); -n.bindBuffer(n.ARRAY_BUFFER,T.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,T.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,T.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,T.faces,n.STATIC_DRAW);T.program=n.createProgram();n.attachShader(T.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(T.program,G("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.position=n.getAttribLocation(T.program,"position"); -T.attributes.uv=n.getAttribLocation(T.program,"uv");T.uniforms.uvOffset=n.getUniformLocation(T.program,"uvOffset");T.uniforms.uvScale=n.getUniformLocation(T.program,"uvScale");T.uniforms.rotation=n.getUniformLocation(T.program,"rotation");T.uniforms.scale=n.getUniformLocation(T.program,"scale");T.uniforms.alignment=n.getUniformLocation(T.program,"alignment");T.uniforms.map=n.getUniformLocation(T.program,"map");T.uniforms.opacity=n.getUniformLocation(T.program,"opacity");T.uniforms.useScreenCoordinates= -n.getUniformLocation(T.program,"useScreenCoordinates");T.uniforms.affectedByDistance=n.getUniformLocation(T.program,"affectedByDistance");T.uniforms.screenPosition=n.getUniformLocation(T.program,"screenPosition");T.uniforms.modelViewMatrix=n.getUniformLocation(T.program,"modelViewMatrix");T.uniforms.projectionMatrix=n.getUniformLocation(T.program,"projectionMatrix");var Aa=!1;this.setSize=function(b,e){oa.width=b;oa.height=e;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(b,e, -c,f){ca=b;ga=e;ia=c;ma=f;n.viewport(ca,ga,ia,ma)};this.setScissor=function(b,e,c,f){n.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){da=b;n.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);ta=e;n.clearColor(pa.r,pa.g,pa.b,ta)};this.setClearColor=function(b,e){pa.copy(b);ta=e;n.clearColor(pa.r,pa.g,pa.b,ta)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)}; -this.getContext=function(){return n};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];n.deleteBuffer(e.__webglVertexBuffer);n.deleteBuffer(e.__webglNormalBuffer);n.deleteBuffer(e.__webglTangentBuffer);n.deleteBuffer(e.__webglColorBuffer);n.deleteBuffer(e.__webglUVBuffer); -n.deleteBuffer(e.__webglUV2Buffer);n.deleteBuffer(e.__webglSkinVertexABuffer);n.deleteBuffer(e.__webglSkinVertexBBuffer);n.deleteBuffer(e.__webglSkinIndicesBuffer);n.deleteBuffer(e.__webglSkinWeightsBuffer);n.deleteBuffer(e.__webglFaceBuffer);n.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c65535&&(u[n].counter+=1,o=u[n].hash+"_"+u[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[], +materials:m,vertices:0,numMorphTargets:p})),b.geometryGroups[o].faces.push(j),b.geometryGroups[o].vertices+=k;b.geometryGroupsList=[];for(var t in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[t])}function J(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function O(b){if(b!=ca){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO, +n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}ca=b}}function K(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,L(e.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,L(e.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,L(e.magFilter)),n.texParameteri(b, +n.TEXTURE_MIN_FILTER,L(e.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,M(e.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,M(e.minFilter)))}function H(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=n.createTexture();n.activeTexture(n.TEXTURE0+e);n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?n.texImage2D(n.TEXTURE_2D, +0,L(b.format),b.image.width,b.image.height,0,L(b.format),n.UNSIGNED_BYTE,b.image.data):n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);K(n.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function F(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=n.createRenderbuffer(); +b.__webglTexture=n.createTexture();if(e){n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture);K(n.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=n.createFramebuffer(),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,L(b.format),b.width,b.height,0,L(b.format),L(b.type),null)}else b.__webglFramebuffer=n.createFramebuffer(),n.bindTexture(n.TEXTURE_2D,b.__webglTexture),K(n.TEXTURE_2D,b,b),n.texImage2D(n.TEXTURE_2D,0,L(b.format),b.width,b.height,0,L(b.format),L(b.type), +null);n.bindRenderbuffer(n.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer[c]),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,b.width,b.height), +n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,b.width,b.height);e?n.bindTexture(n.TEXTURE_CUBE_MAP,null):n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER, +null)}var f,j;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,j=f=0):(e=null,c=ia,b=ma,f=W,j=ja);e!=R&&(n.bindFramebuffer(n.FRAMEBUFFER,e),n.viewport(f,j,c,b),R=e)}function T(b){b instanceof THREE.WebGLRenderTargetCube?(n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture),n.generateMipmap(n.TEXTURE_CUBE_MAP),n.bindTexture(n.TEXTURE_CUBE_MAP,null)):(n.bindTexture(n.TEXTURE_2D,b.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))}function G(b, +e){var c;b=="fragment"?c=n.createShader(n.FRAGMENT_SHADER):b=="vertex"&&(c=n.createShader(n.VERTEX_SHADER));n.shaderSource(c,e);n.compileShader(c);if(!n.getShaderParameter(c,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(c)),console.error(e),null;return c}function M(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST;default:return n.LINEAR}}function L(b){switch(b){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE; +case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT;case THREE.NearestFilter:return n.NEAREST;case THREE.NearestMipMapNearestFilter:return n.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return n.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return n.LINEAR;case THREE.LinearMipMapNearestFilter:return n.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return n.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return n.BYTE;case THREE.UnsignedByteType:return n.UNSIGNED_BYTE;case THREE.ShortType:return n.SHORT; +case THREE.UnsignedShortType:return n.UNSIGNED_SHORT;case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0}var P=this,n,X=[],la=null,R=null,ga=!0,Z=null,da=null,ca=null,ha=null,ka=null,$=null,U=null,W=0,ja=0,ia=0,ma= +0,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Matrix4,ra=new Float32Array(16),aa=new Float32Array(16),va=new THREE.Vector4,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},oa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),wa=b.stencil!==void 0?b.stencil:!0,Ka=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Ea=b.antialias!== +void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),sa=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled= +!1;this.shadowMapSoft=!0;var ea,za=[],b=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(b.uniforms),xa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ya}),Fa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ya,morphTargets:!0});xa._shadowPass=!0;Fa._shadowPass=!0;try{if(!(n=oa.getContext("experimental-webgl",{antialias:Ea,stencil:wa,preserveDrawingBuffer:Ka})))throw"Error creating WebGL context."; +console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}n.clearColor(0,0,0,1);n.clearDepth(1);n.clearStencil(0);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(pa.r,pa.g,pa.b,sa);this.context= +n;var na=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);i=0;V.vertices[i++]=-1;V.vertices[i++]=-1;V.vertices[i++]=0;V.vertices[i++]=1;V.vertices[i++]=1;V.vertices[i++]=-1;V.vertices[i++]=1;V.vertices[i++]=1;V.vertices[i++]=1;V.vertices[i++]=1;V.vertices[i++]=1;V.vertices[i++]=0;V.vertices[i++]=-1;V.vertices[i++]=1;V.vertices[i++]=0;i=V.vertices[i++]=0;V.faces[i++]=0;V.faces[i++]=1;V.faces[i++]=2;V.faces[i++]=0;V.faces[i++]=2;V.faces[i++]= +3;V.vertexBuffer=n.createBuffer();V.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,V.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,V.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,V.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,V.faces,n.STATIC_DRAW);V.program=n.createProgram();n.attachShader(V.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(V.program,G("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(V.program);V.attributes={};V.uniforms= +{};V.attributes.position=n.getAttribLocation(V.program,"position");V.attributes.uv=n.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=n.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=n.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=n.getUniformLocation(V.program,"rotation");V.uniforms.scale=n.getUniformLocation(V.program,"scale");V.uniforms.alignment=n.getUniformLocation(V.program,"alignment");V.uniforms.map=n.getUniformLocation(V.program,"map");V.uniforms.opacity=n.getUniformLocation(V.program, +"opacity");V.uniforms.useScreenCoordinates=n.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=n.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=n.getUniformLocation(V.program,"screenPosition");V.uniforms.modelViewMatrix=n.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=n.getUniformLocation(V.program,"projectionMatrix");var Ba=!1;this.setSize=function(b,e){oa.width=b;oa.height=e;this.setViewport(0,0,oa.width, +oa.height)};this.setViewport=function(b,e,c,f){W=b;ja=e;ia=c;ma=f;n.viewport(W,ja,ia,ma)};this.setScissor=function(b,e,c,f){n.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ga=b;n.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);sa=e;n.clearColor(pa.r,pa.g,pa.b,sa)};this.setClearColor=function(b,e){pa.copy(b);sa=e;n.clearColor(pa.r,pa.g,pa.b,sa)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT| +n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};this.getContext=function(){return n};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];n.deleteBuffer(e.__webglVertexBuffer);n.deleteBuffer(e.__webglNormalBuffer);n.deleteBuffer(e.__webglTangentBuffer);n.deleteBuffer(e.__webglColorBuffer); +n.deleteBuffer(e.__webglUVBuffer);n.deleteBuffer(e.__webglUV2Buffer);n.deleteBuffer(e.__webglSkinVertexABuffer);n.deleteBuffer(e.__webglSkinVertexBBuffer);n.deleteBuffer(e.__webglSkinIndicesBuffer);n.deleteBuffer(e.__webglSkinWeightsBuffer);n.deleteBuffer(e.__webglFaceBuffer);n.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c=0&&n.enableVertexAttribArray(u.position);u.color>=0&&n.enableVertexAttribArray(u.color);u.normal>=0&&n.enableVertexAttribArray(u.normal);u.tangent>=0&&n.enableVertexAttribArray(u.tangent);b.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(n.enableVertexAttribArray(u.skinVertexA),n.enableVertexAttribArray(u.skinVertexB),n.enableVertexAttribArray(u.skinIndex), -n.enableVertexAttribArray(u.skinWeight));if(b.attributes)for(j in b.attributes)u[j]!==void 0&&u[j]>=0&&n.enableVertexAttribArray(u[j]);if(b.morphTargets)for(j=b.numSupportedMorphTargets=0;j=0&&(n.enableVertexAttribArray(u[x]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,e,f){F(b);b=0;c&&(b|=n.COLOR_BUFFER_BIT);e&&(b|=n.DEPTH_BUFFER_BIT);f&&(b|=n.STENCIL_BUFFER_BIT);n.clear(b)};this.render=function(b,c,n,t){var z,D,C,E,Z,I,J,G,K=b.lights, -M=b.fog;this.shadowMapEnabled&&y(b,c);S.data.vertices=0;S.data.faces=0;S.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(la);c.projectionMatrix.flattenToArray(ra);N.multiply(c.projectionMatrix,c.matrixWorldInverse);p(N);this.initWebGLObjects(b);F(n);(this.autoClear||t)&&this.clear();Z=b.__webglObjects.length;for(t=0;t=0;t--)if(z=b.__webglObjects[t],z.render){J=z.object;G=z.buffer;C=z.opaque;k(J);for(z=0;z=0&&n.enableVertexAttribArray(v.position);v.color>=0&&n.enableVertexAttribArray(v.color);v.normal>=0&&n.enableVertexAttribArray(v.normal);v.tangent>=0&&n.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(n.enableVertexAttribArray(v.skinVertexA),n.enableVertexAttribArray(v.skinVertexB),n.enableVertexAttribArray(v.skinIndex), +n.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(j in b.attributes)v[j]!==void 0&&v[j]>=0&&n.enableVertexAttribArray(v[j]);if(b.morphTargets)for(j=b.numSupportedMorphTargets=0;j=0&&(n.enableVertexAttribArray(v[x]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,e,f){F(b);b=0;c&&(b|=n.COLOR_BUFFER_BIT);e&&(b|=n.DEPTH_BUFFER_BIT);f&&(b|=n.STENCIL_BUFFER_BIT);n.clear(b)};this.render=function(b,c,n,t){var z,D,C,E,Y,H,J,G,K=b.lights, +M=b.fog;this.shadowMapEnabled&&y(b,c);P.data.vertices=0;P.data.faces=0;P.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(aa);c.projectionMatrix.flattenToArray(ra);N.multiply(c.projectionMatrix,c.matrixWorldInverse);p(N);this.initWebGLObjects(b);F(n);(this.autoClear||t)&&this.clear();Y=b.__webglObjects.length;for(t=0;t=0;t--)if(z=b.__webglObjects[t],z.render){J=z.object;G=z.buffer;C=z.opaque;k(J);for(z=0;z0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)m.__skinVertexAArray= -new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(y*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(x=m.numMorphTargets;w0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(u*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(u*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)m.__skinVertexAArray= +new Float32Array(u*4),m.__skinVertexBArray=new Float32Array(u*4),m.__skinIndexArray=new Float32Array(u*4),m.__skinWeightArray=new Float32Array(u*4);m.__faceArray=new Uint16Array(y*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(x=m.numMorphTargets;w=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&C(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,ma,p));ya&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,fa,p));Aa&&va.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,aa,p));Da&&Y>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ha,p));Da&&T>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,ja,p));Ja&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER, -o.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,ta,p),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,na,p));R>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,da,p),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,ea,p),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,oa,p),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER, -ua,p));I&&(delete o.__inittedArrays,delete o.__colorArray,delete o.__normalArray,delete o.__tangentArray,delete o.__uvArray,delete o.__uv2Array,delete o.__faceArray,delete o.__vertexArray,delete o.__lineArray,delete o.__skinVertexAArray,delete o.__skinVertexBArray,delete o.__skinIndexArray,delete o.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(j instanceof THREE.Ribbon){h= -j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=n.DYNAMIC_DRAW;m=B=y=y=void 0;w=j.vertices;o=j.colors;t=w.length;p=o.length;v=j.__vertexArray;I=j.__colorArray;x=j.__dirtyColors;if(j.__dirtyVertices){for(y=0;y=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&C(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e0&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,ga,H));za&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,ha,H));Ba&&wa.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,ma,H));Ea&&V>0&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ka,H));Ea&&X>0&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglUV2Buffer), +n.bufferData(n.ARRAY_BUFFER,la,H));Ka&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,u.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,sa,H),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,u.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,na,H));Q>0&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,ea,H),n.bindBuffer(n.ARRAY_BUFFER,u.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,oa,H),n.bindBuffer(n.ARRAY_BUFFER,u.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER, +ta,H),n.bindBuffer(n.ARRAY_BUFFER,u.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,ua,H));y&&(delete u.__inittedArrays,delete u.__colorArray,delete u.__normalArray,delete u.__tangentArray,delete u.__uvArray,delete u.__uv2Array,delete u.__faceArray,delete u.__vertexArray,delete u.__lineArray,delete u.__skinVertexAArray,delete u.__skinVertexBArray,delete u.__skinIndexArray,delete u.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals= +!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(k)}else if(j instanceof THREE.Ribbon){h=j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=n.DYNAMIC_DRAW;m=B=y=y=void 0;w=j.vertices;o=j.colors;t=w.length;u=o.length;p=j.__vertexArray;H=j.__colorArray;x=j.__dirtyColors;if(j.__dirtyVertices){for(y=0;y1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=j;c.v=k;return c}, clamp:function(b,c,e){return be?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,h=e?c.geometry:c,k=b.vertices,j=h.vertices,m=b.faces,p=h.faces,o=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var t=0,v=j.length;t1&&(f=1-f,h=1-h);k=1-f-h;j.copy(b);j.multiplyScalar(f);m.copy(c);m.multiplyScalar(h);j.addSelf(m);m.copy(e);m.multiplyScalar(k);j.addSelf(m);return j},randomPointInFace:function(b, c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position,j;e?b._area1&&b._area2?(e=b._area1,j=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),j=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=j):(e=THREE.GeometryUtils.triangleArea(f, -h,c),j=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+j)b?e(c,j-1):o[j]b?e(c,j-1):o[j]1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",u,j.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",u,m.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== -"rot")THREE.Quaternion.slerp(h,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&t[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",v,j.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== +"rot")THREE.Quaternion.slerp(h,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&t[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;vb.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];m=b[e[1]];p=b[e[2]];o=b[e[3]];e=h*h;j=h*e;f[0]=this.interpolate(k[0],m[0],p[0],o[0],h,e,j);f[1]=this.interpolate(k[1],m[1],p[1],o[1],h,e,j);f[2]=this.interpolate(k[2],m[2],p[2],o[2],h,e,j);return f}; THREE.Animation.prototype.interpolate=function(b,c,e,f,h,k,j){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*j+(-3*(c-e)-2*b-f)*k+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]}; @@ -406,13 +406,13 @@ this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVec this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!= document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this, this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype; -THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Matrix4,p=!1,o=1,t=0,v=0,w=0,u=0,y=0,x=window.innerWidth/2,B=window.innerHeight/2;this.update= -function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(t>0||this.autoForward&&!(t<0)?1:t));this.translateX(b*v);this.translateY(b*w);p&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); +THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Matrix4,p=!1,o=1,t=0,u=0,w=0,v=0,y=0,x=window.innerWidth/2,B=window.innerHeight/2;this.update= +function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(t>0||this.autoForward&&!(t<0)?1:t));this.translateX(b*u);this.translateY(b*w);p&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); else if(this.forward.y0?(j=e[e.length-1],u=j.x,y=j.y):(j=this.actions[f-1].args,u=j[j.length-2],y=j[j.length-1]);for(j=1;j<=b;j++)x=j/b,k=THREE.Shape.Utils.b2(x,u,v,m),x=THREE.Shape.Utils.b2(x,y,w, -p),e.push(new THREE.Vector2(k,x));break;case THREE.PathActions.BEZIER_CURVE_TO:m=k[4];p=k[5];v=k[0];w=k[1];o=k[2];t=k[3];e.length>0?(j=e[e.length-1],u=j.x,y=j.y):(j=this.actions[f-1].args,u=j[j.length-2],y=j[j.length-1]);for(j=1;j<=b;j++)x=j/b,k=THREE.Shape.Utils.b3(x,u,v,o,m),x=THREE.Shape.Utils.b3(x,y,w,t,p),e.push(new THREE.Vector2(k,x));break;case THREE.PathActions.CSPLINE_THRU:j=this.actions[f-1].args;j=[new THREE.Vector2(j[j.length-2],j[j.length-1])];x=b*k[0].length;j=j.concat(k[0]);k=new THREE.SplineCurve(j); -for(j=1;j<=x;j++)e.push(k.getPointAt(j/x));break;case THREE.PathActions.ARC:j=this.actions[f-1].args;m=k[0];p=k[1];o=k[2];v=k[3];x=k[4];w=!!k[5];t=j[j.length-2];u=j[j.length-1];j.length==0&&(t=u=0);y=x-v;var B=b*2;for(j=1;j<=B;j++)x=j/B,w||(x=1-x),x=v+x*y,k=t+m+o*Math.cos(x),x=u+p+o*Math.sin(x),e.push(new THREE.Vector2(k,x))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; -THREE.Path.prototype.nltransform=function(b,c,e,f,h,k){var j=this.getPoints(),m,p,o,t,v;m=0;for(p=j.length;m0?(j=e[e.length-1],v=j.x,y=j.y):(j=this.actions[f-1].args,v=j[j.length-2],y=j[j.length-1]);for(j=1;j<=b;j++)x=j/b,k=THREE.Shape.Utils.b2(x,v,u,m),x=THREE.Shape.Utils.b2(x,y,w, +p),e.push(new THREE.Vector2(k,x));break;case THREE.PathActions.BEZIER_CURVE_TO:m=k[4];p=k[5];u=k[0];w=k[1];o=k[2];t=k[3];e.length>0?(j=e[e.length-1],v=j.x,y=j.y):(j=this.actions[f-1].args,v=j[j.length-2],y=j[j.length-1]);for(j=1;j<=b;j++)x=j/b,k=THREE.Shape.Utils.b3(x,v,u,o,m),x=THREE.Shape.Utils.b3(x,y,w,t,p),e.push(new THREE.Vector2(k,x));break;case THREE.PathActions.CSPLINE_THRU:j=this.actions[f-1].args;j=[new THREE.Vector2(j[j.length-2],j[j.length-1])];x=b*k[0].length;j=j.concat(k[0]);k=new THREE.SplineCurve(j); +for(j=1;j<=x;j++)e.push(k.getPointAt(j/x));break;case THREE.PathActions.ARC:j=this.actions[f-1].args;m=k[0];p=k[1];o=k[2];u=k[3];x=k[4];w=!!k[5];t=j[j.length-2];v=j[j.length-1];j.length==0&&(t=v=0);y=x-u;var B=b*2;for(j=1;j<=B;j++)x=j/B,w||(x=1-x),x=u+x*y,k=t+m+o*Math.cos(x),x=v+p+o*Math.sin(x),e.push(new THREE.Vector2(k,x))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; +THREE.Path.prototype.nltransform=function(b,c,e,f,h,k){var j=this.getPoints(),m,p,o,t,u;m=0;for(p=j.length;m=0?m-1:e.length-1;k=j-1>=0?j-1:o.length-1;var x=[o[j],e[m],e[h]];v=THREE.FontUtils.Triangulate.area(x);var B=[o[j],o[k],e[m]];w=THREE.FontUtils.Triangulate.area(B);u=m;t=j;m+=1;j+=-1;m<0&&(m+=e.length);m%= -e.length;j<0&&(j+=o.length);j%=o.length;h=m-1>=0?m-1:e.length-1;k=j-1>=0?j-1:o.length-1;x=[o[j],e[m],e[h]];x=THREE.FontUtils.Triangulate.area(x);B=[o[j],o[k],e[m]];B=THREE.FontUtils.Triangulate.area(B);v+w>x+B&&(m=u,j=t,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=o.length),j%=o.length,h=m-1>=0?m-1:e.length-1,k=j-1>=0?j-1:o.length-1);v=e.slice(0,m);w=e.slice(m);u=o.slice(j);t=o.slice(0,j);k=[o[j],o[k],e[m]];y.push([o[j],e[m],e[h]]);y.push(k);e=v.concat(u).concat(t).concat(w)}return{shape:e,isolatedPts:y, +THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,k,j,m,p,o,t,u,w,v,y=[];for(p=0;p=0?m-1:e.length-1;k=j-1>=0?j-1:o.length-1;var x=[o[j],e[m],e[h]];u=THREE.FontUtils.Triangulate.area(x);var B=[o[j],o[k],e[m]];w=THREE.FontUtils.Triangulate.area(B);v=m;t=j;m+=1;j+=-1;m<0&&(m+=e.length);m%= +e.length;j<0&&(j+=o.length);j%=o.length;h=m-1>=0?m-1:e.length-1;k=j-1>=0?j-1:o.length-1;x=[o[j],e[m],e[h]];x=THREE.FontUtils.Triangulate.area(x);B=[o[j],o[k],e[m]];B=THREE.FontUtils.Triangulate.area(B);u+w>x+B&&(m=v,j=t,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=o.length),j%=o.length,h=m-1>=0?m-1:e.length-1,k=j-1>=0?j-1:o.length-1);u=e.slice(0,m);w=e.slice(m);v=o.slice(j);t=o.slice(0,j);k=[o[j],o[k],e[m]];y.push([o[j],e[m],e[h]]);y.push(k);e=u.concat(v).concat(t).concat(w)}return{shape:e,isolatedPts:y, allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),k,j,m,p,o={};k=0;for(j=f.length;k0){e=new THREE.Vector3(0,0,-1);j(0,0,-t-(k||0));for(p=b;p0){c=new THREE.Vector3(0,0,1);j(0,0,t+(h||0));for(p=b+b/2;p<2*b;p++)m.faces.push(new THREE.Face4(2*b+1,(2*p-2*b+2)%b+b,(2*p-2*b+1)%b+b,(2*p-2*b)%b+b,[c,c,c,c]))}p= -0;for(b=this.faces.length;p0){e=new THREE.Vector3(0,0,-1);j(0,0,-t-(k||0));for(p=b;p0){c=new THREE.Vector3(0,0,1);j(0,0,t+(h||0));for(p=b+b/2;p<2*b;p++)m.faces.push(new THREE.Face4(2*b+1,(2*p-2*b+2)%b+b,(2*p-2*b+1)%b+b,(2*p-2*b)%b+b,[c,c,c,c]))}p= +0;for(b=this.faces.length;pb&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(k).addSelf(m).subSelf(b).clone()}function h(b){for(G=b.length;--G>=0;){aa=G;ja=G-1;ja<0&&(ja=b.length- -1);for(var c=0,e=u+t*2,c=0;c=0;L--){S=L/t;n=p*(1-S);S=o*Math.sin(S*Math.PI/2);G=0;for(M=D.length;Gb&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(k).addSelf(m).subSelf(b).clone()}function h(b){for(G=b.length;--G>=0;){ha=G;ka=G-1;ka<0&&(ka=b.length- +1);for(var c=0,e=v+t*2,c=0;c=0;L--){P=L/t;n=p*(1-P);P=o*Math.sin(P*Math.PI/2);G=0;for(M=D.length;G0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,m,w)))-1);o.push(t)}c.push(o)}for(var u,y,x,h=c.length,e=0;e0)for(f=0;f1&&(u= -this.vertices[j].position.clone(),y=this.vertices[p].position.clone(),x=this.vertices[o].position.clone(),u.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(j,p,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,v,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,k=Math.max(3,c||8),j=Math.max(2,e||6),c=[],e=0;e0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,m,w)))-1);o.push(t)}c.push(o)}for(var v,y,x,h=c.length,e=0;e0)for(f=0;f1&&(v= +this.vertices[j].position.clone(),y=this.vertices[p].position.clone(),x=this.vertices[o].position.clone(),v.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(j,p,o,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,u,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c= -this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,j=[],b=0;b0)for(o=0;o2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}p=o;h<=p&&(p=0);o=p+1;h<=o&&(o=0);t=o+1;h<=t&&(t=0);var w;a:{w=b;var u=p,y=o,x=t,B=h,z=j,D=void 0,C=void 0,E=void 0, -J=void 0,O=void 0,K=void 0,I=void 0,F=void 0,Y=void 0,C=w[z[u]].x,E=w[z[u]].y,J=w[z[y]].x,O=w[z[y]].y,K=w[z[x]].x,I=w[z[x]].y;if(1.0E-10>(J-C)*(I-E)-(O-E)*(K-C))w=!1;else{for(D=0;D=0&&L>=0&&n>=0){w=!1;break a}}w= -!0}}if(w){k.push([b[j[p]],b[j[o]],b[j[t]]]);m.push([j[p],j[o],j[t]]);p=o;for(t=o+1;t0)for(o=0;o2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}p=o;h<=p&&(p=0);o=p+1;h<=o&&(o=0);t=o+1;h<=t&&(t=0);var w;a:{w=b;var v=p,y=o,x=t,B=h,z=j,D=void 0,C=void 0,E=void 0, +J=void 0,O=void 0,K=void 0,H=void 0,F=void 0,T=void 0,C=w[z[v]].x,E=w[z[v]].y,J=w[z[y]].x,O=w[z[y]].y,K=w[z[x]].x,H=w[z[x]].y;if(1.0E-10>(J-C)*(H-E)-(O-E)*(K-C))w=!1;else{for(D=0;D=0&&L>=0&&n>=0){w=!1;break a}}w= +!0}}if(w){k.push([b[j[p]],b[j[o]],b[j[t]]]);m.push([j[p],j[o],j[t]]);p=o;for(t=o+1;t>7)-127;f|=(j&127)<<16|h<<8;if(f==0&&m==-127)return 0;return(1-2*(k>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,m)}function h(b,c){var e=t(b,c),f=t(b,c+1),j=t(b,c+2);return(t(b,c+3)<<24)+(j<<16)+(f<<8)+e}function p(b,c){var e=t(b,c);return(t(b,c+1)<<8)+e}function o(b,c){var e=t(b,c);return e>127?e-256:e}function t(b,c){return b.charCodeAt(c)&255}function v(c){var e, -f,j;e=h(b,c);f=h(b,c+O);j=h(b,c+K);c=p(b,c+I);z.faces.push(new THREE.Face3(e,f,j,null,null,z.materials[c]))}function w(c){var e,f,j,k,n,o;e=h(b,c);f=h(b,c+O);j=h(b,c+K);k=p(b,c+I);n=h(b,c+F);o=h(b,c+Y);c=h(b,c+G);k=z.materials[k];var t=E[o*3],u=E[o*3+1];o=E[o*3+2];var v=E[c*3],w=E[c*3+1],c=E[c*3+2];z.faces.push(new THREE.Face3(e,f,j,[new THREE.Vector3(E[n*3],E[n*3+1],E[n*3+2]),new THREE.Vector3(t,u,o),new THREE.Vector3(v,w,c)],null,k))}function u(c){var e,f,j,k;e=h(b,c);f=h(b,c+M);j=h(b,c+L);k=h(b, -c+S);c=p(b,c+n);z.faces.push(new THREE.Face4(e,f,j,k,null,null,z.materials[c]))}function y(c){var e,f,j,k,o,t,u,v;e=h(b,c);f=h(b,c+M);j=h(b,c+L);k=h(b,c+S);o=p(b,c+n);t=h(b,c+V);u=h(b,c+fa);v=h(b,c+Q);c=h(b,c+da);o=z.materials[o];var w=E[u*3],x=E[u*3+1];u=E[u*3+2];var y=E[v*3],B=E[v*3+1];v=E[v*3+2];var C=E[c*3],D=E[c*3+1],c=E[c*3+2];z.faces.push(new THREE.Face4(e,f,j,k,[new THREE.Vector3(E[t*3],E[t*3+1],E[t*3+2]),new THREE.Vector3(w,x,u),new THREE.Vector3(y,B,v),new THREE.Vector3(C,D,c)],null,o))} -function x(c){var e,f,j,k;e=h(b,c);f=h(b,c+$);j=h(b,c+ka);c=J[e*2];k=J[e*2+1];e=J[f*2];var n=z.faceVertexUvs[0];f=J[f*2+1];var o=J[j*2];j=J[j*2+1];var p=[];p.push(new THREE.UV(c,k));p.push(new THREE.UV(e,f));p.push(new THREE.UV(o,j));n.push(p)}function B(c){var e,f,j,k,n,o;e=h(b,c);f=h(b,c+U);j=h(b,c+aa);k=h(b,c+ja);c=J[e*2];n=J[e*2+1];e=J[f*2];o=J[f*2+1];f=J[j*2];var p=z.faceVertexUvs[0];j=J[j*2+1];var t=J[k*2];k=J[k*2+1];var u=[];u.push(new THREE.UV(c,n));u.push(new THREE.UV(e,o));u.push(new THREE.UV(f, -j));u.push(new THREE.UV(t,k));p.push(u)}var z=this,D=0,C,E=[],J=[],O,K,I,F,Y,G,M,L,S,n,V,fa,Q,da,$,ka,U,aa,ja,ha,X,ca,ga,ia,ma;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,f,c);C={signature:b.substr(D,8),header_bytes:t(b,D+8),vertex_coordinate_bytes:t(b,D+9),normal_coordinate_bytes:t(b,D+10),uv_coordinate_bytes:t(b,D+11),vertex_index_bytes:t(b,D+12),normal_index_bytes:t(b,D+13),uv_index_bytes:t(b,D+14),material_index_bytes:t(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4),nuvs:h(b, -D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=C.header_bytes;O=C.vertex_index_bytes;K=C.vertex_index_bytes*2;I=C.vertex_index_bytes*3;F=C.vertex_index_bytes*3+C.material_index_bytes;Y=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;G=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;M=C.vertex_index_bytes; -L=C.vertex_index_bytes*2;S=C.vertex_index_bytes*3;n=C.vertex_index_bytes*4;V=C.vertex_index_bytes*4+C.material_index_bytes;fa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;Q=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;da=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;$=C.uv_index_bytes;ka=C.uv_index_bytes*2;U=C.uv_index_bytes;aa=C.uv_index_bytes*2;ja=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;ma=C.vertex_index_bytes* -4+C.material_index_bytes;ha=C.ntri_flat*c;X=C.ntri_smooth*(c+C.normal_index_bytes*3);ca=C.ntri_flat_uv*(c+C.uv_index_bytes*3);ga=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ia=C.nquad_flat*ma;c=C.nquad_smooth*(ma+C.normal_index_bytes*4);ma=C.nquad_flat_uv*(ma+C.uv_index_bytes*4);D+=function(c){for(var f,h,k,m=C.vertex_coordinate_bytes*3,n=c+C.nvertices*m;c>7)-127;f|=(j&127)<<16|h<<8;if(f==0&&m==-127)return 0;return(1-2*(k>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,m)}function h(b,c){var e=t(b,c),f=t(b,c+1),j=t(b,c+2);return(t(b,c+3)<<24)+(j<<16)+(f<<8)+e}function p(b,c){var e=t(b,c);return(t(b,c+1)<<8)+e}function o(b,c){var e=t(b,c);return e>127?e-256:e}function t(b,c){return b.charCodeAt(c)&255}function u(c){var e, +f,j;e=h(b,c);f=h(b,c+O);j=h(b,c+K);c=p(b,c+H);z.faces.push(new THREE.Face3(e,f,j,null,null,z.materials[c]))}function w(c){var e,f,j,k,n,o;e=h(b,c);f=h(b,c+O);j=h(b,c+K);k=p(b,c+H);n=h(b,c+F);o=h(b,c+T);c=h(b,c+G);k=z.materials[k];var u=E[o*3],t=E[o*3+1];o=E[o*3+2];var v=E[c*3],w=E[c*3+1],c=E[c*3+2];z.faces.push(new THREE.Face3(e,f,j,[new THREE.Vector3(E[n*3],E[n*3+1],E[n*3+2]),new THREE.Vector3(u,t,o),new THREE.Vector3(v,w,c)],null,k))}function v(c){var e,f,j,k;e=h(b,c);f=h(b,c+M);j=h(b,c+L);k=h(b, +c+P);c=p(b,c+n);z.faces.push(new THREE.Face4(e,f,j,k,null,null,z.materials[c]))}function y(c){var e,f,j,k,o,u,t,v;e=h(b,c);f=h(b,c+M);j=h(b,c+L);k=h(b,c+P);o=p(b,c+n);u=h(b,c+X);t=h(b,c+la);v=h(b,c+R);c=h(b,c+ga);o=z.materials[o];var w=E[t*3],x=E[t*3+1];t=E[t*3+2];var y=E[v*3],B=E[v*3+1];v=E[v*3+2];var C=E[c*3],D=E[c*3+1],c=E[c*3+2];z.faces.push(new THREE.Face4(e,f,j,k,[new THREE.Vector3(E[u*3],E[u*3+1],E[u*3+2]),new THREE.Vector3(w,x,t),new THREE.Vector3(y,B,v),new THREE.Vector3(C,D,c)],null,o))} +function x(c){var e,f,j,k;e=h(b,c);f=h(b,c+Z);j=h(b,c+da);c=J[e*2];k=J[e*2+1];e=J[f*2];var n=z.faceVertexUvs[0];f=J[f*2+1];var o=J[j*2];j=J[j*2+1];var p=[];p.push(new THREE.UV(c,k));p.push(new THREE.UV(e,f));p.push(new THREE.UV(o,j));n.push(p)}function B(c){var e,f,j,k,n,o;e=h(b,c);f=h(b,c+ca);j=h(b,c+ha);k=h(b,c+ka);c=J[e*2];n=J[e*2+1];e=J[f*2];o=J[f*2+1];f=J[j*2];var p=z.faceVertexUvs[0];j=J[j*2+1];var u=J[k*2];k=J[k*2+1];var t=[];t.push(new THREE.UV(c,n));t.push(new THREE.UV(e,o));t.push(new THREE.UV(f, +j));t.push(new THREE.UV(u,k));p.push(t)}var z=this,D=0,C,E=[],J=[],O,K,H,F,T,G,M,L,P,n,X,la,R,ga,Z,da,ca,ha,ka,$,U,W,ja,ia,ma;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,f,c);C={signature:b.substr(D,8),header_bytes:t(b,D+8),vertex_coordinate_bytes:t(b,D+9),normal_coordinate_bytes:t(b,D+10),uv_coordinate_bytes:t(b,D+11),vertex_index_bytes:t(b,D+12),normal_index_bytes:t(b,D+13),uv_index_bytes:t(b,D+14),material_index_bytes:t(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4),nuvs:h(b, +D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=C.header_bytes;O=C.vertex_index_bytes;K=C.vertex_index_bytes*2;H=C.vertex_index_bytes*3;F=C.vertex_index_bytes*3+C.material_index_bytes;T=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;G=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;M=C.vertex_index_bytes; +L=C.vertex_index_bytes*2;P=C.vertex_index_bytes*3;n=C.vertex_index_bytes*4;X=C.vertex_index_bytes*4+C.material_index_bytes;la=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;R=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ga=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;Z=C.uv_index_bytes;da=C.uv_index_bytes*2;ca=C.uv_index_bytes;ha=C.uv_index_bytes*2;ka=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;ma=C.vertex_index_bytes* +4+C.material_index_bytes;$=C.ntri_flat*c;U=C.ntri_smooth*(c+C.normal_index_bytes*3);W=C.ntri_flat_uv*(c+C.uv_index_bytes*3);ja=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ia=C.nquad_flat*ma;c=C.nquad_smooth*(ma+C.normal_index_bytes*4);ma=C.nquad_flat_uv*(ma+C.uv_index_bytes*4);D+=function(c){for(var f,h,k,m=C.vertex_coordinate_bytes*3,n=c+C.nvertices*m;c1&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,Y);object.name=u;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;Q.scene.addObject(object);Q.objects[u]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(b)); -if(D.castsShadow)b=new THREE.ShadowVolume(O),Q.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},Q.triggers[object.name]=b)}}else C=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], -s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,Q.scene.addObject(object),Q.objects[u]=object,Q.empties[u]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},Q.triggers[object.name]=b)}function p(b){return function(c){Q.geometries[b]=c;m();S-=1;e.onLoadComplete();t()}}function o(b){return function(c){Q.geometries[b]=c}}function t(){e.callbackProgress({totalModels:V,totalTextures:fa,loadedModels:V-S,loadedTextures:fa-n},Q);e.onLoadProgress();S==0&&n==0&&c(Q)} -var v,w,u,y,x,B,z,D,C,E,J,O,K,I,F,Y,G,M,L,S,n,V,fa,Q;M=b.data;F=new THREE.BinaryLoader;L=new THREE.JSONLoader;n=S=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in M.objects)if(D=M.objects[u],D.meshCollider){b=!0;break}if(b)Q.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;E=M.transform.rotation;var da=M.transform.scale;b&&Q.scene.position.set(b[0],b[1],b[2]);E&&Q.scene.rotation.set(E[0], -E[1],E[2]);da&&Q.scene.scale.set(da[0],da[1],da[2]);(b||E||da)&&Q.scene.updateMatrix()}b=function(){n-=1;t();e.onLoadComplete()};for(x in M.cameras){E=M.cameras[x];if(E.type=="perspective")K=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")K=new THREE.Camera,K.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);C=E.position;E=E.target;K.position.set(C[0],C[1],C[2]);K.target.position.set(E[0],E[1],E[2]);Q.cameras[x]=K}for(y in M.lights)x=M.lights[y], -K=x.color!==void 0?x.color:16777215,E=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,G=new THREE.DirectionalLight(K,E),G.position.set(C[0],C[1],C[2]),G.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,G=new THREE.PointLight(K,E,d),G.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(G=new THREE.AmbientLight(K)),Q.scene.addLight(G),Q.lights[y]=G;for(B in M.fogs)y=M.fogs[B],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0, -y.density)),E=y.color,I.color.setRGB(E[0],E[1],E[2]),Q.fogs[B]=I;if(Q.cameras&&M.defaults.camera)Q.currentCamera=Q.cameras[M.defaults.camera];if(Q.fogs&&M.defaults.fog)Q.scene.fog=Q.fogs[M.defaults.fog];E=M.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(E[0],E[1],E[2]);Q.bgColorAlpha=M.defaults.bgalpha;for(v in M.geometries)if(B=M.geometries[v],B.type=="bin_mesh"||B.type=="ascii_mesh")S+=1,e.onLoadStart();V=S;for(v in M.geometries)B=M.geometries[v],B.type=="cube"?(O=new THREE.CubeGeometry(B.width, -B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),Q.geometries[v]=O):B.type=="plane"?(O=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),Q.geometries[v]=O):B.type=="sphere"?(O=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),Q.geometries[v]=O):B.type=="cylinder"?(O=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),Q.geometries[v]=O):B.type=="torus"?(O=new THREE.TorusGeometry(B.radius, -B.tube,B.segmentsR,B.segmentsT),Q.geometries[v]=O):B.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(B.subdivisions),Q.geometries[v]=O):B.type=="bin_mesh"?F.load({model:f(B.url,M.urlBaseType),callback:p(v)}):B.type=="ascii_mesh"?L.load({model:f(B.url,M.urlBaseType),callback:p(v)}):B.type=="embedded_mesh"&&(B=M.embeds[B.id])&&L.createModel(B,o(v),"");for(z in M.textures)if(v=M.textures[z],v.url instanceof Array){n+=v.url.length;for(F=0;F1&&(T=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,T);object.name=v;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;R.scene.addObject(object);R.objects[v]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),R.scene.collisions.colliders.push(b)); +if(D.castsShadow)b=new THREE.ShadowVolume(O),R.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},R.triggers[object.name]=b)}}else C=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], +s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,R.scene.addObject(object),R.objects[v]=object,R.empties[v]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},R.triggers[object.name]=b)}function p(b){return function(c){R.geometries[b]=c;m();P-=1;e.onLoadComplete();t()}}function o(b){return function(c){R.geometries[b]=c}}function t(){e.callbackProgress({totalModels:X,totalTextures:la,loadedModels:X-P,loadedTextures:la-n},R);e.onLoadProgress();P==0&&n==0&&c(R)} +var u,w,v,y,x,B,z,D,C,E,J,O,K,H,F,T,G,M,L,P,n,X,la,R;M=b.data;F=new THREE.BinaryLoader;L=new THREE.JSONLoader;n=P=0;R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in M.objects)if(D=M.objects[v],D.meshCollider){b=!0;break}if(b)R.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;E=M.transform.rotation;var ga=M.transform.scale;b&&R.scene.position.set(b[0],b[1],b[2]);E&&R.scene.rotation.set(E[0], +E[1],E[2]);ga&&R.scene.scale.set(ga[0],ga[1],ga[2]);(b||E||ga)&&R.scene.updateMatrix()}b=function(){n-=1;t();e.onLoadComplete()};for(x in M.cameras){E=M.cameras[x];if(E.type=="perspective")K=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")K=new THREE.Camera,K.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);C=E.position;E=E.target;K.position.set(C[0],C[1],C[2]);K.target.position.set(E[0],E[1],E[2]);R.cameras[x]=K}for(y in M.lights)x=M.lights[y], +K=x.color!==void 0?x.color:16777215,E=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,G=new THREE.DirectionalLight(K,E),G.position.set(C[0],C[1],C[2]),G.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,G=new THREE.PointLight(K,E,d),G.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(G=new THREE.AmbientLight(K)),R.scene.addLight(G),R.lights[y]=G;for(B in M.fogs)y=M.fogs[B],y.type=="linear"?H=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(H=new THREE.FogExp2(0, +y.density)),E=y.color,H.color.setRGB(E[0],E[1],E[2]),R.fogs[B]=H;if(R.cameras&&M.defaults.camera)R.currentCamera=R.cameras[M.defaults.camera];if(R.fogs&&M.defaults.fog)R.scene.fog=R.fogs[M.defaults.fog];E=M.defaults.bgcolor;R.bgColor=new THREE.Color;R.bgColor.setRGB(E[0],E[1],E[2]);R.bgColorAlpha=M.defaults.bgalpha;for(u in M.geometries)if(B=M.geometries[u],B.type=="bin_mesh"||B.type=="ascii_mesh")P+=1,e.onLoadStart();X=P;for(u in M.geometries)B=M.geometries[u],B.type=="cube"?(O=new THREE.CubeGeometry(B.width, +B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),R.geometries[u]=O):B.type=="plane"?(O=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),R.geometries[u]=O):B.type=="sphere"?(O=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),R.geometries[u]=O):B.type=="cylinder"?(O=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),R.geometries[u]=O):B.type=="torus"?(O=new THREE.TorusGeometry(B.radius, +B.tube,B.segmentsR,B.segmentsT),R.geometries[u]=O):B.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(B.subdivisions),R.geometries[u]=O):B.type=="bin_mesh"?F.load({model:f(B.url,M.urlBaseType),callback:p(u)}):B.type=="ascii_mesh"?L.load({model:f(B.url,M.urlBaseType),callback:p(u)}):B.type=="embedded_mesh"&&(B=M.embeds[B.id])&&L.createModel(B,o(u),"");for(z in M.textures)if(u=M.textures[z],u.url instanceof Array){n+=u.url.length;for(F=0;F=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,j=0;j>1^-(m&1);e[8*j+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=j=0;h=this.maxCount-3&&m(this)};this.begin=function(){this.count=0; -this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(p=this.size-1);var w=Math.floor(o-m);w<1&&(w=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var u=Math.floor(t-m);u<1&&(u=1);m=Math.floor(t+m);m>this.size-1&&(m=this.size- -1);for(var y,x,B,z,D,C;v0&&(this.field[B+y]+=z)}}};this.addPlaneX=function(b,c){var h,k,j,m,p,o=this.size,t=this.yd,v=this.zd,w=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(h=0;h0)for(k=0;kt&&(y=t);for(k=0;k0){p=k*v;for(h=0;hsize&&(dist=size);for(j=0;j0){p=zd*j;for(k=0;kthis.size-1&&(p=this.size-1);var w=Math.floor(o-m);w<1&&(w=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var v=Math.floor(t-m);v<1&&(v=1);m=Math.floor(t+m);m>this.size-1&&(m=this.size- +1);for(var y,x,B,z,D,C;u0&&(this.field[B+y]+=z)}}};this.addPlaneX=function(b,c){var h,k,j,m,p,o=this.size,t=this.yd,u=this.zd,w=this.field,v=o*Math.sqrt(b/c);v>o&&(v=o);for(h=0;h0)for(k=0;kt&&(y=t);for(k=0;k0){p=k*u;for(h=0;hsize&&(dist=size);for(j=0;j0){p=zd*j;for(k=0;kc.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c}; THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,k=new THREE.Camera,j=new THREE.Matrix4,m=new THREE.Matrix4,p,o,t;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},v=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z= -2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:v},mapRight:{type:"t",value:1,texture:w}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); -var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);v.width=b;v.height=f;w.width=b;w.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||o!==e.near||t!==e.fov){p=e.aspect;o=e.near;t=e.fov;var z=e.projectionMatrix.clone(),D=125/30*0.5,C=D*o/125,E=o*Math.tan(t*Math.PI/360),J;j.n14=D;m.n14=-D;D=-E*p+C;J=E*p+C;z.n11=2*o/(J-D);z.n13=(J+D)/(J-D);h.projectionMatrix=z.clone();D=-E*p-C;J=E*p-C;z.n11=2*o/(J-D); -z.n13=(J+D)/(J-D);k.projectionMatrix=z.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(m);h.update(null,!0);h.position.copy(e.position);h.near=o;h.far=e.far;f.call(c,b,h,v,!0);k.matrix=e.matrixWorld.clone().multiplySelf(j);k.update(null,!0);k.position.copy(e.position);k.near=o;k.far=e.far;f.call(c,b,k,w,!0);f.call(c,y,u)}}; +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,k=new THREE.Camera,j=new THREE.Matrix4,m=new THREE.Matrix4,p,o,t;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z= +2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:w}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); +var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;w.width=b;w.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||o!==e.near||t!==e.fov){p=e.aspect;o=e.near;t=e.fov;var z=e.projectionMatrix.clone(),D=125/30*0.5,C=D*o/125,E=o*Math.tan(t*Math.PI/360),J;j.n14=D;m.n14=-D;D=-E*p+C;J=E*p+C;z.n11=2*o/(J-D);z.n13=(J+D)/(J-D);h.projectionMatrix=z.clone();D=-E*p-C;J=E*p-C;z.n11=2*o/(J-D); +z.n13=(J+D)/(J-D);k.projectionMatrix=z.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(m);h.update(null,!0);h.position.copy(e.position);h.near=o;h.far=e.far;f.call(c,b,h,u,!0);k.matrix=e.matrixWorld.clone().multiplySelf(j);k.update(null,!0);k.position.copy(e.position);k.near=o;k.far=e.far;f.call(c,b,k,w,!0);f.call(c,y,v)}}; if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,k,j=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;k=f};this.render=function(b,e){this.clear();j.fov=e.fov;j.aspect=0.5*e.aspect;j.near=e.near;j.far=e.far; j.updateProjectionMatrix();j.position.copy(e.position);j.target.position.copy(e.target.position);j.translateX(c.separation);m.projectionMatrix=j.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,h,k);f.call(c,b,j);this.setViewport(h,0,h,k);f.call(c,b,m,!1)}}; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index 4d63a7fc..7a515190 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -16,36 +16,36 @@ b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;thi normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b.matrixWorld.getPosition());if(e==null||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b.matrixWorld.getPosition());if(e==null||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x, -Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,r,p,n,q,s,w,C=b.geometry,y=C.vertices,F=[],e=0;for(j=C.faces.length;e0:q<0)))if(q=n.dot((new THREE.Vector3).sub(k,s))/q,s=s.addSelf(w.multiplyScalar(q)),h instanceof THREE.Face3)d(s,k,m,r)&&(h={distance:this.origin.distanceTo(s),point:s,face:h,object:b},F.push(h));else if(h instanceof THREE.Face4&&(d(s,k,m,p)||d(s,m,r,p)))h={distance:this.origin.distanceTo(s),point:s,face:h,object:b},F.push(h);F.sort(function(b,c){return b.distance-c.distance});return F}else return[]}}; -THREE.Rectangle=function(){function b(){h=e-c;k=j-d}var c,d,e,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return j};this.set=function(h,k,n,q){m=!1;c=h;d=k;e=n;j=q;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,e=h,j=k):(c=ch?e:h,j=j>k?j:k);b()};this.add3Points= -function(h,k,n,q,s,w){m?(m=!1,c=hn?h>s?h:s:n>s?n:s,j=k>q?k>w?k:w:q>w?q:w):(c=hn?h>s?h>e?h:e:s>e?s:e:n>s?n>e?n:e:s>e?s:e,j=k>q?k>w?k>j?k:j:w>j?w:j:q>w?q>j?q:j:w>j?w:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),e=h.getRight(),j=h.getBottom()):(c=ch.getRight()?e:h.getRight(),j=j> +Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,r,n,q,s,u,v,B=b.geometry,y=B.vertices,E=[],e=0;for(j=B.faces.length;e0:s<0)))if(s=q.dot((new THREE.Vector3).sub(k,u))/s,u=u.addSelf(v.multiplyScalar(s)),h instanceof THREE.Face3)d(u,k,m,r)&&(h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},E.push(h));else if(h instanceof THREE.Face4&&(d(u,k,m,n)||d(u,m,r,n)))h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},E.push(h);E.sort(function(b,c){return b.distance-c.distance});return E}else return[]}}; +THREE.Rectangle=function(){function b(){h=e-c;k=j-d}var c,d,e,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return j};this.set=function(h,k,q,s){m=!1;c=h;d=k;e=q;j=s;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,e=h,j=k):(c=ch?e:h,j=j>k?j:k);b()};this.add3Points= +function(h,k,q,s,u,v){m?(m=!1,c=hq?h>u?h:u:q>u?q:u,j=k>s?k>v?k:v:s>v?s:v):(c=hq?h>u?h>e?h:e:u>e?u:e:q>u?q>e?q:e:u>e?u:e,j=k>s?k>v?k>j?k:j:v>j?v:j:s>v?s>j?s:j:v>j?v:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),e=h.getRight(),j=h.getBottom()):(c=ch.getRight()?e:h.getRight(),j=j> h.getBottom()?j:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;e+=h;j+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e=0&&Math.min(j,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){m=!0;j=e=d=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,j,h,k,m,r,p,n,q,s,w,C,y){this.set(b||1,c||0,d||0,e||0,j||0,h||1,k||0,m||0,r||0,p||0,n||1,q||0,s||0,w||0,C||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,j,h,k,m,r,p,n,q,s,w,C,y){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=r;this.n32=p;this.n33=n;this.n34=q;this.n41=s;this.n42=w;this.n43=C;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, +THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,j,h,k,m,r,n,q,s,u,v,B,y){this.set(b||1,c||0,d||0,e||0,j||0,h||1,k||0,m||0,r||0,n||0,q||1,s||0,u||0,v||0,B||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,j,h,k,m,r,n,q,s,u,v,B,y){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=r;this.n32=n;this.n33=q;this.n34=s;this.n41=u;this.n42=v;this.n43=B;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, c,d){var e=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;e.cross(d,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(d,h).normalize());j.cross(h,e).normalize();this.n11=e.x;this.n12=j.x;this.n13=h.x;this.n21=e.y;this.n22=j.y;this.n23=h.y;this.n31=e.z;this.n32=j.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,j=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*j; b.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*j;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*j;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,j=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*j;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*j;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*j;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*j;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+ -d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,p=b.n24,n=b.n31,q=b.n32,s=b.n33,w=b.n34,C=b.n41,y=b.n42,F=b.n43,L=b.n44,xa=c.n11,ya= -c.n12,ka=c.n13,oa=c.n14,R=c.n21,M=c.n22,v=c.n23,U=c.n24,N=c.n31,Z=c.n32,S=c.n33,V=c.n34,H=c.n41,f=c.n42,ua=c.n43,Fa=c.n44;this.n11=d*xa+e*R+j*N+h*H;this.n12=d*ya+e*M+j*Z+h*f;this.n13=d*ka+e*v+j*S+h*ua;this.n14=d*oa+e*U+j*V+h*Fa;this.n21=k*xa+m*R+r*N+p*H;this.n22=k*ya+m*M+r*Z+p*f;this.n23=k*ka+m*v+r*S+p*ua;this.n24=k*oa+m*U+r*V+p*Fa;this.n31=n*xa+q*R+s*N+w*H;this.n32=n*ya+q*M+s*Z+w*f;this.n33=n*ka+q*v+s*S+w*ua;this.n34=n*oa+q*U+s*V+w*Fa;this.n41=C*xa+y*R+F*N+L*H;this.n42=C*ya+y*M+F*Z+L*f;this.n43= -C*ka+y*v+F*S+L*ua;this.n44=C*oa+y*U+F*V+L*Fa;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*= -b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,r=this.n31,p=this.n32,n=this.n33,q=this.n34,s=this.n41,w=this.n42,C=this.n43,y=this.n44;return e*k*p*s-d*m*p*s-e*h*n*s+c*m*n*s+d*h*q*s-c*k*q*s-e*k*r*w+d*m*r*w+e*j*n*w-b*m*n*w-d*j*q*w+b*k*q*w+e*h*r*C-c*m*r*C-e*j*p*C+b*m*p*C+c*j*q*C-b*h*q*C-d*h*r*y+c*k* -r*y+d*j*p*y-b*k*p*y-c*j*n*y+b*h*n*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32; +d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,n=b.n24,q=b.n31,s=b.n32,u=b.n33,v=b.n34,B=b.n41,y=b.n42,E=b.n43,K=b.n44,wa=c.n11,xa= +c.n12,ja=c.n13,na=c.n14,R=c.n21,L=c.n22,w=c.n23,T=c.n24,M=c.n31,Y=c.n32,S=c.n33,U=c.n34,I=c.n41,f=c.n42,ta=c.n43,Ea=c.n44;this.n11=d*wa+e*R+j*M+h*I;this.n12=d*xa+e*L+j*Y+h*f;this.n13=d*ja+e*w+j*S+h*ta;this.n14=d*na+e*T+j*U+h*Ea;this.n21=k*wa+m*R+r*M+n*I;this.n22=k*xa+m*L+r*Y+n*f;this.n23=k*ja+m*w+r*S+n*ta;this.n24=k*na+m*T+r*U+n*Ea;this.n31=q*wa+s*R+u*M+v*I;this.n32=q*xa+s*L+u*Y+v*f;this.n33=q*ja+s*w+u*S+v*ta;this.n34=q*na+s*T+u*U+v*Ea;this.n41=B*wa+y*R+E*M+K*I;this.n42=B*xa+y*L+E*Y+K*f;this.n43= +B*ja+y*w+E*S+K*ta;this.n44=B*na+y*T+E*U+K*Ea;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*= +b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,r=this.n31,n=this.n32,q=this.n33,s=this.n34,u=this.n41,v=this.n42,B=this.n43,y=this.n44;return e*k*n*u-d*m*n*u-e*h*q*u+c*m*q*u+d*h*s*u-c*k*s*u-e*k*r*v+d*m*r*v+e*j*q*v-b*m*q*v-d*j*s*v+b*k*s*v+e*h*r*B-c*m*r*B-e*j*n*B+b*m*n*B+c*j*s*B-b*h*s*B-d*h*r*y+c*k* +r*y+d*j*n*y-b*k*n*y-c*j*q*y+b*h*q*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32; b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]= this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]= this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0, -0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),j=1-d,h=b.x,k=b.y,m=b.z,r=j*h,p=j*k;this.set(r*h+d,r*k-e*m,r*m+e*k,0,r*k+e*m,p*k+d,p*m-e*h,0,r*m-e*k,p*m+e*h,j*m*m+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= +0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),j=1-d,h=b.x,k=b.y,m=b.z,r=j*h,n=j*k;this.set(r*h+d,r*k-e*m,r*m+e*k,0,r*k+e*m,n*k+d,n*m-e*h,0,r*m-e*k,n*m+e*h,j*m*m+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,e=b.y,j=b.z,h=Math.cos(d),d=Math.sin(d),k=Math.cos(e),e=Math.sin(e),m=Math.cos(j),j=Math.sin(j);switch(c){case "YXZ":var r= -k*m,p=k*j,n=e*m,q=e*j;this.n11=r+q*d;this.n12=n*d-p;this.n13=h*e;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=p*d-n;this.n32=q+r*d;this.n33=h*k;break;case "ZXY":r=k*m;p=k*j;n=e*m;q=e*j;this.n11=r-q*d;this.n12=-h*j;this.n13=n+p*d;this.n21=p+n*d;this.n22=h*m;this.n23=q-r*d;this.n31=-h*e;this.n32=d;this.n33=h*k;break;case "ZYX":r=h*m;p=h*j;n=d*m;q=d*j;this.n11=k*m;this.n12=n*e-p;this.n13=r*e+q;this.n21=k*j;this.n22=q*e+r;this.n23=p*e-n;this.n31=-e;this.n32=d*k;this.n33=h*k;break;case "YZX":r=h*k;p= -h*e;n=d*k;q=d*e;this.n11=k*m;this.n12=q-r*j;this.n13=n*j+p;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-e*m;this.n32=p*j+n;this.n33=r-q*j;break;case "XZY":r=h*k;p=h*e;n=d*k;q=d*e;this.n11=k*m;this.n12=-j;this.n13=e*m;this.n21=r*j+q;this.n22=h*m;this.n23=p*j-n;this.n31=n*j-p;this.n32=d*m;this.n33=q*j+r;break;default:r=h*m,p=h*j,n=d*m,q=d*j,this.n11=k*m,this.n12=-k*j,this.n13=e,this.n21=p+n*e,this.n22=r-q*e,this.n23=-d*k,this.n31=q-r*e,this.n32=n+p*e,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c= -b.x,d=b.y,e=b.z,j=b.w,h=c+c,k=d+d,m=e+e,b=c*h,r=c*k;c*=m;var p=d*k;d*=m;e*=m;h*=j;k*=j;j*=m;this.n11=1-(p+e);this.n12=r-j;this.n13=c+k;this.n21=r+j;this.n22=1-(b+e);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var e=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2; +k*m,n=k*j,q=e*m,s=e*j;this.n11=r+s*d;this.n12=q*d-n;this.n13=h*e;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=n*d-q;this.n32=s+r*d;this.n33=h*k;break;case "ZXY":r=k*m;n=k*j;q=e*m;s=e*j;this.n11=r-s*d;this.n12=-h*j;this.n13=q+n*d;this.n21=n+q*d;this.n22=h*m;this.n23=s-r*d;this.n31=-h*e;this.n32=d;this.n33=h*k;break;case "ZYX":r=h*m;n=h*j;q=d*m;s=d*j;this.n11=k*m;this.n12=q*e-n;this.n13=r*e+s;this.n21=k*j;this.n22=s*e+r;this.n23=n*e-q;this.n31=-e;this.n32=d*k;this.n33=h*k;break;case "YZX":r=h*k;n= +h*e;q=d*k;s=d*e;this.n11=k*m;this.n12=s-r*j;this.n13=q*j+n;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-e*m;this.n32=n*j+q;this.n33=r-s*j;break;case "XZY":r=h*k;n=h*e;q=d*k;s=d*e;this.n11=k*m;this.n12=-j;this.n13=e*m;this.n21=r*j+s;this.n22=h*m;this.n23=n*j-q;this.n31=q*j-n;this.n32=d*m;this.n33=s*j+r;break;default:r=h*m,n=h*j,q=d*m,s=d*j,this.n11=k*m,this.n12=-k*j,this.n13=e,this.n21=n+q*e,this.n22=r-s*e,this.n23=-d*k,this.n31=s-r*e,this.n32=q+n*e,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c= +b.x,d=b.y,e=b.z,j=b.w,h=c+c,k=d+d,m=e+e,b=c*h,r=c*k;c*=m;var n=d*k;d*=m;e*=m;h*=j;k*=j;j*=m;this.n11=1-(n+e);this.n12=r-j;this.n13=c+k;this.n21=r+j;this.n22=1-(b+e);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var e=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2; e.identity();e.setRotationFromQuaternion(c);j.setScale(d.x,d.y,d.z);this.multiply(e,j);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var e=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);j.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=e.length(); d.y=j.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=d.x;e.n21/=d.x;e.n31/=d.x;e.n12/=d.y;e.n22/=d.y;e.n32/=d.y;e.n13/=d.z;e.n23/=d.z;e.n33/=d.z;c.setFromRotationMatrix(e);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,j=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*j;this.n23= b.n23*j;this.n33=b.n33*j}}; -THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,p=b.n24,n=b.n31,q=b.n32,s=b.n33,w=b.n34,C=b.n41,y=b.n42,F=b.n43,L=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=r*w*y-p*s*y+p*q*F-m*w*F-r*q*L+m*s*L;c.n12=h*s*y-j*w*y-h*q*F+e*w*F+j*q*L-e*s*L;c.n13=j*p*y-h*r*y+h*m*F-e*p*F-j*m*L+e*r*L;c.n14=h*r*q-j*p*q-h*m*s+e*p*s+j*m*w-e*r*w;c.n21=p*s*C-r*w*C-p*n*F+k*w*F+r*n*L-k*s*L;c.n22=j*w*C-h*s*C+h*n*F-d*w*F-j*n*L+d*s*L;c.n23=h*r*C-j*p*C-h*k*F+d*p*F+j*k*L-d*r*L;c.n24= -j*p*n-h*r*n+h*k*s-d*p*s-j*k*w+d*r*w;c.n31=m*w*C-p*q*C+p*n*y-k*w*y-m*n*L+k*q*L;c.n32=h*q*C-e*w*C-h*n*y+d*w*y+e*n*L-d*q*L;c.n33=j*p*C-h*m*C+h*k*y-d*p*y-e*k*L+d*m*L;c.n34=h*m*n-e*p*n-h*k*q+d*p*q+e*k*w-d*m*w;c.n41=r*q*C-m*s*C-r*n*y+k*s*y+m*n*F-k*q*F;c.n42=e*s*C-j*q*C+j*n*y-d*s*y-e*n*F+d*q*F;c.n43=j*m*C-e*r*C-j*k*y+d*r*y+e*k*F-d*m*F;c.n44=e*r*n-j*m*n+j*k*q-d*r*q-e*k*s+d*m*s;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,r=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,q=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*k+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*r;d[6]=b*p;d[7]=b*n;d[8]=b*q;return c}; +THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,n=b.n24,q=b.n31,s=b.n32,u=b.n33,v=b.n34,B=b.n41,y=b.n42,E=b.n43,K=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=r*v*y-n*u*y+n*s*E-m*v*E-r*s*K+m*u*K;c.n12=h*u*y-j*v*y-h*s*E+e*v*E+j*s*K-e*u*K;c.n13=j*n*y-h*r*y+h*m*E-e*n*E-j*m*K+e*r*K;c.n14=h*r*s-j*n*s-h*m*u+e*n*u+j*m*v-e*r*v;c.n21=n*u*B-r*v*B-n*q*E+k*v*E+r*q*K-k*u*K;c.n22=j*v*B-h*u*B+h*q*E-d*v*E-j*q*K+d*u*K;c.n23=h*r*B-j*n*B-h*k*E+d*n*E+j*k*K-d*r*K;c.n24= +j*n*q-h*r*q+h*k*u-d*n*u-j*k*v+d*r*v;c.n31=m*v*B-n*s*B+n*q*y-k*v*y-m*q*K+k*s*K;c.n32=h*s*B-e*v*B-h*q*y+d*v*y+e*q*K-d*s*K;c.n33=j*n*B-h*m*B+h*k*y-d*n*y-e*k*K+d*m*K;c.n34=h*m*q-e*n*q-h*k*s+d*n*s+e*k*v-d*m*v;c.n41=r*s*B-m*u*B-r*q*y+k*u*y+m*q*E-k*s*E;c.n42=e*u*B-j*s*B+j*q*y-d*u*y-e*q*E+d*s*E;c.n43=j*m*B-e*r*B-j*k*y+d*r*y+e*k*E-d*m*E;c.n44=e*r*q-j*m*q+j*k*s-d*r*s-e*k*u+d*m*u;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,r=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,s=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*k+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*r;d[6]=b*n;d[7]=b*q;d[8]=b*s;return c}; THREE.Matrix4.makeFrustum=function(b,c,d,e,j,h){var k;k=new THREE.Matrix4;k.n11=2*j/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*j/(e-d);k.n23=(e+d)/(e-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+j)/(h-j);k.n34=-2*h*j/(h-j);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,d,e){var j,b=d*Math.tan(b*Math.PI/360);j=-b;return THREE.Matrix4.makeFrustum(j*c,b*c,j,b,d,e)}; -THREE.Matrix4.makeOrtho=function(b,c,d,e,j,h){var k,m,r,p;k=new THREE.Matrix4;m=c-b;r=d-e;p=h-j;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/r;k.n23=0;k.n24=-((d+e)/r);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((h+j)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; +THREE.Matrix4.makeOrtho=function(b,c,d,e,j,h){var k,m,r,n;k=new THREE.Matrix4;m=c-b;r=d-e;n=h-j;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/r;k.n23=0;k.n24=-((d+e)/r);k.n31=0;k.n32=0;k.n33=-2/n;k.n34=-((h+j)/n);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)=== @@ -55,8 +55,8 @@ this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matri THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,e=b.y*c,j=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-j),j=Math.sin(-j),h=Math.cos(d),d=Math.sin(d),k=b*c,m=e*j;this.w=k*h-m*d;this.x=k*d+m*h;this.y=e*c*h+b*j*d;this.z=b*j*h-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d); this.x=b.x*e;this.y=b.y*e;this.z=b.z*e;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c= -this.x,d=this.y,e=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-e*k;this.y=d*b+j*k+e*h-c*m;this.z=e*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-e*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,j=b.z,h=this.x,k=this.y,m=this.z,r=this.w,p=r*d+k*j-m*e,n=r*e+m*d-h*j,q=r*j+h*e-k*d,d=-h* -d-k*e-m*j;c.x=p*r+d*-h+n*-m-q*-k;c.y=n*r+d*-k+q*-h-p*-m;c.z=q*r+d*-m+p*-k-n*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,e){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;d.w=b.w*j+c.w*e;d.x=b.x*j+c.x*e;d.y=b.y*j+c.y*e;d.z=b.z*j+c.z*e;return d}; +this.x,d=this.y,e=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-e*k;this.y=d*b+j*k+e*h-c*m;this.z=e*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-e*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,j=b.z,h=this.x,k=this.y,m=this.z,r=this.w,n=r*d+k*j-m*e,q=r*e+m*d-h*j,s=r*j+h*e-k*d,d=-h* +d-k*e-m*j;c.x=n*r+d*-h+q*-m-s*-k;c.y=q*r+d*-k+s*-h-n*-m;c.z=s*r+d*-m+n*-k-q*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,e){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;d.w=b.w*j+c.w*e;d.x=b.x*j+c.x*e;d.y=b.y*j+c.y*e;d.z=b.z*j+c.z*e;return d}; THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,e,j,h){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,c,d,e,j,h,k){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; @@ -65,17 +65,17 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function() d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,j,h,k,m=new THREE.Vector3,r=new THREE.Vector3;e=0;for(j=this.faces.length;e0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;cthis.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];n=this.points[d[1]]; -q=this.points[d[2]];s=this.points[d[3]];m=k*k;r=k*m;e.x=c(p.x,n.x,q.x,s.x,k,m,r);e.y=c(p.y,n.y,q.y,s.y,k,m,r);e.z=c(p.z,n.z,q.z,s.z,k,m,r);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;bthis.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;n=this.points[d[0]];q=this.points[d[1]]; +s=this.points[d[2]];u=this.points[d[3]];m=k*k;r=k*m;e.x=c(n.x,q.x,s.x,u.x,k,m,r);e.y=c(n.y,q.y,s.y,u.y,k,m,r);e.z=c(n.z,q.z,s.z,u.z,k,m,r);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;b=0&&j>=0&&h>=0&&k>=0?!0:e<0&&j<0||h<0&&k<0?!1:(e<0?f=Math.max(f,e/(e-j)):j<0&&(d=Math.min(d,e/(e-j))),h<0?f=Math.max(f,h/(h-k)):k<0&&(d=Math.min(d,h/(h-k))),dh&&k.positionScreen.z0&&M.z<1))za=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,L=za,L.x=M.x/M.w,L.y=M.y/M.w,L.z=M.z,L.rotation=Q.rotation.z,L.scale.x=Q.scale.x*Math.abs(L.x- -(M.x+j.projectionMatrix.n11)/(M.w+j.projectionMatrix.n14)),L.scale.y=Q.scale.y*Math.abs(L.y-(M.y+j.projectionMatrix.n22)/(M.w+j.projectionMatrix.n24)),L.materials=Q.materials,oa.push(L);f&&oa.sort(c);return oa}}; +THREE.Projector=function(){function b(){var b=r[m]=r[m]||new THREE.RenderableVertex;m++;return b}function c(b,c){return c.z-b.z}function d(b,c){var f=0,d=1,e=b.z+b.w,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return e>=0&&j>=0&&h>=0&&k>=0?!0:e<0&&j<0||h<0&&k<0?!1:(e<0?f=Math.max(f,e/(e-j)):j<0&&(d=Math.min(d,e/(e-j))),h<0?f=Math.max(f,h/(h-k)):k<0&&(d=Math.min(d,h/(h-k))),dh&&k.positionScreen.z0&&L.z<1))ya=xa[wa]=xa[wa]||new THREE.RenderableParticle,wa++,K=ya,K.x=L.x/L.w,K.y=L.y/L.w,K.z=L.z,K.rotation=Q.rotation.z,K.scale.x=Q.scale.x*Math.abs(K.x- +(L.x+j.projectionMatrix.n11)/(L.w+j.projectionMatrix.n14)),K.scale.y=Q.scale.y*Math.abs(K.y-(L.y+j.projectionMatrix.n22)/(L.w+j.projectionMatrix.n24)),K.materials=Q.materials,na.push(K);f&&na.sort(c);return na}}; THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif", envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif", @@ -174,119 +174,119 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_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;", THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex, "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}}; -THREE.WebGLRenderer=function(b){function c(b,c,d){var e,j,h,k=b.vertices,B=k.length,m=b.colors,T=m.length,p=b.__vertexArray,D=b.__colorArray,r=b.__sortArray,q=b.__dirtyVertices,n=b.__dirtyColors,s=b.__webglCustomAttributes,v,u;if(s)for(v in s)s[v].offset=0;if(d.sortParticles){sa.multiplySelf(d.matrixWorld);for(e=0;e=0)f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position, -3,f.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0)):c.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var e=0,B=k.morphTargetForcedOrder,p=k.morphTargetInfluences;er&&(E=D,r=p[E]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[E]);f.vertexAttribPointer(c["morphTarget"+e],3,f.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[e]=r;B[E]=1;r= +THREE.WebGLRenderer=function(b){function c(b,c,d){var e,j,h,k=b.vertices,m=k.length,G=b.colors,H=G.length,D=b.__vertexArray,n=b.__colorArray,r=b.__sortArray,s=b.__dirtyVertices,q=b.__dirtyColors,u=b.__webglCustomAttributes,w,p;if(u)for(w in u)u[w].offset=0;if(d.sortParticles){ra.multiplySelf(d.matrixWorld);for(e=0;e=0)f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position, +3,f.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0)):c.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var e=0,n=k.morphTargetForcedOrder,G=k.morphTargetInfluences;er&&(D=s,r=G[D]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[D]);f.vertexAttribPointer(c["morphTarget"+e],3,f.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[e]=r;n[D]=1;r= -1;e++}}j.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],f.bindBuffer(f.ARRAY_BUFFER,c.buffer),f.vertexAttribPointer(b[m],c.size,f.FLOAT,!1,0,0));b.color>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer), f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUVBuffer),f.vertexAttribPointer(b.uv,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv)):f.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUV2Buffer),f.vertexAttribPointer(b.uv2,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv2)): f.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinWeightsBuffer), -f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(f.lineWidth(j.wireframeLinewidth),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.drawElements(f.LINES,h.__webglLineCount,f.UNSIGNED_SHORT,0)):(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),f.drawElements(f.TRIANGLES,h.__webglFaceCount,f.UNSIGNED_SHORT,0)),H.data.vertices+=h.__webglFaceCount,H.data.faces+=h.__webglFaceCount/3,H.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip? -f.LINE_STRIP:f.LINES,f.lineWidth(j.linewidth),f.drawArrays(k,0,h.__webglLineCount),H.data.drawCalls++):k instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,h.__webglParticleCount),H.data.drawCalls++):k instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,h.__webglVertexCount),H.data.drawCalls++)}}function j(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=f.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=f.createBuffer();b.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer), -f.bufferData(f.ARRAY_BUFFER,b.positionArray,f.DYNAMIC_DRAW),f.enableVertexAttribArray(c.attributes.position),f.vertexAttribPointer(c.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,h,j,k,m,p,r,E,D,n,q=b.count*3;for(n=0;n=0;d--)b[d].object==c&&b.splice(d,1)}function ka(b){function c(b){var e=[];d=0;for(f=b.length;d65535&&(n[m].counter+=1,p=n[m].hash+"_"+n[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[], -materials:k,vertices:0,numMorphTargets:D})),b.geometryGroups[p].faces.push(e),b.geometryGroups[p].vertices+=j}function oa(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(b){if(b!=I){switch(b){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:f.blendEquation(f.FUNC_ADD); -f.blendFunc(f.ZERO,f.SRC_COLOR);break;default:f.blendEquationSeparate(f.FUNC_ADD,f.FUNC_ADD),f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA)}I=b}}function M(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,V(c.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,V(c.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,V(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,V(c.minFilter)),f.generateMipmap(b)):(f.texParameteri(b,f.TEXTURE_WRAP_S, -f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_MAG_FILTER,S(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,S(c.minFilter)))}function v(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=f.createTexture();f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),f.UNSIGNED_BYTE,b.image.data): -f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);M(f.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function U(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=f.createRenderbuffer();b.__webglTexture=f.createTexture();if(c){f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture); -M(f.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=f.createFramebuffer(),f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=f.createFramebuffer(),f.bindTexture(f.TEXTURE_2D,b.__webglTexture),M(f.TEXTURE_2D,b,b),f.texImage2D(f.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null);f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)f.bindFramebuffer(f.FRAMEBUFFER, -b.__webglFramebuffer[d]),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&& -b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,b.width,b.height);c?f.bindTexture(f.TEXTURE_CUBE_MAP,null):f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var e,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height, -h=e=0):(c=null,d=Da,b=Ea,e=Q,h=za);c!=Ra&&(f.bindFramebuffer(f.FRAMEBUFFER,c),f.viewport(e,h,d,b),Ra=c)}function N(b){b instanceof THREE.WebGLRenderTargetCube?(f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,b.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null))}function Z(b,c){var d;b=="fragment"?d=f.createShader(f.FRAGMENT_SHADER):b=="vertex"&&(d=f.createShader(f.VERTEX_SHADER)); -f.shaderSource(d,c);f.compileShader(d);if(!f.getShaderParameter(d,f.COMPILE_STATUS))return console.error(f.getShaderInfoLog(d)),console.error(c),null;return d}function S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function V(b){switch(b){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 H=this,f,ua=[],Fa=null,Ra=null,va=!0,W=null,$=null,I=null,X=null,P=null,ma=null,ga=null,Q=0,za=0,Da=0,Ea=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, -new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Aa=new Float32Array(16),Ca=new Float32Array(16),Ka=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ya=b.stencil!==void 0?b.stencil:!0,Za=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,$a=b.antialias!==void 0?b.antialias:!1,wa=b.clearColor!==void 0?new THREE.Color(b.clearColor): -new THREE.Color(0),Ia=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ga;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var pa,La=[],b=THREE.ShaderLib.depthRGBA, -Wa=THREE.UniformsUtils.clone(b.uniforms),Qa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa}),Ua=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa,morphTargets:!0});Qa._shadowPass=!0;Ua._shadowPass=!0;try{if(!(f=Ga.getContext("experimental-webgl",{antialias:$a,stencil:Ya,preserveDrawingBuffer:Za})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+ -" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(ab){console.error(ab)}f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);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.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(wa.r,wa.g,wa.b,Ia);this.context=f;var Xa=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0, -u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);i=0;u.vertices[i++]=-1;u.vertices[i++]=-1;u.vertices[i++]=0;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=-1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=0;u.vertices[i++]=-1;u.vertices[i++]=1;u.vertices[i++]=0;i=u.vertices[i++]=0;u.faces[i++]=0;u.faces[i++]=1;u.faces[i++]=2;u.faces[i++]=0;u.faces[i++]=2;u.faces[i++]=3;u.vertexBuffer=f.createBuffer();u.elementBuffer=f.createBuffer(); -f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,u.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,u.faces,f.STATIC_DRAW);u.program=f.createProgram();f.attachShader(u.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(u.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=f.getAttribLocation(u.program,"position"); -u.attributes.uv=f.getAttribLocation(u.program,"uv");u.uniforms.uvOffset=f.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=f.getUniformLocation(u.program,"uvScale");u.uniforms.rotation=f.getUniformLocation(u.program,"rotation");u.uniforms.scale=f.getUniformLocation(u.program,"scale");u.uniforms.alignment=f.getUniformLocation(u.program,"alignment");u.uniforms.map=f.getUniformLocation(u.program,"map");u.uniforms.opacity=f.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates= -f.getUniformLocation(u.program,"useScreenCoordinates");u.uniforms.affectedByDistance=f.getUniformLocation(u.program,"affectedByDistance");u.uniforms.screenPosition=f.getUniformLocation(u.program,"screenPosition");u.uniforms.modelViewMatrix=f.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=f.getUniformLocation(u.program,"projectionMatrix");var Va=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c, -d,e){Q=b;za=c;Da=d;Ea=e;f.viewport(Q,za,Da,Ea)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){va=b;f.depthMask(b)};this.setClearColorHex=function(b,c){wa.setHex(b);Ia=c;f.clearColor(wa.r,wa.g,wa.b,Ia)};this.setClearColor=function(b,c){wa.copy(b);Ia=c;f.clearColor(wa.r,wa.g,wa.b,Ia)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT|f.STENCIL_BUFFER_BIT)}; -this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer); -f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d=0;d--)b[d].object==c&&b.splice(d,1)}function ja(b){function c(b){var e=[];d=0;for(f=b.length;d65535&&(r[m].counter+=1,n=r[m].hash+"_"+r[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[], +materials:k,vertices:0,numMorphTargets:q})),b.geometryGroups[n].faces.push(e),b.geometryGroups[n].vertices+=j;b.geometryGroupsList=[];for(var s in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[s])}function na(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(b){if(b!=C){switch(b){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO, +f.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.SRC_COLOR);break;default:f.blendEquationSeparate(f.FUNC_ADD,f.FUNC_ADD),f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA)}C=b}}function L(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,U(c.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,U(c.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,U(c.magFilter)),f.texParameteri(b, +f.TEXTURE_MIN_FILTER,U(c.minFilter)),f.generateMipmap(b)):(f.texParameteri(b,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_MAG_FILTER,S(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,S(c.minFilter)))}function w(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=f.createTexture();f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D, +0,U(b.format),b.image.width,b.image.height,0,U(b.format),f.UNSIGNED_BYTE,b.image.data):f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);L(f.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function T(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=f.createRenderbuffer(); +b.__webglTexture=f.createTexture();if(c){f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture);L(f.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=f.createFramebuffer(),f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null)}else b.__webglFramebuffer=f.createFramebuffer(),f.bindTexture(f.TEXTURE_2D,b.__webglTexture),L(f.TEXTURE_2D,b,b),f.texImage2D(f.TEXTURE_2D,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type), +null);f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer[d]),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,b.width,b.height), +f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,b.width,b.height);c?f.bindTexture(f.TEXTURE_CUBE_MAP,null):f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER, +null)}var e,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=e=0):(c=null,d=Ca,b=Da,e=Q,h=ya);c!=Sa&&(f.bindFramebuffer(f.FRAMEBUFFER,c),f.viewport(e,h,d,b),Sa=c)}function M(b){b instanceof THREE.WebGLRenderTargetCube?(f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,b.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null))} +function Y(b,c){var d;b=="fragment"?d=f.createShader(f.FRAGMENT_SHADER):b=="vertex"&&(d=f.createShader(f.VERTEX_SHADER));f.shaderSource(d,c);f.compileShader(d);if(!f.getShaderParameter(d,f.COMPILE_STATUS))return console.error(f.getShaderInfoLog(d)),console.error(c),null;return d}function S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function U(b){switch(b){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 I=this,f,ta=[],Ea= +null,Sa=null,ua=!0,V=null,Z=null,C=null,W=null,O=null,la=null,fa=null,Q=0,ya=0,Ca=0,Da=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ra=new THREE.Matrix4,za=new Float32Array(16),Ba=new Float32Array(16),Ka=new THREE.Vector4,Ua={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Za=b.stencil!==void 0? +b.stencil:!0,$a=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ab=b.antialias!==void 0?b.antialias:!1,va=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ia=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ga;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear= +1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var oa,La=[],b=THREE.ShaderLib.depthRGBA,Xa=THREE.UniformsUtils.clone(b.uniforms),Ra=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Xa}),Va=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Xa,morphTargets:!0});Ra._shadowPass=!0;Va._shadowPass=!0;try{if(!(f=Ga.getContext("experimental-webgl", +{antialias:ab,stencil:Za,preserveDrawingBuffer:$a})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(bb){console.error(bb)}f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);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.blendEquation(f.FUNC_ADD); +f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(va.r,va.g,va.b,Ia);this.context=f;var Ya=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,p={};p.vertices=new Float32Array(16);p.faces=new Uint16Array(6);i=0;p.vertices[i++]=-1;p.vertices[i++]=-1;p.vertices[i++]=0;p.vertices[i++]=1;p.vertices[i++]=1;p.vertices[i++]=-1;p.vertices[i++]=1;p.vertices[i++]=1;p.vertices[i++]=1;p.vertices[i++]=1;p.vertices[i++]=1;p.vertices[i++]=0;p.vertices[i++]=-1;p.vertices[i++]=1;p.vertices[i++]=0;i=p.vertices[i++]= +0;p.faces[i++]=0;p.faces[i++]=1;p.faces[i++]=2;p.faces[i++]=0;p.faces[i++]=2;p.faces[i++]=3;p.vertexBuffer=f.createBuffer();p.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,p.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,p.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,p.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,p.faces,f.STATIC_DRAW);p.program=f.createProgram();f.attachShader(p.program,Y("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(p.program,Y("vertex", +THREE.ShaderLib.sprite.vertexShader));f.linkProgram(p.program);p.attributes={};p.uniforms={};p.attributes.position=f.getAttribLocation(p.program,"position");p.attributes.uv=f.getAttribLocation(p.program,"uv");p.uniforms.uvOffset=f.getUniformLocation(p.program,"uvOffset");p.uniforms.uvScale=f.getUniformLocation(p.program,"uvScale");p.uniforms.rotation=f.getUniformLocation(p.program,"rotation");p.uniforms.scale=f.getUniformLocation(p.program,"scale");p.uniforms.alignment=f.getUniformLocation(p.program, +"alignment");p.uniforms.map=f.getUniformLocation(p.program,"map");p.uniforms.opacity=f.getUniformLocation(p.program,"opacity");p.uniforms.useScreenCoordinates=f.getUniformLocation(p.program,"useScreenCoordinates");p.uniforms.affectedByDistance=f.getUniformLocation(p.program,"affectedByDistance");p.uniforms.screenPosition=f.getUniformLocation(p.program,"screenPosition");p.uniforms.modelViewMatrix=f.getUniformLocation(p.program,"modelViewMatrix");p.uniforms.projectionMatrix=f.getUniformLocation(p.program, +"projectionMatrix");var Wa=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,e){Q=b;ya=c;Ca=d;Da=e;f.viewport(Q,ya,Ca,Da)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ua=b;f.depthMask(b)};this.setClearColorHex=function(b,c){va.setHex(b);Ia=c;f.clearColor(va.r,va.g,va.b,Ia)};this.setClearColor= +function(b,c){va.copy(b);Ia=c;f.clearColor(va.r,va.g,va.b,Ia)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT|f.STENCIL_BUFFER_BIT)};this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer); +f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d=0&&f.enableVertexAttribArray(r.position);r.color>=0&&f.enableVertexAttribArray(r.color);r.normal>=0&&f.enableVertexAttribArray(r.normal);r.tangent>=0&&f.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(f.enableVertexAttribArray(r.skinVertexA),f.enableVertexAttribArray(r.skinVertexB),f.enableVertexAttribArray(r.skinIndex), -f.enableVertexAttribArray(r.skinWeight));if(b.attributes)for(h in b.attributes)r[h]!==void 0&&r[h]>=0&&f.enableVertexAttribArray(r[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(f.enableVertexAttribArray(r[u]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,e){U(b);b=0;c&&(b|=f.COLOR_BUFFER_BIT);d&&(b|=f.DEPTH_BUFFER_BIT);e&&(b|=f.STENCIL_BUFFER_BIT);f.clear(b)};this.render=function(b,c,f,n){var J,u,ha,B,v,T,E,D,L=b.lights, -Pa=b.fog;this.shadowMapEnabled&&C(b,c);H.data.vertices=0;H.data.faces=0;H.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ca);c.projectionMatrix.flattenToArray(Aa);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);r(sa);this.initWebGLObjects(b);U(f);(this.autoClear||n)&&this.clear();v=b.__webglObjects.length;for(n=0;n=0;n--)if(J=b.__webglObjects[n],J.render){E=J.object;D=J.buffer;ha=J.opaque;h(E);for(J=0;J0||u.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray= -new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(w*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(C*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];u=0;for(v=m.numMorphTargets;u=0&&f.enableVertexAttribArray(p.position);p.color>=0&&f.enableVertexAttribArray(p.color);p.normal>=0&&f.enableVertexAttribArray(p.normal);p.tangent>=0&&f.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(f.enableVertexAttribArray(p.skinVertexA),f.enableVertexAttribArray(p.skinVertexB),f.enableVertexAttribArray(p.skinIndex), +f.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&f.enableVertexAttribArray(p[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(f.enableVertexAttribArray(p[v]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,e){T(b);b=0;c&&(b|=f.COLOR_BUFFER_BIT);d&&(b|=f.DEPTH_BUFFER_BIT);e&&(b|=f.STENCIL_BUFFER_BIT);f.clear(b)};this.render=function(b,c,f,q){var p,w,Fa,ga,G,H,D,K,C=b.lights, +Qa=b.fog;this.shadowMapEnabled&&B(b,c);I.data.vertices=0;I.data.faces=0;I.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ba);c.projectionMatrix.flattenToArray(za);ra.multiply(c.projectionMatrix,c.matrixWorldInverse);r(ra);this.initWebGLObjects(b);T(f);(this.autoClear||q)&&this.clear();G=b.__webglObjects.length;for(q=0;q=0;q--)if(p=b.__webglObjects[q],p.render){D=p.object;K=p.buffer;Fa=p.opaque;h(D);for(p=0;p0||u.faceVertexUvs.length>0)m.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(n*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)m.__skinVertexAArray= +new Float32Array(n*4),m.__skinVertexBArray=new Float32Array(n*4),m.__skinIndexArray=new Float32Array(n*4),m.__skinWeightArray=new Float32Array(n*4);m.__faceArray=new Uint16Array(w*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];u=0;for(v=m.numMorphTargets;u=0;j--)d[j]==e&&d.splice(j,1)}else e instanceof THREE.MarchingCubes&&ya(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglColorBuffer), -f.bufferData(f.ARRAY_BUFFER,ra,p));Ca&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,$,p));Da&&ta.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,aa,p));ua&&X>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,ma,p));ua&&Z>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,pa,p));za&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER, -ia,p),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ba,p));x>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,ca,p),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,da,p),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,ea,p),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,fa,p));F&&(delete n.__inittedArrays, -delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;xa(m)}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices|| -j.__dirtyColors){h=j;k=f.DYNAMIC_DRAW;m=C=w=w=void 0;u=h.vertices;n=h.colors;r=u.length;p=n.length;s=h.__vertexArray;F=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w=0;j--)d[j]==e&&d.splice(j,1)}else e instanceof THREE.MarchingCubes&&xa(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,qa,C));Ba&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,Z,C));Ca&&sa.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,$,C));ta&&W>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,la,C));ta&&Y>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,oa,C));ya&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER, +n.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,ha,C),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,Aa,C));x>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,aa,C),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,ca,C),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,da,C),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER, +ea,C));w&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;wa(k)}else if(h instanceof THREE.Ribbon){j= +h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=f.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;p=h.colors;q=u.length;n=p.length;r=h.__vertexArray;C=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w + + diff --git a/examples/webgl_materials_video.html b/examples/webgl_materials_video.html index 32038169..7306cc2e 100644 --- a/examples/webgl_materials_video.html +++ b/examples/webgl_materials_video.html @@ -42,6 +42,7 @@ + diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 6efc0239..fa5101c9 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -4207,7 +4207,6 @@ THREE.WebGLRenderer = function ( parameters ) { } - return false; }; @@ -4246,9 +4245,9 @@ THREE.WebGLRenderer = function ( parameters ) { // check all geometry groups - for ( g in geometry.geometryGroups ) { + for( var i = 0, il = geometry.geometryGroupsList.length; i < il; i ++ ) { - geometryGroup = geometry.geometryGroups[ g ]; + geometryGroup = geometry.geometryGroupsList[ i ]; customAttributeDirty = areCustomAttributesDirty( geometryGroup ); @@ -4400,7 +4399,7 @@ THREE.WebGLRenderer = function ( parameters ) { var hash_array = []; - for ( i = 0, l = material.length; i < l; i++ ) { + for ( i = 0, l = material.length; i < l; i ++ ) { if ( material[ i ] == undefined ) { @@ -4418,7 +4417,7 @@ THREE.WebGLRenderer = function ( parameters ) { } - for ( f = 0, fl = geometry.faces.length; f < fl; f++ ) { + for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) { face = geometry.faces[ f ]; materials = face.materials; @@ -4459,6 +4458,14 @@ THREE.WebGLRenderer = function ( parameters ) { } + geometry.geometryGroupsList = []; + + for ( var g in geometry.geometryGroups ) { + + geometry.geometryGroupsList.push( geometry.geometryGroups[ g ] ); + + } + }; function addBuffer( objlist, buffer, object ) { @@ -5420,13 +5427,13 @@ THREE.WebGLRenderer = function ( parameters ) { material, meshMaterial, materials = []; - for ( m = 0, ml = object.materials.length; m < ml; m++ ) { + for ( m = 0, ml = object.materials.length; m < ml; m ++ ) { meshMaterial = object.materials[ m ]; if ( meshMaterial instanceof THREE.MeshFaceMaterial ) { - for ( i = 0, l = geometryGroup.materials.length; i < l; i++ ) { + for ( i = 0, l = geometryGroup.materials.length; i < l; i ++ ) { material = geometryGroup.materials[ i ];