diff --git a/build/Three.js b/build/Three.js index 12fb6b98bf901362fde36a99f462134a31f4cf75..a5421d6656a4708e52fb342f5cc3798f51e28f95 100755 --- a/build/Three.js +++ b/build/Three.js @@ -14,35 +14,35 @@ THREE.Vector4.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())}, setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,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={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,k,h,m,n,o,p,t,v,u,w=b.geometry, -B=w.vertices,A=[],f=0;for(g=w.faces.length;f0:t<0))if(p=p.dot((new THREE.Vector3).sub(h,v))/t,v=v.addSelf(u.multiplyScalar(p)), -k instanceof THREE.Face3)e(v,h,m,n)&&(k={distance:this.origin.distanceTo(v),point:v,face:k,object:b},A.push(k));else if(k instanceof THREE.Face4&&(e(v,h,m,o)||e(v,m,n,o)))k={distance:this.origin.distanceTo(v),point:v,face:k,object:b},A.push(k);return A}else return[]}}; -THREE.Rectangle=function(){function b(){k=f-c;h=g-e}var c,e,f,g,k,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,k,p,t){m=!1;c=h;e=k;f=p;g=t;b()};this.addPoint=function(h,k){m?(m=!1,c=h,e=k,f=h,g=k):(c=ch?f:h,g=g>k?g:k);b()};this.add3Points= -function(h,k,p,t,v,u){m?(m=!1,c=hp?h>v?h:v:p>v?p:v,g=k>t?k>u?k:u:t>u?t:u):(c=hp?h>v?h>f?h:f:v>f?v:f:p>v?p>f?p:f:v>f?v:f,g=k>t?k>u?k>g?k:g:u>g?u:g:t>u?t>g?t:g:u>g?u:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=ch.getRight()?f:h.getRight(),g=g> +g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,k,h,m,n,p,o,t,v,u,w=b.geometry, +B=w.vertices,A=[],f=0;for(g=w.faces.length;f0:t<0))if(o=o.dot((new THREE.Vector3).sub(h,v))/t,v=v.addSelf(u.multiplyScalar(o)), +k instanceof THREE.Face3)e(v,h,m,n)&&(k={distance:this.origin.distanceTo(v),point:v,face:k,object:b},A.push(k));else if(k instanceof THREE.Face4&&(e(v,h,m,p)||e(v,m,n,p)))k={distance:this.origin.distanceTo(v),point:v,face:k,object:b},A.push(k);return A}else return[]}}; +THREE.Rectangle=function(){function b(){k=f-c;h=g-e}var c,e,f,g,k,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,k,o,t){m=!1;c=h;e=k;f=o;g=t;b()};this.addPoint=function(h,k){m?(m=!1,c=h,e=k,f=h,g=k):(c=ch?f:h,g=g>k?g:k);b()};this.add3Points= +function(h,k,o,t,v,u){m?(m=!1,c=ho?h>v?h:v:o>v?o:v,g=k>t?k>u?k:u:t>u?t:u):(c=ho?h>v?h>f?h:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,g=k>t?k>u?k>g?k:g:u>g?u:g:t>u?t>g?t:g:u>g?u:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=ch.getRight()?f:h.getRight(),g=g> h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={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,g,k,h,m,n,o,p,t,v,u,w,B){this.set(b||1,c||0,e||0,f||0,g||0,k||1,h||0,m||0,n||0,o||0,p||1,t||0,v||0,u||0,w||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,c,e,f,g,k,h,m,n,o,p,t,v,u,w,B){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=k;this.n23=h;this.n24=m;this.n31=n;this.n32=o;this.n33=p;this.n34=t;this.n41=v;this.n42=u;this.n43=w;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1, +THREE.Matrix3.prototype={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,g,k,h,m,n,p,o,t,v,u,w,B){this.set(b||1,c||0,e||0,f||0,g||0,k||1,h||0,m||0,n||0,p||0,o||1,t||0,v||0,u||0,w||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,c,e,f,g,k,h,m,n,p,o,t,v,u,w,B){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=k;this.n23=h;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=t;this.n41=v;this.n42=u;this.n43=w;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1, g=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());g.cross(k,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=k.x;this.n21=f.y;this.n22=g.y;this.n23=k.y;this.n31=f.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=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)*g;b.y=(this.n21*c+this.n22*e+this.n23* f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;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,g=b.n13,k=b.n14,h=b.n21,m=b.n22,n=b.n23,o=b.n24,p=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,B=b.n42,A=b.n43,y=b.n44,G=c.n11,z=c.n12,C=c.n13,H=c.n14,D=c.n21,Q=c.n22, -J=c.n23,F=c.n24,I=c.n31,S=c.n32,K=c.n33,ea=c.n34,j=c.n41,ca=c.n42,T=c.n43,Z=c.n44;this.n11=e*G+f*D+g*I+k*j;this.n12=e*z+f*Q+g*S+k*ca;this.n13=e*C+f*J+g*K+k*T;this.n14=e*H+f*F+g*ea+k*Z;this.n21=h*G+m*D+n*I+o*j;this.n22=h*z+m*Q+n*S+o*ca;this.n23=h*C+m*J+n*K+o*T;this.n24=h*H+m*F+n*ea+o*Z;this.n31=p*G+t*D+v*I+u*j;this.n32=p*z+t*Q+v*S+u*ca;this.n33=p*C+t*J+v*K+u*T;this.n34=p*H+t*F+v*ea+u*Z;this.n41=w*G+B*D+A*I+y*j;this.n42=w*z+B*Q+A*S+y*ca;this.n43=w*C+B*J+A*K+y*T;this.n44=w*H+B*F+A*ea+y*Z;return this}, +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,g=b.n13,k=b.n14,h=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,B=b.n42,A=b.n43,y=b.n44,G=c.n11,z=c.n12,C=c.n13,H=c.n14,D=c.n21,Q=c.n22, +J=c.n23,F=c.n24,I=c.n31,S=c.n32,K=c.n33,ea=c.n34,j=c.n41,ca=c.n42,T=c.n43,Z=c.n44;this.n11=e*G+f*D+g*I+k*j;this.n12=e*z+f*Q+g*S+k*ca;this.n13=e*C+f*J+g*K+k*T;this.n14=e*H+f*F+g*ea+k*Z;this.n21=h*G+m*D+n*I+p*j;this.n22=h*z+m*Q+n*S+p*ca;this.n23=h*C+m*J+n*K+p*T;this.n24=h*H+m*F+n*ea+p*Z;this.n31=o*G+t*D+v*I+u*j;this.n32=o*z+t*Q+v*S+u*ca;this.n33=o*C+t*J+v*K+u*T;this.n34=o*H+t*F+v*ea+u*Z;this.n41=w*G+B*D+A*I+y*j;this.n42=w*z+B*Q+A*S+y*ca;this.n43=w*C+B*J+A*K+y*T;this.n44=w*H+B*F+A*ea+y*Z;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,g=this.n21,k=this.n22,h=this.n23,m=this.n24,n=this.n31,o=this.n32,p=this.n33,t=this.n34,v=this.n41,u=this.n42,w=this.n43,B=this.n44;return f*h*o*v-e*m*o*v-f*k*p*v+c*m*p*v+e*k*t*v-c*h*t*v-f*h*n*u+e*m*n*u+f*g*p*u-b*m*p*u-e*g*t*u+b*h*t*u+f*k*n*w-c*m*n*w-f*g*o*w+b*m*o*w+c*g*t*w-b*k*t*w-e*k*n*B+c*h*n*B+e*g*o*B-b*h*o*B-c*g*p*B+b*k*p*B},transpose:function(){var 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,g=this.n21,k=this.n22,h=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,t=this.n34,v=this.n41,u=this.n42,w=this.n43,B=this.n44;return f*h*p*v-e*m*p*v-f*k*o*v+c*m*o*v+e*k*t*v-c*h*t*v-f*h*n*u+e*m*n*u+f*g*o*u-b*m*o*u-e*g*t*u+b*h*t*u+f*k*n*w-c*m*n*w-f*g*p*w+b*m*p*w+c*g*t*w-b*k*t*w-e*k*n*B+c*h*n*B+e*g*p*B-b*h*p*B-c*g*o*B+b*k*o*B},transpose:function(){var b; b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42; b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31; b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,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),g=1-e,k=b.x,h=b.y,m=b.z,n=g*k,o=g*h;this.set(n*k+e,n*h-f*m,n*m+f*h,0,n*h+f*m,o*h+e,o*m-f*k,0,n*m-f*h,o*m+f*k,g*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,g=b.z,k=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var n=h*m,o=h*g,p=f*m,t=f*g; -this.n11=n+t*e;this.n12=p*e-o;this.n13=k*f;this.n21=k*g;this.n22=k*m;this.n23=-e;this.n31=o*e-p;this.n32=t+n*e;this.n33=k*h;break;case "ZXY":n=h*m;o=h*g;p=f*m;t=f*g;this.n11=n-t*e;this.n12=-k*g;this.n13=p+o*e;this.n21=o+p*e;this.n22=k*m;this.n23=t-n*e;this.n31=-k*f;this.n32=e;this.n33=k*h;break;case "ZYX":n=k*m;o=k*g;p=e*m;t=e*g;this.n11=h*m;this.n12=p*f-o;this.n13=n*f+t;this.n21=h*g;this.n22=t*f+n;this.n23=o*f-p;this.n31=-f;this.n32=e*h;this.n33=k*h;break;case "YZX":n=k*h;o=k*f;p=e*h;t=e*f;this.n11= -h*m;this.n12=t-n*g;this.n13=p*g+o;this.n21=g;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=o*g+p;this.n33=n-t*g;break;case "XZY":n=k*h;o=k*f;p=e*h;t=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=n*g+t;this.n22=k*m;this.n23=o*g-p;this.n31=p*g-o;this.n32=e*m;this.n33=t*g+n;break;default:n=k*m,o=k*g,p=e*m,t=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=o+p*f,this.n22=n-t*f,this.n23=-e*h,this.n31=t-n*f,this.n32=p+o*f,this.n33=k*h}return this},setRotationFromQuaternion:function(b){var c= -b.x,e=b.y,f=b.z,g=b.w,k=c+c,h=e+e,m=f+f,b=c*k,n=c*h;c*=m;var o=e*h;e*=m;f*=m;k*=g;h*=g;g*=m;this.n11=1-(o+f);this.n12=n-g;this.n13=c+h;this.n21=n+g;this.n22=1-(b+f);this.n23=e-k;this.n31=c-h;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},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34}, +setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,k=b.x,h=b.y,m=b.z,n=g*k,p=g*h;this.set(n*k+e,n*h-f*m,n*m+f*h,0,n*h+f*m,p*h+e,p*m-f*k,0,n*m-f*h,p*m+f*k,g*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,g=b.z,k=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var n=h*m,p=h*g,o=f*m,t=f*g; +this.n11=n+t*e;this.n12=o*e-p;this.n13=k*f;this.n21=k*g;this.n22=k*m;this.n23=-e;this.n31=p*e-o;this.n32=t+n*e;this.n33=k*h;break;case "ZXY":n=h*m;p=h*g;o=f*m;t=f*g;this.n11=n-t*e;this.n12=-k*g;this.n13=o+p*e;this.n21=p+o*e;this.n22=k*m;this.n23=t-n*e;this.n31=-k*f;this.n32=e;this.n33=k*h;break;case "ZYX":n=k*m;p=k*g;o=e*m;t=e*g;this.n11=h*m;this.n12=o*f-p;this.n13=n*f+t;this.n21=h*g;this.n22=t*f+n;this.n23=p*f-o;this.n31=-f;this.n32=e*h;this.n33=k*h;break;case "YZX":n=k*h;p=k*f;o=e*h;t=e*f;this.n11= +h*m;this.n12=t-n*g;this.n13=o*g+p;this.n21=g;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+o;this.n33=n-t*g;break;case "XZY":n=k*h;p=k*f;o=e*h;t=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=n*g+t;this.n22=k*m;this.n23=p*g-o;this.n31=o*g-p;this.n32=e*m;this.n33=t*g+n;break;default:n=k*m,p=k*g,o=e*m,t=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=p+o*f,this.n22=n-t*f,this.n23=-e*h,this.n31=t-n*f,this.n32=o+p*f,this.n33=k*h}return this},setRotationFromQuaternion:function(b){var c= +b.x,e=b.y,f=b.z,g=b.w,k=c+c,h=e+e,m=f+f,b=c*k,n=c*h;c*=m;var p=e*h;e*=m;f*=m;k*=g;h*=g;g*=m;this.n11=1-(p+f);this.n12=n-g;this.n13=c+h;this.n21=n+g;this.n22=1-(b+f);this.n23=e-k;this.n31=c-h;this.n32=e+k;this.n33=1-(b+p);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},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,g=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*g;this.n23=b.n23*g;this.n33=b.n33*g}}; -THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,k=b.n14,h=b.n21,m=b.n22,n=b.n23,o=b.n24,p=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,B=b.n42,A=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*u*B-o*v*B+o*t*A-m*u*A-n*t*y+m*v*y;c.n12=k*v*B-g*u*B-k*t*A+f*u*A+g*t*y-f*v*y;c.n13=g*o*B-k*n*B+k*m*A-f*o*A-g*m*y+f*n*y;c.n14=k*n*t-g*o*t-k*m*v+f*o*v+g*m*u-f*n*u;c.n21=o*v*w-n*u*w-o*p*A+h*u*A+n*p*y-h*v*y;c.n22=g*u*w-k*v*w+k*p*A-e*u*A-g*p*y+e*v*y;c.n23=k*n*w-g*o*w-k*h*A+e*o*A+g*h*y-e*n*y;c.n24= -g*o*p-k*n*p+k*h*v-e*o*v-g*h*u+e*n*u;c.n31=m*u*w-o*t*w+o*p*B-h*u*B-m*p*y+h*t*y;c.n32=k*t*w-f*u*w-k*p*B+e*u*B+f*p*y-e*t*y;c.n33=g*o*w-k*m*w+k*h*B-e*o*B-f*h*y+e*m*y;c.n34=k*m*p-f*o*p-k*h*t+e*o*t+f*h*u-e*m*u;c.n41=n*t*w-m*v*w-n*p*B+h*v*B+m*p*A-h*t*A;c.n42=f*v*w-g*t*w+g*p*B-e*v*B-f*p*A+e*t*A;c.n43=g*m*w-f*n*w-g*h*B+e*n*B+f*h*A-e*m*A;c.n44=f*n*p-g*m*p+g*h*t-e*n*t-f*h*v+e*m*v;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,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*k;e[3]=b*h;e[4]=b*m;e[5]=b*n;e[6]=b*o;e[7]=b*p;e[8]=b*t;return c}; +THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,k=b.n14,h=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,B=b.n42,A=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*u*B-p*v*B+p*t*A-m*u*A-n*t*y+m*v*y;c.n12=k*v*B-g*u*B-k*t*A+f*u*A+g*t*y-f*v*y;c.n13=g*p*B-k*n*B+k*m*A-f*p*A-g*m*y+f*n*y;c.n14=k*n*t-g*p*t-k*m*v+f*p*v+g*m*u-f*n*u;c.n21=p*v*w-n*u*w-p*o*A+h*u*A+n*o*y-h*v*y;c.n22=g*u*w-k*v*w+k*o*A-e*u*A-g*o*y+e*v*y;c.n23=k*n*w-g*p*w-k*h*A+e*p*A+g*h*y-e*n*y;c.n24= +g*p*o-k*n*o+k*h*v-e*p*v-g*h*u+e*n*u;c.n31=m*u*w-p*t*w+p*o*B-h*u*B-m*o*y+h*t*y;c.n32=k*t*w-f*u*w-k*o*B+e*u*B+f*o*y-e*t*y;c.n33=g*p*w-k*m*w+k*h*B-e*p*B-f*h*y+e*m*y;c.n34=k*m*o-f*p*o-k*h*t+e*p*t+f*h*u-e*m*u;c.n41=n*t*w-m*v*w-n*o*B+h*v*B+m*o*A-h*t*A;c.n42=f*v*w-g*t*w+g*o*B-e*v*B-f*o*A+e*t*A;c.n43=g*m*w-f*n*w-g*h*B+e*n*B+f*h*A-e*m*A;c.n44=f*n*o-g*m*o+g*h*t-e*n*t-f*h*v+e*m*v;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,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*k;e[3]=b*h;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*t;return c}; THREE.Matrix4.makeFrustum=function(b,c,e,f,g,k){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(k+g)/(k-g);h.n34=-2*k*g/(k-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)}; -THREE.Matrix4.makeOrtho=function(b,c,e,f,g,k){var h,m,n,o;h=new THREE.Matrix4;m=c-b;n=e-f;o=k-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/n;h.n23=0;h.n24=-((e+f)/n);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((k+g)/o);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; +THREE.Matrix4.makeOrtho=function(b,c,e,f,g,k){var h,m,n,p;h=new THREE.Matrix4;m=c-b;n=e-f;p=k-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/n;h.n23=0;h.n24=-((e+f)/n);h.n31=0;h.n32=0;h.n33=-2/p;h.n34=-((k+g)/p);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.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._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={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)=== @@ -51,8 +51,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<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;g=Math.sin((1-f)*k)/h;f=Math.sin(f*k)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; THREE.Face3=function(b,c,e,f,g,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=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,c,e,f,g,k,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)}; @@ -61,15 +61,15 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.f e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,k,h,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=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]];p=this.points[e[1]]; -t=this.points[e[2]];v=this.points[e[3]];m=h*h;n=h*m;f.x=c(o.x,p.x,t.x,v.x,h,m,n);f.y=c(o.y,p.y,t.y,v.y,h,m,n);f.z=c(o.z,p.z,t.z,v.z,h,m,n);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;p=this.points[e[0]];o=this.points[e[1]]; +t=this.points[e[2]];v=this.points[e[3]];m=h*h;n=h*m;f.x=c(p.x,o.x,t.x,v.x,h,m,n);f.y=c(p.y,o.y,t.y,v.y,h,m,n);f.z=c(p.z,o.z,t.z,v.z,h,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1, this.LODs[f].object3D.visible=!0;else break;for(;ft&&(e=p,p=t,t=e):pu&&(e=v,v=u,u=e):vt&&(e=o,o=t,t=e):ou&&(e=v,v=u,u=e):v=0&&g>=0&&h>=0&&k>=0?!0:f<0&&g<0||h<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(j=Math.min(j,f/(f-g))),h<0?c=Math.max(c,h/(h-k)):k<0&&(j=Math.min(j,h/(h-k))),j=0&&h>=0&&k>=0&&m>=0?!0:g<0&&h<0||k<0&&m<0?!1:(g<0?c=Math.max(c,g/(g-h)):h<0&&(f=Math.min(f,g/(g-h))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),fC&&h.positionScreen.z0&&H.z<1))fa=z[G]=z[G]||new THREE.RenderableParticle,G++,y=fa,y.x=H.x/H.w,y.y=H.y/H.w,y.z= H.z,y.rotation=L.rotation.z,y.scale.x=L.scale.x*Math.abs(y.x-(H.x+g.projectionMatrix.n11)/(H.w+g.projectionMatrix.n14)),y.scale.y=L.scale.y*Math.abs(y.y-(H.y+g.projectionMatrix.n22)/(H.w+g.projectionMatrix.n24)),y.materials=L.materials,j.push(y);k&&j.sort(c);return j}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;k=f/2};this.render=function(e,f){var n,o,p,t,v,u,w,B;b=c.projectScene(e,f);n=0;for(o=b.length;n>1,V=o.height>>1,h=j.scale.x* -v,n=j.scale.y*u,k=h*p,m=n*V,R.set(b.x-k,b.y-m,b.x+k,b.y+m),va.instersects(R)&&(w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(h,-n),w.translate(-p,-V),w.drawImage(o,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*v,m=j.scale.y*u,R.set(b.x-k,b.y-m,b.x+k,b.y+m),va.instersects(R)&&(f(h.color),g(h.color),w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(k,m),h.program(w),w.restore()))}function y(b,j,g,h){c(h.opacity);e(h.blending);w.beginPath();w.moveTo(b.positionScreen.x, -b.positionScreen.y);w.lineTo(j.positionScreen.x,j.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(H!=b)w.lineWidth=H=b;b=h.linecap;if(D!=b)w.lineCap=D=b;b=h.linejoin;if(Q!=b)w.lineJoin=Q=b;f(h.color);w.stroke();R.inflate(h.linewidth*2)}}function A(b,f,g,m,n,o,V,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);j=b.positionScreen.x;ca=b.positionScreen.y;T=f.positionScreen.x;Z=f.positionScreen.y;N=g.positionScreen.x;da=g.positionScreen.y;z(j, -ca,T,Z,N,da);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(ga=V.uvs[0],Ea(j,ca,T,Z,N,da,t.map.image,ga[m].u,ga[m].v,ga[n].u,ga[n].v,ga[o].u,ga[o].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,pa.copy(V.vertexNormalsWorld[0]),Da=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ua=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(V.vertexNormalsWorld[1]),Aa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+ -0.5,xa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(V.vertexNormalsWorld[2]),ta=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ya=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,Ea(j,ca,T,Z,N,da,t.envMap.image,Da,ua,Aa,xa,ta,ya)}else t.wireframe?C(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(ga=V.uvs[0],Ea(j,ca,T,Z,N,da,t.map.image,ga[m].u,ga[m].v,ga[n].u, -ga[n].v,ga[o].u,ga[o].v)),e(THREE.SubtractiveBlending)),O?!t.wireframe&&t.shading==THREE.SmoothShading&&V.vertexNormalsWorld.length==3?(fa.r=W.r=U.r=P.r,fa.g=W.g=U.g=P.g,fa.b=W.b=U.b=P.b,p(u,V.v1.positionWorld,V.vertexNormalsWorld[0],fa),p(u,V.v2.positionWorld,V.vertexNormalsWorld[1],W),p(u,V.v3.positionWorld,V.vertexNormalsWorld[2],U),$.r=(W.r+U.r)*0.5,$.g=(W.g+U.g)*0.5,$.b=(W.b+U.b)*0.5,la=Ta(fa,W,U,$),Ea(j,ca,T,Z,N,da,la,0,0,1,0,0,1)):(oa.r=P.r,oa.g=P.g,oa.b=P.b,p(u,V.centroidWorld,V.normalWorld, -oa),L.r=Math.max(0,Math.min(t.color.r*oa.r,1)),L.g=Math.max(0,Math.min(t.color.g*oa.g,1)),L.b=Math.max(0,Math.min(t.color.b*oa.b,1)),L.updateHex(),t.wireframe?C(L,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(L)):t.wireframe?C(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshDepthMaterial)Y=k.near,ka=k.far,fa.r=fa.g=fa.b=1-Ja(b.positionScreen.z,Y,ka),W.r=W.g=W.b=1-Ja(f.positionScreen.z,Y,ka),U.r=U.g=U.b=1-Ja(g.positionScreen.z, -Y,ka),$.r=(W.r+U.r)*0.5,$.g=(W.g+U.g)*0.5,$.b=(W.b+U.b)*0.5,la=Ta(fa,W,U,$),Ea(j,ca,T,Z,N,da,la,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)L.r=Na(V.normalWorld.x),L.g=Na(V.normalWorld.y),L.b=Na(V.normalWorld.z),L.updateHex(),t.wireframe?C(L,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(L)}function B(b,f,g,m,n,o,t,V,u){h.data.vertices+=4;h.data.faces++;c(V.opacity);e(V.blending);if(V.map||V.envMap)A(b,f,m,0,1,3,t,V,u),A(n,g,o,1,2,3,t,V,u);else if(j=b.positionScreen.x, -ca=b.positionScreen.y,T=f.positionScreen.x,Z=f.positionScreen.y,N=g.positionScreen.x,da=g.positionScreen.y,X=m.positionScreen.x,aa=m.positionScreen.y,ia=n.positionScreen.x,ha=n.positionScreen.y,na=o.positionScreen.x,ja=o.positionScreen.y,V instanceof THREE.MeshBasicMaterial)G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ga(V.color);else if(V instanceof THREE.MeshLambertMaterial)O?!V.wireframe&&V.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length== -4?(fa.r=W.r=U.r=$.r=P.r,fa.g=W.g=U.g=$.g=P.g,fa.b=W.b=U.b=$.b=P.b,p(u,t.v1.positionWorld,t.vertexNormalsWorld[0],fa),p(u,t.v2.positionWorld,t.vertexNormalsWorld[1],W),p(u,t.v4.positionWorld,t.vertexNormalsWorld[3],U),p(u,t.v3.positionWorld,t.vertexNormalsWorld[2],$),la=Ta(fa,W,U,$),z(j,ca,T,Z,X,aa),Ea(j,ca,T,Z,X,aa,la,0,0,1,0,0,1),z(ia,ha,N,da,na,ja),Ea(ia,ha,N,da,na,ja,la,1,0,1,1,0,1)):(oa.r=P.r,oa.g=P.g,oa.b=P.b,p(u,t.centroidWorld,t.normalWorld,oa),L.r=Math.max(0,Math.min(V.color.r*oa.r,1)),L.g= -Math.max(0,Math.min(V.color.g*oa.g,1)),L.b=Math.max(0,Math.min(V.color.b*oa.b,1)),L.updateHex(),G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(L,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ga(L)):(G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ga(V.color));else if(V instanceof THREE.MeshNormalMaterial)L.r=Na(t.normalWorld.x),L.g=Na(t.normalWorld.y),L.b=Na(t.normalWorld.z),L.updateHex(),G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(L,V.wireframeLinewidth, -V.wireframeLinecap,V.wireframeLinejoin):Ga(L);else if(V instanceof THREE.MeshDepthMaterial)Y=k.near,ka=k.far,fa.r=fa.g=fa.b=1-Ja(b.positionScreen.z,Y,ka),W.r=W.g=W.b=1-Ja(f.positionScreen.z,Y,ka),U.r=U.g=U.b=1-Ja(m.positionScreen.z,Y,ka),$.r=$.g=$.b=1-Ja(g.positionScreen.z,Y,ka),la=Ta(fa,W,U,$),z(j,ca,T,Z,X,aa),Ea(j,ca,T,Z,X,aa,la,0,0,1,0,0,1),z(ia,ha,N,da,na,ja),Ea(ia,ha,N,da,na,ja,la,1,0,1,1,0,1)}function z(b,e,c,j,f,g){w.beginPath();w.moveTo(b,e);w.lineTo(c,j);w.lineTo(f,g);w.lineTo(b,e);w.closePath()} -function G(b,e,c,j,f,g,h,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,j);w.lineTo(f,g);w.lineTo(h,k);w.lineTo(b,e);w.closePath()}function C(b,e,c,j){if(H!=e)w.lineWidth=H=e;if(D!=c)w.lineCap=D=c;if(Q!=j)w.lineJoin=Q=j;f(b);w.stroke();R.inflate(e*2)}function Ga(b){g(b);w.fill()}function Ea(b,e,c,j,f,g,h,k,m,n,V,t,o){var p,u;p=h.width-1;u=h.height-1;k*=p;m*=u;n*=p;V*=u;t*=p;o*=u;c-=b;j-=e;f-=b;g-=e;n-=k;V-=m;t-=k;o-=m;p=n*o-t*V;p!=0&&(u=1/p,p=(o*c-V*f)*u,V=(o*j-V*g)*u,c=(n*f-t*c)*u,j=(n*g-t*j)*u,b=b-p* -k-c*m,e=e-V*k-j*m,w.save(),w.transform(p,V,c,j,b,e),w.clip(),w.drawImage(h,0,0),w.restore())}function Ta(b,e,c,j){var f=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),V=~~(j.r*255),t=~~(j.g*255),j=~~(j.b*255);wa[0]=f<0?0:f>255?255:f;wa[1]=g<0?0:g>255?255:g;wa[2]=b<0?0:b>255?255:b;wa[4]=h<0?0:h>255?255:h;wa[5]=k<0?0:k>255?255:k;wa[6]=e<0?0:e>255?255:e;wa[8]=m<0?0:m>255?255:m;wa[9]=n<0?0:n>255?255:n;wa[10]=c<0?0:c>255?255: -c;wa[12]=V<0?0:V>255?255:V;wa[13]=t<0?0:t>255?255:t;wa[14]=j<0?0:j>255?255:j;Qa.putImageData(Wa,0,0);Sa.drawImage(Pa,0,0);return Ra}function Ja(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function E(b,e){var c=e.x-b.x,j=e.y-b.y,f=1/Math.sqrt(c*c+j*j);c*=f;j*=f;e.x+=c;e.y+=j;b.x-=c;b.y-=j}var Ua,x,ma,za,Ha,Oa,Va,ra;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,u);h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,k,this.sortElements);(O=b.lights.length> +var h=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,t,v,u,w=p.getContext("2d"),B=new THREE.Color(0),A=0,y=1,G=0,z=null,C=null,H=null,D=null,Q=null,J,F,I,S,K=new THREE.RenderableVertex,ea=new THREE.RenderableVertex,j,ca,T,Z,N,da,X,aa,ia,ha,na,ja,L=new THREE.Color(0),fa=new THREE.Color(0),V=new THREE.Color(0),U=new THREE.Color(0),$=new THREE.Color(0),Y,ka,la,ga,Da,ua,Aa,xa,ta,ya,va=new THREE.Rectangle,qa=new THREE.Rectangle,R=new THREE.Rectangle, +O=!1,oa=new THREE.Color,P=new THREE.Color,Ba=new THREE.Color,W=new THREE.Color,pa=new THREE.Vector3,Pa,Qa,Wa,wa,Ra,Sa,b=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;Qa=Pa.getContext("2d");Qa.fillStyle="rgba(0,0,0,1)";Qa.fillRect(0,0,2,2);Wa=Qa.getImageData(0,0,2,2);wa=Wa.data;Ra=document.createElement("canvas");Ra.width=Ra.height=b;Sa=Ra.getContext("2d");Sa.translate(-b/2,-b/2);Sa.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0, +faces:0};this.setSize=function(b,e){o=b;t=e;v=o/2;u=t/2;p.width=o;p.height=t;va.set(-v,-u,v,u);y=1;G=0;Q=D=H=C=z=null};this.setClearColor=function(b,e){B=b;A=e};this.setClearColorHex=function(b,e){B.setHex(b);A=e};this.clear=function(){w.setTransform(1,0,0,-1,v,u);if(!qa.isEmpty())qa.inflate(1),qa.minSelf(va),B.hex==0&&A==0?w.clearRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b* +255)+","+A+")",w.fillRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight())),qa.empty()};this.render=function(b,k){function o(b){var e,c,f,j=b.lights;P.setRGB(0,0,0);Ba.setRGB(0,0,0);W.setRGB(0,0,0);b=0;for(e=j.length;b>1,W=o.height>>1,h=j.scale.x* +v,n=j.scale.y*u,k=h*p,m=n*W,R.set(b.x-k,b.y-m,b.x+k,b.y+m),va.instersects(R)&&(w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(h,-n),w.translate(-p,-W),w.drawImage(o,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*v,m=j.scale.y*u,R.set(b.x-k,b.y-m,b.x+k,b.y+m),va.instersects(R)&&(f(h.color),g(h.color),w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(k,m),h.program(w),w.restore()))}function y(b,j,g,h){c(h.opacity);e(h.blending);w.beginPath();w.moveTo(b.positionScreen.x, +b.positionScreen.y);w.lineTo(j.positionScreen.x,j.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(H!=b)w.lineWidth=H=b;b=h.linecap;if(D!=b)w.lineCap=D=b;b=h.linejoin;if(Q!=b)w.lineJoin=Q=b;f(h.color);w.stroke();R.inflate(h.linewidth*2)}}function A(b,f,g,m,n,o,t,W,u){h.data.vertices+=3;h.data.faces++;c(W.opacity);e(W.blending);j=b.positionScreen.x;ca=b.positionScreen.y;T=f.positionScreen.x;Z=f.positionScreen.y;N=g.positionScreen.x;da=g.positionScreen.y;z(j, +ca,T,Z,N,da);if(W instanceof THREE.MeshBasicMaterial)if(W.map)W.map.mapping instanceof THREE.UVMapping&&(ga=t.uvs[0],Ea(j,ca,T,Z,N,da,W.map.image,ga[m].u,ga[m].v,ga[n].u,ga[n].v,ga[o].u,ga[o].v));else if(W.envMap){if(W.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),Da=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ua=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[1]),Aa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+ +0.5,xa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[2]),ta=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ya=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,Ea(j,ca,T,Z,N,da,W.envMap.image,Da,ua,Aa,xa,ta,ya)}else W.wireframe?C(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Ga(W.color);else if(W instanceof THREE.MeshLambertMaterial)W.map&&!W.wireframe&&(W.map.mapping instanceof THREE.UVMapping&&(ga=t.uvs[0],Ea(j,ca,T,Z,N,da,W.map.image,ga[m].u,ga[m].v,ga[n].u, +ga[n].v,ga[o].u,ga[o].v)),e(THREE.SubtractiveBlending)),O?!W.wireframe&&W.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?(fa.r=V.r=U.r=P.r,fa.g=V.g=U.g=P.g,fa.b=V.b=U.b=P.b,p(u,t.v1.positionWorld,t.vertexNormalsWorld[0],fa),p(u,t.v2.positionWorld,t.vertexNormalsWorld[1],V),p(u,t.v3.positionWorld,t.vertexNormalsWorld[2],U),$.r=(V.r+U.r)*0.5,$.g=(V.g+U.g)*0.5,$.b=(V.b+U.b)*0.5,la=Ta(fa,V,U,$),Ea(j,ca,T,Z,N,da,la,0,0,1,0,0,1)):(oa.r=P.r,oa.g=P.g,oa.b=P.b,p(u,t.centroidWorld,t.normalWorld, +oa),L.r=Math.max(0,Math.min(W.color.r*oa.r,1)),L.g=Math.max(0,Math.min(W.color.g*oa.g,1)),L.b=Math.max(0,Math.min(W.color.b*oa.b,1)),L.updateHex(),W.wireframe?C(L,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Ga(L)):W.wireframe?C(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Ga(W.color);else if(W instanceof THREE.MeshDepthMaterial)Y=k.near,ka=k.far,fa.r=fa.g=fa.b=1-Ja(b.positionScreen.z,Y,ka),V.r=V.g=V.b=1-Ja(f.positionScreen.z,Y,ka),U.r=U.g=U.b=1-Ja(g.positionScreen.z, +Y,ka),$.r=(V.r+U.r)*0.5,$.g=(V.g+U.g)*0.5,$.b=(V.b+U.b)*0.5,la=Ta(fa,V,U,$),Ea(j,ca,T,Z,N,da,la,0,0,1,0,0,1);else if(W instanceof THREE.MeshNormalMaterial)L.r=Na(t.normalWorld.x),L.g=Na(t.normalWorld.y),L.b=Na(t.normalWorld.z),L.updateHex(),W.wireframe?C(L,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):Ga(L)}function B(b,f,g,m,n,o,W,t,u){h.data.vertices+=4;h.data.faces++;c(t.opacity);e(t.blending);if(t.map||t.envMap)A(b,f,m,0,1,3,W,t,u),A(n,g,o,1,2,3,W,t,u);else if(j=b.positionScreen.x, +ca=b.positionScreen.y,T=f.positionScreen.x,Z=f.positionScreen.y,N=g.positionScreen.x,da=g.positionScreen.y,X=m.positionScreen.x,aa=m.positionScreen.y,ia=n.positionScreen.x,ha=n.positionScreen.y,na=o.positionScreen.x,ja=o.positionScreen.y,t instanceof THREE.MeshBasicMaterial)G(j,ca,T,Z,N,da,X,aa),t.wireframe?C(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshLambertMaterial)O?!t.wireframe&&t.shading==THREE.SmoothShading&&W.vertexNormalsWorld.length== +4?(fa.r=V.r=U.r=$.r=P.r,fa.g=V.g=U.g=$.g=P.g,fa.b=V.b=U.b=$.b=P.b,p(u,W.v1.positionWorld,W.vertexNormalsWorld[0],fa),p(u,W.v2.positionWorld,W.vertexNormalsWorld[1],V),p(u,W.v4.positionWorld,W.vertexNormalsWorld[3],U),p(u,W.v3.positionWorld,W.vertexNormalsWorld[2],$),la=Ta(fa,V,U,$),z(j,ca,T,Z,X,aa),Ea(j,ca,T,Z,X,aa,la,0,0,1,0,0,1),z(ia,ha,N,da,na,ja),Ea(ia,ha,N,da,na,ja,la,1,0,1,1,0,1)):(oa.r=P.r,oa.g=P.g,oa.b=P.b,p(u,W.centroidWorld,W.normalWorld,oa),L.r=Math.max(0,Math.min(t.color.r*oa.r,1)),L.g= +Math.max(0,Math.min(t.color.g*oa.g,1)),L.b=Math.max(0,Math.min(t.color.b*oa.b,1)),L.updateHex(),G(j,ca,T,Z,N,da,X,aa),t.wireframe?C(L,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(L)):(G(j,ca,T,Z,N,da,X,aa),t.wireframe?C(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color));else if(t instanceof THREE.MeshNormalMaterial)L.r=Na(W.normalWorld.x),L.g=Na(W.normalWorld.y),L.b=Na(W.normalWorld.z),L.updateHex(),G(j,ca,T,Z,N,da,X,aa),t.wireframe?C(L,t.wireframeLinewidth, +t.wireframeLinecap,t.wireframeLinejoin):Ga(L);else if(t instanceof THREE.MeshDepthMaterial)Y=k.near,ka=k.far,fa.r=fa.g=fa.b=1-Ja(b.positionScreen.z,Y,ka),V.r=V.g=V.b=1-Ja(f.positionScreen.z,Y,ka),U.r=U.g=U.b=1-Ja(m.positionScreen.z,Y,ka),$.r=$.g=$.b=1-Ja(g.positionScreen.z,Y,ka),la=Ta(fa,V,U,$),z(j,ca,T,Z,X,aa),Ea(j,ca,T,Z,X,aa,la,0,0,1,0,0,1),z(ia,ha,N,da,na,ja),Ea(ia,ha,N,da,na,ja,la,1,0,1,1,0,1)}function z(b,e,c,f,j,g){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(j,g);w.lineTo(b,e);w.closePath()} +function G(b,e,c,f,j,g,h,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(j,g);w.lineTo(h,k);w.lineTo(b,e);w.closePath()}function C(b,e,c,j){if(H!=e)w.lineWidth=H=e;if(D!=c)w.lineCap=D=c;if(Q!=j)w.lineJoin=Q=j;f(b);w.stroke();R.inflate(e*2)}function Ga(b){g(b);w.fill()}function Ea(b,e,c,f,j,g,h,k,m,t,n,o,W){var p,u;p=h.width-1;u=h.height-1;k*=p;m*=u;t*=p;n*=u;o*=p;W*=u;c-=b;f-=e;j-=b;g-=e;t-=k;n-=m;o-=k;W-=m;p=t*W-o*n;p!=0&&(u=1/p,p=(W*c-n*j)*u,n=(W*f-n*g)*u,c=(t*j-o*c)*u,f=(t*g-o*f)*u,b=b-p* +k-c*m,e=e-n*k-f*m,w.save(),w.transform(p,n,c,f,b,e),w.clip(),w.drawImage(h,0,0),w.restore())}function Ta(b,e,c,f){var j=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),t=~~(f.r*255),o=~~(f.g*255),f=~~(f.b*255);wa[0]=j<0?0:j>255?255:j;wa[1]=g<0?0:g>255?255:g;wa[2]=b<0?0:b>255?255:b;wa[4]=h<0?0:h>255?255:h;wa[5]=k<0?0:k>255?255:k;wa[6]=e<0?0:e>255?255:e;wa[8]=m<0?0:m>255?255:m;wa[9]=n<0?0:n>255?255:n;wa[10]=c<0?0:c>255?255: +c;wa[12]=t<0?0:t>255?255:t;wa[13]=o<0?0:o>255?255:o;wa[14]=f<0?0:f>255?255:f;Qa.putImageData(Wa,0,0);Sa.drawImage(Pa,0,0);return Ra}function Ja(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function E(b,e){var c=e.x-b.x,f=e.y-b.y,j=1/Math.sqrt(c*c+f*f);c*=j;f*=j;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ua,x,ma,za,Ha,Oa,Va,ra;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,u);h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,k,this.sortElements);(O=b.lights.length> 0)&&o(b);Ua=0;for(x=m.length;Ua0&&(c.r+=g.color.r*h,c.g+=g.color.g*h,c.b+=g.color.b*h)):g instanceof THREE.PointLight&&(S.sub(g.position,e.centroidWorld),S.normalize(),h=e.normalWorld.dot(S)*g.intensity,h>0&&(c.r+=g.color.r*h,c.g+=g.color.g*h,c.b+=g.color.b*h))}function c(e,c,m,n,t,p){h.data.vertices+=3;h.data.faces++;j=f(ca++);j.setAttribute("d", -"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?H.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?C?(D.r=Q.r,D.g=Q.g,D.b=Q.b,b(p,n,D),H.r=Math.max(0,Math.min(t.color.r*D.r,1)),H.g=Math.max(0,Math.min(t.color.g*D.g,1)),H.b=Math.max(0,Math.min(t.color.b*D.b,1)),H.updateHex()):H.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(I=1-t.__2near/(t.__farPlusNear- -n.z*t.__farMinusNear),H.setRGB(I,I,I)):t instanceof THREE.MeshNormalMaterial&&H.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));t.wireframe?j.setAttribute("style","fill: none; stroke: #"+k(H.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):j.setAttribute("style","fill: #"+k(H.hex.toString(16))+"; fill-opacity: "+t.opacity);o.appendChild(j)}function e(e,c,m,n, -t,p,u){h.data.vertices+=4;h.data.faces++;j=f(ca++);j.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?H.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?C?(D.r=Q.r,D.g=Q.g,D.b=Q.b,b(u,t,D),H.r=Math.max(0,Math.min(p.color.r*D.r,1)),H.g=Math.max(0,Math.min(p.color.g*D.g,1)),H.b=Math.max(0,Math.min(p.color.b* -D.b,1)),H.updateHex()):H.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(I=1-p.__2near/(p.__farPlusNear-t.z*p.__farMinusNear),H.setRGB(I,I,I)):p instanceof THREE.MeshNormalMaterial&&H.setRGB(g(t.normalWorld.x),g(t.normalWorld.y),g(t.normalWorld.z));p.wireframe?j.setAttribute("style","fill: none; stroke: #"+k(H.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):j.setAttribute("style", -"fill: #"+k(H.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(j)}function f(b){K[b]==null&&(K[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),Z==0&&K[b].setAttribute("shape-rendering","crispEdges"));return K[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function k(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,v,u,w,B,A,y,G=new THREE.Rectangle,z=new THREE.Rectangle,C= -!1,H=new THREE.Color(16777215),D=new THREE.Color(16777215),Q=new THREE.Color(0),J=new THREE.Color(0),F=new THREE.Color(0),I,S=new THREE.Vector3,K=[],ea=[],j,ca,T,Z=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":Z=1;break;case "low":Z=0}};this.setSize=function(b,e){p=b;t=e;v=p/2;u=t/2;o.setAttribute("viewBox",-v+" "+-u+" "+p+" "+t);o.setAttribute("width",p);o.setAttribute("height",t);G.set(-v, --u,v,u)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,f){var g,t,p,H,D,I,L,K;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,f,this.sortElements);T=ca=0;if(C=b.lights.length>0){L=b.lights;Q.setRGB(0,0,0);J.setRGB(0,0,0);F.setRGB(0,0,0);g=0;for(t=L.length;g0&&(c.r+=g.color.r*h,c.g+=g.color.g*h,c.b+=g.color.b*h)):g instanceof THREE.PointLight&&(S.sub(g.position,e.centroidWorld),S.normalize(),h=e.normalWorld.dot(S)*g.intensity,h>0&&(c.r+=g.color.r*h,c.g+=g.color.g*h,c.b+=g.color.b*h))}function c(e,c,m,n,t,o){h.data.vertices+=3;h.data.faces++;j=f(ca++);j.setAttribute("d", +"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?H.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?C?(D.r=Q.r,D.g=Q.g,D.b=Q.b,b(o,n,D),H.r=Math.max(0,Math.min(t.color.r*D.r,1)),H.g=Math.max(0,Math.min(t.color.g*D.g,1)),H.b=Math.max(0,Math.min(t.color.b*D.b,1)),H.updateHex()):H.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(I=1-t.__2near/(t.__farPlusNear- +n.z*t.__farMinusNear),H.setRGB(I,I,I)):t instanceof THREE.MeshNormalMaterial&&H.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));t.wireframe?j.setAttribute("style","fill: none; stroke: #"+k(H.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):j.setAttribute("style","fill: #"+k(H.hex.toString(16))+"; fill-opacity: "+t.opacity);p.appendChild(j)}function e(e,c,m,t, +n,o,u){h.data.vertices+=4;h.data.faces++;j=f(ca++);j.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+t.positionScreen.x+","+t.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?H.hex=o.color.hex:o instanceof THREE.MeshLambertMaterial?C?(D.r=Q.r,D.g=Q.g,D.b=Q.b,b(u,n,D),H.r=Math.max(0,Math.min(o.color.r*D.r,1)),H.g=Math.max(0,Math.min(o.color.g*D.g,1)),H.b=Math.max(0,Math.min(o.color.b* +D.b,1)),H.updateHex()):H.hex=o.color.hex:o instanceof THREE.MeshDepthMaterial?(I=1-o.__2near/(o.__farPlusNear-n.z*o.__farMinusNear),H.setRGB(I,I,I)):o instanceof THREE.MeshNormalMaterial&&H.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));o.wireframe?j.setAttribute("style","fill: none; stroke: #"+k(H.hex.toString(16))+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):j.setAttribute("style", +"fill: #"+k(H.hex.toString(16))+"; fill-opacity: "+o.opacity);p.appendChild(j)}function f(b){K[b]==null&&(K[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),Z==0&&K[b].setAttribute("shape-rendering","crispEdges"));return K[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function k(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,v,u,w,B,A,y,G=new THREE.Rectangle,z=new THREE.Rectangle,C= +!1,H=new THREE.Color(16777215),D=new THREE.Color(16777215),Q=new THREE.Color(0),J=new THREE.Color(0),F=new THREE.Color(0),I,S=new THREE.Vector3,K=[],ea=[],j,ca,T,Z=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":Z=1;break;case "low":Z=0}};this.setSize=function(b,e){o=b;t=e;v=o/2;u=t/2;p.setAttribute("viewBox",-v+" "+-u+" "+o+" "+t);p.setAttribute("width",o);p.setAttribute("height",t);G.set(-v, +-u,v,u)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,t,o,H,D,I,L,K;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,f,this.sortElements);T=ca=0;if(C=b.lights.length>0){L=b.lights;Q.setRGB(0,0,0);J.setRGB(0,0,0);F.setRGB(0,0,0);g=0;for(t=L.length;g=0)j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0);else{c=g.program.attributes;k.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]), -j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,n=k.morphTargetForcedOrder,t=k.morphTargetInfluences;fp&&(o=u,p=t[o]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=p;n[o]=1;p=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(g.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>= +j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,t=k.morphTargetInfluences;fn&&(p=u,n=t[p]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=n;o[p]=1;n=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(g.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>= 0&&(c=h.__webglCustomAttributes[m],j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[m],c.size,j.FLOAT,!1,0,0));b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER, h.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4, j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));k instanceof THREE.Mesh?(g.wireframe?(j.lineWidth(g.wireframeLinewidth),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.drawElements(j.LINES,h.__webglLineCount, j.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.drawElements(j.TRIANGLES,h.__webglFaceCount,j.UNSIGNED_SHORT,0)),ea.data.vertices+=h.__webglFaceCount,ea.data.faces+=h.__webglFaceCount/3,ea.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?j.LINE_STRIP:j.LINES,j.lineWidth(g.linewidth),j.drawArrays(k,0,h.__webglLineCount),ea.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,h.__webglParticleCount),ea.data.drawCalls++):k instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,h.__webglVertexCount),ea.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=j.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=j.createBuffer();b.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,b.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(e.attributes.position),j.vertexAttribPointer(e.attributes.position,3,j.FLOAT,!1,0,0));if(b.hasNormal){j.bindBuffer(j.ARRAY_BUFFER, -b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,g,h,k,m,n,t,p,o,u,v=b.count*3;for(u=0;u0&&y[0]0&&y[1]0&&y[0]0&&y[1]0.0010&&m.scale>0.0010)w[0]=m.x,w[1]=m.y,w[2]=m.z,u=m.size*m.scale/U,v[0]=u*t,v[1]=u,j.uniform3fv(A.screenPosition,w),j.uniform2fv(A.scale,v),j.uniform1f(A.rotation,m.rotation),j.uniform1f(A.opacity,m.opacity),D(m.blending),J(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST); -j.depthMask(N)}function y(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function G(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];a:{for(var k=h=void 0,m=void 0,n=void 0,t=void 0,t=g.__materials,k=0,m=t.length;k0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m));qa&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,da,m));Aa&&ja.hasTangents&& (j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,T,m));oa&&N>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));oa&&P>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,ea,m));ta&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,fa,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ha,m));M>0&&(j.bindBuffer(j.ARRAY_BUFFER, -h.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,U,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,W,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,X,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));k.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray, +h.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,U,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,V,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,X,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));k.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray, delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var sa;g=g.__materials;f=0;for(b=g.length;f=0;c--)b[c].object==e&&b.splice(c,1)}function C(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(n[m].counter+=1,o=n[m].hash+"_"+n[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:t})),b.geometryGroups[o].faces.push(h), +t=sa.vertices;g=sa.colors;A=t.length;h=g.length;B=sa.__vertexArray;k=sa.__colorArray;z=sa.__dirtyColors;if(sa.__dirtyVertices){for(m=0;m=0;c--)b[c].object==e&&b.splice(c,1)}function C(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(p[m].counter+=1,o=p[m].hash+"_"+p[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:n})),b.geometryGroups[o].faces.push(h), b.geometryGroups[o].vertices+=j}function H(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function D(b){if(b!=aa){switch(b){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD, j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}aa=b}}function Q(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,K(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,K(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,K(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,K(e.minFilter)),j.generateMipmap(b)):(j.texParameteri(b,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(b, j.TEXTURE_MAG_FILTER,S(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,S(e.minFilter)))}function J(b,e){if(b.needsUpdate)b.__webglInit?(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image)):(b.__webglTexture=j.createTexture(),j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image),b.__webglInit=!0),Q(j.TEXTURE_2D,b,b.image),j.bindTexture(j.TEXTURE_2D,null),b.needsUpdate=!1;j.activeTexture(j.TEXTURE0+ e);j.bindTexture(j.TEXTURE_2D,b.__webglTexture)}function F(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=j.createFramebuffer();b.__webglRenderbuffer=j.createRenderbuffer();b.__webglTexture=j.createTexture();j.bindTexture(j.TEXTURE_2D,b.__webglTexture);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,K(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,K(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER, K(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,K(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,K(b.format),b.width,b.height,0,K(b.format),K(b.type),null);j.bindRenderbuffer(j.RENDERBUFFER,b.__webglRenderbuffer);j.bindFramebuffer(j.FRAMEBUFFER,b.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER, j.DEPTH_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height);j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null, -c=W,b=U);e!=Z&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(L,fa,c,b),Z=e)}function I(b,e){var c;b=="fragment"?c=j.createShader(j.FRAGMENT_SHADER):b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}} +c=V,b=U);e!=Z&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(L,fa,c,b),Z=e)}function I(b,e){var c;b=="fragment"?c=j.createShader(j.FRAGMENT_SHADER):b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}} function K(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR; case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0} -var ea=this,j,ca=[],T=null,Z=null,N=!0,da=null,X=null,aa=null,ia=null,ha=null,na=null,ja=null,L=0,fa=0,W=0,U=0,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Y=new THREE.Matrix4,ka=new Float32Array(16),la=new Float32Array(16),ga=new THREE.Vector4,Da={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ua=b.canvas!==void 0?b.canvas:document.createElement("canvas"), +var ea=this,j,ca=[],T=null,Z=null,N=!0,da=null,X=null,aa=null,ia=null,ha=null,na=null,ja=null,L=0,fa=0,V=0,U=0,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Y=new THREE.Matrix4,ka=new Float32Array(16),la=new Float32Array(16),ga=new THREE.Vector4,Da={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ua=b.canvas!==void 0?b.canvas:document.createElement("canvas"), Aa=b.stencil!==void 0?b.stencil:!0,xa=b.antialias!==void 0?b.antialias:!1,ta=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ya=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ua;this.sortObjects=this.autoClear=!0;try{if(!(j=ua.getContext("experimental-webgl",{antialias:xa,stencil:Aa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+ " | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(va){console.error(va)}j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(ta.r,ta.g,ta.b,ya);this.context=j;var qa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Aa){var R={};R.vertices=new Float32Array(12);R.faces= new Uint16Array(6);R.darkness=0.5;R.vertices[0]=-20;R.vertices[1]=-20;R.vertices[2]=-1;R.vertices[3]=20;R.vertices[4]=-20;R.vertices[5]=-1;R.vertices[6]=20;R.vertices[7]=20;R.vertices[8]=-1;R.vertices[9]=-20;R.vertices[10]=20;R.vertices[11]=-1;R.faces[0]=0;R.faces[1]=1;R.faces[2]=2;R.faces[3]=0;R.faces[4]=2;R.faces[5]=3;R.vertexBuffer=j.createBuffer();R.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,R.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,R.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER, @@ -303,33 +303,33 @@ j.getUniformLocation(O.program,"screenPosition");var oa=!1,P={};P.vertices=new F 3;P.vertexBuffer=j.createBuffer();P.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,P.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,P.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,P.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,P.faces,j.STATIC_DRAW);P.program=j.createProgram();j.attachShader(P.program,I("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(P.program,I("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(P.program);P.attributes={};P.uniforms= {};P.attributes.position=j.getAttribLocation(P.program,"position");P.attributes.uv=j.getAttribLocation(P.program,"uv");P.uniforms.uvOffset=j.getUniformLocation(P.program,"uvOffset");P.uniforms.uvScale=j.getUniformLocation(P.program,"uvScale");P.uniforms.rotation=j.getUniformLocation(P.program,"rotation");P.uniforms.scale=j.getUniformLocation(P.program,"scale");P.uniforms.alignment=j.getUniformLocation(P.program,"alignment");P.uniforms.map=j.getUniformLocation(P.program,"map");P.uniforms.opacity=j.getUniformLocation(P.program, "opacity");P.uniforms.useScreenCoordinates=j.getUniformLocation(P.program,"useScreenCoordinates");P.uniforms.affectedByDistance=j.getUniformLocation(P.program,"affectedByDistance");P.uniforms.screenPosition=j.getUniformLocation(P.program,"screenPosition");P.uniforms.modelViewMatrix=j.getUniformLocation(P.program,"modelViewMatrix");P.uniforms.projectionMatrix=j.getUniformLocation(P.program,"projectionMatrix");var Ba=!1;this.setSize=function(b,e){ua.width=b;ua.height=e;this.setViewport(0,0,ua.width, -ua.height)};this.setViewport=function(b,e,c,f){L=b;fa=e;W=c;U=f;j.viewport(L,fa,W,U)};this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){N=b;j.depthMask(b)};this.setClearColorHex=function(b,e){ta.setHex(b);ya=e;j.clearColor(ta.r,ta.g,ta.b,ya)};this.setClearColor=function(b,e){ta.copy(b);ya=e;j.clearColor(ta.r,ta.g,ta.b,ya)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT| +ua.height)};this.setViewport=function(b,e,c,f){L=b;fa=e;V=c;U=f;j.viewport(L,fa,V,U)};this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){N=b;j.depthMask(b)};this.setClearColorHex=function(b,e){ta.setHex(b);ya=e;j.clearColor(ta.r,ta.g,ta.b,ya)};this.setClearColor=function(b,e){ta.copy(b);ya=e;j.clearColor(ta.r,ta.g,ta.b,ya)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT| j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){R.darkness=b};this.getContext=function(){return j};this.initMaterial=function(b,e,c,f){var h,g,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof -THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var o,n,t;o=t=m=0;for(n=e.length;o=0&&j.enableVertexAttribArray(p.position);p.color>=0&&j.enableVertexAttribArray(p.color);p.normal>=0&&j.enableVertexAttribArray(p.normal);p.tangent>=0&&j.enableVertexAttribArray(p.tangent); -b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&j.enableVertexAttribArray(p[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(j.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(j.enableVertexAttribArray(p.morphTarget1), -b.numSupportedMorphTargets++);p.morphTarget2>=0&&(j.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(j.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(j.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(j.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>=0&&(j.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>= -0&&(j.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b=0&&j.enableVertexAttribArray(t.position);t.color>=0&&j.enableVertexAttribArray(t.color);t.normal>=0&&j.enableVertexAttribArray(t.normal);t.tangent>=0&&j.enableVertexAttribArray(t.tangent); +b.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0&&(j.enableVertexAttribArray(t.skinVertexA),j.enableVertexAttribArray(t.skinVertexB),j.enableVertexAttribArray(t.skinIndex),j.enableVertexAttribArray(t.skinWeight));if(b.attributes)for(h in b.attributes)t[h]!==void 0&&t[h]>=0&&j.enableVertexAttribArray(t[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;t.morphTarget0>=0&&(j.enableVertexAttribArray(t.morphTarget0),b.numSupportedMorphTargets++);t.morphTarget1>=0&&(j.enableVertexAttribArray(t.morphTarget1), +b.numSupportedMorphTargets++);t.morphTarget2>=0&&(j.enableVertexAttribArray(t.morphTarget2),b.numSupportedMorphTargets++);t.morphTarget3>=0&&(j.enableVertexAttribArray(t.morphTarget3),b.numSupportedMorphTargets++);t.morphTarget4>=0&&(j.enableVertexAttribArray(t.morphTarget4),b.numSupportedMorphTargets++);t.morphTarget5>=0&&(j.enableVertexAttribArray(t.morphTarget5),b.numSupportedMorphTargets++);t.morphTarget6>=0&&(j.enableVertexAttribArray(t.morphTarget6),b.numSupportedMorphTargets++);t.morphTarget7>= +0&&(j.enableVertexAttribArray(t.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4), -k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(y*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof +o;m++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}for(var k=g,m=e,t=void 0,p=void 0,n=void 0,u=n=void 0,v=void 0,w=void 0,y=w=o=0,A=n=p=void 0,B=A=p=t=void 0,n=void 0,u=m.geometry,v=u.faces,A=k.faces,t=0,p=A.length;t0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4), +k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(y*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u=0;h--)e[h]==c&&e.splice(h,1)}else c instanceof THREE.LensFlare?z(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&z(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=k;return c}, clamp:function(b,c,e){return be?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -var GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,k=b.vertices,h=g.vertices,m=b.faces,n=g.faces,o=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,t=h.length;p25&&(k=25);g=(k-1)*0.5;e=Array(k);for(c=f=0;c1)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=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= this.getPrevKeyWith("pos",u,h.index-1).pos,this.points[1]=g,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",u,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[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(g,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f}}if(this.JITCompile&&p[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;ub.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];m=b[e[1]];n=b[e[2]];o=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(k[0],m[0],n[0],o[0],g,e,h);f[1]=this.interpolate(k[1],m[1],n[1],o[1],g,e,h);f[2]=this.interpolate(k[2],m[2],n[2],o[2],g,e,h);return f}; +"rot")THREE.Quaternion.slerp(g,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;ub.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(k[0],m[0],n[0],p[0],g,e,h);f[1]=this.interpolate(k[1],m[1],n[1],p[1],g,e,h);f[2]=this.interpolate(k[2],m[2],n[2],p[2],g,e,h);return f}; THREE.Animation.prototype.interpolate=function(b,c,e,f,g,k,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*k+b*g+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]}; THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed= @@ -380,7 +380,7 @@ this.heightSpeed?this.tdiff*((this.position.y0||this.autoForward&&!(p<0)?1:p));this.translateX(b*t);this.translateY(b*v);n&&(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 g=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,t=0,v=0,u=0,w=0,B=window.innerWidth/2,A=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*w));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*t);this.translateY(b*v);n&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); else if(this.forward.y1?c.normalize():c.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(g).setLength(c.x));f.addSelf(g.setLength(c.z));return f}; this.rotateCamera=function(){var b=Math.acos(k.dot(h)/k.length()/h.length());if(b){var e=(new THREE.Vector3).cross(k,h).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(g);c.multiplyVector3(this.up);c.multiplyVector3(h);this.staticMoving?k=h:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(k))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)}; -this.panCamera=function(){var b=p.clone().subSelf(o);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var e=g.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?o=p:o.addSelf(b.sub(p,o).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), +this.panCamera=function(){var b=o.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var e=g.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?p=o:p.addSelf(b.sub(o,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), g.lengthSq()0){h(0,0,-p-(k||0));for(n=b;n0){h(0,0,p+ -(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n0?(t=c[c.length-1],o=t.x,t=t.y):(t=this.actions[e-1].args,o=t[t.length-2],t=t[t.length-1]);for(v=1;v<=b;v++)u=v/b,w=THREE.FontUtils.b2(u,o,n,k),u=THREE.FontUtils.b2(u,t,p,g),c.push(new THREE.Vector2(w, +u));break;case THREE.PathActions.BEZIER_CURVE_TO:k=h[4];g=h[5];n=h[0];p=h[1];m=h[2];h=h[3];c.length>0?(t=c[c.length-1],o=t.x,t=t.y):(t=this.actions[e-1].args,o=t[t.length-2],t=t[t.length-1]);for(v=1;v<=b;v++)u=v/b,w=THREE.FontUtils.b3(u,o,n,m,k),u=THREE.FontUtils.b3(u,t,p,h,g),c.push(new THREE.Vector2(w,u))}return c}; +THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var k,h,m;h=0;for(m=b.length;hc)c=k.x;else if(k.xe)e=k.y;else if(k.y0){h(0,0,-o-(k||0));for(n=b;n0){h(0,0,o+ +(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n0;){for(m=0;m0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,v)))-1);o.push(p)}c.push(o)}for(var u,w,B,g=c.length,e=0;e0)for(f=0;f1&&(u= -this.vertices[h].position.clone(),w=this.vertices[n].position.clone(),B=this.vertices[o].position.clone(),u.normalize(),w.normalize(),B.normalize(),this.faces.push(new THREE.Face3(h,n,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(B.x,B.y,B.z)])),this.faceVertexUvs[0].push([p,t,A]))}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,g=Math.PI,k=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,v)))-1);p.push(o)}c.push(p)}for(var u,w,B,g=c.length,e=0;e0)for(f=0;f1&&(u= +this.vertices[h].position.clone(),w=this.vertices[n].position.clone(),B=this.vertices[p].position.clone(),u.normalize(),w.normalize(),B.normalize(),this.faces.push(new THREE.Face3(h,n,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(B.x,B.y,B.z)])),this.faceVertexUvs[0].push([o,t,A]))}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){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; -THREE.TextGeometry.prototype.set=function(b,c){function e(b,e,c){w.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){w.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,k=c.curveSegments!==void 0?c.curveSegments:4,h=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",o=c.bezelThickness!==void 0?c.bezelThickness:10,p=c.bezelSize!==void 0?c.bezelSize:8,t=c.bezelEnabled!== -void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=k;THREE.FontUtils.face=h;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=p;var m=THREE.FontUtils.drawText(b),k=m.points,v=m.faces,h=m.contour,u=m.bezel,w=this;w.vertices=[];w.faces=[];for(var B,n=k.length,A=v.length,p=u.length,m=0;m0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];o=n*2+m;v=o-1;f(o,v,v+p,o+p);for(t=0;t0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];for(t=0;t0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];p=n*2+m;v=p-1;f(p,v,v+o,p+o);for(t=0;t0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];for(t=0;t0&&m.push({shape:g,holes:f}),g=t,f=[]):f.push(t):this.Triangulate.area(t)<0?(m.push({shape:t,holes:f}),f=[]):f.push(t);e++}p&&m.push({shape:g,holes:f})}var v,u,w, -B,A,y;k=[];for(h=0;h=0?u-1:g.length-1;var t=v-1>=0?v-1:p.length-1,G=[];G.push(p[v]);G.push(g[u]);G.push(g[e]);w=this.Triangulate.area(G);var z=[];z.push(p[v]);z.push(p[t]);z.push(g[u]);A=this.Triangulate.area(z);B=u;y=v;u+=1;v+=-1;u<0&&(u+=g.length);u%=g.length;v<0&&(v+=p.length);v%=g.length;e=u- -1>=0?u-1:g.length-1;t=v-1>=0?v-1:p.length-1;G=[];G.push(p[v]);G.push(g[u]);G.push(g[e]);G=this.Triangulate.area(G);z=[];z.push(p[v]);z.push(p[t]);z.push(g[u]);z=this.Triangulate.area(z);w+A>G+z&&(u=B,v=y,u<0&&(u+=g.length),u%=g.length,v<0&&(v+=p.length),v%=g.length,e=u-1>=0?u-1:g.length-1,t=v-1>=0?v-1:p.length-1);w=g.slice(0,u);A=g.slice(u);B=p.slice(v);y=p.slice(0,v);k.push(p[v]);k.push(g[u]);k.push(g[e]);k.push(p[v]);k.push(p[t]);k.push(g[u]);g=w.concat(B).concat(y).concat(A)}n.shape=g}v=[];u=[]; -for(h=o=0;h=0;){if(o){if(o.equals(e[b])){o=null;n=this.Triangulate.area(f)>0;h.push(n);k.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else o=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;f=0;for(var p;--b>=0;)n=e[b],m=k[f],n=n.clone().subSelf(m), -p=this.bezelSize/n.length(),h[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b* -c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f){var g=[],k,h,m,n,o,p,t,v,u,w,B=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));m=c.length;for(b=0;b0)for(o=0;o2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}n=o;g<=n&&(n=0);o=n+1;g<=o&&(o=0);p=o+1;g<=p&&(p=0);var v;a:{v=b;var u=n,w=o,B=p,A=g,y=h,G=void 0,z=void 0,C=void 0, +{points:b,faces:[]};for(var e,f,g,k,h,m=[],n=0;n0&&m.push({shape:g,holes:f}),g=t,f=[]):f.push(t):this.Triangulate.area(t)<0?(m.push({shape:t,holes:f}),f=[]):f.push(t);e++}o&&m.push({shape:g,holes:f})}var v,u,w, +B,A,y;k=[];for(h=0;h=0?u-1:g.length-1;var t=v-1>=0?v-1:o.length-1,G=[];G.push(o[v]);G.push(g[u]);G.push(g[e]);w=this.Triangulate.area(G);var z=[];z.push(o[v]);z.push(o[t]);z.push(g[u]);A=this.Triangulate.area(z);B=u;y=v;u+=1;v+=-1;u<0&&(u+=g.length);u%=g.length;v<0&&(v+=o.length);v%=g.length;e=u- +1>=0?u-1:g.length-1;t=v-1>=0?v-1:o.length-1;G=[];G.push(o[v]);G.push(g[u]);G.push(g[e]);G=this.Triangulate.area(G);z=[];z.push(o[v]);z.push(o[t]);z.push(g[u]);z=this.Triangulate.area(z);w+A>G+z&&(u=B,v=y,u<0&&(u+=g.length),u%=g.length,v<0&&(v+=o.length),v%=g.length,e=u-1>=0?u-1:g.length-1,t=v-1>=0?v-1:o.length-1);w=g.slice(0,u);A=g.slice(u);B=o.slice(v);y=o.slice(0,v);k.push(o[v]);k.push(g[u]);k.push(g[e]);k.push(o[v]);k.push(o[t]);k.push(g[u]);g=w.concat(B).concat(y).concat(A)}n.shape=g}v=[];u=[]; +for(h=p=0;h=0;){if(o){if(o.equals(e[b])){o=null;n=this.Triangulate.area(f)>0;h.push(n);k.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else o=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=0;--b>=0;)n=e[b], +m=k[f],n=n.clone().subSelf(m),p=this.bezelSize/n.length(),h[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b, +c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f){var g=[],k=new THREE.Path,h,m,n,p,o,t,v,u,w,B,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));n=c.length;for(b=0;b0)for(p=0;p2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}n=p;g<=n&&(n=0);p=n+1;g<=p&&(p=0);o=p+1;g<=o&&(o=0);var v;a:{v=b;var u=n,w=p,B=o,A=g,y=h,G=void 0,z=void 0,C=void 0, H=void 0,D=void 0,Q=void 0,J=void 0,F=void 0,I=void 0,z=v[y[u]].x,C=v[y[u]].y,H=v[y[w]].x,D=v[y[w]].y,Q=v[y[B]].x,J=v[y[B]].y;if(1.0E-10>(H-z)*(J-C)-(D-C)*(Q-z))v=!1;else{for(G=0;G=0&&ea>=0&&ca>= -0){v=!1;break a}}v=!0}}if(v){t=h[n];v=h[o];u=h[p];k.push(b[t]);k.push(b[v]);k.push(b[u]);m.push([h[n],h[o],h[p]]);n=o;for(p=o+1;p>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=p(b,c),f=p(b,c+1),h=p(b,c+2);return(p(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=p(b,c);return(p(b,c+1)<<8)+e}function o(b,c){var e=p(b,c);return e>127?e-256:e}function p(b, +h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function p(b,c){var e=o(b,c);return e>127?e-256:e}function o(b, c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+D);h=g(b,c+Q);c=n(b,c+J);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function v(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+D);h=g(b,c+Q);j=n(b,c+J);k=g(b,c+F);o=g(b,c+I);c=g(b,c+S);THREE.BinaryLoader.prototype.f3n(y,C,e,f,h,j,k,o,c)}function u(c){var e,f,h,k;e=g(b,c);f=g(b,c+K);h=g(b,c+ea);k=g(b,c+j);c=n(b,c+ca);THREE.BinaryLoader.prototype.f4(y,e,f,h,k,c)}function w(c){var e,f,h,k,o,p,t,u;e=g(b,c);f=g(b,c+K);h=g(b,c+ea);k=g(b,c+j);o= n(b,c+ca);p=g(b,c+T);t=g(b,c+Z);u=g(b,c+N);c=g(b,c+da);THREE.BinaryLoader.prototype.f4n(y,C,e,f,h,k,o,p,t,u,c)}function B(c){var e,f;e=g(b,c);f=g(b,c+X);c=g(b,c+aa);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],H[e*2],H[e*2+1],H[f*2],H[f*2+1],H[c*2],H[c*2+1])}function A(c){var e,f,h;e=g(b,c);f=g(b,c+ia);h=g(b,c+ha);c=g(b,c+na);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],H[e*2],H[e*2+1],H[f*2],H[f*2+1],H[h*2],H[h*2+1],H[c*2],H[c*2+1])}var y=this,G=0,z,C=[],H=[],D,Q,J,F,I,S,K,ea,j,ca, -T,Z,N,da,X,aa,ia,ha,na,ja,L,fa,W,U,$;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);z={signature:b.substr(G,8),header_bytes:p(b,G+8),vertex_coordinate_bytes:p(b,G+9),normal_coordinate_bytes:p(b,G+10),uv_coordinate_bytes:p(b,G+11),vertex_index_bytes:p(b,G+12),normal_index_bytes:p(b,G+13),uv_index_bytes:p(b,G+14),material_index_bytes:p(b,G+15),nvertices:g(b,G+16),nnormals:g(b,G+16+4),nuvs:g(b,G+16+8),ntri_flat:g(b,G+16+12),ntri_smooth:g(b,G+16+16),ntri_flat_uv:g(b,G+16+20),ntri_smooth_uv:g(b, +T,Z,N,da,X,aa,ia,ha,na,ja,L,fa,V,U,$;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);z={signature:b.substr(G,8),header_bytes:o(b,G+8),vertex_coordinate_bytes:o(b,G+9),normal_coordinate_bytes:o(b,G+10),uv_coordinate_bytes:o(b,G+11),vertex_index_bytes:o(b,G+12),normal_index_bytes:o(b,G+13),uv_index_bytes:o(b,G+14),material_index_bytes:o(b,G+15),nvertices:g(b,G+16),nnormals:g(b,G+16+4),nuvs:g(b,G+16+8),ntri_flat:g(b,G+16+12),ntri_smooth:g(b,G+16+16),ntri_flat_uv:g(b,G+16+20),ntri_smooth_uv:g(b, G+16+24),nquad_flat:g(b,G+16+28),nquad_smooth:g(b,G+16+32),nquad_flat_uv:g(b,G+16+36),nquad_smooth_uv:g(b,G+16+40)};G+=z.header_bytes;D=z.vertex_index_bytes;Q=z.vertex_index_bytes*2;J=z.vertex_index_bytes*3;F=z.vertex_index_bytes*3+z.material_index_bytes;I=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;S=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;K=z.vertex_index_bytes;ea=z.vertex_index_bytes*2;j=z.vertex_index_bytes*3;ca=z.vertex_index_bytes*4;T=z.vertex_index_bytes* 4+z.material_index_bytes;Z=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;N=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;da=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;X=z.uv_index_bytes;aa=z.uv_index_bytes*2;ia=z.uv_index_bytes;ha=z.uv_index_bytes*2;na=z.uv_index_bytes*3;c=z.vertex_index_bytes*3+z.material_index_bytes;$=z.vertex_index_bytes*4+z.material_index_bytes;ja=z.ntri_flat*c;L=z.ntri_smooth*(c+z.normal_index_bytes*3);fa= -z.ntri_flat_uv*(c+z.uv_index_bytes*3);W=z.ntri_smooth_uv*(c+z.normal_index_bytes*3+z.uv_index_bytes*3);U=z.nquad_flat*$;c=z.nquad_smooth*($+z.normal_index_bytes*4);$=z.nquad_flat_uv*($+z.uv_index_bytes*4);G+=function(c){for(var f,g,j,k=z.vertex_coordinate_bytes*3,m=c+z.nvertices*k;c1&&(I=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(D,I);object.name=u;object.position.set(z[0],z[1],z[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;N.scene.addObject(object);N.objects[u]=object;G.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),N.scene.collisions.colliders.push(b)); if(G.castsShadow)b=new THREE.ShadowVolume(D),N.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},N.triggers[object.name]=b)}}else z=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(z[0],z[1],z[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], -s[1],s[2]),object.visible=G.visible!==void 0?G.visible:!1,N.scene.addObject(object),N.objects[u]=object,N.empties[u]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},N.triggers[object.name]=b)}function n(b){return function(c){N.geometries[b]=c;m();j-=1;e.onLoadComplete();p()}}function o(b){return function(c){N.geometries[b]=c}}function p(){e.callbackProgress({totalModels:T,totalTextures:Z,loadedModels:T-j,loadedTextures:Z-ca},N);e.onLoadProgress();j==0&&ca==0&&c(N)} +s[1],s[2]),object.visible=G.visible!==void 0?G.visible:!1,N.scene.addObject(object),N.objects[u]=object,N.empties[u]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},N.triggers[object.name]=b)}function n(b){return function(c){N.geometries[b]=c;m();j-=1;e.onLoadComplete();o()}}function p(b){return function(c){N.geometries[b]=c}}function o(){e.callbackProgress({totalModels:T,totalTextures:Z,loadedModels:T-j,loadedTextures:Z-ca},N);e.onLoadProgress();j==0&&ca==0&&c(N)} var t,v,u,w,B,A,y,G,z,C,H,D,Q,J,F,I,S,K,ea,j,ca,T,Z,N;K=b.data;F=new THREE.BinaryLoader;ea=new THREE.JSONLoader;ca=j=0;N={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in K.objects)if(G=K.objects[u],G.meshCollider){b=!0;break}if(b)N.scene.collisions=new THREE.CollisionSystem;if(K.transform){b=K.transform.position;C=K.transform.rotation;var da=K.transform.scale;b&&N.scene.position.set(b[0],b[1],b[2]);C&&N.scene.rotation.set(C[0], -C[1],C[2]);da&&N.scene.scale.set(da[0],da[1],da[2]);(b||C||da)&&N.scene.updateMatrix()}b=function(){ca-=1;p();e.onLoadComplete()};for(B in K.cameras){C=K.cameras[B];if(C.type=="perspective")Q=new THREE.Camera(C.fov,C.aspect,C.near,C.far);else if(C.type=="ortho")Q=new THREE.Camera,Q.projectionMatrix=THREE.Matrix4.makeOrtho(C.left,C.right,C.top,C.bottom,C.near,C.far);z=C.position;C=C.target;Q.position.set(z[0],z[1],z[2]);Q.target.position.set(C[0],C[1],C[2]);N.cameras[B]=Q}for(w in K.lights)B=K.lights[w], +C[1],C[2]);da&&N.scene.scale.set(da[0],da[1],da[2]);(b||C||da)&&N.scene.updateMatrix()}b=function(){ca-=1;o();e.onLoadComplete()};for(B in K.cameras){C=K.cameras[B];if(C.type=="perspective")Q=new THREE.Camera(C.fov,C.aspect,C.near,C.far);else if(C.type=="ortho")Q=new THREE.Camera,Q.projectionMatrix=THREE.Matrix4.makeOrtho(C.left,C.right,C.top,C.bottom,C.near,C.far);z=C.position;C=C.target;Q.position.set(z[0],z[1],z[2]);Q.target.position.set(C[0],C[1],C[2]);N.cameras[B]=Q}for(w in K.lights)B=K.lights[w], Q=B.color!==void 0?B.color:16777215,C=B.intensity!==void 0?B.intensity:1,B.type=="directional"?(z=B.direction,S=new THREE.DirectionalLight(Q,C),S.position.set(z[0],z[1],z[2]),S.position.normalize()):B.type=="point"?(z=B.position,d=B.distance,S=new THREE.PointLight(Q,C,d),S.position.set(z[0],z[1],z[2])):B.type=="ambient"&&(S=new THREE.AmbientLight(Q)),N.scene.addLight(S),N.lights[w]=S;for(A in K.fogs)w=K.fogs[A],w.type=="linear"?J=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(J=new THREE.FogExp2(0, w.density)),C=w.color,J.color.setRGB(C[0],C[1],C[2]),N.fogs[A]=J;if(N.cameras&&K.defaults.camera)N.currentCamera=N.cameras[K.defaults.camera];if(N.fogs&&K.defaults.fog)N.scene.fog=N.fogs[K.defaults.fog];C=K.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(C[0],C[1],C[2]);N.bgColorAlpha=K.defaults.bgalpha;for(t in K.geometries)if(A=K.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")j+=1,e.onLoadStart();T=j;for(t in K.geometries)A=K.geometries[t],A.type=="cube"?(D=new THREE.CubeGeometry(A.width, A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),N.geometries[t]=D):A.type=="plane"?(D=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),N.geometries[t]=D):A.type=="sphere"?(D=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),N.geometries[t]=D):A.type=="cylinder"?(D=new THREE.CylinderGeometry(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset),N.geometries[t]=D):A.type=="torus"?(D=new THREE.TorusGeometry(A.radius, -A.tube,A.segmentsR,A.segmentsT),N.geometries[t]=D):A.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(A.subdivisions),N.geometries[t]=D):A.type=="bin_mesh"?F.load({model:f(A.url,K.urlBaseType),callback:n(t)}):A.type=="ascii_mesh"?ea.load({model:f(A.url,K.urlBaseType),callback:n(t)}):A.type=="embedded_mesh"&&(A=K.embeds[A.id])&&ea.createModel(A,o(t),"");for(y in K.textures)if(t=K.textures[y],t.url instanceof Array){ca+=t.url.length;for(F=0;F=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&&(n=this.size-1);var v=Math.floor(o-m);v<1&&(v=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var u=Math.floor(p-m);u<1&&(u=1);m=Math.floor(p+m);m>this.size-1&&(m=this.size- -1);for(var w,B,A,y,G,z;t0&&(this.field[A+w]+=y)}}};this.addPlaneX=function(b,c){var g,k,h,m,n,o=this.size,p=this.yd,t=this.zd,v=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(g=0;g0)for(k=0;kp&&(w=p);for(k=0;k0){n=k*t;for(g=0;gsize&&(dist=size);for(h=0;h0){n=zd*h;for(k=0;kthis.size-1&&(n=this.size-1);var v=Math.floor(p-m);v<1&&(v=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var u=Math.floor(o-m);u<1&&(u=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size- +1);for(var w,B,A,y,G,z;t0&&(this.field[A+w]+=y)}}};this.addPlaneX=function(b,c){var g,k,h,m,n,p=this.size,o=this.yd,t=this.zd,v=this.field,u=p*Math.sqrt(b/c);u>p&&(u=p);for(g=0;g0)for(k=0;ko&&(w=o);for(k=0;k0){n=k*t;for(g=0;gsize&&(dist=size);for(h=0;h0){n=zd*h;for(k=0;kk?this.hits.push(g):this.hits.unshift(g),k=f;return this.hits}; THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.distc.length)return null;return c[e]}; THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,k=0;k=m*g))return Number.MAX_VALUE;h/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(h);m.addSelf(b.origin);Math.abs(k.x)> Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=m.y-c.y,k=e.y-c.y,g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(k.y)>Math.abs(k.z)?(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=k*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=k*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h}; THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f}; -THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,k=0,h=0,m=0,n=0,o=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,o=!1,h=1);e.origin.yc.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y, -o=!1,m=1);e.origin.zc.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,o=!1,n=1);if(o)return-1;o=0;g>f&&(o=1,f=g);k>f&&(o=2,f=k);switch(o){case 0:m=e.origin.y+e.direction.y*f;if(mc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(hc.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z* +THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,k=0,h=0,m=0,n=0,p=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,h=1);e.origin.yc.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y, +p=!1,m=1);e.origin.zc.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,p=!1,n=1);if(p)return-1;p=0;g>f&&(p=1,f=g);k>f&&(p=2,f=k);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(mc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(hc.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z* f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:h=e.origin.x+e.direction.x*f;if(hc.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(mc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE}; 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,g=new THREE.Camera,k=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,n,o,p;g.useTarget=k.useTarget=!1;g.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z= +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,k=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;g.useTarget=k.useTarget=!1;g.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),v=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:t},mapRight:{type:"t",value:1,texture:v}},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 w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||o!==e.near||p!==e.fov){n=e.aspect;o=e.near;p=e.fov;var y=e.projectionMatrix.clone(),G=125/30*0.5,z=G*o/125,C=o*Math.tan(p*Math.PI/360),H;h.n14=G;m.n14=-G;G=-C*n+z;H=C*n+z;y.n11=2*o/(H-G);y.n13=(H+G)/(H-G);g.projectionMatrix=y.clone();G=-C*n-z;H=C*n-z;y.n11=2*o/(H-G); -y.n13=(H+G)/(H-G);k.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=o;g.far=e.far;f.call(c,b,g,t,!0);k.matrix=e.matrixWorld.clone().multiplySelf(h);k.update(null,!0);k.position.copy(e.position);k.near=o;k.far=e.far;f.call(c,b,k,v,!0);f.call(c,w,u)}}; +var w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||p!==e.near||o!==e.fov){n=e.aspect;p=e.near;o=e.fov;var y=e.projectionMatrix.clone(),G=125/30*0.5,z=G*p/125,C=p*Math.tan(o*Math.PI/360),H;h.n14=G;m.n14=-G;G=-C*n+z;H=C*n+z;y.n11=2*p/(H-G);y.n13=(H+G)/(H-G);g.projectionMatrix=y.clone();G=-C*n-z;H=C*n-z;y.n11=2*p/(H-G); +y.n13=(H+G)/(H-G);k.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,t,!0);k.matrix=e.matrixWorld.clone().multiplySelf(h);k.update(null,!0);k.position.copy(e.position);k.near=p;k.far=e.far;f.call(c,b,k,v,!0);f.call(c,w,u)}}; if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,k,h=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);g=b/2;k=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far; h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,k);f.call(c,b,h);this.setViewport(g,0,g,k);f.call(c,b,m,!1)}}; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index 5152859e8e70bb72a5e44118fd21d162ed388e8e..86e15ad270a4bfa85563d7388f71b3a0dd7c27f7 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -1,10 +1,10 @@ // ThreeExtras.js r42 - http://github.com/mrdoob/three.js -THREE.ColorUtils={adjustHSV:function(a,c,b,f){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.ColorUtils.clamp(e.h+c,0,1);e.s=THREE.ColorUtils.clamp(e.s+b,0,1);e.v=THREE.ColorUtils.clamp(e.v+f,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,c){var b=a.r,f=a.g,e=a.b,h=Math.max(Math.max(b,f),e),g=Math.min(Math.min(b,f),e);if(g==h)g=b=0;else{var k=h-g,g=k/h,b=b==h?(f-e)/k:f==h?2+(e-b)/k:4+(b-f)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=g;c.v=h;return c}, -clamp:function(a,c,b){return ab?b:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,f=a.vertices.length,e=b?c.geometry:c,h=a.vertices,g=e.vertices,k=a.faces,j=e.faces,m=a.faceVertexUvs[0],e=e.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var l=0,n=g.length;l1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=h;return b}, +clamp:function(a,b,c){return ac?c:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; +var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,g=a.vertices.length,e=c?b.geometry:b,h=a.vertices,f=e.vertices,j=a.faces,k=e.faces,m=a.faceVertexUvs[0],e=e.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var l=0,n=f.length;l 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;", @@ -14,172 +14,181 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i25&&(h=25);e=(h-1)*0.5;b=Array(h);for(c=f=0;c25&&(h=25);e=(h-1)*0.5;c=Array(h);for(b=g=0;b1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+p),f=f<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=e[0]+(h[0]-e[0])*f,b.y=e[1]+(h[1]-e[1])*f,b.z=e[2]+(h[2]-e[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",p,g.index-1).pos,this.points[1]=e,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",p,k.index+1).pos,f=f*0.33+0.33,e=this.interpolateCatmullRom(this.points,f),b.x=e[0],b.y=e[1],b.z=e[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(b),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,f,0)}else if(b=== -"rot")THREE.Quaternion.slerp(e,h,a.quaternion,f);else if(b==="scl")b=a.scale,b.x=e[0]+(h[0]-e[0])*f,b.y=e[1]+(h[1]-e[1])*f,b.z=e[2]+(h[2]-e[2])*f}}if(this.JITCompile&&l[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;pa.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];j=a[b[2]];m=a[b[3]];b=e*e;g=e*b;f[0]=this.interpolate(h[0],k[0],j[0],m[0],e,b,g);f[1]=this.interpolate(h[1],k[1],j[1],m[1],e,b,g);f[2]=this.interpolate(h[2],k[2],j[2],m[2],e,b,g);return f}; -THREE.Animation.prototype.interpolate=function(a,c,b,f,e,h,g){a=(b-a)*0.5;f=(f-c)*0.5;return(2*(c-b)+a+f)*g+(-3*(c-b)-2*a-f)*h+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b0?b:0:b>=0?b:b+f.length;b>=0;b--)if(f[b][a]!==void 0)return f[b];return this.data.hierarchy[c].keys[f.length-1]}; -THREE.FirstPersonCamera=function(a){function c(a,c){return function(){c.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed= +THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,g,e,h,f,j,k,m,l=this.data.JIT.hierarchy,n,o;this.currentTime+=a*this.timeScale;o=this.currentTime;n=this.currentTime%=this.data.length;m=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,u=this.hierarchy.length;p1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+g+" on bone "+p),g=g<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(h[0]-e[0])*g,c.y=e[1]+(h[1]-e[1])*g,c.z=e[2]+(h[2]-e[2])*g;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",p,f.index-1).pos,this.points[1]=e,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",p,j.index+1).pos,g=g*0.33+0.33,e=this.interpolateCatmullRom(this.points,g),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)g=this.interpolateCatmullRom(this.points,g*1.01),this.target.set(g[0],g[1],g[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),g=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,g,0)}else if(c=== +"rot")THREE.Quaternion.slerp(e,h,a.quaternion,g);else if(c==="scl")c=a.scale,c.x=e[0]+(h[0]-e[0])*g,c.y=e[1]+(h[1]-e[1])*g,c.z=e[2]+(h[2]-e[2])*g}}if(this.JITCompile&&l[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;pa.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];j=a[c[1]];k=a[c[2]];m=a[c[3]];c=e*e;f=e*c;g[0]=this.interpolate(h[0],j[0],k[0],m[0],e,c,f);g[1]=this.interpolate(h[1],j[1],k[1],m[1],e,c,f);g[2]=this.interpolate(h[2],j[2],k[2],m[2],e,c,f);return g}; +THREE.Animation.prototype.interpolate=function(a,b,c,g,e,h,f){a=(c-a)*0.5;g=(g-b)*0.5;return(2*(b-c)+a+g)*f+(-3*(b-c)-2*a-g)*h+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var g=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c0?c:0:c>=0?c:c+g.length;c>=0;c--)if(g[c][a]!==void 0)return g[c];return this.data.hierarchy[b].keys[g.length-1]}; +THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed= a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!== void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(a){a.preventDefault(); a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.mouseX=a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward= !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;if(!this.freeze){this.autoSpeedFactor= -this.heightSpeed?this.tdiff*((this.position.ythis.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.translateZ(c);this.moveLeft&&this.translateX(-c);this.moveRight&&this.translateX(c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&& -(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,e=this.position;a.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=e.y+100*Math.cos(this.phi);a.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi= -(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;e=this.position;a.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=e.y+100*Math.cos(this.phi);a.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown), -!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype; -THREE.FirstPersonCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))}; -THREE.PathCamera=function(a){function c(a,b,c,g){var f={name:c,fps:0.6,length:g,hierarchy:[]},h,e=b.getControlPointsArray(),k=b.getLength(),j=e.length,x=0;h=j-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:e[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:g,pos:e[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;hthis.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var b=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.translateZ(b);this.moveLeft&&this.translateX(-b);this.moveRight&&this.translateX(b);b=this.tdiff*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&& +(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,e=this.position;a.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=e.y+100*Math.cos(this.phi);a.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi= +(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;e=this.position;a.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=e.y+100*Math.cos(this.phi);a.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown), +!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype; +THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))}; +THREE.PathCamera=function(a){function b(a,c,b,f){var g={name:b,fps:0.6,length:f,hierarchy:[]},e,h=c.getControlPointsArray(),j=c.getLength(),k=h.length,w=0;e=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[e]={time:f,pos:h[e],rot:[0,0,0,1],scl:[1,1,1]};for(e=1;e=0?g:g+e;g=this.verticalAngleMap.srcRange;f=this.verticalAngleMap.dstRange;var k=f[1]-f[0];this.phi= -TWEEN.Easing.Quadratic.EaseInOut(((this.phi-g[0])*(f[1]-f[0])/(g[1]-g[0])+f[0]-f[0])/k)*k+f[0];g=this.horizontalAngleMap.srcRange;f=this.horizontalAngleMap.dstRange;k=f[1]-f[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-g[0])*(f[1]-f[0])/(g[1]-g[0])+f[0]-f[0])/k)*k+f[0];g=this.target.position;g.x=100*Math.sin(this.phi)*Math.cos(this.theta);g.y=100*Math.cos(this.phi);g.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,b,c)};this.onMouseMove=function(a){this.mouseX= -a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),g=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),j=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(j,g);a.position.set(0,10,0);this.animation= -c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,b){return function(){b.apply(a,arguments)}}(this,this.onMouseMove), +window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var f,g;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;f=this.phi%e;this.phi=f>=0?f:f+e;f=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var j=g[1]-g[0];this.phi= +TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g[0])/j)*j+g[0];f=this.horizontalAngleMap.srcRange;g=this.horizontalAngleMap.dstRange;j=g[1]-g[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g[0])/j)*j+g[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,c,b)};this.onMouseMove=function(a){this.mouseX= +a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),f=new THREE.MeshLambertMaterial({color:65280}),j=new THREE.CubeGeometry(10,10,20),k=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,f);a.position.set(0,10,0);this.animation= +b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&g(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,c){return function(){c.apply(a,arguments)}}(this,this.onMouseMove), !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; -THREE.FlyCamera=function(a){function c(a,c){return function(){c.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward= +THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward= a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier= 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}}; this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break; -case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),e=c.size[0]/2,h=c.size[1]/2;this.moveState.yawLeft=-(a.clientX-c.offset[0]-e)/e;this.moveState.pitchDown=(a.clientY- -c.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,c=this.tdiff* -this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVector.y*a);this.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var a=this.moveState.forward|| +case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),e=b.size[0]/2,h=b.size[1]/2;this.moveState.yawLeft=-(a.clientX-b.offset[0]-e)/e;this.moveState.pitchDown=(a.clientY- +b.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,b=this.tdiff* +this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVector.y*a);this.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*b,this.rotationVector.y*b,this.rotationVector.z*b,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var a=this.moveState.forward|| 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=-a+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, +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",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,this.mouseup),!1);window.addEventListener("keydown",b(this,this.keydown),!1);window.addEventListener("keyup",b(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(a,c,b,f){THREE.Camera.call(this,a,c,b,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 e=new THREE.Vector3,h=new THREE.Vector3,g=new THREE.Vector3,k=new THREE.Matrix4,j=!1,m=1,l=0,n=0,o=0,p=0,u=0,v=window.innerWidth/2,y=window.innerHeight/2;this.update= -function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*p),this.rotateVertically(a*u));a=this.delta*this.movementSpeed;this.translateZ(a*(l>0||this.autoForward&&!(l<0)?1:l));this.translateX(a*n);this.translateY(a*o);j&&(this.roll+=this.rollSpeed*this.delta*m);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); -else if(this.forward.y0||this.autoForward&&!(l<0)?1:l));this.translateX(a*n);this.translateY(a*o);k&&(this.roll+=this.rollSpeed*this.delta*m);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); +else if(this.forward.y1?c.normalize():c.z=Math.sqrt(1-g*g);e=this.position.clone().subSelf(this.target.position);g=this.up.clone().setLength(c.y);g.addSelf(this.up.clone().crossSelf(e).setLength(c.x));g.addSelf(e.setLength(c.z));return g}; -this.rotateCamera=function(){var a=Math.acos(h.dot(g)/h.length()/g.length());if(a){var b=(new THREE.Vector3).cross(h,g).normalize(),c=new THREE.Quaternion;a*=this.rotateSpeed;c.setFromAxisAngle(b,-a);c.multiplyVector3(e);c.multiplyVector3(this.up);c.multiplyVector3(g);this.staticMoving?h=g:(c.setFromAxisAngle(b,a*(this.dynamicDampingFactor-1)),c.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*this.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),this.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)}; -this.panCamera=function(){var a=l.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(e.length()*this.panSpeed);var b=e.clone().crossSelf(this.up).setLength(a.x);b.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(b);this.target.position.addSelf(b);this.staticMoving?m=l:m.addSelf(a.sub(l,m).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), -e.lengthSq()0){g(0,0,-l-(h||0));for(j=a;j0){g(0,0,l+ -(e||0));for(j=a+a/2;j<2*a;j++)k.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j1?b.normalize():b.z=Math.sqrt(1-f*f);e=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(b.y);f.addSelf(this.up.clone().crossSelf(e).setLength(b.x));f.addSelf(e.setLength(b.z));return f}; +this.rotateCamera=function(){var a=Math.acos(h.dot(f)/h.length()/f.length());if(a){var c=(new THREE.Vector3).cross(h,f).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(e);b.multiplyVector3(this.up);b.multiplyVector3(f);this.staticMoving?h=f:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*this.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),this.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)}; +this.panCamera=function(){var a=l.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(e.length()*this.panSpeed);var c=e.clone().crossSelf(this.up).setLength(a.x);c.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?m=l:m.addSelf(a.sub(l,m).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), +e.lengthSq()0?(n=b[b.length-1],l=n.x,n=n.y):(n=this.actions[c-1].args,l=n[n.length-2],n=n[n.length-1]);for(o=1;o<=a;o++)p=o/a,u=THREE.FontUtils.b2(p,l,k,h),p=THREE.FontUtils.b2(p,n,m,e),b.push(new THREE.Vector2(u, +p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];e=f[5];k=f[0];m=f[1];j=f[2];f=f[3];b.length>0?(n=b[b.length-1],l=n.x,n=n.y):(n=this.actions[c-1].args,l=n[n.length-2],n=n[n.length-1]);for(o=1;o<=a;o++)p=o/a,u=THREE.FontUtils.b3(p,l,k,j,h),p=THREE.FontUtils.b3(p,n,m,f,e),b.push(new THREE.Vector2(u,p))}return b}; +THREE.Path.prototype.getMinAndMax=function(){var a=this.getPoints(),b,c,g,e;b=c=Number.NEGATIVE_INFINITY;g=e=Number.POSITIVE_INFINITY;var h,f,j;f=0;for(j=a.length;fb)b=h.x;else if(h.xc)c=h.y;else if(h.y0){f(0,0,-l-(h||0));for(k=a;k0){f(0,0,l+ +(e||0));for(k=a+a/2;k<2*a;k++)j.faces.push(new THREE.Face4(2*a+1,(2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a))}k=0;for(a=this.faces.length;k0;){for(j=0;j0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,k,o)))-1);m.push(l)}c.push(m)}for(var p,u,v,e=c.length,b=0;b0)for(f=0;f1&&(p= -this.vertices[g].position.clone(),u=this.vertices[j].position.clone(),v=this.vertices[m].position.clone(),p.normalize(),u.normalize(),v.normalize(),this.faces.push(new THREE.Face3(g,j,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([l,n,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry; -THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(a,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(a)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; -THREE.TextGeometry.prototype.set=function(a,c){function b(a,b,c){u.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c,g){u.faces.push(new THREE.Face4(a,b,c,g))}this.text=a;var c=c||this.parameters,e=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,g=c.font!==void 0?c.font:"helvetiker",k=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal",m=c.bezelThickness!==void 0?c.bezelThickness:10,l=c.bezelSize!==void 0?c.bezelSize:8,n=c.bezelEnabled!== -void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=g;THREE.FontUtils.weight=k;THREE.FontUtils.style=j;THREE.FontUtils.bezelSize=l;var k=THREE.FontUtils.drawText(a),h=k.points,o=k.faces,g=k.contour,p=k.bezel,u=this;u.vertices=[];u.faces=[];for(var v,j=h.length,y=o.length,l=p.length,k=0;k0;){if(w){if(w.equals(g[k])){w=null;continue}}else w=g[k];m=j*2+k;o=m-1;f(m,o,o+l,m+l);for(n=0;n0;){if(w){if(w.equals(g[k])){w=null;continue}}else w=g[k];for(n=0;n0&&k.push({shape:e,holes:f}),e=n,f=[]):f.push(n):this.Triangulate.area(n)<0?(k.push({shape:n,holes:f}),f=[]):f.push(n);b++}l&&k.push({shape:e,holes:f})}var o,p,u, -v,y,w;h=[];for(g=0;g=0?p-1:e.length-1;var n=o-1>=0?o-1:l.length-1,x=[];x.push(l[o]);x.push(e[p]);x.push(e[b]);u=this.Triangulate.area(x);var t=[];t.push(l[o]);t.push(l[n]);t.push(e[p]);y=this.Triangulate.area(t);v=p;w=o;p+=1;o+=-1;p<0&&(p+=e.length);p%=e.length;o<0&&(o+=l.length);o%=e.length;b=p- -1>=0?p-1:e.length-1;n=o-1>=0?o-1:l.length-1;x=[];x.push(l[o]);x.push(e[p]);x.push(e[b]);x=this.Triangulate.area(x);t=[];t.push(l[o]);t.push(l[n]);t.push(e[p]);t=this.Triangulate.area(t);u+y>x+t&&(p=v,o=w,p<0&&(p+=e.length),p%=e.length,o<0&&(o+=l.length),o%=e.length,b=p-1>=0?p-1:e.length-1,n=o-1>=0?o-1:l.length-1);u=e.slice(0,p);y=e.slice(p);v=l.slice(o);w=l.slice(0,o);h.push(l[o]);h.push(e[p]);h.push(e[b]);h.push(l[o]);h.push(l[n]);h.push(e[p]);e=u.concat(v).concat(w).concat(y)}j.shape=e}o=[];p=[]; -for(g=m=0;g=0;){if(m){if(m.equals(b[a])){m=null;j=this.Triangulate.area(f)>0;g.push(j);h.push(k.divideScalar(f.length));f=[];k=new THREE.Vector2;continue}}else m=b[a];k.addSelf(b[a]);f.push(b[a])}a=b.length;f=0;for(var l;--a>=0;)j=b[a],k=h[f],j=j.clone().subSelf(k), -l=this.bezelSize/j.length(),g[f]?l+=1:l=1-l,l=j.multiplyScalar(l).addSelf(k),e.unshift(l),m?m.equals(b[a])&&(m=null,f++):m=b[a];c.bezel=e;return c},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,f){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,f)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a* -c},b3:function(a,c,b,f,e){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,f)+this.b3p3(a,e)},extractGlyphPoints:function(a,c,b,f){var e=[],h,g,k,j,m,l,n,o,p,u,v=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(v){if(v.o){c=v._cachedOutline||(v._cachedOutline=v.o.split(" "));k=c.length;for(a=0;a0)for(m=0;m2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return k;return h}j=m;e<=j&&(j=0);m=j+1;e<=m&&(m=0);l=m+1;e<=l&&(l=0);var o;a:{o=a;var p=j,u=m,v=l,y=e,w=g,x=void 0,t=void 0,z=void 0, -A=void 0,E=void 0,F=void 0,G=void 0,D=void 0,K=void 0,t=o[w[p]].x,z=o[w[p]].y,A=o[w[u]].x,E=o[w[u]].y,F=o[w[v]].x,G=o[w[v]].y;if(1.0E-10>(A-t)*(G-z)-(E-z)*(F-t))o=!1;else{for(x=0;x=0&&J>=0&&H>=0){o=!1;break a}}o=!0}}if(o){n= -g[j];o=g[m];p=g[l];h.push(a[n]);h.push(a[o]);h.push(a[p]);k.push([g[j],g[m],g[l]]);j=m;for(l=m+1;l0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,o)))-1);m.push(l)}b.push(m)}for(var p,u,x,e=b.length,c=0;c0)for(g=0;g1&&(p= +this.vertices[f].position.clone(),u=this.vertices[k].position.clone(),x=this.vertices[m].position.clone(),p.normalize(),u.normalize(),x.normalize(),this.faces.push(new THREE.Face3(f,k,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([l,n,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(a,b){THREE.Geometry.call(this);this.parameters=b||{};this.set(a)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; +THREE.TextGeometry.prototype.set=function(a,b){function c(a,c,b){u.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function g(a,c,b,f){u.faces.push(new THREE.Face4(a,c,b,f))}this.text=a;var b=b||this.parameters,e=b.height!==void 0?b.height:50,h=b.curveSegments!==void 0?b.curveSegments:4,f=b.font!==void 0?b.font:"helvetiker",j=b.weight!==void 0?b.weight:"normal",k=b.style!==void 0?b.style:"normal",m=b.bezelThickness!==void 0?b.bezelThickness:10,l=b.bezelSize!==void 0?b.bezelSize:8,n=b.bezelEnabled!== +void 0?b.bezelEnabled:!1;THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=f;THREE.FontUtils.weight=j;THREE.FontUtils.style=k;THREE.FontUtils.bezelSize=l;var j=THREE.FontUtils.drawText(a),h=j.points,o=j.faces,f=j.contour,p=j.bezel,u=this;u.vertices=[];u.faces=[];for(var x,k=h.length,y=o.length,l=p.length,j=0;j0;){if(v){if(v.equals(f[j])){v=null;continue}}else v=f[j];m=k*2+j;o=m-1;g(m,o,o+l,m+l);for(n=0;n0;){if(v){if(v.equals(f[j])){v=null;continue}}else v=f[j];for(n=0;n0&&j.push({shape:e,holes:g}),e=n,g=[]):g.push(n):this.Triangulate.area(n)<0?(j.push({shape:n,holes:g}),g=[]):g.push(n);c++}l&&j.push({shape:e,holes:g})}var o,p,u, +x,y,v;h=[];for(f=0;f=0?p-1:e.length-1;var n=o-1>=0?o-1:l.length-1,w=[];w.push(l[o]);w.push(e[p]);w.push(e[c]);u=this.Triangulate.area(w);var t=[];t.push(l[o]);t.push(l[n]);t.push(e[p]);y=this.Triangulate.area(t);x=p;v=o;p+=1;o+=-1;p<0&&(p+=e.length);p%=e.length;o<0&&(o+=l.length);o%=e.length;c=p- +1>=0?p-1:e.length-1;n=o-1>=0?o-1:l.length-1;w=[];w.push(l[o]);w.push(e[p]);w.push(e[c]);w=this.Triangulate.area(w);t=[];t.push(l[o]);t.push(l[n]);t.push(e[p]);t=this.Triangulate.area(t);u+y>w+t&&(p=x,o=v,p<0&&(p+=e.length),p%=e.length,o<0&&(o+=l.length),o%=e.length,c=p-1>=0?p-1:e.length-1,n=o-1>=0?o-1:l.length-1);u=e.slice(0,p);y=e.slice(p);x=l.slice(o);v=l.slice(0,o);h.push(l[o]);h.push(e[p]);h.push(e[c]);h.push(l[o]);h.push(l[n]);h.push(e[p]);e=u.concat(x).concat(v).concat(y)}k.shape=e}o=[];p=[]; +for(f=m=0;f=0;){if(l){if(l.equals(c[a])){l=null;k=this.Triangulate.area(g)>0;f.push(k);h.push(j.divideScalar(g.length));g=[];j=new THREE.Vector2;continue}}else l=c[a];j.addSelf(c[a]);g.push(c[a])}a=c.length;for(g=0;--a>=0;)k=c[a], +j=h[g],k=k.clone().subSelf(j),m=this.bezelSize/k.length(),f[g]?m+=1:m=1-m,m=k.multiplyScalar(m).addSelf(j),e.unshift(m),l?l.equals(c[a])&&(l=null,g++):l=c[a];b.bezel=e;return b},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,g){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,g)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a, +b){return a*a*a*b},b3:function(a,b,c,g,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,g)+this.b3p3(a,e)},extractGlyphPoints:function(a,b,c,g){var e=[],h=new THREE.Path,f,j,k,m,l,n,o,p,u,x,y=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){b=y._cachedOutline||(y._cachedOutline=y.o.split(" "));k=b.length;for(a=0;a0)for(m=0;m2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(g)return j;return h}k=m;e<=k&&(k=0);m=k+1;e<=m&&(m=0);l=m+1;e<=l&&(l=0);var o;a:{o=a;var p=k,u=m,x=l,y=e,v=f,w=void 0,t=void 0,z=void 0, +A=void 0,E=void 0,F=void 0,G=void 0,D=void 0,K=void 0,t=o[v[p]].x,z=o[v[p]].y,A=o[v[u]].x,E=o[v[u]].y,F=o[v[x]].x,G=o[v[x]].y;if(1.0E-10>(A-t)*(G-z)-(E-z)*(F-t))o=!1;else{for(w=0;w=0&&J>=0&&H>=0){o=!1;break a}}o=!0}}if(o){n= +f[k];o=f[m];p=f[l];h.push(a[n]);h.push(a[o]);h.push(a[p]);j.push([f[k],f[m],f[l]]);k=m;for(l=m+1;l>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function e(a,b){var c=l(a,b),f=l(a,b+1),g=l(a,b+2);return(l(a,b+3)<<24)+(g<<16)+(f<<8)+c}function j(a,b){var c=l(a,b);return(l(a,b+1)<<8)+c}function m(a,b){var c=l(a,b);return c>127?c-256:c}function l(a, -b){return a.charCodeAt(b)&255}function n(b){var c,f,g;c=e(a,b);f=e(a,b+E);g=e(a,b+F);b=j(a,b+G);THREE.BinaryLoader.prototype.f3(w,c,f,g,b)}function o(b){var c,f,g,h,l,m;c=e(a,b);f=e(a,b+E);g=e(a,b+F);h=j(a,b+G);l=e(a,b+D);m=e(a,b+K);b=e(a,b+I);THREE.BinaryLoader.prototype.f3n(w,z,c,f,g,h,l,m,b)}function p(b){var c,f,g,h;c=e(a,b);f=e(a,b+C);g=e(a,b+J);h=e(a,b+L);b=j(a,b+H);THREE.BinaryLoader.prototype.f4(w,c,f,g,h,b)}function u(b){var c,f,g,h,l,m,n,o;c=e(a,b);f=e(a,b+C);g=e(a,b+J);h=e(a,b+L);l=j(a, -b+H);m=e(a,b+N);n=e(a,b+O);o=e(a,b+B);b=e(a,b+P);THREE.BinaryLoader.prototype.f4n(w,z,c,f,g,h,l,m,n,o,b)}function v(b){var c,f;c=e(a,b);f=e(a,b+M);b=e(a,b+R);THREE.BinaryLoader.prototype.uv3(w.faceVertexUvs[0],A[c*2],A[c*2+1],A[f*2],A[f*2+1],A[b*2],A[b*2+1])}function y(b){var c,f,g;c=e(a,b);f=e(a,b+S);g=e(a,b+Y);b=e(a,b+Z);THREE.BinaryLoader.prototype.uv4(w.faceVertexUvs[0],A[c*2],A[c*2+1],A[f*2],A[f*2+1],A[g*2],A[g*2+1],A[b*2],A[b*2+1])}var w=this,x=0,t,z=[],A=[],E,F,G,D,K,I,C,J,L,H,N,O,B,P,M,R, -S,Y,Z,T,U,V,W,X,Q;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,f,b);t={signature:a.substr(x,8),header_bytes:l(a,x+8),vertex_coordinate_bytes:l(a,x+9),normal_coordinate_bytes:l(a,x+10),uv_coordinate_bytes:l(a,x+11),vertex_index_bytes:l(a,x+12),normal_index_bytes:l(a,x+13),uv_index_bytes:l(a,x+14),material_index_bytes:l(a,x+15),nvertices:e(a,x+16),nnormals:e(a,x+16+4),nuvs:e(a,x+16+8),ntri_flat:e(a,x+16+12),ntri_smooth:e(a,x+16+16),ntri_flat_uv:e(a,x+16+20),ntri_smooth_uv:e(a,x+ -16+24),nquad_flat:e(a,x+16+28),nquad_smooth:e(a,x+16+32),nquad_flat_uv:e(a,x+16+36),nquad_smooth_uv:e(a,x+16+40)};x+=t.header_bytes;E=t.vertex_index_bytes;F=t.vertex_index_bytes*2;G=t.vertex_index_bytes*3;D=t.vertex_index_bytes*3+t.material_index_bytes;K=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;I=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;C=t.vertex_index_bytes;J=t.vertex_index_bytes*2;L=t.vertex_index_bytes*3;H=t.vertex_index_bytes*4;N=t.vertex_index_bytes* -4+t.material_index_bytes;O=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;B=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;P=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;M=t.uv_index_bytes;R=t.uv_index_bytes*2;S=t.uv_index_bytes;Y=t.uv_index_bytes*2;Z=t.uv_index_bytes*3;b=t.vertex_index_bytes*3+t.material_index_bytes;Q=t.vertex_index_bytes*4+t.material_index_bytes;T=t.ntri_flat*b;U=t.ntri_smooth*(b+t.normal_index_bytes*3);V=t.ntri_flat_uv* -(b+t.uv_index_bytes*3);W=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);X=t.nquad_flat*Q;b=t.nquad_smooth*(Q+t.normal_index_bytes*4);Q=t.nquad_flat_uv*(Q+t.uv_index_bytes*4);x+=function(b){for(var f,e,h,j=t.vertex_coordinate_bytes*3,k=b+t.nvertices*j;b1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(E,K);object.name=p;object.position.set(t[0],t[1],t[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=x.visible;B.scene.addObject(object);B.objects[p]=object;x.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),B.scene.collisions.colliders.push(a)); -if(x.castsShadow)a=new THREE.ShadowVolume(E),B.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},B.triggers[object.name]=a)}}else t=x.position,r=x.rotation,q=x.quaternion,s=x.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(t[0],t[1],t[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=x.visible!==void 0?x.visible:!1,B.scene.addObject(object),B.objects[p]=object,B.empties[p]=object,x.trigger&&x.trigger.toLowerCase()!="none"&&(a={type:x.trigger,object:x},B.triggers[object.name]=a)}function j(a){return function(c){B.geometries[a]=c;k();L-=1;b.onLoadComplete();l()}}function m(a){return function(b){B.geometries[a]=b}}function l(){b.callbackProgress({totalModels:N,totalTextures:O,loadedModels:N-L,loadedTextures:O-H},B);b.onLoadProgress();L==0&&H==0&&c(B)}var n, -o,p,u,v,y,w,x,t,z,A,E,F,G,D,K,I,C,J,L,H,N,O,B;C=a.data;D=new THREE.BinaryLoader;J=new THREE.JSONLoader;H=L=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in C.objects)if(x=C.objects[p],x.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(C.transform){a=C.transform.position;z=C.transform.rotation;var P=C.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);z&&B.scene.rotation.set(z[0], -z[1],z[2]);P&&B.scene.scale.set(P[0],P[1],P[2]);(a||z||P)&&B.scene.updateMatrix()}a=function(){H-=1;l();b.onLoadComplete()};for(v in C.cameras){z=C.cameras[v];if(z.type=="perspective")F=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho")F=new THREE.Camera,F.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far);t=z.position;z=z.target;F.position.set(t[0],t[1],t[2]);F.target.position.set(z[0],z[1],z[2]);B.cameras[v]=F}for(u in C.lights)v=C.lights[u], -F=v.color!==void 0?v.color:16777215,z=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(t=v.direction,I=new THREE.DirectionalLight(F,z),I.position.set(t[0],t[1],t[2]),I.position.normalize()):v.type=="point"?(t=v.position,d=v.distance,I=new THREE.PointLight(F,z,d),I.position.set(t[0],t[1],t[2])):v.type=="ambient"&&(I=new THREE.AmbientLight(F)),B.scene.addLight(I),B.lights[u]=I;for(y in C.fogs)u=C.fogs[y],u.type=="linear"?G=new THREE.Fog(0,u.near,u.far):u.type=="exp2"&&(G=new THREE.FogExp2(0, -u.density)),z=u.color,G.color.setRGB(z[0],z[1],z[2]),B.fogs[y]=G;if(B.cameras&&C.defaults.camera)B.currentCamera=B.cameras[C.defaults.camera];if(B.fogs&&C.defaults.fog)B.scene.fog=B.fogs[C.defaults.fog];z=C.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(z[0],z[1],z[2]);B.bgColorAlpha=C.defaults.bgalpha;for(n in C.geometries)if(y=C.geometries[n],y.type=="bin_mesh"||y.type=="ascii_mesh")L+=1,b.onLoadStart();N=L;for(n in C.geometries)y=C.geometries[n],y.type=="cube"?(E=new THREE.CubeGeometry(y.width, +THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB"; +this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,b,c){a.materials=[];for(var g=0;g>7)-127;e|=(f&127)<<16|g<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function e(a,c){var b=l(a,c),g=l(a,c+1),f=l(a,c+2);return(l(a,c+3)<<24)+(f<<16)+(g<<8)+b}function k(a,c){var b=l(a,c);return(l(a,c+1)<<8)+b}function m(a,c){var b=l(a,c);return b>127?b-256:b}function l(a, +c){return a.charCodeAt(c)&255}function n(c){var b,g,f;b=e(a,c);g=e(a,c+E);f=e(a,c+F);c=k(a,c+G);THREE.BinaryLoader.prototype.f3(v,b,g,f,c)}function o(c){var b,g,f,h,l,m;b=e(a,c);g=e(a,c+E);f=e(a,c+F);h=k(a,c+G);l=e(a,c+D);m=e(a,c+K);c=e(a,c+I);THREE.BinaryLoader.prototype.f3n(v,z,b,g,f,h,l,m,c)}function p(c){var b,g,f,h;b=e(a,c);g=e(a,c+C);f=e(a,c+J);h=e(a,c+L);c=k(a,c+H);THREE.BinaryLoader.prototype.f4(v,b,g,f,h,c)}function u(c){var b,g,f,h,l,m,n,o;b=e(a,c);g=e(a,c+C);f=e(a,c+J);h=e(a,c+L);l=k(a, +c+H);m=e(a,c+N);n=e(a,c+O);o=e(a,c+B);c=e(a,c+P);THREE.BinaryLoader.prototype.f4n(v,z,b,g,f,h,l,m,n,o,c)}function x(c){var b,g;b=e(a,c);g=e(a,c+M);c=e(a,c+R);THREE.BinaryLoader.prototype.uv3(v.faceVertexUvs[0],A[b*2],A[b*2+1],A[g*2],A[g*2+1],A[c*2],A[c*2+1])}function y(c){var b,g,f;b=e(a,c);g=e(a,c+S);f=e(a,c+Y);c=e(a,c+Z);THREE.BinaryLoader.prototype.uv4(v.faceVertexUvs[0],A[b*2],A[b*2+1],A[g*2],A[g*2+1],A[f*2],A[f*2+1],A[c*2],A[c*2+1])}var v=this,w=0,t,z=[],A=[],E,F,G,D,K,I,C,J,L,H,N,O,B,P,M,R, +S,Y,Z,T,U,V,W,X,Q;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,g,c);t={signature:a.substr(w,8),header_bytes:l(a,w+8),vertex_coordinate_bytes:l(a,w+9),normal_coordinate_bytes:l(a,w+10),uv_coordinate_bytes:l(a,w+11),vertex_index_bytes:l(a,w+12),normal_index_bytes:l(a,w+13),uv_index_bytes:l(a,w+14),material_index_bytes:l(a,w+15),nvertices:e(a,w+16),nnormals:e(a,w+16+4),nuvs:e(a,w+16+8),ntri_flat:e(a,w+16+12),ntri_smooth:e(a,w+16+16),ntri_flat_uv:e(a,w+16+20),ntri_smooth_uv:e(a,w+ +16+24),nquad_flat:e(a,w+16+28),nquad_smooth:e(a,w+16+32),nquad_flat_uv:e(a,w+16+36),nquad_smooth_uv:e(a,w+16+40)};w+=t.header_bytes;E=t.vertex_index_bytes;F=t.vertex_index_bytes*2;G=t.vertex_index_bytes*3;D=t.vertex_index_bytes*3+t.material_index_bytes;K=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;I=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;C=t.vertex_index_bytes;J=t.vertex_index_bytes*2;L=t.vertex_index_bytes*3;H=t.vertex_index_bytes*4;N=t.vertex_index_bytes* +4+t.material_index_bytes;O=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;B=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;P=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;M=t.uv_index_bytes;R=t.uv_index_bytes*2;S=t.uv_index_bytes;Y=t.uv_index_bytes*2;Z=t.uv_index_bytes*3;c=t.vertex_index_bytes*3+t.material_index_bytes;Q=t.vertex_index_bytes*4+t.material_index_bytes;T=t.ntri_flat*c;U=t.ntri_smooth*(c+t.normal_index_bytes*3);V=t.ntri_flat_uv* +(c+t.uv_index_bytes*3);W=t.ntri_smooth_uv*(c+t.normal_index_bytes*3+t.uv_index_bytes*3);X=t.nquad_flat*Q;c=t.nquad_smooth*(Q+t.normal_index_bytes*4);Q=t.nquad_flat_uv*(Q+t.uv_index_bytes*4);w+=function(c){for(var e,g,h,j=t.vertex_coordinate_bytes*3,k=c+t.nvertices*j;c1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(E,K);object.name=p;object.position.set(t[0],t[1],t[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=w.visible;B.scene.addObject(object);B.objects[p]=object;w.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),B.scene.collisions.colliders.push(a)); +if(w.castsShadow)a=new THREE.ShadowVolume(E),B.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},B.triggers[object.name]=a)}}else t=w.position,r=w.rotation,q=w.quaternion,s=w.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(t[0],t[1],t[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=w.visible!==void 0?w.visible:!1,B.scene.addObject(object),B.objects[p]=object,B.empties[p]=object,w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},B.triggers[object.name]=a)}function k(a){return function(b){B.geometries[a]=b;j();L-=1;c.onLoadComplete();l()}}function m(a){return function(c){B.geometries[a]=c}}function l(){c.callbackProgress({totalModels:N,totalTextures:O,loadedModels:N-L,loadedTextures:O-H},B);c.onLoadProgress();L==0&&H==0&&b(B)}var n, +o,p,u,x,y,v,w,t,z,A,E,F,G,D,K,I,C,J,L,H,N,O,B;C=a.data;D=new THREE.BinaryLoader;J=new THREE.JSONLoader;H=L=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in C.objects)if(w=C.objects[p],w.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(C.transform){a=C.transform.position;z=C.transform.rotation;var P=C.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);z&&B.scene.rotation.set(z[0], +z[1],z[2]);P&&B.scene.scale.set(P[0],P[1],P[2]);(a||z||P)&&B.scene.updateMatrix()}a=function(){H-=1;l();c.onLoadComplete()};for(x in C.cameras){z=C.cameras[x];if(z.type=="perspective")F=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho")F=new THREE.Camera,F.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far);t=z.position;z=z.target;F.position.set(t[0],t[1],t[2]);F.target.position.set(z[0],z[1],z[2]);B.cameras[x]=F}for(u in C.lights)x=C.lights[u], +F=x.color!==void 0?x.color:16777215,z=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(t=x.direction,I=new THREE.DirectionalLight(F,z),I.position.set(t[0],t[1],t[2]),I.position.normalize()):x.type=="point"?(t=x.position,d=x.distance,I=new THREE.PointLight(F,z,d),I.position.set(t[0],t[1],t[2])):x.type=="ambient"&&(I=new THREE.AmbientLight(F)),B.scene.addLight(I),B.lights[u]=I;for(y in C.fogs)u=C.fogs[y],u.type=="linear"?G=new THREE.Fog(0,u.near,u.far):u.type=="exp2"&&(G=new THREE.FogExp2(0, +u.density)),z=u.color,G.color.setRGB(z[0],z[1],z[2]),B.fogs[y]=G;if(B.cameras&&C.defaults.camera)B.currentCamera=B.cameras[C.defaults.camera];if(B.fogs&&C.defaults.fog)B.scene.fog=B.fogs[C.defaults.fog];z=C.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(z[0],z[1],z[2]);B.bgColorAlpha=C.defaults.bgalpha;for(n in C.geometries)if(y=C.geometries[n],y.type=="bin_mesh"||y.type=="ascii_mesh")L+=1,c.onLoadStart();N=L;for(n in C.geometries)y=C.geometries[n],y.type=="cube"?(E=new THREE.CubeGeometry(y.width, y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),B.geometries[n]=E):y.type=="plane"?(E=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),B.geometries[n]=E):y.type=="sphere"?(E=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),B.geometries[n]=E):y.type=="cylinder"?(E=new THREE.CylinderGeometry(y.numSegs,y.topRad,y.botRad,y.height,y.topOffset,y.botOffset),B.geometries[n]=E):y.type=="torus"?(E=new THREE.TorusGeometry(y.radius, -y.tube,y.segmentsR,y.segmentsT),B.geometries[n]=E):y.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(y.subdivisions),B.geometries[n]=E):y.type=="bin_mesh"?D.load({model:f(y.url,C.urlBaseType),callback:j(n)}):y.type=="ascii_mesh"?J.load({model:f(y.url,C.urlBaseType),callback:j(n)}):y.type=="embedded_mesh"&&(y=C.embeds[y.id])&&J.createModel(y,m(n),"");for(w in C.textures)if(n=C.textures[w],n.url instanceof Array){H+=n.url.length;for(D=0;D=this.maxCount-3&&k(this)};this.begin=function(){this.count=0; -this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(j=this.size-1);var o=Math.floor(m-k);o<1&&(o=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(l-k);p<1&&(p=1);k=Math.floor(l+k);k>this.size-1&&(k=this.size- -1);for(var u,v,y,w,x,t;n0&&(this.field[y+u]+=w)}}};this.addPlaneX=function(a,c){var e,h,g,k,j,m=this.size,l=this.yd,n=this.zd,o=this.field,p=m*Math.sqrt(a/c);p>m&&(p=m);for(e=0;e0)for(h=0;hl&&(u=l);for(h=0;h0){j=h*n;for(e=0;esize&&(dist=size);for(g=0;g0){j=zd*g;for(h=0;h=this.maxCount-3&&j(this)};this.begin=function(){this.count=0; +this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;bthis.size-1&&(k=this.size-1);var o=Math.floor(m-j);o<1&&(o=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var p=Math.floor(l-j);p<1&&(p=1);j=Math.floor(l+j);j>this.size-1&&(j=this.size- +1);for(var u,x,y,v,w,t;n0&&(this.field[y+u]+=v)}}};this.addPlaneX=function(a,b){var e,h,f,j,k,m=this.size,l=this.yd,n=this.zd,o=this.field,p=m*Math.sqrt(a/b);p>m&&(p=m);for(e=0;e0)for(h=0;hl&&(u=l);for(h=0;h0){k=h*n;for(e=0;esize&&(dist=size);for(f=0;f0){k=zd*f;for(h=0;hh?this.hits.push(e):this.hits.unshift(e),h=f;return this.hits}; -THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var f=this.rayMesh(a,c[b]);if(f.distc.length)return null;return c[b]}; -THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),f=Number.MAX_VALUE,e,h=0;h=k*e))return Number.MAX_VALUE;g/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(g);k.addSelf(a.origin);Math.abs(h.x)> -Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=k.y-c.y,h=b.y-c.y,e=f.y-c.y,k=k.z-c.z,b=b.z-c.z,f=f.z-c.z):(a=k.x-c.x,h=b.x-c.x,e=f.x-c.x,k=k.y-c.y,b=b.y-c.y,f=f.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=k.x-c.x,h=b.x-c.x,e=f.x-c.x,k=k.z-c.z,b=b.z-c.z,f=f.z-c.z):(a=k.x-c.x,h=b.x-c.x,e=f.x-c.x,k=k.y-c.y,b=b.y-c.y,f=f.y-c.y);c=h*f-b*e;if(c==0)return Number.MAX_VALUE;c=1/c;f=(a*f-k*e)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return g}; -THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);var f=THREE.CollisionSystem.__r;f.origin.copy(a.origin);f.direction.copy(a.direction);b.multiplyVector3(f.origin);b.rotateAxis(f.direction);f.direction.normalize();return f}; -THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var f=0,e=0,h=0,g=0,k=0,j=0,m=!0;b.origin.xc.max.x&&(f=c.max.x-b.origin.x,f/=b.direction.x,m=!1,g=1);b.origin.yc.max.y&&(e=c.max.y-b.origin.y,e/=b.direction.y, -m=!1,k=1);b.origin.zc.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,m=!1,j=1);if(m)return-1;m=0;e>f&&(m=1,f=e);h>f&&(m=2,f=h);switch(m){case 0:k=b.origin.y+b.direction.y*f;if(kc.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*f;if(bc.max.z)return Number.MAX_VALUE;c.normal.set(g,0,0);break;case 1:g=b.origin.x+b.direction.x*f;if(gc.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z* -f;if(bc.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:g=b.origin.x+b.direction.x*f;if(gc.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*f;if(kc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,j)}return f};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),f=c.point.dot(c.normal);if(b<0)b=(f-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE}; -THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq=0)return Math.abs(f)-Math.sqrt(b);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(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=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]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c}; +THREE.Trident=function(a){function b(b){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:b}))}function c(a,b){var c=new THREE.Geometry;c.vertices=[new THREE.Vertex,new THREE.Vertex(a)];return new THREE.Line(c,new THREE.LineBasicMaterial({color:b}))}THREE.Object3D.call(this);var g=Math.PI/2,e,a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(e in THREE.Trident.defaultParams)a.hasOwnProperty(e)||(a[e]=THREE.Trident.defaultParams[e]); +this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(c(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(c(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(c(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows)e=b(a.xAxisColor),e.rotation.y=-g,e.position.x=a.length,this.addChild(e),e=b(a.yAxisColor),e.rotation.x=g,e.position.y=a.length,this.addChild(e),e=b(a.zAxisColor),e.rotation.y=Math.PI,e.position.z=a.length,this.addChild(e)}; +THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(a,b){this.point=a;this.normal=b};THREE.SphereCollider=function(a,b){this.center=a;this.radius=b;this.radiusSq=b*b};THREE.BoxCollider=function(a,b){this.min=a;this.max=b;this.dynamic=!0;this.normal=new THREE.Vector3}; +THREE.MeshCollider=function(a,b){this.mesh=a;this.box=b;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)}; +THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,g,e,h=0;b=0;for(c=this.colliders.length;bh?this.hits.push(e):this.hits.unshift(e),h=g;return this.hits}; +THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var g=this.rayMesh(a,b[c]);if(g.distb.length)return null;return b[c]}; +THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)}; +THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),g=Number.MAX_VALUE,e,h=0;h=j*e))return Number.MAX_VALUE;f/=j;j=THREE.CollisionSystem.__v3;j.copy(a.direction);j.multiplyScalar(f);j.addSelf(a.origin);Math.abs(h.x)> +Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=j.y-b.y,h=c.y-b.y,e=g.y-b.y,j=j.z-b.z,c=c.z-b.z,g=g.z-b.z):(a=j.x-b.x,h=c.x-b.x,e=g.x-b.x,j=j.y-b.y,c=c.y-b.y,g=g.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=j.x-b.x,h=c.x-b.x,e=g.x-b.x,j=j.z-b.z,c=c.z-b.z,g=g.z-b.z):(a=j.x-b.x,h=c.x-b.x,e=g.x-b.x,j=j.y-b.y,c=c.y-b.y,g=g.y-b.y);b=h*g-c*e;if(b==0)return Number.MAX_VALUE;b=1/b;g=(a*g-j*e)*b;if(!(g>=0))return Number.MAX_VALUE;b*=h*j-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-g-b>=0))return Number.MAX_VALUE;return f}; +THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var g=THREE.CollisionSystem.__r;g.origin.copy(a.origin);g.direction.copy(a.direction);c.multiplyVector3(g.origin);c.rotateAxis(g.direction);g.direction.normalize();return g}; +THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var g=0,e=0,h=0,f=0,j=0,k=0,m=!0;c.origin.xb.max.x&&(g=b.max.x-c.origin.x,g/=c.direction.x,m=!1,f=1);c.origin.yb.max.y&&(e=b.max.y-c.origin.y,e/=c.direction.y, +m=!1,j=1);c.origin.zb.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,m=!1,k=1);if(m)return-1;m=0;e>g&&(m=1,g=e);h>g&&(m=2,g=h);switch(m){case 0:j=c.origin.y+c.direction.y*g;if(jb.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*g;if(cb.max.z)return Number.MAX_VALUE;b.normal.set(f,0,0);break;case 1:f=c.origin.x+c.direction.x*g;if(fb.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z* +g;if(cb.max.z)return Number.MAX_VALUE;b.normal.set(0,j,0);break;case 2:f=c.origin.x+c.direction.x*g;if(fb.max.x)return Number.MAX_VALUE;j=c.origin.y+c.direction.y*g;if(jb.max.y)return Number.MAX_VALUE;b.normal.set(0,0,k)}return g};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),g=b.point.dot(b.normal);if(c<0)c=(g-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE}; +THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq=0)return Math.abs(g)-Math.sqrt(c);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(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b}; THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var c=this,b=this.setSize,f=this.render,e=new THREE.Camera,h=new THREE.Camera,g=new THREE.Matrix4,k=new THREE.Matrix4,j,m,l;e.useTarget=h.useTarget=!1;e.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.Camera(53,1,1,1E4);p.position.z= +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,g=this.render,e=new THREE.Camera,h=new THREE.Camera,f=new THREE.Matrix4,j=new THREE.Matrix4,k,m,l;e.useTarget=h.useTarget=!1;e.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.Camera(53,1,1,1E4);p.position.z= 2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:o}},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 u=new THREE.Scene;u.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);n.width=a;n.height=e;o.width=a;o.height=e};this.render=function(a,b){b.update(null,!0);if(j!==b.aspect||m!==b.near||l!==b.fov){j=b.aspect;m=b.near;l=b.fov;var w=b.projectionMatrix.clone(),x=125/30*0.5,t=x*m/125,z=m*Math.tan(l*Math.PI/360),A;g.n14=x;k.n14=-x;x=-z*j+t;A=z*j+t;w.n11=2*m/(A-x);w.n13=(A+x)/(A-x);e.projectionMatrix=w.clone();x=-z*j-t;A=z*j-t;w.n11=2*m/(A-x); -w.n13=(A+x)/(A-x);h.projectionMatrix=w.clone()}e.matrix=b.matrixWorld.clone().multiplySelf(k);e.update(null,!0);e.position.copy(b.position);e.near=m;e.far=b.far;f.call(c,a,e,n,!0);h.matrix=b.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(b.position);h.near=m;h.far=b.far;f.call(c,a,h,o,!0);f.call(c,u,p)}}; -if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,f=this.render,e,h,g=new THREE.Camera,k=new THREE.Camera;c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,f){b.call(c,a,f);e=a/2;h=f};this.render=function(a,b){this.clear();g.fov=b.fov;g.aspect=0.5*b.aspect;g.near=b.near;g.far=b.far; -g.updateProjectionMatrix();g.position.copy(b.position);g.target.position.copy(b.target.position);g.translateX(c.separation);k.projectionMatrix=g.projectionMatrix;k.position.copy(b.position);k.target.position.copy(b.target.position);k.translateX(-c.separation);this.setViewport(0,0,e,h);f.call(c,a,g);this.setViewport(e,0,e,h);f.call(c,a,k,!1)}}; +var u=new THREE.Scene;u.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);n.width=a;n.height=e;o.width=a;o.height=e};this.render=function(a,c){c.update(null,!0);if(k!==c.aspect||m!==c.near||l!==c.fov){k=c.aspect;m=c.near;l=c.fov;var v=c.projectionMatrix.clone(),w=125/30*0.5,t=w*m/125,z=m*Math.tan(l*Math.PI/360),A;f.n14=w;j.n14=-w;w=-z*k+t;A=z*k+t;v.n11=2*m/(A-w);v.n13=(A+w)/(A-w);e.projectionMatrix=v.clone();w=-z*k-t;A=z*k-t;v.n11=2*m/(A-w); +v.n13=(A+w)/(A-w);h.projectionMatrix=v.clone()}e.matrix=c.matrixWorld.clone().multiplySelf(j);e.update(null,!0);e.position.copy(c.position);e.near=m;e.far=c.far;g.call(b,a,e,n,!0);h.matrix=c.matrixWorld.clone().multiplySelf(f);h.update(null,!0);h.position.copy(c.position);h.near=m;h.far=c.far;g.call(b,a,h,o,!0);g.call(b,u,p)}}; +if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,g=this.render,e,h,f=new THREE.Camera,j=new THREE.Camera;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,f){c.call(b,a,f);e=a/2;h=f};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=c.far; +f.updateProjectionMatrix();f.position.copy(c.position);f.target.position.copy(c.target.position);f.translateX(b.separation);j.projectionMatrix=f.projectionMatrix;j.position.copy(c.position);j.target.position.copy(c.target.position);j.translateX(-b.separation);this.setViewport(0,0,e,h);g.call(b,a,f);this.setViewport(e,0,e,h);g.call(b,a,j,!1)}}; diff --git a/examples/canvas_geometry_shape.html b/examples/canvas_geometry_shape.html index e3cb443c68e6d354e09a4b1e52b4b4800caf7084..85a5d1d1543835a13ef393561af953b5212c8d00 100644 --- a/examples/canvas_geometry_shape.html +++ b/examples/canvas_geometry_shape.html @@ -1,7 +1,7 @@ - three.js canvas/webgl - geometry - text + three.js canvas - geometry - shapes