diff --git a/build/Three.js b/build/Three.js index 77252caf12895286ca396000678d481e9071aed0..2561eff218c5ab8e08ba0ee6c7bd9e3993b8f63d 100644 --- a/build/Three.js +++ b/build/Three.js @@ -1,7 +1,7 @@ // Three.js r44dev - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this}; -THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,g,j;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),g=b*6-f,b=e*(1-c),j=e*(1-c*g),c=e*(1-c*(1-g)),f){case 1:this.r=j;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=j;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r= -e;this.g=b;this.b=j;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; +THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,h,k;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),h=b*6-f,b=e*(1-c),k=e*(1-c*h),c=e*(1-c*(1-h)),f){case 1:this.r=k;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=k;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r= +e;this.g=b;this.b=k;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this}, divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)}, @@ -15,72 +15,72 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,e,f){this.x= b.w-c.w;return this},subSelf:function(b){this.x-=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.z=this.y=this.x=0,this.w=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={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x, -Math.max(b.scale.y,b.scale.z)))return[];var g,j,h,k,m,o,p,u,v,t,x=b.geometry,w=x.vertices,A=[],f=0;for(g=x.faces.length;f0:u<0)))if(u=p.dot((new THREE.Vector3).sub(h,v))/u,v=v.addSelf(t.multiplyScalar(u)),j instanceof THREE.Face3)e(v,h,k,m)&&(j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},A.push(j));else if(j instanceof THREE.Face4&&(e(v,h,k,o)||e(v,k,m,o)))j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},A.push(j);A.sort(function(b,c){return b.distance-c.distance});return A}else return[]}}; -THREE.Rectangle=function(){function b(){j=f-c;h=g-e}var c,e,f,g,j,h,k=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};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,j,p,u){k=!1;c=h;e=j;f=p;g=u;b()};this.addPoint=function(h,j){k?(k=!1,c=h,e=j,f=h,g=j):(c=ch?f:h,g=g>j?g:j);b()};this.add3Points= -function(h,j,p,u,v,t){k?(k=!1,c=hp?h>v?h:v:p>v?p:v,g=j>u?j>t?j:t:u>t?u:t):(c=hp?h>v?h>f?h:f:v>f?v:f:p>v?p>f?p:f:v>f?v:f,g=j>u?j>t?j>g?j:g:t>g?t:g:u>t?u>g?u:g:t>g?t:g);b()};this.addRectangle=function(h){k?(k=!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(){k=!0;g=f=e=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,j,h,k,m,o,p,u,v,t,x,w){this.set(b||1,c||0,e||0,f||0,g||0,j||1,h||0,k||0,m||0,o||0,p||1,u||0,v||0,t||0,x||0,w||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,g,j,h,k,m,o,p,u,v,t,x,w){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=h;this.n24=k;this.n31=m;this.n32=o;this.n33=p;this.n34=u;this.n41=v;this.n42=t;this.n43=x;this.n44=w;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,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.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,j=b.n14,h=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,u=b.n32,v=b.n33,t=b.n34,x=b.n41,w=b.n42,A=b.n43,y=b.n44,G=c.n11,D=c.n12, -I=c.n13,J=c.n14,C=c.n21,B=c.n22,L=c.n23,E=c.n24,V=c.n31,H=c.n32,S=c.n33,K=c.n34,Q=c.n41,n=c.n42,T=c.n43,X=c.n44;this.n11=e*G+f*C+g*V+j*Q;this.n12=e*D+f*B+g*H+j*n;this.n13=e*I+f*L+g*S+j*T;this.n14=e*J+f*E+g*K+j*X;this.n21=h*G+k*C+m*V+o*Q;this.n22=h*D+k*B+m*H+o*n;this.n23=h*I+k*L+m*S+o*T;this.n24=h*J+k*E+m*K+o*X;this.n31=p*G+u*C+v*V+t*Q;this.n32=p*D+u*B+v*H+t*n;this.n33=p*I+u*L+v*S+t*T;this.n34=p*J+u*E+v*K+t*X;this.n41=x*G+w*C+A*V+y*Q;this.n42=x*D+w*B+A*H+y*n;this.n43=x*I+w*L+A*S+y*T;this.n44=x*J+w* -E+A*K+y*X;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,j=this.n22,h=this.n23,k=this.n24,m=this.n31,o=this.n32,p=this.n33,u=this.n34,v=this.n41,t=this.n42,x=this.n43,w=this.n44;return f*h*o*v-e*k*o*v-f*j*p*v+c*k*p*v+e*j*u*v-c*h*u*v-f*h*m*t+e*k*m*t+f*g*p*t-b*k*p*t-e*g*u*t+b*h*u*t+f*j*m*x-c*k*m*x-f*g*o*x+b*k*o*x+c*g*u*x-b*j*u*x-e*j*m*w+c*h*m*w+e*g*o*w-b*h*o*w-c*g*p*w+b*j*p*w}, -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,j=b.x,h=b.y,k=b.z,m=g*j,o=g*h;this.set(m*j+e,m*h-f*k,m*k+f*h,0,m*h+f*k,o*h+e,o*k-f*j,0,m*k-f*h,o*k+f*j,g*k*k+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,j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var m= -h*k,o=h*g,p=f*k,u=f*g;this.n11=m+u*e;this.n12=p*e-o;this.n13=j*f;this.n21=j*g;this.n22=j*k;this.n23=-e;this.n31=o*e-p;this.n32=u+m*e;this.n33=j*h;break;case "ZXY":m=h*k;o=h*g;p=f*k;u=f*g;this.n11=m-u*e;this.n12=-j*g;this.n13=p+o*e;this.n21=o+p*e;this.n22=j*k;this.n23=u-m*e;this.n31=-j*f;this.n32=e;this.n33=j*h;break;case "ZYX":m=j*k;o=j*g;p=e*k;u=e*g;this.n11=h*k;this.n12=p*f-o;this.n13=m*f+u;this.n21=h*g;this.n22=u*f+m;this.n23=o*f-p;this.n31=-f;this.n32=e*h;this.n33=j*h;break;case "YZX":m=j*h;o= -j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=u-m*g;this.n13=p*g+o;this.n21=g;this.n22=j*k;this.n23=-e*k;this.n31=-f*k;this.n32=o*g+p;this.n33=m-u*g;break;case "XZY":m=j*h;o=j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=-g;this.n13=f*k;this.n21=m*g+u;this.n22=j*k;this.n23=o*g-p;this.n31=p*g-o;this.n32=e*k;this.n33=u*g+m;break;default:m=j*k,o=j*g,p=e*k,u=e*g,this.n11=h*k,this.n12=-h*g,this.n13=f,this.n21=o+p*f,this.n22=m-u*f,this.n23=-e*h,this.n31=u-m*f,this.n32=p+o*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c= -b.x,e=b.y,f=b.z,g=b.w,j=c+c,h=e+e,k=f+f,b=c*j,m=c*h;c*=k;var o=e*h;e*=k;f*=k;j*=g;h*=g;g*=k;this.n11=1-(o+f);this.n12=m-g;this.n13=c+h;this.n21=m+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,g=THREE.Matrix4.__m2; -f.identity();f.setRotationFromQuaternion(c);g.setScale(e.x,e.y,e.z);this.multiply(f,g);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);g.set(this.n12,this.n22,this.n32);j.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); -e.y=g.length();e.z=j.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,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,j=b.n14,h=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,u=b.n32,v=b.n33,t=b.n34,x=b.n41,w=b.n42,A=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*t*w-o*v*w+o*u*A-k*t*A-m*u*y+k*v*y;c.n12=j*v*w-g*t*w-j*u*A+f*t*A+g*u*y-f*v*y;c.n13=g*o*w-j*m*w+j*k*A-f*o*A-g*k*y+f*m*y;c.n14=j*m*u-g*o*u-j*k*v+f*o*v+g*k*t-f*m*t;c.n21=o*v*x-m*t*x-o*p*A+h*t*A+m*p*y-h*v*y;c.n22=g*t*x-j*v*x+j*p*A-e*t*A-g*p*y+e*v*y;c.n23=j*m*x-g*o*x-j*h*A+e*o*A+g*h*y-e*m*y;c.n24= -g*o*p-j*m*p+j*h*v-e*o*v-g*h*t+e*m*t;c.n31=k*t*x-o*u*x+o*p*w-h*t*w-k*p*y+h*u*y;c.n32=j*u*x-f*t*x-j*p*w+e*t*w+f*p*y-e*u*y;c.n33=g*o*x-j*k*x+j*h*w-e*o*w-f*h*y+e*k*y;c.n34=j*k*p-f*o*p-j*h*u+e*o*u+f*h*t-e*k*t;c.n41=m*u*x-k*v*x-m*p*w+h*v*w+k*p*A-h*u*A;c.n42=f*v*x-g*u*x+g*p*w-e*v*w-f*p*A+e*u*A;c.n43=g*k*x-f*m*x-g*h*w+e*m*w+f*h*A-e*k*A;c.n44=f*m*p-g*k*p+g*h*u-e*m*u-f*h*v+e*k*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,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,u=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*j;e[3]=b*h;e[4]=b*k;e[5]=b*m;e[6]=b*o;e[7]=b*p;e[8]=b*u;return c}; -THREE.Matrix4.makeFrustum=function(b,c,e,f,g,j){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=-(j+g)/(j-g);h.n34=-2*j*g/(j-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,j){var h,k,m,o;h=new THREE.Matrix4;k=c-b;m=e-f;o=j-g;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+b)/k);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((e+f)/m);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((j+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.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; -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.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""}; +e=e.clone().subSelf(c),h=b.clone().subSelf(c),b=f.dot(f),c=f.dot(e),f=f.dot(h),j=e.dot(e),e=e.dot(h),h=1/(b*j-c*c),j=(j*f-c*e)*h,b=(b*e-c*f)*h;return j>0&&b>0&&j+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x, +Math.max(b.scale.y,b.scale.z)))return[];var h,k,j,m,o,p,t,v,w,u,y=b.geometry,x=y.vertices,B=[],f=0;for(h=y.faces.length;f0:v<0)))if(v=t.dot((new THREE.Vector3).sub(j,w))/v,w=w.addSelf(u.multiplyScalar(v)),k instanceof THREE.Face3)e(w,j,m,o)&&(k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},B.push(k));else if(k instanceof THREE.Face4&&(e(w,j,m,p)||e(w,m,o,p)))k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},B.push(k);B.sort(function(b,c){return b.distance-c.distance});return B}else return[]}}; +THREE.Rectangle=function(){function b(){k=f-c;j=h-e}var c,e,f,h,k,j,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(j,k,t,v){m=!1;c=j;e=k;f=t;h=v;b()};this.addPoint=function(j,k){m?(m=!1,c=j,e=k,f=j,h=k):(c=cj?f:j,h=h>k?h:k);b()};this.add3Points= +function(j,k,t,v,w,u){m?(m=!1,c=jt?j>w?j:w:t>w?t:w,h=k>v?k>u?k:u:v>u?v:u):(c=jt?j>w?j>f?j:f:w>f?w:f:t>w?t>f?t:f:w>f?w:f,h=k>v?k>u?k>h?k:h:u>h?u:h:v>u?v>h?v:h:u>h?u:h);b()};this.addRectangle=function(j){m?(m=!1,c=j.getLeft(),e=j.getTop(),f=j.getRight(),h=j.getBottom()):(c=cj.getRight()?f:j.getRight(),h=h> +j.getBottom()?h:j.getBottom());b()};this.inflate=function(j){c-=j;e-=j;f+=j;h+=j;b()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();e=e>j.getTop()?e:j.getTop();f=f=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;h=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]}; +THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,h,k,j,m,o,p,t,v,w,u,y,x){this.set(b||1,c||0,e||0,f||0,h||0,k||1,j||0,m||0,o||0,p||0,t||1,v||0,w||0,u||0,y||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,j,m,o,p,t,v,w,u,y,x){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=j;this.n24=m;this.n31=o;this.n32=p;this.n33=t;this.n34=v;this.n41=w;this.n42=u;this.n43=y;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, +c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h; +b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+ +e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,j=b.n21,m=b.n22,o=b.n23,p=b.n24,t=b.n31,v=b.n32,w=b.n33,u=b.n34,y=b.n41,x=b.n42,B=b.n43,z=b.n44,H=c.n11,D=c.n12, +I=c.n13,K=c.n14,M=c.n21,C=c.n22,J=c.n23,E=c.n24,Y=c.n31,F=c.n32,L=c.n33,N=c.n34,P=c.n41,n=c.n42,V=c.n43,ha=c.n44;this.n11=e*H+f*M+h*Y+k*P;this.n12=e*D+f*C+h*F+k*n;this.n13=e*I+f*J+h*L+k*V;this.n14=e*K+f*E+h*N+k*ha;this.n21=j*H+m*M+o*Y+p*P;this.n22=j*D+m*C+o*F+p*n;this.n23=j*I+m*J+o*L+p*V;this.n24=j*K+m*E+o*N+p*ha;this.n31=t*H+v*M+w*Y+u*P;this.n32=t*D+v*C+w*F+u*n;this.n33=t*I+v*J+w*L+u*V;this.n34=t*K+v*E+w*N+u*ha;this.n41=y*H+x*M+B*Y+z*P;this.n42=y*D+x*C+B*F+z*n;this.n43=y*I+x*J+B*L+z*V;this.n44=y* +K+x*E+B*N+z*ha;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*= +b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,j=this.n23,m=this.n24,o=this.n31,p=this.n32,t=this.n33,v=this.n34,w=this.n41,u=this.n42,y=this.n43,x=this.n44;return f*j*p*w-e*m*p*w-f*k*t*w+c*m*t*w+e*k*v*w-c*j*v*w-f*j*o*u+e*m*o*u+f*h*t*u-b*m*t*u-e*h*v*u+b*j*v*u+f*k*o*y-c*m*o*y-f*h*p*y+b*m*p*y+c*h*v*y-b*k*v*y-e*k*o*x+c*j*o*x+e*h*p*x-b*j*p*x-c*h* +t*x+b*k*t*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34= +this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]= +this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]= +this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0, +0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,k=b.x,j=b.y,m=b.z,o=h*k,p=h*j;this.set(o*k+e,o*j-f*m,o*m+f*j,0,o*j+f*m,p*j+e,p*m-f*k,0,o*m-f*j,p*m+f*k,h*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= +new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,h=b.z,k=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f),m=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var o= +j*m,p=j*h,t=f*m,v=f*h;this.n11=o+v*e;this.n12=t*e-p;this.n13=k*f;this.n21=k*h;this.n22=k*m;this.n23=-e;this.n31=p*e-t;this.n32=v+o*e;this.n33=k*j;break;case "ZXY":o=j*m;p=j*h;t=f*m;v=f*h;this.n11=o-v*e;this.n12=-k*h;this.n13=t+p*e;this.n21=p+t*e;this.n22=k*m;this.n23=v-o*e;this.n31=-k*f;this.n32=e;this.n33=k*j;break;case "ZYX":o=k*m;p=k*h;t=e*m;v=e*h;this.n11=j*m;this.n12=t*f-p;this.n13=o*f+v;this.n21=j*h;this.n22=v*f+o;this.n23=p*f-t;this.n31=-f;this.n32=e*j;this.n33=k*j;break;case "YZX":o=k*j;p= +k*f;t=e*j;v=e*f;this.n11=j*m;this.n12=v-o*h;this.n13=t*h+p;this.n21=h;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*h+t;this.n33=o-v*h;break;case "XZY":o=k*j;p=k*f;t=e*j;v=e*f;this.n11=j*m;this.n12=-h;this.n13=f*m;this.n21=o*h+v;this.n22=k*m;this.n23=p*h-t;this.n31=t*h-p;this.n32=e*m;this.n33=v*h+o;break;default:o=k*m,p=k*h,t=e*m,v=e*h,this.n11=j*m,this.n12=-j*h,this.n13=f,this.n21=p+t*f,this.n22=o-v*f,this.n23=-e*j,this.n31=v-o*f,this.n32=t+p*f,this.n33=k*j}return this},setRotationFromQuaternion:function(b){var c= +b.x,e=b.y,f=b.z,h=b.w,k=c+c,j=e+e,m=f+f,b=c*k,o=c*j;c*=m;var p=e*j;e*=m;f*=m;k*=h;j*=h;h*=m;this.n11=1-(p+f);this.n12=o-h;this.n13=c+j;this.n21=o+h;this.n22=1-(b+f);this.n23=e-k;this.n31=c-j;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},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2; +f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);k.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); +e.y=h.length();e.z=k.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23= +b.n23*h;this.n33=b.n33*h}}; +THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,j=b.n21,m=b.n22,o=b.n23,p=b.n24,t=b.n31,v=b.n32,w=b.n33,u=b.n34,y=b.n41,x=b.n42,B=b.n43,z=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*u*x-p*w*x+p*v*B-m*u*B-o*v*z+m*w*z;c.n12=k*w*x-h*u*x-k*v*B+f*u*B+h*v*z-f*w*z;c.n13=h*p*x-k*o*x+k*m*B-f*p*B-h*m*z+f*o*z;c.n14=k*o*v-h*p*v-k*m*w+f*p*w+h*m*u-f*o*u;c.n21=p*w*y-o*u*y-p*t*B+j*u*B+o*t*z-j*w*z;c.n22=h*u*y-k*w*y+k*t*B-e*u*B-h*t*z+e*w*z;c.n23=k*o*y-h*p*y-k*j*B+e*p*B+h*j*z-e*o*z;c.n24= +h*p*t-k*o*t+k*j*w-e*p*w-h*j*u+e*o*u;c.n31=m*u*y-p*v*y+p*t*x-j*u*x-m*t*z+j*v*z;c.n32=k*v*y-f*u*y-k*t*x+e*u*x+f*t*z-e*v*z;c.n33=h*p*y-k*m*y+k*j*x-e*p*x-f*j*z+e*m*z;c.n34=k*m*t-f*p*t-k*j*v+e*p*v+f*j*u-e*m*u;c.n41=o*v*y-m*w*y-o*t*x+j*w*x+m*t*B-j*v*B;c.n42=f*w*y-h*v*y+h*t*x-e*w*x-f*t*B+e*v*B;c.n43=h*m*y-f*o*y-h*j*x+e*o*x+f*j*B-e*m*B;c.n44=f*o*t-h*m*t+h*j*v-e*o*v-f*j*w+e*m*w;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,t=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*j;e[4]=b*m;e[5]=b*o;e[6]=b*p;e[7]=b*t;e[8]=b*v;return c}; +THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(f-e);j.n23=(f+e)/(f-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(k+h)/(k-h);j.n34=-2*k*h/(k-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)}; +THREE.Matrix4.makeOrtho=function(b,c,e,f,h,k){var j,m,o,p;j=new THREE.Matrix4;m=c-b;o=e-f;p=k-h;j.n11=2/m;j.n12=0;j.n13=0;j.n14=-((c+b)/m);j.n21=0;j.n22=2/o;j.n23=0;j.n24=-((e+f)/o);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((k+h)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; +THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= +!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)=== --1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,g;e=0;for(f=this.children.length;e=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=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)*j)/h;f=Math.sin(f*j)/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,j){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=j instanceof Array?j:[j];this.centroid=new THREE.Vector3}; -THREE.Face4=function(b,c,e,f,g,j,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=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; +this.x,e=this.y,f=this.z,h=this.w,k=b.x,j=b.y,m=b.z,b=b.w;this.x=c*b+h*k+e*m-f*j;this.y=e*b+h*j+f*k-c*m;this.z=f*b+h*m+c*j-e*k;this.w=h*b-c*k-e*j-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,k=this.x,j=this.y,m=this.z,o=this.w,p=o*e+j*h-m*f,t=o*f+m*e-k*h,v=o*h+k*f-j*e,e=-k* +e-j*f-m*h;c.x=p*o+e*-k+t*-m-v*-j;c.y=t*o+e*-j+v*-k-p*-m;c.z=v*o+e*-m+p*-j-t*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*k)/j;f=Math.sin(f*k)/j;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; +THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,k){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3}; +THREE.Face4=function(b,c,e,f,h,k,j){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; -THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; +THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var 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?j:j+1;e[3]=j>this.points.length-3?j:j+2;o=this.points[e[0]];p=this.points[e[1]]; -u=this.points[e[2]];v=this.points[e[3]];k=h*h;m=h*k;f.x=c(o.x,p.x,u.x,v.x,h,k,m);f.y=c(o.y,p.y,u.y,v.y,h,k,m);f.z=c(o.z,p.z,u.z,v.z,h,k,m);return f};this.getControlPointsArray=function(){var b,c,e=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]];t=this.points[e[1]]; +v=this.points[e[2]];w=this.points[e[3]];m=j*j;o=j*m;f.x=c(p.x,t.x,v.x,w.x,j,m,o);f.y=c(p.y,t.y,v.y,w.y,j,m,o);f.z=c(p.z,t.z,v.z,w.z,j,m,o);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;b1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1, this.LODs[f].object3D.visible=!0;else break;for(;f=0&&g>=0&&j>=0&&k>=0?!0:h<0&&g<0||j<0&&k<0?!1:(h<0?e=Math.max(e,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),j<0?e=Math.max(e,j/(j-k)):k<0&&(f=Math.min(f,j/(j-k))),fn&&h.positionScreen.z0&&J.z<1))ea=D[G]=D[G]||new THREE.RenderableParticle,G++,y=ea,y.x=J.x/J.w,y.y=J.y/J.w,y.z=J.z,y.rotation=P.rotation.z,y.scale.x=P.scale.x*Math.abs(y.x- -(J.x+g.projectionMatrix.n11)/(J.w+g.projectionMatrix.n14)),y.scale.y=P.scale.y*Math.abs(y.y-(J.y+g.projectionMatrix.n22)/(J.w+g.projectionMatrix.n24)),y.materials=P.materials,I.push(y);j&&I.sort(c);return I}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var m,o,p,u,v,t,x,w;b=c.projectScene(e,f);m=0;for(o=b.length;m0&&(e(THREE.NormalBlending),c(1),g("rgba("+Math.floor(x.r*255)+","+Math.floor(x.g*255)+","+ -Math.floor(x.b*255)+","+w+")"),t.fillRect(Math.floor(na.getX()),Math.floor(na.getY()),Math.floor(na.getWidth()),Math.floor(na.getHeight()))),na.empty())};this.render=function(b,m){function o(b){var c,e,f,h=b.lights;oa.setRGB(0,0,0);Da.setRGB(0,0,0);Ga.setRGB(0,0,0);b=0;for(c=h.length;b>1,ka=o.height>>1,j=h.scale.x*u,m=h.scale.y*v,k=j*p,n=m*ka,aa.set(b.x-k,b.y-n,b.x+k,b.y+n),ra.instersects(aa)&&(t.save(),t.translate(b.x,b.y),t.rotate(-h.rotation),t.scale(j,-m),t.translate(-p,-ka),t.drawImage(o,0,0),t.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*u,n=h.scale.y*v,aa.set(b.x-k,b.y-n,b.x+k,b.y+n),ra.instersects(aa)&&(f(j.color.getContextStyle()),g(j.color.getContextStyle()),t.save(),t.translate(b.x,b.y),t.rotate(-h.rotation),t.scale(k, -n),j.program(t),t.restore()))}function w(b,h,g,j){c(j.opacity);e(j.blending);t.beginPath();t.moveTo(b.positionScreen.x,b.positionScreen.y);t.lineTo(h.positionScreen.x,h.positionScreen.y);t.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(I!=b)t.lineWidth=I=b;b=j.linecap;if(J!=b)t.lineCap=J=b;b=j.linejoin;if(C!=b)t.lineJoin=C=b;f(j.color.getContextStyle());t.stroke();aa.inflate(j.linewidth*2)}}function A(b,f,h,g,k,u,o,t,ka){j.data.vertices+=3;j.data.faces++;c(t.opacity);e(t.blending); -K=b.positionScreen.x;Q=b.positionScreen.y;n=f.positionScreen.x;T=f.positionScreen.y;X=h.positionScreen.x;M=h.positionScreen.y;D(K,Q,n,T,X,M);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(la=o.uvs[0],Za(K,Q,n,T,X,M,la[g].u,la[g].v,la[k].u,la[k].v,la[u].u,la[u].v,t.map));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=m.matrixWorldInverse,sa.copy(o.vertexNormalsWorld[0]),ma=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Fa= --(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,sa.copy(o.vertexNormalsWorld[1]),ya=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Ia=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,sa.copy(o.vertexNormalsWorld[2]),Ja=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Ta=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,Za(K,Q,n,T,X,M,ma,Fa,ya,Ia,Ja,Ta,t.envMap)}else t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&& -(t.map.mapping instanceof THREE.UVMapping&&(la=o.uvs[0],Za(K,Q,n,T,X,M,la[g].u,la[g].v,la[k].u,la[k].v,la[u].u,la[u].v,t.map)),e(THREE.SubtractiveBlending)),xa?!t.wireframe&&t.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(P.r=ea.r=Z.r=oa.r,P.g=ea.g=Z.g=oa.g,P.b=ea.b=Z.b=oa.b,p(ka,o.v1.positionWorld,o.vertexNormalsWorld[0],P),p(ka,o.v2.positionWorld,o.vertexNormalsWorld[1],ea),p(ka,o.v3.positionWorld,o.vertexNormalsWorld[2],Z),da.r=(ea.r+Z.r)*0.5,da.g=(ea.g+Z.g)*0.5,da.b=(ea.b+Z.b)* -0.5,pa=Xa(P,ea,Z,da),Ua(K,Q,n,T,X,M,0,0,1,0,0,1,pa)):(va.r=oa.r,va.g=oa.g,va.b=oa.b,p(ka,o.centroidWorld,o.normalWorld,va),Y.r=Math.max(0,Math.min(t.color.r*va.r,1)),Y.g=Math.max(0,Math.min(t.color.g*va.g,1)),Y.b=Math.max(0,Math.min(t.color.b*va.b,1)),t.wireframe?Ka(Y,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Y)):t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof THREE.MeshDepthMaterial)U=m.near,ja=m.far,P.r=P.g= -P.b=1-Oa(b.positionScreen.z,U,ja),ea.r=ea.g=ea.b=1-Oa(f.positionScreen.z,U,ja),Z.r=Z.g=Z.b=1-Oa(h.positionScreen.z,U,ja),da.r=(ea.r+Z.r)*0.5,da.g=(ea.g+Z.g)*0.5,da.b=(ea.b+Z.b)*0.5,pa=Xa(P,ea,Z,da),Ua(K,Q,n,T,X,M,0,0,1,0,0,1,pa);else if(t instanceof THREE.MeshNormalMaterial)Y.r=Va(o.normalWorld.x),Y.g=Va(o.normalWorld.y),Y.b=Va(o.normalWorld.z),t.wireframe?Ka(Y,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Y)}function y(b,f,h,g,k,u,o,t,ka){j.data.vertices+=4;j.data.faces++;c(t.opacity); -e(t.blending);if(t.map||t.envMap)A(b,f,g,0,1,3,o,t,ka),A(k,h,u,1,2,3,o,t,ka);else if(K=b.positionScreen.x,Q=b.positionScreen.y,n=f.positionScreen.x,T=f.positionScreen.y,X=h.positionScreen.x,M=h.positionScreen.y,W=g.positionScreen.x,ha=g.positionScreen.y,ca=k.positionScreen.x,fa=k.positionScreen.y,ga=u.positionScreen.x,$=u.positionScreen.y,t instanceof THREE.MeshBasicMaterial)G(K,Q,n,T,X,M,W,ha),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof -THREE.MeshLambertMaterial)xa?!t.wireframe&&t.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(P.r=ea.r=Z.r=da.r=oa.r,P.g=ea.g=Z.g=da.g=oa.g,P.b=ea.b=Z.b=da.b=oa.b,p(ka,o.v1.positionWorld,o.vertexNormalsWorld[0],P),p(ka,o.v2.positionWorld,o.vertexNormalsWorld[1],ea),p(ka,o.v4.positionWorld,o.vertexNormalsWorld[3],Z),p(ka,o.v3.positionWorld,o.vertexNormalsWorld[2],da),pa=Xa(P,ea,Z,da),D(K,Q,n,T,W,ha),Ua(K,Q,n,T,W,ha,0,0,1,0,0,1,pa),D(ca,fa,X,M,ga,$),Ua(ca,fa,X,M,ga,$,1,0,1,1,0,1,pa)):(va.r= -oa.r,va.g=oa.g,va.b=oa.b,p(ka,o.centroidWorld,o.normalWorld,va),Y.r=Math.max(0,Math.min(t.color.r*va.r,1)),Y.g=Math.max(0,Math.min(t.color.g*va.g,1)),Y.b=Math.max(0,Math.min(t.color.b*va.b,1)),G(K,Q,n,T,X,M,W,ha),t.wireframe?Ka(Y,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Y)):(G(K,Q,n,T,X,M,W,ha),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color));else if(t instanceof THREE.MeshNormalMaterial)Y.r=Va(o.normalWorld.x),Y.g=Va(o.normalWorld.y), -Y.b=Va(o.normalWorld.z),G(K,Q,n,T,X,M,W,ha),t.wireframe?Ka(Y,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Y);else if(t instanceof THREE.MeshDepthMaterial)U=m.near,ja=m.far,P.r=P.g=P.b=1-Oa(b.positionScreen.z,U,ja),ea.r=ea.g=ea.b=1-Oa(f.positionScreen.z,U,ja),Z.r=Z.g=Z.b=1-Oa(g.positionScreen.z,U,ja),da.r=da.g=da.b=1-Oa(h.positionScreen.z,U,ja),pa=Xa(P,ea,Z,da),D(K,Q,n,T,W,ha),Ua(K,Q,n,T,W,ha,0,0,1,0,0,1,pa),D(ca,fa,X,M,ga,$),Ua(ca,fa,X,M,ga,$,1,0,1,1,0,1,pa)}function D(b,c,e,f, -h,g){t.beginPath();t.moveTo(b,c);t.lineTo(e,f);t.lineTo(h,g);t.lineTo(b,c);t.closePath()}function G(b,c,e,f,h,g,j,k){t.beginPath();t.moveTo(b,c);t.lineTo(e,f);t.lineTo(h,g);t.lineTo(j,k);t.lineTo(b,c);t.closePath()}function Ka(b,c,e,h){if(I!=c)t.lineWidth=I=c;if(J!=e)t.lineCap=J=e;if(C!=h)t.lineJoin=C=h;f(b.getContextStyle());t.stroke();aa.inflate(c*2)}function La(b){g(b.getContextStyle());t.fill()}function Za(b,c,e,f,h,j,k,n,m,o,u,p,ka){if(ka.image.width!=0){if(ka.needsUpdate==!0||ia[ka.id]==void 0){var v= -ka.wrapS==THREE.RepeatWrapping,Ba=ka.wrapT==THREE.RepeatWrapping;ia[ka.id]=t.createPattern(ka.image,v&&Ba?"repeat":v&&!Ba?"repeat-x":!v&&Ba?"repeat-y":"no-repeat");ka.needsUpdate=!1}g(ia[ka.id]);var v=ka.offset.x/ka.repeat.x,Ba=ka.offset.y/ka.repeat.y,x=(ka.image.width-1)*ka.repeat.x,ka=(ka.image.height-1)*ka.repeat.y,k=(k+v)*x,n=(n+Ba)*ka,m=(m+v)*x,o=(o+Ba)*ka,u=(u+v)*x,p=(p+Ba)*ka;e-=b;f-=c;h-=b;j-=c;m-=k;o-=n;u-=k;p-=n;v=1/(m*p-u*o);ka=(p*e-o*h)*v;o=(p*f-o*j)*v;e=(m*h-u*e)*v;f=(m*j-u*f)*v;b=b- -ka*k-e*n;c=c-o*k-f*n;t.save();t.transform(ka,o,e,f,b,c);t.fill();t.restore()}}function Ua(b,c,e,f,h,g,j,k,n,m,o,u,ka){var p,v;p=ka.width-1;v=ka.height-1;j*=p;k*=v;n*=p;m*=v;o*=p;u*=v;e-=b;f-=c;h-=b;g-=c;n-=j;m-=k;o-=j;u-=k;v=1/(n*u-o*m);p=(u*e-m*h)*v;m=(u*f-m*g)*v;e=(n*h-o*e)*v;f=(n*g-o*f)*v;b=b-p*j-e*k;c=c-m*j-f*k;t.save();t.transform(p,m,e,f,b,c);t.clip();t.drawImage(ka,0,0);t.restore()}function Xa(b,c,e,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(c.r*255),k=~~(c.g*255),c=~~(c.b*255), -n=~~(e.r*255),m=~~(e.g*255),e=~~(e.b*255),t=~~(f.r*255),o=~~(f.g*255),f=~~(f.b*255);za[0]=h<0?0:h>255?255:h;za[1]=g<0?0:g>255?255:g;za[2]=b<0?0:b>255?255:b;za[4]=j<0?0:j>255?255:j;za[5]=k<0?0:k>255?255:k;za[6]=c<0?0:c>255?255:c;za[8]=n<0?0:n>255?255:n;za[9]=m<0?0:m>255?255:m;za[10]=e<0?0:e>255?255:e;za[12]=t<0?0:t>255?255:t;za[13]=o<0?0:o>255?255:o;za[14]=f<0?0:f>255?255:f;Aa.putImageData(ka,0,0);Ba.drawImage(R,0,0);return Wa}function Oa(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Va(b){b=(b+ -1)*0.5;return b<0?0:b>1?1:b}function Ma(b,c){var e=c.x-b.x,f=c.y-b.y,h=e*e+f*f;h!=0&&(h=1/Math.sqrt(h),e*=h,f*=h,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Ya,$a,qa,Ca,Na,F,z,N;this.autoClear?this.clear():t.setTransform(1,0,0,-1,u,v);j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,m,this.sortElements);(xa=b.lights.length>0)&&o(b);Ya=0;for($a=h.length;Ya<$a;Ya++){qa=h[Ya];aa.empty();if(qa instanceof THREE.RenderableParticle){B=qa;B.x*=u;B.y*=v;Ca=0;for(Na=qa.materials.length;Ca0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j)):g instanceof THREE.PointLight&&(V.sub(g.position,c.centroidWorld),V.normalize(),j=c.normalWorld.dot(V)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j))}function c(c,e,h,k,n,t){j.data.vertices+=3;j.data.faces++;K=f(Q++);K.setAttribute("d", -"M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(J.r=C.r,J.g=C.g,J.b=C.b,b(t,k,J),I.r=Math.max(0,Math.min(n.color.r*J.r,1)),I.g=Math.max(0,Math.min(n.color.g*J.g,1)),I.b=Math.max(0,Math.min(n.color.b*J.b,1))):I.copy(n.color):n instanceof THREE.MeshDepthMaterial?(E=1-n.__2near/(n.__farPlusNear-k.z*n.__farMinusNear), -I.setRGB(E,E,E)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(g(k.normalWorld.x),g(k.normalWorld.y),g(k.normalWorld.z));n.wireframe?K.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):K.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+n.opacity);m.appendChild(K)}function e(c,e,h,k,n,t,o){j.data.vertices+=4;j.data.faces++; -K=f(Q++);K.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?I.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(J.r=C.r,J.g=C.g,J.b=C.b,b(o,n,J),I.r=Math.max(0,Math.min(t.color.r*J.r,1)),I.g=Math.max(0,Math.min(t.color.g*J.g,1)),I.b=Math.max(0,Math.min(t.color.b*J.b,1))):I.copy(t.color):t instanceof -THREE.MeshDepthMaterial?(E=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),I.setRGB(E,E,E)):t instanceof THREE.MeshNormalMaterial&&I.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));t.wireframe?K.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):K.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+ -t.opacity);m.appendChild(K)}function f(b){H[b]==null&&(H[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),T==0&&H[b].setAttribute("shape-rendering","crispEdges"));return H[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,h=null,k=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,u,v,t,x,w,A,y=new THREE.Rectangle,G=new THREE.Rectangle,D=!1,I=new THREE.Color(16777215),J=new THREE.Color(16777215),C=new THREE.Color(0),B=new THREE.Color(0), -L=new THREE.Color(0),E,V=new THREE.Vector3,H=[],S=[],K,Q,n,T=1;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":T=1;break;case "low":T=0}};this.setSize=function(b,c){o=b;p=c;u=o/2;v=p/2;m.setAttribute("viewBox",-u+" "+-v+" "+o+" "+p);m.setAttribute("width",o);m.setAttribute("height",p);y.set(-u,-v,u,v)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render= -function(b,f){var g,o,p,I,J,H,E,P;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,f,this.sortElements);n=Q=0;if(D=b.lights.length>0){E=b.lights;C.setRGB(0,0,0);B.setRGB(0,0,0);L.setRGB(0,0,0);g=0;for(o=E.length;g=0&&h>=0&&k>=0&&m>=0?!0:j<0&&h<0||k<0&&m<0?!1:(j<0?e=Math.max(e,j/(j-h)):h<0&&(f=Math.min(f,j/(j-h))),k<0?e=Math.max(e,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),fI&&j.positionScreen.z0&&C.z<1))da=D[H]=D[H]||new THREE.RenderableParticle,H++,z=da,z.x=C.x/C.w,z.y=C.y/C.w,z.z=C.z,z.rotation=W.rotation.z,z.scale.x=W.scale.x*Math.abs(z.x- +(C.x+h.projectionMatrix.n11)/(C.w+h.projectionMatrix.n14)),z.scale.y=W.scale.y*Math.abs(z.y-(C.y+h.projectionMatrix.n22)/(C.w+h.projectionMatrix.n24)),z.materials=W.materials,K.push(z);k&&K.sort(c);return K}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var o,p,t,v,w,u,y,x;b=c.projectScene(e,f);o=0;for(p=b.length;o0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+ +Math.floor(y.b*255)+","+x+")"),u.fillRect(Math.floor(na.getX()),Math.floor(na.getY()),Math.floor(na.getWidth()),Math.floor(na.getHeight()))),na.empty())};this.render=function(b,o){function p(b){var c,e,f,j=b.lights;oa.setRGB(0,0,0);Ea.setRGB(0,0,0);Ha.setRGB(0,0,0);b=0;for(c=j.length;b>1,t=p.height>>1,k=j.scale.x*v,o=j.scale.y*w,m=k*pa,n=o*t,ca.set(b.x-m,b.y-n,b.x+m,b.y+n),sa.instersects(ca)&&(u.save(),u.translate(b.x,b.y),u.rotate(-j.rotation),u.scale(k,-o),u.translate(-pa,-t),u.drawImage(p,0,0),u.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(m=j.scale.x*v,n=j.scale.y*w,ca.set(b.x-m,b.y-n,b.x+m,b.y+n),sa.instersects(ca)&&(f(k.color.getContextStyle()),h(k.color.getContextStyle()),u.save(),u.translate(b.x,b.y),u.rotate(-j.rotation),u.scale(m, +n),k.program(u),u.restore()))}function x(b,j,h,k){c(k.opacity);e(k.blending);u.beginPath();u.moveTo(b.positionScreen.x,b.positionScreen.y);u.lineTo(j.positionScreen.x,j.positionScreen.y);u.closePath();if(k instanceof THREE.LineBasicMaterial){b=k.linewidth;if(I!=b)u.lineWidth=I=b;b=k.linecap;if(K!=b)u.lineCap=K=b;b=k.linejoin;if(M!=b)u.lineJoin=M=b;f(k.color.getContextStyle());u.stroke();ca.inflate(k.linewidth*2)}}function B(b,f,j,h,m,v,p,u,pa){k.data.vertices+=3;k.data.faces++;c(u.opacity);e(u.blending); +N=b.positionScreen.x;P=b.positionScreen.y;n=f.positionScreen.x;V=f.positionScreen.y;ha=j.positionScreen.x;R=j.positionScreen.y;D(N,P,n,V,ha,R);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(ka=p.uvs[0],$a(N,P,n,V,ha,R,ka[h].u,ka[h].v,ka[m].u,ka[m].v,ka[v].u,ka[v].v,u.map));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=o.matrixWorldInverse,ta.copy(p.vertexNormalsWorld[0]),ma=(ta.x*b.n11+ta.y*b.n12+ta.z*b.n13)*0.5+0.5, +Ga=-(ta.x*b.n21+ta.y*b.n22+ta.z*b.n23)*0.5+0.5,ta.copy(p.vertexNormalsWorld[1]),za=(ta.x*b.n11+ta.y*b.n12+ta.z*b.n13)*0.5+0.5,Ja=-(ta.x*b.n21+ta.y*b.n22+ta.z*b.n23)*0.5+0.5,ta.copy(p.vertexNormalsWorld[2]),Ka=(ta.x*b.n11+ta.y*b.n12+ta.z*b.n13)*0.5+0.5,Ua=-(ta.x*b.n21+ta.y*b.n22+ta.z*b.n23)*0.5+0.5,$a(N,P,n,V,ha,R,ma,Ga,za,Ja,Ka,Ua,u.envMap)}else u.wireframe?La(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&& +(u.map.mapping instanceof THREE.UVMapping&&(ka=p.uvs[0],$a(N,P,n,V,ha,R,ka[h].u,ka[h].v,ka[m].u,ka[m].v,ka[v].u,ka[v].v,u.map)),e(THREE.SubtractiveBlending)),ya?!u.wireframe&&u.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(S.r=W.r=da.r=oa.r,S.g=W.g=da.g=oa.g,S.b=W.b=da.b=oa.b,t(pa,p.v1.positionWorld,p.vertexNormalsWorld[0],S),t(pa,p.v2.positionWorld,p.vertexNormalsWorld[1],W),t(pa,p.v3.positionWorld,p.vertexNormalsWorld[2],da),fa.r=(W.r+da.r)*0.5,fa.g=(W.g+da.g)*0.5,fa.b=(W.b+da.b)* +0.5,ra=Ya(S,W,da,fa),Va(N,P,n,V,ha,R,0,0,1,0,0,1,ra)):(wa.r=oa.r,wa.g=oa.g,wa.b=oa.b,t(pa,p.centroidWorld,p.normalWorld,wa),$.r=Math.max(0,Math.min(u.color.r*wa.r,1)),$.g=Math.max(0,Math.min(u.color.g*wa.g,1)),$.b=Math.max(0,Math.min(u.color.b*wa.b,1)),u.wireframe?La($,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma($)):u.wireframe?La(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma(u.color);else if(u instanceof THREE.MeshDepthMaterial)X=o.near,ja=o.far,S.r= +S.g=S.b=1-Pa(b.positionScreen.z,X,ja),W.r=W.g=W.b=1-Pa(f.positionScreen.z,X,ja),da.r=da.g=da.b=1-Pa(j.positionScreen.z,X,ja),fa.r=(W.r+da.r)*0.5,fa.g=(W.g+da.g)*0.5,fa.b=(W.b+da.b)*0.5,ra=Ya(S,W,da,fa),Va(N,P,n,V,ha,R,0,0,1,0,0,1,ra);else if(u instanceof THREE.MeshNormalMaterial)$.r=Wa(p.normalWorld.x),$.g=Wa(p.normalWorld.y),$.b=Wa(p.normalWorld.z),u.wireframe?La($,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma($)}function z(b,f,j,h,m,v,p,u,pa){k.data.vertices+=4;k.data.faces++; +c(u.opacity);e(u.blending);if(u.map||u.envMap)B(b,f,h,0,1,3,p,u,pa),B(m,j,v,1,2,3,p,u,pa);else if(N=b.positionScreen.x,P=b.positionScreen.y,n=f.positionScreen.x,V=f.positionScreen.y,ha=j.positionScreen.x,R=j.positionScreen.y,aa=h.positionScreen.x,Z=h.positionScreen.y,ia=m.positionScreen.x,U=m.positionScreen.y,ea=v.positionScreen.x,ga=v.positionScreen.y,u instanceof THREE.MeshBasicMaterial)H(N,P,n,V,ha,R,aa,Z),u.wireframe?La(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma(u.color); +else if(u instanceof THREE.MeshLambertMaterial)ya?!u.wireframe&&u.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==4?(S.r=W.r=da.r=fa.r=oa.r,S.g=W.g=da.g=fa.g=oa.g,S.b=W.b=da.b=fa.b=oa.b,t(pa,p.v1.positionWorld,p.vertexNormalsWorld[0],S),t(pa,p.v2.positionWorld,p.vertexNormalsWorld[1],W),t(pa,p.v4.positionWorld,p.vertexNormalsWorld[3],da),t(pa,p.v3.positionWorld,p.vertexNormalsWorld[2],fa),ra=Ya(S,W,da,fa),D(N,P,n,V,aa,Z),Va(N,P,n,V,aa,Z,0,0,1,0,0,1,ra),D(ia,U,ha,R,ea,ga),Va(ia,U,ha,R,ea, +ga,1,0,1,1,0,1,ra)):(wa.r=oa.r,wa.g=oa.g,wa.b=oa.b,t(pa,p.centroidWorld,p.normalWorld,wa),$.r=Math.max(0,Math.min(u.color.r*wa.r,1)),$.g=Math.max(0,Math.min(u.color.g*wa.g,1)),$.b=Math.max(0,Math.min(u.color.b*wa.b,1)),H(N,P,n,V,ha,R,aa,Z),u.wireframe?La($,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma($)):(H(N,P,n,V,ha,R,aa,Z),u.wireframe?La(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma(u.color));else if(u instanceof THREE.MeshNormalMaterial)$.r=Wa(p.normalWorld.x), +$.g=Wa(p.normalWorld.y),$.b=Wa(p.normalWorld.z),H(N,P,n,V,ha,R,aa,Z),u.wireframe?La($,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ma($);else if(u instanceof THREE.MeshDepthMaterial)X=o.near,ja=o.far,S.r=S.g=S.b=1-Pa(b.positionScreen.z,X,ja),W.r=W.g=W.b=1-Pa(f.positionScreen.z,X,ja),da.r=da.g=da.b=1-Pa(h.positionScreen.z,X,ja),fa.r=fa.g=fa.b=1-Pa(j.positionScreen.z,X,ja),ra=Ya(S,W,da,fa),D(N,P,n,V,aa,Z),Va(N,P,n,V,aa,Z,0,0,1,0,0,1,ra),D(ia,U,ha,R,ea,ga),Va(ia,U,ha,R,ea,ga,1,0,1,1, +0,1,ra)}function D(b,c,e,f,j,h){u.beginPath();u.moveTo(b,c);u.lineTo(e,f);u.lineTo(j,h);u.lineTo(b,c);u.closePath()}function H(b,c,e,f,j,h,k,m){u.beginPath();u.moveTo(b,c);u.lineTo(e,f);u.lineTo(j,h);u.lineTo(k,m);u.lineTo(b,c);u.closePath()}function La(b,c,e,j){if(I!=c)u.lineWidth=I=c;if(K!=e)u.lineCap=K=e;if(M!=j)u.lineJoin=M=j;f(b.getContextStyle());u.stroke();ca.inflate(c*2)}function Ma(b){h(b.getContextStyle());u.fill()}function $a(b,c,e,f,j,k,m,n,o,p,v,pa,t){if(t.image.width!=0){if(t.needsUpdate== +!0||la[t.id]==void 0){var w=t.wrapS==THREE.RepeatWrapping,Ca=t.wrapT==THREE.RepeatWrapping;la[t.id]=u.createPattern(t.image,w&&Ca?"repeat":w&&!Ca?"repeat-x":!w&&Ca?"repeat-y":"no-repeat");t.needsUpdate=!1}h(la[t.id]);var w=t.offset.x/t.repeat.x,Ca=t.offset.y/t.repeat.y,y=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,m=(m+w)*y,n=(n+Ca)*t,o=(o+w)*y,p=(p+Ca)*t,v=(v+w)*y,pa=(pa+Ca)*t;e-=b;f-=c;j-=b;k-=c;o-=m;p-=n;v-=m;pa-=n;w=1/(o*pa-v*p);t=(pa*e-p*j)*w;p=(pa*f-p*k)*w;e=(o*j-v*e)*w;f=(o* +k-v*f)*w;b=b-t*m-e*n;c=c-p*m-f*n;u.save();u.transform(t,p,e,f,b,c);u.fill();u.restore()}}function Va(b,c,e,f,j,h,k,m,n,o,p,v,t){var pa,w;pa=t.width-1;w=t.height-1;k*=pa;m*=w;n*=pa;o*=w;p*=pa;v*=w;e-=b;f-=c;j-=b;h-=c;n-=k;o-=m;p-=k;v-=m;w=1/(n*v-p*o);pa=(v*e-o*j)*w;o=(v*f-o*h)*w;e=(n*j-p*e)*w;f=(n*h-p*f)*w;b=b-pa*k-e*m;c=c-o*k-f*m;u.save();u.transform(pa,o,e,f,b,c);u.clip();u.drawImage(t,0,0);u.restore()}function Ya(b,c,e,f){var j=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(c.r*255),m=~~(c.g*255), +c=~~(c.b*255),n=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),u=~~(f.r*255),p=~~(f.g*255),f=~~(f.b*255);Aa[0]=j<0?0:j>255?255:j;Aa[1]=h<0?0:h>255?255:h;Aa[2]=b<0?0:b>255?255:b;Aa[4]=k<0?0:k>255?255:k;Aa[5]=m<0?0:m>255?255:m;Aa[6]=c<0?0:c>255?255:c;Aa[8]=n<0?0:n>255?255:n;Aa[9]=o<0?0:o>255?255:o;Aa[10]=e<0?0:e>255?255:e;Aa[12]=u<0?0:u>255?255:u;Aa[13]=p<0?0:p>255?255:p;Aa[14]=f<0?0:f>255?255:f;Ba.putImageData(pa,0,0);Ca.drawImage(T,0,0);return Xa}function Pa(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Wa(b){b= +(b+1)*0.5;return b<0?0:b>1?1:b}function Na(b,c){var e=c.x-b.x,f=c.y-b.y,j=e*e+f*f;j!=0&&(j=1/Math.sqrt(j),e*=j,f*=j,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,ab,qa,Da,Oa,G,A,O;this.autoClear?this.clear():u.setTransform(1,0,0,-1,v,w);k.data.vertices=0;k.data.faces=0;j=m.projectScene(b,o,this.sortElements);(ya=b.lights.length>0)&&p(b);Za=0;for(ab=j.length;Za0&&(e.r+=h.color.r*k,e.g+=h.color.g*k,e.b+=h.color.b*k)):h instanceof THREE.PointLight&&(Y.sub(h.position,c.centroidWorld),Y.normalize(),k=c.normalWorld.dot(Y)*h.intensity,k>0&&(e.r+=h.color.r*k,e.g+=h.color.g*k,e.b+=h.color.b*k))}function c(c,e,j,m,n,u){k.data.vertices+=3;k.data.faces++;N=f(P++);N.setAttribute("d", +"M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(K.r=M.r,K.g=M.g,K.b=M.b,b(u,m,K),I.r=Math.max(0,Math.min(n.color.r*K.r,1)),I.g=Math.max(0,Math.min(n.color.g*K.g,1)),I.b=Math.max(0,Math.min(n.color.b*K.b,1))):I.copy(n.color):n instanceof THREE.MeshDepthMaterial?(E=1-n.__2near/(n.__farPlusNear-m.z*n.__farMinusNear), +I.setRGB(E,E,E)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(h(m.normalWorld.x),h(m.normalWorld.y),h(m.normalWorld.z));n.wireframe?N.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):N.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+n.opacity);o.appendChild(N)}function e(c,e,j,m,n,u,p){k.data.vertices+=4;k.data.faces++; +N=f(P++);N.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?I.copy(u.color):u instanceof THREE.MeshLambertMaterial?D?(K.r=M.r,K.g=M.g,K.b=M.b,b(p,n,K),I.r=Math.max(0,Math.min(u.color.r*K.r,1)),I.g=Math.max(0,Math.min(u.color.g*K.g,1)),I.b=Math.max(0,Math.min(u.color.b*K.b,1))):I.copy(u.color):u instanceof +THREE.MeshDepthMaterial?(E=1-u.__2near/(u.__farPlusNear-n.z*u.__farMinusNear),I.setRGB(E,E,E)):u instanceof THREE.MeshNormalMaterial&&I.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));u.wireframe?N.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):N.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+ +u.opacity);o.appendChild(N)}function f(b){F[b]==null&&(F[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),V==0&&F[b].setAttribute("shape-rendering","crispEdges"));return F[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,j=null,m=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,v,w,u,y,x,B,z=new THREE.Rectangle,H=new THREE.Rectangle,D=!1,I=new THREE.Color(16777215),K=new THREE.Color(16777215),M=new THREE.Color(0),C=new THREE.Color(0), +J=new THREE.Color(0),E,Y=new THREE.Vector3,F=[],L=[],N,P,n,V=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":V=1;break;case "low":V=0}};this.setSize=function(b,c){p=b;t=c;v=p/2;w=t/2;o.setAttribute("viewBox",-v+" "+-w+" "+p+" "+t);o.setAttribute("width",p);o.setAttribute("height",t);z.set(-v,-w,v,w)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render= +function(b,f){var h,p,t,I,K,F,E,S;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;j=m.projectScene(b,f,this.sortElements);n=P=0;if(D=b.lights.length>0){E=b.lights;M.setRGB(0,0,0);C.setRGB(0,0,0);J.setRGB(0,0,0);h=0;for(p=E.length;h= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * shadowColor;\n#endif", shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif"}; -THREE.UniformsUtils={merge:function(b){var c,e,f,g={};for(c=0;c=0)n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer),n.vertexAttribPointer(b.position, -3,n.FLOAT,!1,0,0);else if(j.morphTargetBase){c=h.program.attributes;j.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0)):c.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,m=j.morphTargetForcedOrder,t=j.morphTargetInfluences;fo&&(u=p,o=t[u]);n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[u]);n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=o;m[u]=1;o= --1;f++}}h.program.uniforms.morphTargetInfluences!==null&&n.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=0&&(c=g.__webglCustomAttributes[k],n.bindBuffer(n.ARRAY_BUFFER,c.buffer),n.vertexAttribPointer(b[k],c.size,n.FLOAT,!1,0,0));b.color>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer),n.vertexAttribPointer(b.color,3,n.FLOAT,!1,0,0));b.normal>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglNormalBuffer), -n.vertexAttribPointer(b.normal,3,n.FLOAT,!1,0,0));b.tangent>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglTangentBuffer),n.vertexAttribPointer(b.tangent,4,n.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(n.bindBuffer(n.ARRAY_BUFFER,g.__webglUVBuffer),n.vertexAttribPointer(b.uv,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv)):n.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(n.bindBuffer(n.ARRAY_BUFFER,g.__webglUV2Buffer),n.vertexAttribPointer(b.uv2,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv2)): -n.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinVertexABuffer),n.vertexAttribPointer(b.skinVertexA,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),n.vertexAttribPointer(b.skinVertexB,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),n.vertexAttribPointer(b.skinIndex,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinWeightsBuffer), -n.vertexAttribPointer(b.skinWeight,4,n.FLOAT,!1,0,0));j instanceof THREE.Mesh?(h.wireframe?(n.lineWidth(h.wireframeLinewidth),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),n.drawElements(n.LINES,g.__webglLineCount,n.UNSIGNED_SHORT,0)):(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),n.drawElements(n.TRIANGLES,g.__webglFaceCount,n.UNSIGNED_SHORT,0)),Q.data.vertices+=g.__webglFaceCount,Q.data.faces+=g.__webglFaceCount/3,Q.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip? -n.LINE_STRIP:n.LINES,n.lineWidth(h.linewidth),n.drawArrays(j,0,g.__webglLineCount),Q.data.drawCalls++):j instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,g.__webglParticleCount),Q.data.drawCalls++):j instanceof THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,g.__webglVertexCount),Q.data.drawCalls++)}}function g(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=n.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=n.createBuffer();b.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer), -n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(c.attributes.position),n.vertexAttribPointer(c.attributes.position,3,n.FLOAT,!1,0,0));if(b.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,j,k,m,t,o,u,p,v=b.count*3;for(p=0;p=0;e--)b[e].object==c&&b.splice(e,1)}function I(b){function c(b){var g=[];e=0;for(f=b.length;e65535&&(t[n].counter+=1,m=t[n].hash+"_"+t[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[], -materials:k,vertices:0,numMorphTargets:u})),b.geometryGroups[m].faces.push(g),b.geometryGroups[m].vertices+=j}function J(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function C(b){if(b!=fa){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD); -n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}fa=b}}function B(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,K(c.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,K(c.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,K(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,K(c.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S, -n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,S(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,S(c.minFilter)))}function L(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=n.createTexture(),b.__webglInit=!0;n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?n.texImage2D(n.TEXTURE_2D,0,K(b.format),b.image.width,b.image.height,0,K(b.format),n.UNSIGNED_BYTE,b.image.data): -n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);B(n.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+c),n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function E(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=n.createRenderbuffer();b.__webglTexture=n.createTexture();if(c){n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture); -B(n.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=n.createFramebuffer(),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,K(b.format),b.width,b.height,0,K(b.format),K(b.type),null)}else b.__webglFramebuffer=n.createFramebuffer(),n.bindTexture(n.TEXTURE_2D,b.__webglTexture),B(n.TEXTURE_2D,b,b),n.texImage2D(n.TEXTURE_2D,0,K(b.format),b.width,b.height,0,K(b.format),K(b.type),null);n.bindRenderbuffer(n.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)n.bindFramebuffer(n.FRAMEBUFFER, +THREE.WebGLRenderer=function(b){function c(b,c,e){var f,j,h,k=b.vertices,m=k.length,u=b.colors,o=u.length,p=b.__vertexArray,v=b.__colorArray,t=b.__sortArray,w=b.__dirtyVertices,y=b.__dirtyColors,B=b.__webglCustomAttributes,x,z;if(B)for(x in B)B[x].offset=0;if(e.sortParticles){ja.multiplySelf(e.matrixWorld);for(f=0;f=0)n.bindBuffer(n.ARRAY_BUFFER,h.__webglVertexBuffer),n.vertexAttribPointer(b.position, +3,n.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0)):c.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,h.__webglVertexBuffer),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,u=k.morphTargetInfluences;fp&&(v=t,p=u[v]);n.bindBuffer(n.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[v]);n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=p;o[v]=1;p= +-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&n.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],n.bindBuffer(n.ARRAY_BUFFER,c.buffer),n.vertexAttribPointer(b[m],c.size,n.FLOAT,!1,0,0));b.color>=0&&(n.bindBuffer(n.ARRAY_BUFFER,h.__webglColorBuffer),n.vertexAttribPointer(b.color,3,n.FLOAT,!1,0,0));b.normal>=0&&(n.bindBuffer(n.ARRAY_BUFFER,h.__webglNormalBuffer), +n.vertexAttribPointer(b.normal,3,n.FLOAT,!1,0,0));b.tangent>=0&&(n.bindBuffer(n.ARRAY_BUFFER,h.__webglTangentBuffer),n.vertexAttribPointer(b.tangent,4,n.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(n.bindBuffer(n.ARRAY_BUFFER,h.__webglUVBuffer),n.vertexAttribPointer(b.uv,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv)):n.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(n.bindBuffer(n.ARRAY_BUFFER,h.__webglUV2Buffer),n.vertexAttribPointer(b.uv2,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv2)): +n.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(n.bindBuffer(n.ARRAY_BUFFER,h.__webglSkinVertexABuffer),n.vertexAttribPointer(b.skinVertexA,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),n.vertexAttribPointer(b.skinVertexB,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),n.vertexAttribPointer(b.skinIndex,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,h.__webglSkinWeightsBuffer), +n.vertexAttribPointer(b.skinWeight,4,n.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(n.lineWidth(j.wireframeLinewidth),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),n.drawElements(n.LINES,h.__webglLineCount,n.UNSIGNED_SHORT,0)):(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),n.drawElements(n.TRIANGLES,h.__webglFaceCount,n.UNSIGNED_SHORT,0)),P.data.vertices+=h.__webglFaceCount,P.data.faces+=h.__webglFaceCount/3,P.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip? +n.LINE_STRIP:n.LINES,n.lineWidth(j.linewidth),n.drawArrays(k,0,h.__webglLineCount),P.data.drawCalls++):k instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,h.__webglParticleCount),P.data.drawCalls++):k instanceof THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,h.__webglVertexCount),P.data.drawCalls++)}}function h(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=n.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=n.createBuffer();b.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer), +n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(c.attributes.position),n.vertexAttribPointer(c.attributes.position,3,n.FLOAT,!1,0,0));if(b.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,j,k,m,o,u,p,v,t,w=b.count*3;for(t=0;t=0;e--)b[e].object==c&&b.splice(e,1)}function I(b){function c(b){var h=[];e=0;for(f=b.length;e65535&&(u[n].counter+=1,o=u[n].hash+"_"+u[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[], +materials:m,vertices:0,numMorphTargets:v})),b.geometryGroups[o].faces.push(h),b.geometryGroups[o].vertices+=k}function K(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(b){if(b!=U){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO, +n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}U=b}}function C(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,N(c.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,N(c.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,N(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,N(c.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE), +n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,L(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,L(c.minFilter)))}function J(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=n.createTexture();n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?n.texImage2D(n.TEXTURE_2D,0,N(b.format),b.image.width,b.image.height,0,N(b.format),n.UNSIGNED_BYTE,b.image.data):n.texImage2D(n.TEXTURE_2D, +0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);C(n.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+c),n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function E(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=n.createRenderbuffer();b.__webglTexture=n.createTexture();if(c){n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture);C(n.TEXTURE_CUBE_MAP, +b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=n.createFramebuffer(),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,N(b.format),b.width,b.height,0,N(b.format),N(b.type),null)}else b.__webglFramebuffer=n.createFramebuffer(),n.bindTexture(n.TEXTURE_2D,b.__webglTexture),C(n.TEXTURE_2D,b,b),n.texImage2D(n.TEXTURE_2D,0,N(b.format),b.width,b.height,0,N(b.format),N(b.type),null);n.bindRenderbuffer(n.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)n.bindFramebuffer(n.FRAMEBUFFER, b.__webglFramebuffer[e]),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+e,b.__webglTexture,0);else n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&& -b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,b.width,b.height);c?n.bindTexture(n.TEXTURE_CUBE_MAP,null):n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null)}var f,g;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height, -g=f=0):(c=null,e=da,b=ia,f=ea,g=Z);c!=M&&(n.bindFramebuffer(n.FRAMEBUFFER,c),n.viewport(f,g,e,b),M=c)}function V(b){b instanceof THREE.WebGLRenderTargetCube?(n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture),n.generateMipmap(n.TEXTURE_CUBE_MAP),n.bindTexture(n.TEXTURE_CUBE_MAP,null)):(n.bindTexture(n.TEXTURE_2D,b.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))}function H(b,c){var e;b=="fragment"?e=n.createShader(n.FRAGMENT_SHADER):b=="vertex"&&(e=n.createShader(n.VERTEX_SHADER)); -n.shaderSource(e,c);n.compileShader(e);if(!n.getShaderParameter(e,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(e)),console.error(c),null;return e}function S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST;default:return n.LINEAR}}function K(b){switch(b){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT; +b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,b.width,b.height);c?n.bindTexture(n.TEXTURE_CUBE_MAP,null):n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height, +h=f=0):(c=null,e=fa,b=la,f=W,h=da);c!=R&&(n.bindFramebuffer(n.FRAMEBUFFER,c),n.viewport(f,h,e,b),R=c)}function Y(b){b instanceof THREE.WebGLRenderTargetCube?(n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture),n.generateMipmap(n.TEXTURE_CUBE_MAP),n.bindTexture(n.TEXTURE_CUBE_MAP,null)):(n.bindTexture(n.TEXTURE_2D,b.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))}function F(b,c){var e;b=="fragment"?e=n.createShader(n.FRAGMENT_SHADER):b=="vertex"&&(e=n.createShader(n.VERTEX_SHADER)); +n.shaderSource(e,c);n.compileShader(e);if(!n.getShaderParameter(e,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(e)),console.error(c),null;return e}function L(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST;default:return n.LINEAR}}function N(b){switch(b){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT; case THREE.NearestFilter:return n.NEAREST;case THREE.NearestMipMapNearestFilter:return n.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return n.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return n.LINEAR;case THREE.LinearMipMapNearestFilter:return n.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return n.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return n.BYTE;case THREE.UnsignedByteType:return n.UNSIGNED_BYTE;case THREE.ShortType:return n.SHORT;case THREE.UnsignedShortType:return n.UNSIGNED_SHORT; -case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0}var Q=this,n,T=[],X=null,M=null,W=!0,ha=null,ca=null,fa=null,ga=null,$=null,Y=null,P=null,ea=0,Z=0,da=0,ia=0,U=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, -new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,pa=new Float32Array(16),la=new Float32Array(16),ma=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ya=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ia=b.stencil!==void 0?b.stencil:!0,Ja=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Ta=b.antialias!==void 0?b.antialias:!1,ra=b.clearColor!==void 0?new THREE.Color(b.clearColor): -new THREE.Color(0),na=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ya;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var aa,xa=[],b=THREE.ShaderLib.depthRGBA, -va=THREE.UniformsUtils.clone(b.uniforms),oa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:va}),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:va,morphTargets:!0});oa._shadowPass=!0;Da._shadowPass=!0;try{if(!(n=ya.getContext("experimental-webgl",{antialias:Ta,stencil:Ia,preserveDrawingBuffer:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+ -" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}n.clearColor(0,0,0,1);n.clearDepth(1);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(ra.r,ra.g,ra.b,na);this.context=n;var sa=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,R={};R.vertices=new Float32Array(16); -R.faces=new Uint16Array(6);i=0;R.vertices[i++]=-1;R.vertices[i++]=-1;R.vertices[i++]=0;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=-1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=1;R.vertices[i++]=0;R.vertices[i++]=-1;R.vertices[i++]=1;R.vertices[i++]=0;i=R.vertices[i++]=0;R.faces[i++]=0;R.faces[i++]=1;R.faces[i++]=2;R.faces[i++]=0;R.faces[i++]=2;R.faces[i++]=3;R.vertexBuffer=n.createBuffer();R.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER, -R.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,R.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,R.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,R.faces,n.STATIC_DRAW);R.program=n.createProgram();n.attachShader(R.program,H("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(R.program,H("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(R.program);R.attributes={};R.uniforms={};R.attributes.position=n.getAttribLocation(R.program,"position");R.attributes.uv=n.getAttribLocation(R.program, -"uv");R.uniforms.uvOffset=n.getUniformLocation(R.program,"uvOffset");R.uniforms.uvScale=n.getUniformLocation(R.program,"uvScale");R.uniforms.rotation=n.getUniformLocation(R.program,"rotation");R.uniforms.scale=n.getUniformLocation(R.program,"scale");R.uniforms.alignment=n.getUniformLocation(R.program,"alignment");R.uniforms.map=n.getUniformLocation(R.program,"map");R.uniforms.opacity=n.getUniformLocation(R.program,"opacity");R.uniforms.useScreenCoordinates=n.getUniformLocation(R.program,"useScreenCoordinates"); -R.uniforms.affectedByDistance=n.getUniformLocation(R.program,"affectedByDistance");R.uniforms.screenPosition=n.getUniformLocation(R.program,"screenPosition");R.uniforms.modelViewMatrix=n.getUniformLocation(R.program,"modelViewMatrix");R.uniforms.projectionMatrix=n.getUniformLocation(R.program,"projectionMatrix");var Aa=!1;this.setSize=function(b,c){ya.width=b;ya.height=c;this.setViewport(0,0,ya.width,ya.height)};this.setViewport=function(b,c,e,f){ea=b;Z=c;da=e;ia=f;n.viewport(ea,Z,da,ia)};this.setScissor= -function(b,c,e,f){n.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){W=b;n.depthMask(b)};this.setClearColorHex=function(b,c){ra.setHex(b);na=c;n.clearColor(ra.r,ra.g,ra.b,na)};this.setClearColor=function(b,c){ra.copy(b);na=c;n.clearColor(ra.r,ra.g,ra.b,na)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};this.getContext=function(){return n};this.initMaterial= -function(b,c,e,f){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader= -k.fragmentShader}var m,t,u;m=u=k=0;for(t=c.length;m=0&&n.enableVertexAttribArray(p.position);p.color>=0&&n.enableVertexAttribArray(p.color);p.normal>=0&&n.enableVertexAttribArray(p.normal);p.tangent>=0&&n.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(n.enableVertexAttribArray(p.skinVertexA),n.enableVertexAttribArray(p.skinVertexB),n.enableVertexAttribArray(p.skinIndex), -n.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&n.enableVertexAttribArray(p[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g=0&&(n.enableVertexAttribArray(p[x]),b.numSupportedMorphTargets++)};this.render=function(b,c,n,p){var y,D,G,I,U,J,H,B,L=b.lights,P=b.fog;this.shadowMapEnabled&&x(b,c);Q.data.vertices=0;Q.data.faces=0;Q.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0, -!1,c);c.matrixWorldInverse.flattenToArray(la);c.projectionMatrix.flattenToArray(pa);ja.multiply(c.projectionMatrix,c.matrixWorldInverse);m(ja);this.initWebGLObjects(b);E(n);(this.autoClear||p)&&this.clear();U=b.__webglObjects.length;for(p=0;p=0;p--)if(y=b.__webglObjects[p],y.render){H=y.object;B=y.buffer;G=y.opaque;j(H);for(y=0;y0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(t*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(t*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(t*4),k.__skinVertexBArray=new Float32Array(t*4),k.__skinIndexArray=new Float32Array(t*4),k.__skinWeightArray= -new Float32Array(t*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(A*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(x=k.numMorphTargets;v=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof -THREE.MarchingCubes&&D(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,$,t));Aa&& -(n.bindBuffer(n.ARRAY_BUFFER,m.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,fa,t));Ia&&wa.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,ma,t));xa&&ea>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ga,t));xa&&ca>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,ha,t));va&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,ra,t),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER, -m.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,oa,t));O>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,ia,t),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,aa,t),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,ta,t),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,ua,t));H&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray, -delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;G(k)}else if(g instanceof THREE.Ribbon){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=A=w=w= -void 0;v=g.vertices;m=g.colors;p=v.length;t=m.length;u=g.__vertexArray;H=g.__colorArray;x=g.__dirtyColors;if(g.__dirtyVertices){for(w=0;w0,T={};T.vertices=new Float32Array(16); +T.faces=new Uint16Array(6);i=0;T.vertices[i++]=-1;T.vertices[i++]=-1;T.vertices[i++]=0;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=-1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=0;T.vertices[i++]=-1;T.vertices[i++]=1;T.vertices[i++]=0;i=T.vertices[i++]=0;T.faces[i++]=0;T.faces[i++]=1;T.faces[i++]=2;T.faces[i++]=0;T.faces[i++]=2;T.faces[i++]=3;T.vertexBuffer=n.createBuffer();T.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER, +T.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,T.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,T.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,T.faces,n.STATIC_DRAW);T.program=n.createProgram();n.attachShader(T.program,F("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(T.program,F("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.position=n.getAttribLocation(T.program,"position");T.attributes.uv=n.getAttribLocation(T.program, +"uv");T.uniforms.uvOffset=n.getUniformLocation(T.program,"uvOffset");T.uniforms.uvScale=n.getUniformLocation(T.program,"uvScale");T.uniforms.rotation=n.getUniformLocation(T.program,"rotation");T.uniforms.scale=n.getUniformLocation(T.program,"scale");T.uniforms.alignment=n.getUniformLocation(T.program,"alignment");T.uniforms.map=n.getUniformLocation(T.program,"map");T.uniforms.opacity=n.getUniformLocation(T.program,"opacity");T.uniforms.useScreenCoordinates=n.getUniformLocation(T.program,"useScreenCoordinates"); +T.uniforms.affectedByDistance=n.getUniformLocation(T.program,"affectedByDistance");T.uniforms.screenPosition=n.getUniformLocation(T.program,"screenPosition");T.uniforms.modelViewMatrix=n.getUniformLocation(T.program,"modelViewMatrix");T.uniforms.projectionMatrix=n.getUniformLocation(T.program,"projectionMatrix");var Ba=!1;this.setSize=function(b,c){za.width=b;za.height=c;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(b,c,e,f){W=b;da=c;fa=e;la=f;n.viewport(W,da,fa,la)};this.setScissor= +function(b,c,e,f){n.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){aa=b;n.depthMask(b)};this.setClearColorHex=function(b,c){sa.setHex(b);na=c;n.clearColor(sa.r,sa.g,sa.b,na)};this.setClearColor=function(b,c){sa.copy(b);na=c;n.clearColor(sa.r,sa.g,sa.b,na)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};this.getContext=function(){return n};this.deallocateObject= +function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];n.deleteBuffer(c.__webglVertexBuffer);n.deleteBuffer(c.__webglNormalBuffer);n.deleteBuffer(c.__webglTangentBuffer);n.deleteBuffer(c.__webglColorBuffer);n.deleteBuffer(c.__webglUVBuffer);n.deleteBuffer(c.__webglUV2Buffer);n.deleteBuffer(c.__webglSkinVertexABuffer); +n.deleteBuffer(c.__webglSkinVertexBBuffer);n.deleteBuffer(c.__webglSkinIndicesBuffer);n.deleteBuffer(c.__webglSkinWeightsBuffer);n.deleteBuffer(c.__webglFaceBuffer);n.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets){var e=void 0,f=void 0;c.__webglMorphTargetsBuffers=[];e=0;for(f=c.numMorphTargets;e=0&&n.enableVertexAttribArray(t.position);t.color>=0&&n.enableVertexAttribArray(t.color);t.normal>=0&&n.enableVertexAttribArray(t.normal);t.tangent>=0&&n.enableVertexAttribArray(t.tangent);b.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0&&(n.enableVertexAttribArray(t.skinVertexA),n.enableVertexAttribArray(t.skinVertexB),n.enableVertexAttribArray(t.skinIndex), +n.enableVertexAttribArray(t.skinWeight));if(b.attributes)for(h in b.attributes)t[h]!==void 0&&t[h]>=0&&n.enableVertexAttribArray(t[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(n.enableVertexAttribArray(t[y]),b.numSupportedMorphTargets++)};this.render=function(b,c,n,t){var z,D,H,I,X,J,K,F,C=b.lights,N=b.fog;this.shadowMapEnabled&&y(b,c);P.data.vertices=0;P.data.faces=0;P.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0, +!1,c);c.matrixWorldInverse.flattenToArray(ka);c.projectionMatrix.flattenToArray(ra);ja.multiply(c.projectionMatrix,c.matrixWorldInverse);o(ja);this.initWebGLObjects(b);E(n);(this.autoClear||t)&&this.clear();X=b.__webglObjects.length;for(t=0;t=0;t--)if(z=b.__webglObjects[t],z.render){K=z.object;F=z.buffer;H=z.opaque;k(K);for(z=0;z0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(t*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray= +new Float32Array(t*4);m.__faceArray=new Uint16Array(x*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(y=m.numMorphTargets;w=0;j--)e[j]==f&&e.splice(j,1)}else f instanceof +THREE.MarchingCubes&&D(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER, +la,t));Ba&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,ea,t));Ja&&xa.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,ma,t));ya&&Y>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ga,t));ya&&T>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,ha,t));wa&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,sa,t),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER, +o.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,oa,t));Q>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,aa,t),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,ca,t),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,ua,t),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,va,t));J&&(delete o.__inittedArrays,delete o.__colorArray,delete o.__normalArray, +delete o.__tangentArray,delete o.__uvArray,delete o.__uv2Array,delete o.__faceArray,delete o.__vertexArray,delete o.__lineArray,delete o.__skinVertexAArray,delete o.__skinVertexBArray,delete o.__skinIndexArray,delete o.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;H(m)}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=n.DYNAMIC_DRAW;m=B=x=x= +void 0;w=h.vertices;o=h.colors;u=w.length;t=o.length;v=h.__vertexArray;J=h.__colorArray;y=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=j;return c}, +THREE.ColorUtils={adjustHSV:function(b,c,e,f){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,h);h.h=THREE.ColorUtils.clamp(h.h+c,0,1);h.s=THREE.ColorUtils.clamp(h.s+e,0,1);h.v=THREE.ColorUtils.clamp(h.v+f,0,1);b.setHSV(h.h,h.s,h.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,h=b.b,k=Math.max(Math.max(e,f),h),j=Math.min(Math.min(e,f),h);if(j==k)j=e=0;else{var m=k-j,j=m/k,e=e==k?(f-h)/m:f==k?2+(h-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=j;c.v=k;return c}, clamp:function(b,c,e){return be?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,j=b.vertices,h=g.vertices,k=b.faces,m=g.faces,o=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,u=h.length;p1&&(f=1-f,g=1-g);j=1-f-g;h.copy(b);h.multiplyScalar(f);k.copy(c);k.multiplyScalar(g);h.addSelf(k);k.copy(e);k.multiplyScalar(j);h.addSelf(k);return h},randomPointInFace:function(b, -c,e){var f,g,j;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,g=c.vertices[b.b].position,j=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,g,j);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;g=c.vertices[b.b].position;j=c.vertices[b.c].position;var c=c.vertices[b.d].position,h;e?b._area1&&b._area2?(e=b._area1,h=b._area2):(e=THREE.GeometryUtils.triangleArea(f,g,c),h=THREE.GeometryUtils.triangleArea(g,j,c),b._area1=e,b._area2=h):(e=THREE.GeometryUtils.triangleArea(f, -g,c),h=THREE.GeometryUtils.triangleArea(g,j,c));return THREE.GeometryUtils.random()*(e+h)b?c(e,g-1):o[g]1&&(f=1-f,h=1-h);k=1-f-h;j.copy(b);j.multiplyScalar(f);m.copy(c);m.multiplyScalar(h);j.addSelf(m);m.copy(e);m.multiplyScalar(k);j.addSelf(m);return j},randomPointInFace:function(b, +c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position,j;e?b._area1&&b._area2?(e=b._area1,j=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),j=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=j):(e=THREE.GeometryUtils.triangleArea(f, +h,c),j=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+j)b?c(e,h-1):p[h] 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"}, cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"}}}; THREE.AnimationHandler=function(){var b=[],c={},e={update:function(c){for(var e=0;e1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+t),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",t,h.index-1).pos,this.points[1]=g,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",t,k.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,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f}}if(this.JITCompile&&p[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;tb.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];k=b[e[1]];m=b[e[2]];o=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(j[0],k[0],m[0],o[0],g,e,h);f[1]=this.interpolate(j[1],k[1],m[1],o[1],g,e,h);f[2]=this.interpolate(j[2],k[2],m[2],o[2],g,e,h);return f}; -THREE.Animation.prototype.interpolate=function(b,c,e,f,g,j,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*j+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=e1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",u,j.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",u,m.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== +"rot")THREE.Quaternion.slerp(h,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&t[0][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]];o=b[e[2]];p=b[e[3]];e=h*h;j=h*e;f[0]=this.interpolate(k[0],m[0],o[0],p[0],h,e,j);f[1]=this.interpolate(k[1],m[1],o[1],p[1],h,e,j);f[2]=this.interpolate(k[2],m[2],o[2],p[2],h,e,j);return f}; +THREE.Animation.prototype.interpolate=function(b,c,e,f,h,k,j){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*j+(-3*(c-e)-2*b-f)*k+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]}; -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= +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.005;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= b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!== void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.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(b){b.preventDefault(); b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.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 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.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;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update= function(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;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);this.moveUp&&this.translateY(c);this.moveDown&&this.translateY(-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 b=this.target.position,g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b= -1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)* +this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown&&this.translateY(-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 b=this.target.position,h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b= +1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;b=this.target.position;h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)* Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.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(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))}; -THREE.PathCamera=function(b){function c(b,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},h,j=c.getControlPointsArray(),k=c.getLength(),m=j.length,G=0;h=m-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var k=h[1]-h[0];this.phi= -TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/k)*k+h[0];f=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;k=h[1]-h[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/k)*k+h[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,b,c,e)};this.onMouseMove=function(b){this.mouseX= -b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),m=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,h);b.position.set(0,10,0);this.animation= +window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var h=Math.PI*2,k=Math.PI/180;this.update=function(b,c,e){var f,j;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)*k;this.theta=this.lon*k;f=this.phi%h;this.phi=f>=0?f:f+h;f=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;var m=j[1]-j[0];this.phi= +TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(j[1]-j[0])/(f[1]-f[0])+j[0]-j[0])/m)*m+j[0];f=this.horizontalAngleMap.srcRange;j=this.horizontalAngleMap.dstRange;m=j[1]-j[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(j[1]-j[0])/(f[1]-f[0])+j[0]-j[0])/m)*m+j[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,b,c,e)};this.onMouseMove=function(b){this.mouseX= +b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),j=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),o=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(o,j);b.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(b)}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(b,c){return function(){c.apply(b,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(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.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward= +THREE.FlyCamera=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.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward= b.autoForward;if(b.domElement!==void 0)this.domElement=b.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(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.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(b){switch(b.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(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,j=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY- -c.offset[1]-j)/j;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff* +case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),h=c.size[0]/2,k=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-h)/h;this.moveState.pitchDown=(b.clientY- +c.offset[1]-k)/k;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff* this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);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 b=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=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!= document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this, this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype; -THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,m=!1,o=1,p=0,u=0,v=0,t=0,x=0,w=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*t),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.translateZ(b*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(b*u);this.translateY(b*v);m&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); -else if(this.forward.y0||this.autoForward&&!(t<0)?1:t));this.translateX(b*v);this.translateY(b*w);o&&(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?e.normalize():e.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(g).setLength(e.x));f.addSelf(g.setLength(e.z));return f}; -this.rotateCamera=function(){var b=Math.acos(j.dot(h)/j.length()/h.length());if(b){var c=(new THREE.Vector3).cross(j,h).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(h);this.staticMoving?j=h:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(j))}};this.zoomCamera=function(){var b=1+(m.y-k.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?k=m:k.y+=(m.y-k.y)*this.dynamicDampingFactor)}; -this.panCamera=function(){var b=p.clone().subSelf(o);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var c=g.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);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), -g.lengthSq()1?e.normalize():e.z=Math.sqrt(1-f*f);h=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(h).setLength(e.x));f.addSelf(h.setLength(e.z));return f}; +this.rotateCamera=function(){var b=Math.acos(k.dot(j)/k.length()/j.length());if(b){var c=(new THREE.Vector3).cross(k,j).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(h);e.multiplyVector3(this.up);e.multiplyVector3(j);this.staticMoving?k=j:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var b=1+(o.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b),this.staticMoving?m=o:m.y+=(o.y-m.y)*this.dynamicDampingFactor)}; +this.panCamera=function(){var b=t.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?p=t:p.addSelf(b.sub(t,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), +h.lengthSq()0)k=f-1;else{k=f;break}f=k;if(e[f]==j)return f/(g-1);h=e[f];return e=(f+(j-h)/(e[f+1]-h))/(g-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)}; +THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==b+1)return this.cacheArcLengths;var c=[],e,f=this.getPoint(0),h,k=0;c.push(0);for(h=1;h<=b;h++)e=this.getPoint(h/b),k+=e.distanceTo(f),c.push(k),f=e;return this.cacheArcLengths=c}; +THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,h=e.length,k;k=c?c:b*e[h-1];time=Date.now();for(var j=0,m=h-1,o;j<=m;)if(f=Math.floor(j+(m-j)/2),o=e[f]-k,o<0)j=f+1;else if(o>0)m=f-1;else{m=f;break}f=m;if(e[f]==k)return f/(h-1);j=e[f];return e=(f+(k-j)/(e[f+1]-j))/(h-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)}; THREE.Curve.prototype.getTangent=function(b){var c=b-1.0E-4;b+=1.0E-4;c<0&&(c=0);b>1&&(b=1);var c=this.getPoint(c),b=this.getPoint(b),e=new THREE.Vector2;e.sub(b,c);return e.unit()};THREE.LineCurve=function(b,c){b instanceof THREE.Vector2?(this.v1=b,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(b,c,e,f){this.constructor(new THREE.Vector2(b,c),new THREE.Vector2(e,f))};THREE.LineCurve.prototype=new THREE.Curve; THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(b).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(b){return this.getPoint(b)};THREE.LineCurve.prototype.getTangent=function(){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.normalize();return b}; THREE.QuadraticBezierCurve=function(b,c,e){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),b=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),e=new THREE.Vector2(f[4],f[5]);this.v0=b;this.v1=c;this.v2=e};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,b)};THREE.QuadraticBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,b);c.normalize();return c}; -THREE.CubicBezierCurve=function(b,c,e,f){if(!(c instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),b=new THREE.Vector2(g[0],g[1]),c=new THREE.Vector2(g[2],g[3]),e=new THREE.Vector2(g[4],g[5]),f=new THREE.Vector2(g[6],g[7]);this.v0=b;this.v1=c;this.v2=e;this.v3=f};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; +THREE.CubicBezierCurve=function(b,c,e,f){if(!(c instanceof THREE.Vector2))var h=Array.prototype.slice.call(arguments),b=new THREE.Vector2(h[0],h[1]),c=new THREE.Vector2(h[2],h[3]),e=new THREE.Vector2(h[4],h[5]),f=new THREE.Vector2(h[6],h[7]);this.v0=b;this.v1=c;this.v2=e;this.v3=f};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b3(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,b)};THREE.CubicBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,b);c.normalize();return c}; THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve; -THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,g;g=(f.length-1)*b;b=Math.floor(g);g-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,g);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,g);return c};THREE.ArcCurve=function(b,c,e,f,g,j){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=g;this.aClockwise=j}; +THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,h;h=(f.length-1)*b;b=Math.floor(h);h-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,h);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,h);return c};THREE.ArcCurve=function(b,c,e,f,h,k){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=h;this.aClockwise=k}; THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(b=1-b);b=this.aStartAngle+b*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(b),this.aY+this.aRadius*Math.sin(b))}; -THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentCubicBezier:function(b,c,e,f,g){return-3*c*(1-b)*(1-b)+3*e*(1-b)*(1-b)-6*b*e*(1-b)+6*b*f*(1-b)-3*b*b*f+3*b*b*g},tangentSpline:function(b){return 6*b*b-6*b+(3*b*b-4*b+1)+(-6*b*b+6*b)+(3*b*b-2*b)},interpolate:function(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,j=g*g;return(2*c-2*e+b+f)*g*j+(-3*c+3*e-2*b-f)*j+b*g+c}}; +THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentCubicBezier:function(b,c,e,f,h){return-3*c*(1-b)*(1-b)+3*e*(1-b)*(1-b)-6*b*e*(1-b)+6*b*f*(1-b)-3*b*b*f+3*b*b*h},tangentSpline:function(b){return 6*b*b-6*b+(3*b*b-4*b+1)+(-6*b*b+6*b)+(3*b*b-2*b)},interpolate:function(b,c,e,f,h){var b=(e-b)*0.5,f=(f-c)*0.5,k=h*h;return(2*c-2*e+b+f)*h*k+(-3*c+3*e-2*b-f)*k+b*h+c}}; THREE.Curve.create=function(b,c){b.prototype=new THREE.Curve;b.prototype.constructor=b;b.prototype.getPoint=c;return b};THREE.LineCurve3=THREE.Curve.create(function(b,c){this.v1=b;this.v2=c},function(b){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(b);c.addSelf(this.v1);return c}); THREE.QuadraticBezierCurve3=THREE.Curve.create(function(b,c,e){this.v0=b;this.v1=c;this.v2=e},function(b){var c,e;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);e=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);b=THREE.Shape.Utils.b2(b,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,e,b)});THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(b){this.curves.push(b)}; THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};THREE.CurvePath.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.getCurveLengths(),b=0;b=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};THREE.CurvePath.prototype.getLength=function(){var b=this.getCurveLengths();return b[b.length-1]}; THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var b=[],c=0,e,f=this.curves.length;for(e=0;ec)c=j.x;else if(j.xe)e=j.y;else if(j.yc)c=k.x;else if(k.xe)e=k.y;else if(k.y0?(h=e[e.length-1],t=h.x,x=h.y):(h=this.actions[f-1].args,t=h[h.length-2],x=h[h.length-1]);for(h=1;h<=b;h++)w=h/b,j=THREE.Shape.Utils.b2(w,t,u,k),w=THREE.Shape.Utils.b2(w,x,v, -m),e.push(new THREE.Vector2(j,w));break;case THREE.PathActions.BEZIER_CURVE_TO:k=j[4];m=j[5];u=j[0];v=j[1];o=j[2];p=j[3];e.length>0?(h=e[e.length-1],t=h.x,x=h.y):(h=this.actions[f-1].args,t=h[h.length-2],x=h[h.length-1]);for(h=1;h<=b;h++)w=h/b,j=THREE.Shape.Utils.b3(w,t,u,o,k),w=THREE.Shape.Utils.b3(w,x,v,p,m),e.push(new THREE.Vector2(j,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[f-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=b*j[0].length;h=h.concat(j[0]);j=new THREE.SplineCurve(h); -for(h=1;h<=w;h++)e.push(j.getPointAt(h/w));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;k=j[0];m=j[1];o=j[2];u=j[3];w=j[4];v=!!j[5];p=h[h.length-2];t=h[h.length-1];h.length==0&&(p=t=0);x=w-u;var A=b*2;for(h=1;h<=A;h++)w=h/A,v||(w=1-w),w=u+w*x,j=p+k+o*Math.cos(w),w=t+m+o*Math.sin(w),e.push(new THREE.Vector2(j,w))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; -THREE.Path.prototype.nltransform=function(b,c,e,f,g,j){var h=this.getPoints(),k,m,o,p,u;k=0;for(m=h.length;k0?(j=e[e.length-1],u=j.x,y=j.y):(j=this.actions[f-1].args,u=j[j.length-2],y=j[j.length-1]);for(j=1;j<=b;j++)x=j/b,k=THREE.Shape.Utils.b2(x,u,v,m),x=THREE.Shape.Utils.b2(x,y,w, +o),e.push(new THREE.Vector2(k,x));break;case THREE.PathActions.BEZIER_CURVE_TO:m=k[4];o=k[5];v=k[0];w=k[1];p=k[2];t=k[3];e.length>0?(j=e[e.length-1],u=j.x,y=j.y):(j=this.actions[f-1].args,u=j[j.length-2],y=j[j.length-1]);for(j=1;j<=b;j++)x=j/b,k=THREE.Shape.Utils.b3(x,u,v,p,m),x=THREE.Shape.Utils.b3(x,y,w,t,o),e.push(new THREE.Vector2(k,x));break;case THREE.PathActions.CSPLINE_THRU:j=this.actions[f-1].args;j=[new THREE.Vector2(j[j.length-2],j[j.length-1])];x=b*k[0].length;j=j.concat(k[0]);k=new THREE.SplineCurve(j); +for(j=1;j<=x;j++)e.push(k.getPointAt(j/x));break;case THREE.PathActions.ARC:j=this.actions[f-1].args;m=k[0];o=k[1];p=k[2];v=k[3];x=k[4];w=!!k[5];t=j[j.length-2];u=j[j.length-1];j.length==0&&(t=u=0);y=x-v;var B=b*2;for(j=1;j<=B;j++)x=j/B,w||(x=1-x),x=v+x*y,k=t+m+p*Math.cos(x),x=u+o+p*Math.sin(x),e.push(new THREE.Vector2(k,x))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; +THREE.Path.prototype.nltransform=function(b,c,e,f,h,k){var j=this.getPoints(),m,o,p,t,v;m=0;for(o=j.length;m=0?k-1:e.length-1;j=h-1>=0?h-1:o.length-1;var w=[o[h],e[k],e[g]];u=THREE.FontUtils.Triangulate.area(w);var A=[o[h],o[j],e[k]];v=THREE.FontUtils.Triangulate.area(A);t=k;p=h;k+=1;h+=-1;k<0&&(k+=e.length);k%= -e.length;h<0&&(h+=o.length);h%=o.length;g=k-1>=0?k-1:e.length-1;j=h-1>=0?h-1:o.length-1;w=[o[h],e[k],e[g]];w=THREE.FontUtils.Triangulate.area(w);A=[o[h],o[j],e[k]];A=THREE.FontUtils.Triangulate.area(A);u+v>w+A&&(k=t,h=p,k<0&&(k+=e.length),k%=e.length,h<0&&(h+=o.length),h%=o.length,g=k-1>=0?k-1:e.length-1,j=h-1>=0?h-1:o.length-1);u=e.slice(0,k);v=e.slice(k);t=o.slice(h);p=o.slice(0,h);j=[o[h],o[j],e[k]];x.push([o[h],e[k],e[g]]);x.push(j);e=u.concat(t).concat(p).concat(v)}return{shape:e,isolatedPts:x, -allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,h,k,m,o={};j=0;for(h=f.length;j=0?m-1:e.length-1;k=j-1>=0?j-1:p.length-1;var x=[p[j],e[m],e[h]];v=THREE.FontUtils.Triangulate.area(x);var B=[p[j],p[k],e[m]];w=THREE.FontUtils.Triangulate.area(B);u=m;t=j;m+=1;j+=-1;m<0&&(m+=e.length);m%= +e.length;j<0&&(j+=p.length);j%=p.length;h=m-1>=0?m-1:e.length-1;k=j-1>=0?j-1:p.length-1;x=[p[j],e[m],e[h]];x=THREE.FontUtils.Triangulate.area(x);B=[p[j],p[k],e[m]];B=THREE.FontUtils.Triangulate.area(B);v+w>x+B&&(m=u,j=t,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=p.length),j%=p.length,h=m-1>=0?m-1:e.length-1,k=j-1>=0?j-1:p.length-1);v=e.slice(0,m);w=e.slice(m);u=p.slice(j);t=p.slice(0,j);k=[p[j],p[k],e[m]];y.push([p[j],e[m],e[h]]);y.push(k);e=v.concat(u).concat(t).concat(w)}return{shape:e,isolatedPts:y, +allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),k,j,m,o,p={};k=0;for(j=f.length;k0){e=new THREE.Vector3(0,0,-1);h(0,0,-p-(j||0));for(m=b;m0){c=new THREE.Vector3(0,0,1);h(0,0,p+(g||0));for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b,[c,c,c,c]))}m= -0;for(b=this.faces.length;m0){e=new THREE.Vector3(0,0,-1);j(0,0,-t-(k||0));for(o=b;o0){c=new THREE.Vector3(0,0,1);j(0,0,t+(h||0));for(o=b+b/2;o<2*b;o++)m.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b,[c,c,c,c]))}o= +0;for(b=this.faces.length;ob&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(H=b.length;--H>=0;){ga=H;$=H-1;$<0&&($=b.length- -1);for(var c=0,e=t+p*2,c=0;c=0;K--){Q=K/p;n=m*(1-Q);Q=o*Math.sin(Q*Math.PI/2);H=0;for(S=G.length;Hb&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(k).addSelf(m).subSelf(b).clone()}function h(b){for(F=b.length;--F>=0;){ea=F;ga=F-1;ga<0&&(ga=b.length- +1);for(var c=0,e=u+t*2,c=0;c=0;N--){P=N/t;n=o*(1-P);P=p*Math.sin(P*Math.PI/2);F=0;for(L=H.length;F0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,k,v)))-1);o.push(p)}c.push(o)}for(var t,x,w,g=c.length,e=0;e0)for(f=0;f1&&(t= -this.vertices[h].position.clone(),x=this.vertices[m].position.clone(),w=this.vertices[o].position.clone(),t.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,m,o,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([p,u,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,h=Math.PI,k=Math.max(3,c||8),j=Math.max(2,e||6),c=[],e=0;e0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,m,w)))-1);p.push(t)}c.push(p)}for(var u,y,x,h=c.length,e=0;e0)for(f=0;f1&&(u= +this.vertices[j].position.clone(),y=this.vertices[o].position.clone(),x=this.vertices[p].position.clone(),u.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(j,o,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,v,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c= -this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),j=g.length,h=[],b=0;b0)for(o=0;o2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return k;return j}m=o;g<=m&&(m=0);o=m+1;g<=o&&(o=0);p=o+1;g<=p&&(p=0);var v;a:{v=b;var t=m,x=o,w=p,A=g,y=h,G=void 0,D=void 0,I=void 0, -J=void 0,C=void 0,B=void 0,L=void 0,E=void 0,V=void 0,D=v[y[t]].x,I=v[y[t]].y,J=v[y[x]].x,C=v[y[x]].y,B=v[y[w]].x,L=v[y[w]].y;if(1.0E-10>(J-D)*(L-I)-(C-I)*(B-D))v=!1;else{for(G=0;G=0&&K>=0&&n>=0){v=!1;break a}}v= -!0}}if(v){j.push([b[h[m]],b[h[o]],b[h[p]]]);k.push([h[m],h[o],h[p]]);m=o;for(p=o+1;p0)for(p=0;p2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}o=p;h<=o&&(o=0);p=o+1;h<=p&&(p=0);t=p+1;h<=t&&(t=0);var w;a:{w=b;var u=o,y=p,x=t,B=h,z=j,H=void 0,D=void 0,I=void 0, +K=void 0,M=void 0,C=void 0,J=void 0,E=void 0,Y=void 0,D=w[z[u]].x,I=w[z[u]].y,K=w[z[y]].x,M=w[z[y]].y,C=w[z[x]].x,J=w[z[x]].y;if(1.0E-10>(K-D)*(J-I)-(M-I)*(C-D))w=!1;else{for(H=0;H=0&&N>=0&&n>=0){w=!1;break a}}w= +!0}}if(w){k.push([b[j[o]],b[j[p]],b[j[t]]]);m.push([j[o],j[p],j[t]]);o=p;for(t=p+1;t>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 m(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, -c){return b.charCodeAt(c)&255}function u(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+B);c=m(b,c+L);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function v(c){var e,f,h,j,n,o;e=g(b,c);f=g(b,c+C);h=g(b,c+B);j=m(b,c+L);n=g(b,c+E);o=g(b,c+V);c=g(b,c+H);THREE.BinaryLoader.prototype.f3n(y,I,e,f,h,j,n,o,c)}function t(c){var e,f,h,j;e=g(b,c);f=g(b,c+S);h=g(b,c+K);j=g(b,c+Q);c=m(b,c+n);THREE.BinaryLoader.prototype.f4(y,e,f,h,j,c)}function x(c){var e,f,h,j,o,p,t,u;e=g(b,c);f=g(b,c+S);h=g(b,c+K);j=g(b,c+Q);o=m(b, -c+n);p=g(b,c+T);t=g(b,c+X);u=g(b,c+M);c=g(b,c+W);THREE.BinaryLoader.prototype.f4n(y,I,e,f,h,j,o,p,t,u,c)}function w(c){var e,f;e=g(b,c);f=g(b,c+ha);c=g(b,c+ca);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],J[e*2],J[e*2+1],J[f*2],J[f*2+1],J[c*2],J[c*2+1])}function A(c){var e,f,h;e=g(b,c);f=g(b,c+fa);h=g(b,c+ga);c=g(b,c+$);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],J[e*2],J[e*2+1],J[f*2],J[f*2+1],J[h*2],J[h*2+1],J[c*2],J[c*2+1])}var y=this,G=0,D,I=[],J=[],C,B,L,E,V,H,S,K,Q,n,T,X,M,W, -ha,ca,fa,ga,$,Y,P,ea,Z,da,ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);D={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, -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+=D.header_bytes;C=D.vertex_index_bytes;B=D.vertex_index_bytes*2;L=D.vertex_index_bytes*3;E=D.vertex_index_bytes*3+D.material_index_bytes;V=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;H=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;S=D.vertex_index_bytes;K=D.vertex_index_bytes*2;Q=D.vertex_index_bytes*3;n=D.vertex_index_bytes*4;T=D.vertex_index_bytes* -4+D.material_index_bytes;X=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;M=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;W=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ha=D.uv_index_bytes;ca=D.uv_index_bytes*2;fa=D.uv_index_bytes;ga=D.uv_index_bytes*2;$=D.uv_index_bytes*3;c=D.vertex_index_bytes*3+D.material_index_bytes;ia=D.vertex_index_bytes*4+D.material_index_bytes;Y=D.ntri_flat*c;P=D.ntri_smooth*(c+D.normal_index_bytes*3);ea=D.ntri_flat_uv* -(c+D.uv_index_bytes*3);Z=D.ntri_smooth_uv*(c+D.normal_index_bytes*3+D.uv_index_bytes*3);da=D.nquad_flat*ia;c=D.nquad_smooth*(ia+D.normal_index_bytes*4);ia=D.nquad_flat_uv*(ia+D.uv_index_bytes*4);G+=function(c){for(var f,g,j,k=D.vertex_coordinate_bytes*3,m=c+D.nvertices*k;c>7)-127;f|=(j&127)<<16|h<<8;if(f==0&&m==-127)return 0;return(1-2*(k>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,m)}function h(b,c){var e=t(b,c),f=t(b,c+1),j=t(b,c+2);return(t(b,c+3)<<24)+(j<<16)+(f<<8)+e}function o(b,c){var e=t(b,c);return(t(b,c+1)<<8)+e}function p(b,c){var e=t(b,c);return e>127?e-256:e}function t(b, +c){return b.charCodeAt(c)&255}function v(c){var e,f,j;e=h(b,c);f=h(b,c+M);j=h(b,c+C);c=o(b,c+J);THREE.BinaryLoader.prototype.f3(z,e,f,j,c)}function w(c){var e,f,j,k,n,p;e=h(b,c);f=h(b,c+M);j=h(b,c+C);k=o(b,c+J);n=h(b,c+E);p=h(b,c+Y);c=h(b,c+F);THREE.BinaryLoader.prototype.f3n(z,I,e,f,j,k,n,p,c)}function u(c){var e,f,j,k;e=h(b,c);f=h(b,c+L);j=h(b,c+N);k=h(b,c+P);c=o(b,c+n);THREE.BinaryLoader.prototype.f4(z,e,f,j,k,c)}function y(c){var e,f,j,k,p,t,u,v;e=h(b,c);f=h(b,c+L);j=h(b,c+N);k=h(b,c+P);p=o(b, +c+n);t=h(b,c+V);u=h(b,c+ha);v=h(b,c+R);c=h(b,c+aa);THREE.BinaryLoader.prototype.f4n(z,I,e,f,j,k,p,t,u,v,c)}function x(c){var e,f;e=h(b,c);f=h(b,c+Z);c=h(b,c+ia);THREE.BinaryLoader.prototype.uv3(z.faceVertexUvs[0],K[e*2],K[e*2+1],K[f*2],K[f*2+1],K[c*2],K[c*2+1])}function B(c){var e,f,j;e=h(b,c);f=h(b,c+U);j=h(b,c+ea);c=h(b,c+ga);THREE.BinaryLoader.prototype.uv4(z.faceVertexUvs[0],K[e*2],K[e*2+1],K[f*2],K[f*2+1],K[j*2],K[j*2+1],K[c*2],K[c*2+1])}var z=this,H=0,D,I=[],K=[],M,C,J,E,Y,F,L,N,P,n,V,ha,R, +aa,Z,ia,U,ea,ga,$,S,W,da,fa,la;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,f,c);D={signature:b.substr(H,8),header_bytes:t(b,H+8),vertex_coordinate_bytes:t(b,H+9),normal_coordinate_bytes:t(b,H+10),uv_coordinate_bytes:t(b,H+11),vertex_index_bytes:t(b,H+12),normal_index_bytes:t(b,H+13),uv_index_bytes:t(b,H+14),material_index_bytes:t(b,H+15),nvertices:h(b,H+16),nnormals:h(b,H+16+4),nuvs:h(b,H+16+8),ntri_flat:h(b,H+16+12),ntri_smooth:h(b,H+16+16),ntri_flat_uv:h(b,H+16+20),ntri_smooth_uv:h(b, +H+16+24),nquad_flat:h(b,H+16+28),nquad_smooth:h(b,H+16+32),nquad_flat_uv:h(b,H+16+36),nquad_smooth_uv:h(b,H+16+40)};H+=D.header_bytes;M=D.vertex_index_bytes;C=D.vertex_index_bytes*2;J=D.vertex_index_bytes*3;E=D.vertex_index_bytes*3+D.material_index_bytes;Y=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;F=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;L=D.vertex_index_bytes;N=D.vertex_index_bytes*2;P=D.vertex_index_bytes*3;n=D.vertex_index_bytes*4;V=D.vertex_index_bytes* +4+D.material_index_bytes;ha=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;R=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;aa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;Z=D.uv_index_bytes;ia=D.uv_index_bytes*2;U=D.uv_index_bytes;ea=D.uv_index_bytes*2;ga=D.uv_index_bytes*3;c=D.vertex_index_bytes*3+D.material_index_bytes;la=D.vertex_index_bytes*4+D.material_index_bytes;$=D.ntri_flat*c;S=D.ntri_smooth*(c+D.normal_index_bytes*3);W=D.ntri_flat_uv* +(c+D.uv_index_bytes*3);da=D.ntri_smooth_uv*(c+D.normal_index_bytes*3+D.uv_index_bytes*3);fa=D.nquad_flat*la;c=D.nquad_smooth*(la+D.normal_index_bytes*4);la=D.nquad_flat_uv*(la+D.uv_index_bytes*4);H+=function(c){for(var f,h,k,m=D.vertex_coordinate_bytes*3,n=c+D.nvertices*m;c1&&(V=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,V);object.name=t;object.position.set(D[0],D[1],D[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;M.scene.addObject(object);M.objects[t]=object;G.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),M.scene.collisions.colliders.push(b)); -if(G.castsShadow)b=new THREE.ShadowVolume(C),M.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},M.triggers[object.name]=b)}}else D=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(D[0],D[1],D[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,M.scene.addObject(object),M.objects[t]=object,M.empties[t]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},M.triggers[object.name]=b)}function m(b){return function(c){M.geometries[b]=c;k();Q-=1;e.onLoadComplete();p()}}function o(b){return function(c){M.geometries[b]=c}}function p(){e.callbackProgress({totalModels:T,totalTextures:X,loadedModels:T-Q,loadedTextures:X-n},M);e.onLoadProgress();Q==0&&n==0&&c(M)}var u, -v,t,x,w,A,y,G,D,I,J,C,B,L,E,V,H,S,K,Q,n,T,X,M;S=b.data;E=new THREE.BinaryLoader;K=new THREE.JSONLoader;n=Q=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(t in S.objects)if(G=S.objects[t],G.meshCollider){b=!0;break}if(b)M.scene.collisions=new THREE.CollisionSystem;if(S.transform){b=S.transform.position;I=S.transform.rotation;var W=S.transform.scale;b&&M.scene.position.set(b[0],b[1],b[2]);I&&M.scene.rotation.set(I[0], -I[1],I[2]);W&&M.scene.scale.set(W[0],W[1],W[2]);(b||I||W)&&M.scene.updateMatrix()}b=function(){n-=1;p();e.onLoadComplete()};for(w in S.cameras){I=S.cameras[w];if(I.type=="perspective")B=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")B=new THREE.Camera,B.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);D=I.position;I=I.target;B.position.set(D[0],D[1],D[2]);B.target.position.set(I[0],I[1],I[2]);M.cameras[w]=B}for(x in S.lights)w=S.lights[x], -B=w.color!==void 0?w.color:16777215,I=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(D=w.direction,H=new THREE.DirectionalLight(B,I),H.position.set(D[0],D[1],D[2]),H.position.normalize()):w.type=="point"?(D=w.position,d=w.distance,H=new THREE.PointLight(B,I,d),H.position.set(D[0],D[1],D[2])):w.type=="ambient"&&(H=new THREE.AmbientLight(B)),M.scene.addLight(H),M.lights[x]=H;for(A in S.fogs)x=S.fogs[A],x.type=="linear"?L=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(L=new THREE.FogExp2(0, -x.density)),I=x.color,L.color.setRGB(I[0],I[1],I[2]),M.fogs[A]=L;if(M.cameras&&S.defaults.camera)M.currentCamera=M.cameras[S.defaults.camera];if(M.fogs&&S.defaults.fog)M.scene.fog=M.fogs[S.defaults.fog];I=S.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(I[0],I[1],I[2]);M.bgColorAlpha=S.defaults.bgalpha;for(u in S.geometries)if(A=S.geometries[u],A.type=="bin_mesh"||A.type=="ascii_mesh")Q+=1,e.onLoadStart();T=Q;for(u in S.geometries)A=S.geometries[u],A.type=="cube"?(C=new THREE.CubeGeometry(A.width, -A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),M.geometries[u]=C):A.type=="plane"?(C=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),M.geometries[u]=C):A.type=="sphere"?(C=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),M.geometries[u]=C):A.type=="cylinder"?(C=new THREE.CylinderGeometry(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset),M.geometries[u]=C):A.type=="torus"?(C=new THREE.TorusGeometry(A.radius, -A.tube,A.segmentsR,A.segmentsT),M.geometries[u]=C):A.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(A.subdivisions),M.geometries[u]=C):A.type=="bin_mesh"?E.load({model:f(A.url,S.urlBaseType),callback:m(u)}):A.type=="ascii_mesh"?K.load({model:f(A.url,S.urlBaseType),callback:m(u)}):A.type=="embedded_mesh"&&(A=S.embeds[A.id])&&K.createModel(A,o(u),"");for(y in S.textures)if(u=S.textures[y],u.url instanceof Array){n+=u.url.length;for(E=0;E1&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,Y);object.name=u;object.position.set(D[0],D[1],D[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=H.visible;R.scene.addObject(object);R.objects[u]=object;H.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),R.scene.collisions.colliders.push(b)); +if(H.castsShadow)b=new THREE.ShadowVolume(M),R.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},R.triggers[object.name]=b)}}else D=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(D[0],D[1],D[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=H.visible!==void 0?H.visible:!1,R.scene.addObject(object),R.objects[u]=object,R.empties[u]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},R.triggers[object.name]=b)}function o(b){return function(c){R.geometries[b]=c;m();P-=1;e.onLoadComplete();t()}}function p(b){return function(c){R.geometries[b]=c}}function t(){e.callbackProgress({totalModels:V,totalTextures:ha,loadedModels:V-P,loadedTextures:ha-n},R);e.onLoadProgress();P==0&&n==0&&c(R)} +var v,w,u,y,x,B,z,H,D,I,K,M,C,J,E,Y,F,L,N,P,n,V,ha,R;L=b.data;E=new THREE.BinaryLoader;N=new THREE.JSONLoader;n=P=0;R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in L.objects)if(H=L.objects[u],H.meshCollider){b=!0;break}if(b)R.scene.collisions=new THREE.CollisionSystem;if(L.transform){b=L.transform.position;I=L.transform.rotation;var aa=L.transform.scale;b&&R.scene.position.set(b[0],b[1],b[2]);I&&R.scene.rotation.set(I[0], +I[1],I[2]);aa&&R.scene.scale.set(aa[0],aa[1],aa[2]);(b||I||aa)&&R.scene.updateMatrix()}b=function(){n-=1;t();e.onLoadComplete()};for(x in L.cameras){I=L.cameras[x];if(I.type=="perspective")C=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")C=new THREE.Camera,C.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);D=I.position;I=I.target;C.position.set(D[0],D[1],D[2]);C.target.position.set(I[0],I[1],I[2]);R.cameras[x]=C}for(y in L.lights)x=L.lights[y], +C=x.color!==void 0?x.color:16777215,I=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(D=x.direction,F=new THREE.DirectionalLight(C,I),F.position.set(D[0],D[1],D[2]),F.position.normalize()):x.type=="point"?(D=x.position,d=x.distance,F=new THREE.PointLight(C,I,d),F.position.set(D[0],D[1],D[2])):x.type=="ambient"&&(F=new THREE.AmbientLight(C)),R.scene.addLight(F),R.lights[y]=F;for(B in L.fogs)y=L.fogs[B],y.type=="linear"?J=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(J=new THREE.FogExp2(0, +y.density)),I=y.color,J.color.setRGB(I[0],I[1],I[2]),R.fogs[B]=J;if(R.cameras&&L.defaults.camera)R.currentCamera=R.cameras[L.defaults.camera];if(R.fogs&&L.defaults.fog)R.scene.fog=R.fogs[L.defaults.fog];I=L.defaults.bgcolor;R.bgColor=new THREE.Color;R.bgColor.setRGB(I[0],I[1],I[2]);R.bgColorAlpha=L.defaults.bgalpha;for(v in L.geometries)if(B=L.geometries[v],B.type=="bin_mesh"||B.type=="ascii_mesh")P+=1,e.onLoadStart();V=P;for(v in L.geometries)B=L.geometries[v],B.type=="cube"?(M=new THREE.CubeGeometry(B.width, +B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),R.geometries[v]=M):B.type=="plane"?(M=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),R.geometries[v]=M):B.type=="sphere"?(M=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),R.geometries[v]=M):B.type=="cylinder"?(M=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),R.geometries[v]=M):B.type=="torus"?(M=new THREE.TorusGeometry(B.radius, +B.tube,B.segmentsR,B.segmentsT),R.geometries[v]=M):B.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(B.subdivisions),R.geometries[v]=M):B.type=="bin_mesh"?E.load({model:f(B.url,L.urlBaseType),callback:o(v)}):B.type=="ascii_mesh"?N.load({model:f(B.url,L.urlBaseType),callback:o(v)}):B.type=="embedded_mesh"&&(B=L.embeds[B.id])&&N.createModel(B,p(v),"");for(z in L.textures)if(v=L.textures[z],v.url instanceof Array){n+=v.url.length;for(E=0;E=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,g=0;g<8;g++){for(var j=0,h=0;h>1^-(k&1);e[8*h+g]=j}f+=c}c=b.length-f;j=new Uint16Array(c);for(g=h=0;g=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,j=0;j>1^-(m&1);e[8*j+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=j=0;h=this.maxCount-3&&k(this)};this.begin=function(){this.count=0; -this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(m=this.size-1);var v=Math.floor(o-k);v<1&&(v=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var t=Math.floor(p-k);t<1&&(t=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size- -1);for(var x,w,A,y,G,D;u0&&(this.field[A+x]+=y)}}};this.addPlaneX=function(b,c){var g,j,h,k,m,o=this.size,p=this.yd,u=this.zd,v=this.field,t=o*Math.sqrt(b/c);t>o&&(t=o);for(g=0;g0)for(j=0;jp&&(x=p);for(j=0;j0){m=j*u;for(g=0;gsize&&(dist=size);for(h=0;h0){m=zd*h;for(j=0;j=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&&(o=this.size-1);var w=Math.floor(p-m);w<1&&(w=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var u=Math.floor(t-m);u<1&&(u=1);m=Math.floor(t+m);m>this.size-1&&(m=this.size- +1);for(var y,x,B,z,H,D;v0&&(this.field[B+y]+=z)}}};this.addPlaneX=function(b,c){var h,k,j,m,o,p=this.size,t=this.yd,v=this.zd,w=this.field,u=p*Math.sqrt(b/c);u>p&&(u=p);for(h=0;h0)for(k=0;kt&&(y=t);for(k=0;k0){o=k*v;for(h=0;hsize&&(dist=size);for(j=0;j0){o=zd*j;for(k=0;kj?this.hits.push(g):this.hits.unshift(g),j=f;return this.hits}; +THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,h,k=0;c=0;for(e=this.colliders.length;ck?this.hits.push(h):this.hits.unshift(h),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,j=0;j=k*g))return Number.MAX_VALUE;h/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(h);k.addSelf(b.origin);Math.abs(j.x)> -Math.abs(j.y)?Math.abs(j.x)>Math.abs(j.z)?(b=k.y-c.y,j=e.y-c.y,g=f.y-c.y,k=k.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=k.x-c.x,j=e.x-c.x,g=f.x-c.x,k=k.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(j.y)>Math.abs(j.z)?(b=k.x-c.x,j=e.x-c.x,g=f.x-c.x,k=k.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=k.x-c.x,j=e.x-c.x,g=f.x-c.x,k=k.y-c.y,e=e.y-c.y,f=f.y-c.y);c=j*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-k*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=j*k-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h}; +THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,k=0;k=m*h))return Number.MAX_VALUE;j/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(j);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,h=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,h=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,h=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,h=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=k*f-e*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*h)*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 j}; 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,j=0,h=0,k=0,m=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,k=1);e.origin.zc.max.z&&(j=c.max.z-e.origin.z,j/=e.direction.z,o=!1,m=1);if(o)return-1;o=0;g>f&&(o=1,f=g);j>f&&(o=2,f=j);switch(o){case 0:k=e.origin.y+e.direction.y*f;if(kc.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,k,0);break;case 2:h=e.origin.x+e.direction.x*f;if(hc.max.x)return Number.MAX_VALUE;k=e.origin.y+e.direction.y*f;if(kc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,m)}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.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,h=0,k=0,j=0,m=0,o=0,p=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,j=1);e.origin.yc.max.y&&(h=c.max.y-e.origin.y,h/=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,o=1);if(p)return-1;p=0;h>f&&(p=1,f=h);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(j,0,0);break;case 1:j=e.origin.x+e.direction.x*f;if(jc.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:j=e.origin.x+e.direction.x*f;if(jc.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,o)}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,j=new THREE.Camera,h=new THREE.Matrix4,k=new THREE.Matrix4,m,o,p;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),t=new THREE.Camera(53,1,1,1E4);t.position.z= -2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},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 x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(m!==e.aspect||o!==e.near||p!==e.fov){m=e.aspect;o=e.near;p=e.fov;var y=e.projectionMatrix.clone(),G=125/30*0.5,D=G*o/125,I=o*Math.tan(p*Math.PI/360),J;h.n14=G;k.n14=-G;G=-I*m+D;J=I*m+D;y.n11=2*o/(J-G);y.n13=(J+G)/(J-G);g.projectionMatrix=y.clone();G=-I*m-D;J=I*m-D;y.n11=2*o/(J-G); -y.n13=(J+G)/(J-G);j.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(e.position);g.near=o;g.far=e.far;f.call(c,b,g,u,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=o;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,x,t)}}; -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,j,h=new THREE.Camera,k=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;j=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);k.projectionMatrix=h.projectionMatrix;k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,h);this.setViewport(g,0,g,j);f.call(c,b,k,!1)}}; +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,k=new THREE.Camera,j=new THREE.Matrix4,m=new THREE.Matrix4,o,p,t;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},v=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z= +2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:v},mapRight:{type:"t",value:1,texture:w}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); +var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);v.width=b;v.height=f;w.width=b;w.height=f};this.render=function(b,e){e.update(null,!0);if(o!==e.aspect||p!==e.near||t!==e.fov){o=e.aspect;p=e.near;t=e.fov;var z=e.projectionMatrix.clone(),H=125/30*0.5,D=H*p/125,I=p*Math.tan(t*Math.PI/360),K;j.n14=H;m.n14=-H;H=-I*o+D;K=I*o+D;z.n11=2*p/(K-H);z.n13=(K+H)/(K-H);h.projectionMatrix=z.clone();H=-I*o-D;K=I*o-D;z.n11=2*p/(K-H); +z.n13=(K+H)/(K-H);k.projectionMatrix=z.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(m);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,v,!0);k.matrix=e.matrixWorld.clone().multiplySelf(j);k.update(null,!0);k.position.copy(e.position);k.near=p;k.far=e.far;f.call(c,b,k,w,!0);f.call(c,y,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,h,k,j=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;k=f};this.render=function(b,e){this.clear();j.fov=e.fov;j.aspect=0.5*e.aspect;j.near=e.near;j.far=e.far; +j.updateProjectionMatrix();j.position.copy(e.position);j.target.position.copy(e.target.position);j.translateX(c.separation);m.projectionMatrix=j.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,h,k);f.call(c,b,j);this.setViewport(h,0,h,k);f.call(c,b,m,!1)}}; diff --git a/build/custom/ThreeCanvas.js b/build/custom/ThreeCanvas.js index 97362a6b2f1ed8135a873431e5555e546ea341d5..ac269d7fd28d46523d21e27f27a18417996ca0f4 100644 --- a/build/custom/ThreeCanvas.js +++ b/build/custom/ThreeCanvas.js @@ -16,62 +16,62 @@ a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;thi normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b0&&a>0&&f+a<1}if(a instanceof THREE.Particle){var d=b(this.origin,this.direction,a.matrixWorld.getPosition());if(d==null||d>a.scale.x)return[];return[{distance:d,point:a.position,face:null,object:a}]}else if(a instanceof THREE.Mesh){d=b(this.origin,this.direction,a.matrixWorld.getPosition());if(d==null||d>a.geometry.boundingSphere.radius*Math.max(a.scale.x, -Math.max(a.scale.y,a.scale.z)))return[];var e,g,f,h,i,l,n,j,m,k,p=a.geometry,q=p.vertices,u=[],d=0;for(e=p.faces.length;d0:j<0)))if(j=n.dot((new THREE.Vector3).sub(f,m))/j,m=m.addSelf(k.multiplyScalar(j)),g instanceof THREE.Face3)c(m,f,h,i)&&(g={distance:this.origin.distanceTo(m),point:m,face:g,object:a},u.push(g));else if(g instanceof THREE.Face4&&(c(m,f,h,l)||c(m,h,i,l)))g={distance:this.origin.distanceTo(m),point:m,face:g,object:a},u.push(g);u.sort(function(a,b){return a.distance-b.distance});return u}else return[]}}; -THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,n,j){h=!1;b=f;c=g;d=n;e=j;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=bf?d:f,e=e>g?e:g);a()};this.add3Points= -function(f,g,n,j,m,k){h?(h=!1,b=fn?f>m?f:m:n>m?n:m,e=g>j?g>k?g:k:j>k?j:k):(b=fn?f>m?f>d?f:d:m>d?m:d:n>m?n>d?n:d:m>d?m:d,e=g>j?g>k?g>e?g:e:k>e?k:e:j>k?j>e?j:e:k>e?k:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=bf.getRight()?d:f.getRight(),e=e> +Math.max(a.scale.y,a.scale.z)))return[];var e,g,f,h,j,l,o,i,m,k,p=a.geometry,r=p.vertices,u=[],d=0;for(e=p.faces.length;d0:i<0)))if(i=o.dot((new THREE.Vector3).sub(f,m))/i,m=m.addSelf(k.multiplyScalar(i)),g instanceof THREE.Face3)c(m,f,h,j)&&(g={distance:this.origin.distanceTo(m),point:m,face:g,object:a},u.push(g));else if(g instanceof THREE.Face4&&(c(m,f,h,l)||c(m,h,j,l)))g={distance:this.origin.distanceTo(m),point:m,face:g,object:a},u.push(g);u.sort(function(a,b){return a.distance-b.distance});return u}else return[]}}; +THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,o,i){h=!1;b=f;c=g;d=o;e=i;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=bf?d:f,e=e>g?e:g);a()};this.add3Points= +function(f,g,o,i,m,k){h?(h=!1,b=fo?f>m?f:m:o>m?o:m,e=g>i?g>k?g:k:i>k?i:k):(b=fo?f>m?f>d?f:d:m>d?m:d:o>m?o>d?o:d:m>d?m:d,e=g>i?g>k?g>e?g:e:k>e?k:e:i>k?i>e?i:e:k>e?k:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=bf.getRight()?d:f.getRight(),e=e> f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,l,n,j,m,k,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,i||0,l||0,n||1,j||0,m||0,k||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,l,n,j,m,k,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=n;this.n34=j;this.n41=m;this.n42=k;this.n43=p;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a, +THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,j,l,o,i,m,k,p,r){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,j||0,l||0,o||1,i||0,m||0,k||0,p||0,r||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,j,l,o,i,m,k,p,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=j;this.n32=l;this.n33=o;this.n34=i;this.n41=m;this.n42=k;this.n43=p;this.n44=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a, b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e; a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+ -c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,n=a.n31,j=a.n32,m=a.n33,k=a.n34,p=a.n41,q=a.n42,u=a.n43,s=a.n44,O=b.n11,P=b.n12, -y=b.n13,B=b.n14,o=b.n21,t=b.n22,r=b.n23,x=b.n24,E=b.n31,Z=b.n32,$=b.n33,I=b.n34,D=b.n41,J=b.n42,M=b.n43,F=b.n44;this.n11=c*O+d*o+e*E+g*D;this.n12=c*P+d*t+e*Z+g*J;this.n13=c*y+d*r+e*$+g*M;this.n14=c*B+d*x+e*I+g*F;this.n21=f*O+h*o+i*E+l*D;this.n22=f*P+h*t+i*Z+l*J;this.n23=f*y+h*r+i*$+l*M;this.n24=f*B+h*x+i*I+l*F;this.n31=n*O+j*o+m*E+k*D;this.n32=n*P+j*t+m*Z+k*J;this.n33=n*y+j*r+m*$+k*M;this.n34=n*B+j*x+m*I+k*F;this.n41=p*O+q*o+u*E+s*D;this.n42=p*P+q*t+u*Z+s*J;this.n43=p*y+q*r+u*$+s*M;this.n44=p*B+q* -x+u*I+s*F;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*= -a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,n=this.n33,j=this.n34,m=this.n41,k=this.n42,p=this.n43,q=this.n44;return d*f*l*m-c*h*l*m-d*g*n*m+b*h*n*m+c*g*j*m-b*f*j*m-d*f*i*k+c*h*i*k+d*e*n*k-a*h*n*k-c*e*j*k+a*f*j*k+d*g*i*p-b*h*i*p-d*e*l*p+a*h*l*p+b*e*j*p-a*g*j*p-c*g*i*q+b*f*i*q+c*e*l*q-a*f*l*q-b*e*n*q+a*g*n*q}, +c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,j=a.n23,l=a.n24,o=a.n31,i=a.n32,m=a.n33,k=a.n34,p=a.n41,r=a.n42,u=a.n43,s=a.n44,L=b.n11,P=b.n12, +C=b.n13,M=b.n14,y=b.n21,q=b.n22,n=b.n23,z=b.n24,A=b.n31,R=b.n32,S=b.n33,F=b.n34,J=b.n41,H=b.n42,I=b.n43,N=b.n44;this.n11=c*L+d*y+e*A+g*J;this.n12=c*P+d*q+e*R+g*H;this.n13=c*C+d*n+e*S+g*I;this.n14=c*M+d*z+e*F+g*N;this.n21=f*L+h*y+j*A+l*J;this.n22=f*P+h*q+j*R+l*H;this.n23=f*C+h*n+j*S+l*I;this.n24=f*M+h*z+j*F+l*N;this.n31=o*L+i*y+m*A+k*J;this.n32=o*P+i*q+m*R+k*H;this.n33=o*C+i*n+m*S+k*I;this.n34=o*M+i*z+m*F+k*N;this.n41=p*L+r*y+u*A+s*J;this.n42=p*P+r*q+u*R+s*H;this.n43=p*C+r*n+u*S+s*I;this.n44=p*M+r* +z+u*F+s*N;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*= +a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,j=this.n31,l=this.n32,o=this.n33,i=this.n34,m=this.n41,k=this.n42,p=this.n43,r=this.n44;return d*f*l*m-c*h*l*m-d*g*o*m+b*h*o*m+c*g*i*m-b*f*i*m-d*f*j*k+c*h*j*k+d*e*o*k-a*h*o*k-c*e*i*k+a*f*i*k+d*g*j*p-b*h*j*p-d*e*l*p+a*h*l*p+b*e*i*p-a*g*i*p-c*g*j*r+b*f*j*r+c*e*l*r-a*f*l*r-b*e*o*r+a*g*o*r}, transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34; a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11; a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34; a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0, -0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,l=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+c,l*h-d*g,0,i*h-d*f,l*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i= -f*h,l=f*e,n=d*h,j=d*e;this.n11=i+j*c;this.n12=n*c-l;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=l*c-n;this.n32=j+i*c;this.n33=g*f;break;case "ZXY":i=f*h;l=f*e;n=d*h;j=d*e;this.n11=i-j*c;this.n12=-g*e;this.n13=n+l*c;this.n21=l+n*c;this.n22=g*h;this.n23=j-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=g*h;l=g*e;n=c*h;j=c*e;this.n11=f*h;this.n12=n*d-l;this.n13=i*d+j;this.n21=f*e;this.n22=j*d+i;this.n23=l*d-n;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;l= -g*d;n=c*f;j=c*d;this.n11=f*h;this.n12=j-i*e;this.n13=n*e+l;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+n;this.n33=i-j*e;break;case "XZY":i=g*f;l=g*d;n=c*f;j=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=i*e+j;this.n22=g*h;this.n23=l*e-n;this.n31=n*e-l;this.n32=c*h;this.n33=j*e+i;break;default:i=g*h,l=g*e,n=c*h,j=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=l+n*d,this.n22=i-j*d,this.n23=-c*f,this.n31=j-i*d,this.n32=n+l*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b= -a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f;b*=h;var l=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(l+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2; +0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,j=e*g,l=e*f;this.set(j*g+c,j*f-d*h,j*h+d*f,0,j*f+d*h,l*f+c,l*h-d*g,0,j*h-d*f,l*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},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(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var j= +f*h,l=f*e,o=d*h,i=d*e;this.n11=j+i*c;this.n12=o*c-l;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=l*c-o;this.n32=i+j*c;this.n33=g*f;break;case "ZXY":j=f*h;l=f*e;o=d*h;i=d*e;this.n11=j-i*c;this.n12=-g*e;this.n13=o+l*c;this.n21=l+o*c;this.n22=g*h;this.n23=i-j*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":j=g*h;l=g*e;o=c*h;i=c*e;this.n11=f*h;this.n12=o*d-l;this.n13=j*d+i;this.n21=f*e;this.n22=i*d+j;this.n23=l*d-o;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":j=g*f;l= +g*d;o=c*f;i=c*d;this.n11=f*h;this.n12=i-j*e;this.n13=o*e+l;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+o;this.n33=j-i*e;break;case "XZY":j=g*f;l=g*d;o=c*f;i=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=j*e+i;this.n22=g*h;this.n23=l*e-o;this.n31=o*e-l;this.n32=c*h;this.n33=i*e+j;break;default:j=g*h,l=g*e,o=c*h,i=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=l+o*d,this.n22=j-i*d,this.n23=-c*f,this.n31=i-j*d,this.n32=o+l*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b= +a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,j=b*f;b*=h;var l=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(l+d);this.n12=j-e;this.n13=b+f;this.n21=j+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2; d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length(); c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23= a.n23*e;this.n33=a.n33*e}}; -THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,n=a.n31,j=a.n32,m=a.n33,k=a.n34,p=a.n41,q=a.n42,u=a.n43,s=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=i*k*q-l*m*q+l*j*u-h*k*u-i*j*s+h*m*s;b.n12=g*m*q-e*k*q-g*j*u+d*k*u+e*j*s-d*m*s;b.n13=e*l*q-g*i*q+g*h*u-d*l*u-e*h*s+d*i*s;b.n14=g*i*j-e*l*j-g*h*m+d*l*m+e*h*k-d*i*k;b.n21=l*m*p-i*k*p-l*n*u+f*k*u+i*n*s-f*m*s;b.n22=e*k*p-g*m*p+g*n*u-c*k*u-e*n*s+c*m*s;b.n23=g*i*p-e*l*p-g*f*u+c*l*u+e*f*s-c*i*s;b.n24= -e*l*n-g*i*n+g*f*m-c*l*m-e*f*k+c*i*k;b.n31=h*k*p-l*j*p+l*n*q-f*k*q-h*n*s+f*j*s;b.n32=g*j*p-d*k*p-g*n*q+c*k*q+d*n*s-c*j*s;b.n33=e*l*p-g*h*p+g*f*q-c*l*q-d*f*s+c*h*s;b.n34=g*h*n-d*l*n-g*f*j+c*l*j+d*f*k-c*h*k;b.n41=i*j*p-h*m*p-i*n*q+f*m*q+h*n*u-f*j*u;b.n42=d*m*p-e*j*p+e*n*q-c*m*q-d*n*u+c*j*u;b.n43=e*h*p-d*i*p-e*f*q+c*i*q+d*f*u-c*h*u;b.n44=d*i*n-e*h*n+e*f*j-c*i*j-d*f*m+c*h*m;b.multiplyScalar(1/a.determinant());return b}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*l;c[7]=a*n;c[8]=a*j;return b}; +THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,j=a.n23,l=a.n24,o=a.n31,i=a.n32,m=a.n33,k=a.n34,p=a.n41,r=a.n42,u=a.n43,s=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*k*r-l*m*r+l*i*u-h*k*u-j*i*s+h*m*s;b.n12=g*m*r-e*k*r-g*i*u+d*k*u+e*i*s-d*m*s;b.n13=e*l*r-g*j*r+g*h*u-d*l*u-e*h*s+d*j*s;b.n14=g*j*i-e*l*i-g*h*m+d*l*m+e*h*k-d*j*k;b.n21=l*m*p-j*k*p-l*o*u+f*k*u+j*o*s-f*m*s;b.n22=e*k*p-g*m*p+g*o*u-c*k*u-e*o*s+c*m*s;b.n23=g*j*p-e*l*p-g*f*u+c*l*u+e*f*s-c*j*s;b.n24= +e*l*o-g*j*o+g*f*m-c*l*m-e*f*k+c*j*k;b.n31=h*k*p-l*i*p+l*o*r-f*k*r-h*o*s+f*i*s;b.n32=g*i*p-d*k*p-g*o*r+c*k*r+d*o*s-c*i*s;b.n33=e*l*p-g*h*p+g*f*r-c*l*r-d*f*s+c*h*s;b.n34=g*h*o-d*l*o-g*f*i+c*l*i+d*f*k-c*h*k;b.n41=j*i*p-h*m*p-j*o*r+f*m*r+h*o*u-f*i*u;b.n42=d*m*p-e*i*p+e*o*r-c*m*r-d*o*u+c*i*u;b.n43=e*h*p-d*j*p-e*f*r+c*j*r+d*f*u-c*h*u;b.n44=d*j*o-e*h*o+e*f*i-c*j*i-d*f*m+c*h*m;b.multiplyScalar(1/a.determinant());return b}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*j;c[6]=a*l;c[7]=a*o;c[8]=a*i;return b}; THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)}; -THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,i,l;f=new THREE.Matrix4;h=b-a;i=c-d;l=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((g+e)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; -THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion; -this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""}; +THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,j,l;f=new THREE.Matrix4;h=b-a;j=c-d;l=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/j;f.n23=0;f.n24=-((c+d)/j);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((g+e)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; +THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= +!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)=== -1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,j=this.w,l=j*c+f*e-h*d,o=j*d+h*c-g*e,i=j*e+g*d-f*c,c=-g* +c-f*d-h*e;b.x=l*j+c*-g+o*-h-i*-f;b.y=o*j+c*-f+i*-g-l*-h;b.z=i*j+c*-h+l*-f-o*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; -THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; +THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),dJ&&f.positionScreen.z0&&B.z<1))A=P[O]=P[O]||new THREE.RenderableParticle,O++,s=A,s.x=B.x/B.w,s.y=B.y/B.w,s.z=B.z,s.rotation=v.rotation.z,s.scale.x=v.scale.x*Math.abs(s.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14)),s.scale.y=v.scale.y*Math.abs(s.y-(B.y+ -e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24)),s.materials=v.materials,D.push(s);g&&D.sort(b);return D}}; -THREE.CanvasRenderer=function(a){function b(a){if(u!=a)k.globalAlpha=u=a}function c(a){if(s!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}s=a}}function d(a){if(O!=a)k.strokeStyle=O=a}function e(a){if(P!=a)k.fillStyle=P=a}var g=this,f=null,h=new THREE.Projector,a=a||{},i=a.canvas!==void 0?a.canvas:document.createElement("canvas"), -l,n,j,m,k=i.getContext("2d"),p=new THREE.Color(0),q=0,u=1,s=0,O=null,P=null,y=null,B=null,o=null,t,r,x,E,Z=new THREE.RenderableVertex,$=new THREE.RenderableVertex,I,D,J,M,F,K,G,Q,w,N,L,pa,C=new THREE.Color(0),v=new THREE.Color(0),A=new THREE.Color(0),H=new THREE.Color(0),S=new THREE.Color(0),la=[],V,ca,W,aa,Da,Ea,Fa,Ga,Ha,Ia,ja=new THREE.Rectangle,X=new THREE.Rectangle,U=new THREE.Rectangle,za=!1,ba=new THREE.Color,Y=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,R=new THREE.Vector3,qa,ra, -Aa,da,sa,va,a=16;qa=document.createElement("canvas");qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);Aa=ra.getImageData(0,0,2,2);da=Aa.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(a,b){l=a;n=b;j=Math.floor(l/2);m=Math.floor(n/2);i.width=l;i.height=n; -ja.set(-j,-m,j,m);X.set(-j,-m,j,m);u=1;s=0;o=B=y=P=O=null};this.setClearColor=function(a,b){p.copy(a);q=b;X.set(-j,-m,j,m)};this.setClearColorHex=function(a,b){p.setHex(a);q=b;X.set(-j,-m,j,m)};this.clear=function(){k.setTransform(1,0,0,-1,j,m);X.isEmpty()||(X.minSelf(ja),X.inflate(2),q<1&&k.clearRect(Math.floor(X.getX()),Math.floor(X.getY()),Math.floor(X.getWidth()),Math.floor(X.getHeight())),q>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b* -255)+","+q+")"),k.fillRect(Math.floor(X.getX()),Math.floor(X.getY()),Math.floor(X.getWidth()),Math.floor(X.getHeight()))),X.empty())};this.render=function(a,l){function i(a){var b,c,d,e=a.lights;Y.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);a=0;for(b=e.length;a>1,o=i.height>>1,g=f.scale.x*j,n=f.scale.y*m,h=g*Ba,l=n*o,U.set(a.x-h,a.y-l,a.x+h,a.y+l),ja.instersects(U)&&(k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(g,-n),k.translate(-Ba,-o),k.drawImage(i,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*j,l=f.scale.y*m,U.set(a.x-h,a.y-l,a.x+h,a.y+l),ja.instersects(U)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(h,l),g.program(k), -k.restore()))}function q(a,e,f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(y!=a)k.lineWidth=y=a;a=g.linecap;if(B!=a)k.lineCap=B=a;a=g.linejoin;if(o!=a)k.lineJoin=o=a;d(g.color.getContextStyle());k.stroke();U.inflate(g.linewidth*2)}}function s(a,d,e,f,h,k,j,i,m){g.data.vertices+=3;g.data.faces++;b(i.opacity);c(i.blending);I=a.positionScreen.x; -D=a.positionScreen.y;J=d.positionScreen.x;M=d.positionScreen.y;F=e.positionScreen.x;K=e.positionScreen.y;O(I,D,J,M,F,K);if(i instanceof THREE.MeshBasicMaterial)if(i.map)i.map.mapping instanceof THREE.UVMapping&&(aa=j.uvs[0],Ca(I,D,J,M,F,K,aa[f].u,aa[f].v,aa[h].u,aa[h].v,aa[k].u,aa[k].v,i.map));else if(i.envMap){if(i.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,R.copy(j.vertexNormalsWorld[0]),Da=(R.x*a.n11+R.y*a.n12+R.z*a.n13)*0.5+0.5,Ea=-(R.x*a.n21+R.y*a.n22+R.z* -a.n23)*0.5+0.5,R.copy(j.vertexNormalsWorld[1]),Fa=(R.x*a.n11+R.y*a.n12+R.z*a.n13)*0.5+0.5,Ga=-(R.x*a.n21+R.y*a.n22+R.z*a.n23)*0.5+0.5,R.copy(j.vertexNormalsWorld[2]),Ha=(R.x*a.n11+R.y*a.n12+R.z*a.n13)*0.5+0.5,Ia=-(R.x*a.n21+R.y*a.n22+R.z*a.n23)*0.5+0.5,Ca(I,D,J,M,F,K,Da,Ea,Fa,Ga,Ha,Ia,i.envMap)}else i.wireframe?fa(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color);else if(i instanceof THREE.MeshLambertMaterial)i.map&&!i.wireframe&&(i.map.mapping instanceof THREE.UVMapping&& -(aa=j.uvs[0],Ca(I,D,J,M,F,K,aa[f].u,aa[f].v,aa[h].u,aa[h].v,aa[k].u,aa[k].v,i.map)),c(THREE.SubtractiveBlending)),za?!i.wireframe&&i.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3?(v.r=A.r=H.r=Y.r,v.g=A.g=H.g=Y.g,v.b=A.b=H.b=Y.b,n(m,j.v1.positionWorld,j.vertexNormalsWorld[0],v),n(m,j.v2.positionWorld,j.vertexNormalsWorld[1],A),n(m,j.v3.positionWorld,j.vertexNormalsWorld[2],H),S.r=(A.r+H.r)*0.5,S.g=(A.g+H.g)*0.5,S.b=(A.b+H.b)*0.5,W=wa(v,A,H,S),ma(I,D,J,M,F,K,0,0,1,0,0,1,W)):(ba.r=Y.r, -ba.g=Y.g,ba.b=Y.b,n(m,j.centroidWorld,j.normalWorld,ba),C.r=Math.max(0,Math.min(i.color.r*ba.r,1)),C.g=Math.max(0,Math.min(i.color.g*ba.g,1)),C.b=Math.max(0,Math.min(i.color.b*ba.b,1)),i.wireframe?fa(C,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(C)):i.wireframe?fa(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color);else if(i instanceof THREE.MeshDepthMaterial)V=l.near,ca=l.far,v.r=v.g=v.b=1-ka(a.positionScreen.z,V,ca),A.r=A.g=A.b=1-ka(d.positionScreen.z, -V,ca),H.r=H.g=H.b=1-ka(e.positionScreen.z,V,ca),S.r=(A.r+H.r)*0.5,S.g=(A.g+H.g)*0.5,S.b=(A.b+H.b)*0.5,W=wa(v,A,H,S),ma(I,D,J,M,F,K,0,0,1,0,0,1,W);else if(i instanceof THREE.MeshNormalMaterial)C.r=na(j.normalWorld.x),C.g=na(j.normalWorld.y),C.b=na(j.normalWorld.z),i.wireframe?fa(C,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(C)}function u(a,d,e,f,h,i,j,k,m){g.data.vertices+=4;g.data.faces++;b(k.opacity);c(k.blending);if(k.map||k.envMap)s(a,d,f,0,1,3,j,k,m),s(h,e,i,1,2,3,j,k,m);else if(I= -a.positionScreen.x,D=a.positionScreen.y,J=d.positionScreen.x,M=d.positionScreen.y,F=e.positionScreen.x,K=e.positionScreen.y,G=f.positionScreen.x,Q=f.positionScreen.y,w=h.positionScreen.x,N=h.positionScreen.y,L=i.positionScreen.x,pa=i.positionScreen.y,k instanceof THREE.MeshBasicMaterial)P(I,D,J,M,F,K,G,Q),k.wireframe?fa(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(k.color);else if(k instanceof THREE.MeshLambertMaterial)za?!k.wireframe&&k.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length== -4?(v.r=A.r=H.r=S.r=Y.r,v.g=A.g=H.g=S.g=Y.g,v.b=A.b=H.b=S.b=Y.b,n(m,j.v1.positionWorld,j.vertexNormalsWorld[0],v),n(m,j.v2.positionWorld,j.vertexNormalsWorld[1],A),n(m,j.v4.positionWorld,j.vertexNormalsWorld[3],H),n(m,j.v3.positionWorld,j.vertexNormalsWorld[2],S),W=wa(v,A,H,S),O(I,D,J,M,G,Q),ma(I,D,J,M,G,Q,0,0,1,0,0,1,W),O(w,N,F,K,L,pa),ma(w,N,F,K,L,pa,1,0,1,1,0,1,W)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,n(m,j.centroidWorld,j.normalWorld,ba),C.r=Math.max(0,Math.min(k.color.r*ba.r,1)),C.g=Math.max(0,Math.min(k.color.g* -ba.g,1)),C.b=Math.max(0,Math.min(k.color.b*ba.b,1)),P(I,D,J,M,F,K,G,Q),k.wireframe?fa(C,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(C)):(P(I,D,J,M,F,K,G,Q),k.wireframe?fa(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(k.color));else if(k instanceof THREE.MeshNormalMaterial)C.r=na(j.normalWorld.x),C.g=na(j.normalWorld.y),C.b=na(j.normalWorld.z),P(I,D,J,M,F,K,G,Q),k.wireframe?fa(C,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ga(C);else if(k instanceof -THREE.MeshDepthMaterial)V=l.near,ca=l.far,v.r=v.g=v.b=1-ka(a.positionScreen.z,V,ca),A.r=A.g=A.b=1-ka(d.positionScreen.z,V,ca),H.r=H.g=H.b=1-ka(f.positionScreen.z,V,ca),S.r=S.g=S.b=1-ka(e.positionScreen.z,V,ca),W=wa(v,A,H,S),O(I,D,J,M,G,Q),ma(I,D,J,M,G,Q,0,0,1,0,0,1,W),O(w,N,F,K,L,pa),ma(w,N,F,K,L,pa,1,0,1,1,0,1,W)}function O(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function P(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e, -f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function fa(a,b,c,e){if(y!=b)k.lineWidth=y=b;if(B!=c)k.lineCap=B=c;if(o!=e)k.lineJoin=o=e;d(a.getContextStyle());k.stroke();U.inflate(b*2)}function ga(a){e(a.getContextStyle());k.fill()}function Ca(a,b,c,d,f,g,h,j,i,l,m,n,o){if(o.image.width!=0){if(o.needsUpdate==!0||la[o.id]==void 0){var p=o.wrapS==THREE.RepeatWrapping,q=o.wrapT==THREE.RepeatWrapping;la[o.id]=k.createPattern(o.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");o.needsUpdate= -!1}e(la[o.id]);var p=o.offset.x/o.repeat.x,q=o.offset.y/o.repeat.y,r=(o.image.width-1)*o.repeat.x,o=(o.image.height-1)*o.repeat.y,h=(h+p)*r,j=(j+q)*o,i=(i+p)*r,l=(l+q)*o,m=(m+p)*r,n=(n+q)*o;c-=a;d-=b;f-=a;g-=b;i-=h;l-=j;m-=h;n-=j;p=1/(i*n-m*l);o=(n*c-l*f)*p;l=(n*d-l*g)*p;c=(i*f-m*c)*p;d=(i*g-m*d)*p;a=a-o*h-c*j;b=b-l*h-d*j;k.save();k.transform(o,l,c,d,a,b);k.fill();k.restore()}}function ma(a,b,c,d,e,f,g,h,j,i,l,m,n){var o,p;o=n.width-1;p=n.height-1;g*=o;h*=p;j*=o;i*=p;l*=o;m*=p;c-=a;d-=b;e-=a;f-=b; -j-=g;i-=h;l-=g;m-=h;p=1/(j*m-l*i);o=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-l*c)*p;d=(j*f-l*d)*p;a=a-o*g-c*h;b=b-i*g-d*h;k.save();k.transform(o,i,c,d,a,b);k.clip();k.drawImage(n,0,0);k.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);da[0]=e<0?0:e>255?255:e;da[1]=f<0?0:f>255?255:f;da[2]=a<0?0:a>255?255:a;da[4]=g<0?0:g>255?255:g;da[5]=h<0?0:h>255?255:h; -da[6]=b<0?0:b>255?255:b;da[8]=i<0?0:i>255?255:i;da[9]=j<0?0:j>255?255:j;da[10]=c<0?0:c>255?255:c;da[12]=k<0?0:k>255?255:k;da[13]=l<0?0:l>255?255:l;da[14]=d<0?0:d>255?255:d;ra.putImageData(Aa,0,0);va.drawImage(qa,0,0);return sa}function ka(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ha(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ja,z,ea,ia,oa,ya,T;this.autoClear?this.clear():k.setTransform(1, -0,0,-1,j,m);g.data.vertices=0;g.data.faces=0;f=h.projectScene(a,l,this.sortElements);(za=a.lights.length>0)&&i(a);xa=0;for(Ja=f.length;xa=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),dI&&f.positionScreen.z0&&q.z<1))B=P[L]=P[L]||new THREE.RenderableParticle,L++,s=B,s.x=q.x/q.w,s.y=q.y/q.w,s.z=q.z,s.rotation=t.rotation.z,s.scale.x=t.scale.x*Math.abs(s.x-(q.x+e.projectionMatrix.n11)/(q.w+e.projectionMatrix.n14)),s.scale.y=t.scale.y*Math.abs(s.y-(q.y+ +e.projectionMatrix.n22)/(q.w+e.projectionMatrix.n24)),s.materials=t.materials,M.push(s);g&&M.sort(b);return M}}; +THREE.CanvasRenderer=function(a){function b(a){if(u!=a)k.globalAlpha=u=a}function c(a){if(s!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}s=a}}function d(a){if(L!=a)k.strokeStyle=L=a}function e(a){if(P!=a)k.fillStyle=P=a}var g=this,f=null,h=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"), +l,o,i,m,k=j.getContext("2d"),p=new THREE.Color(0),r=0,u=1,s=0,L=null,P=null,C=null,M=null,y=null,q,n,z,A,R=new THREE.RenderableVertex,S=new THREE.RenderableVertex,F,J,H,I,N,O,ea,E,pa,v,K,G,w=new THREE.Color(0),D=new THREE.Color(0),t=new THREE.Color(0),B=new THREE.Color(0),T=new THREE.Color(0),la=[],ca,X,$,U,Da,Ea,Fa,Ga,Ha,Ia,ja=new THREE.Rectangle,Y=new THREE.Rectangle,W=new THREE.Rectangle,za=!1,aa=new THREE.Color,Z=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,Q=new THREE.Vector3,qa,ra, +Aa,ba,sa,va,a=16;qa=document.createElement("canvas");qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);Aa=ra.getImageData(0,0,2,2);ba=Aa.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(a,b){l=a;o=b;i=Math.floor(l/2);m=Math.floor(o/2);j.width=l;j.height=o; +ja.set(-i,-m,i,m);Y.set(-i,-m,i,m);u=1;s=0;y=M=C=P=L=null};this.setClearColor=function(a,b){p.copy(a);r=b;Y.set(-i,-m,i,m)};this.setClearColorHex=function(a,b){p.setHex(a);r=b;Y.set(-i,-m,i,m)};this.clear=function(){k.setTransform(1,0,0,-1,i,m);Y.isEmpty()||(Y.minSelf(ja),Y.inflate(2),r<1&&k.clearRect(Math.floor(Y.getX()),Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight())),r>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b* +255)+","+r+")"),k.fillRect(Math.floor(Y.getX()),Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight()))),Y.empty())};this.render=function(a,l){function j(a){var b,c,d,e=a.lights;Z.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);a=0;for(b=e.length;a>1,n=o.height>>1,g=f.scale.x*i,j=f.scale.y*m,h=g*Ba,l=j*n,W.set(a.x-h,a.y-l,a.x+h,a.y+l),ja.instersects(W)&&(k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(g,-j),k.translate(-Ba,-n),k.drawImage(o,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*i,l=f.scale.y*m,W.set(a.x-h,a.y-l,a.x+h,a.y+l),ja.instersects(W)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-f.rotation),k.scale(h,l),g.program(k), +k.restore()))}function r(a,e,f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(C!=a)k.lineWidth=C=a;a=g.linecap;if(M!=a)k.lineCap=M=a;a=g.linejoin;if(y!=a)k.lineJoin=y=a;d(g.color.getContextStyle());k.stroke();W.inflate(g.linewidth*2)}}function s(a,d,e,f,h,k,i,j,m){g.data.vertices+=3;g.data.faces++;b(j.opacity);c(j.blending);F=a.positionScreen.x; +J=a.positionScreen.y;H=d.positionScreen.x;I=d.positionScreen.y;N=e.positionScreen.x;O=e.positionScreen.y;L(F,J,H,I,N,O);if(j instanceof THREE.MeshBasicMaterial)if(j.map)j.map.mapping instanceof THREE.UVMapping&&(U=i.uvs[0],Ca(F,J,H,I,N,O,U[f].u,U[f].v,U[h].u,U[h].v,U[k].u,U[k].v,j.map));else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,Q.copy(i.vertexNormalsWorld[0]),Da=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ea=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)* +0.5+0.5,Q.copy(i.vertexNormalsWorld[1]),Fa=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ga=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(i.vertexNormalsWorld[2]),Ha=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ia=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Ca(F,J,H,I,N,O,Da,Ea,Fa,Ga,Ha,Ia,j.envMap)}else j.wireframe?fa(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(j.color);else if(j instanceof THREE.MeshLambertMaterial)j.map&&!j.wireframe&&(j.map.mapping instanceof THREE.UVMapping&& +(U=i.uvs[0],Ca(F,J,H,I,N,O,U[f].u,U[f].v,U[h].u,U[h].v,U[k].u,U[k].v,j.map)),c(THREE.SubtractiveBlending)),za?!j.wireframe&&j.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(D.r=t.r=B.r=Z.r,D.g=t.g=B.g=Z.g,D.b=t.b=B.b=Z.b,o(m,i.v1.positionWorld,i.vertexNormalsWorld[0],D),o(m,i.v2.positionWorld,i.vertexNormalsWorld[1],t),o(m,i.v3.positionWorld,i.vertexNormalsWorld[2],B),T.r=(t.r+B.r)*0.5,T.g=(t.g+B.g)*0.5,T.b=(t.b+B.b)*0.5,$=wa(D,t,B,T),ma(F,J,H,I,N,O,0,0,1,0,0,1,$)):(aa.r=Z.r,aa.g=Z.g, +aa.b=Z.b,o(m,i.centroidWorld,i.normalWorld,aa),w.r=Math.max(0,Math.min(j.color.r*aa.r,1)),w.g=Math.max(0,Math.min(j.color.g*aa.g,1)),w.b=Math.max(0,Math.min(j.color.b*aa.b,1)),j.wireframe?fa(w,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(w)):j.wireframe?fa(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(j.color);else if(j instanceof THREE.MeshDepthMaterial)ca=l.near,X=l.far,D.r=D.g=D.b=1-ka(a.positionScreen.z,ca,X),t.r=t.g=t.b=1-ka(d.positionScreen.z,ca, +X),B.r=B.g=B.b=1-ka(e.positionScreen.z,ca,X),T.r=(t.r+B.r)*0.5,T.g=(t.g+B.g)*0.5,T.b=(t.b+B.b)*0.5,$=wa(D,t,B,T),ma(F,J,H,I,N,O,0,0,1,0,0,1,$);else if(j instanceof THREE.MeshNormalMaterial)w.r=na(i.normalWorld.x),w.g=na(i.normalWorld.y),w.b=na(i.normalWorld.z),j.wireframe?fa(w,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ga(w)}function u(a,d,e,f,h,j,k,i,m){g.data.vertices+=4;g.data.faces++;b(i.opacity);c(i.blending);if(i.map||i.envMap)s(a,d,f,0,1,3,k,i,m),s(h,e,j,1,2,3,k,i,m);else if(F= +a.positionScreen.x,J=a.positionScreen.y,H=d.positionScreen.x,I=d.positionScreen.y,N=e.positionScreen.x,O=e.positionScreen.y,ea=f.positionScreen.x,E=f.positionScreen.y,pa=h.positionScreen.x,v=h.positionScreen.y,K=j.positionScreen.x,G=j.positionScreen.y,i instanceof THREE.MeshBasicMaterial)P(F,J,H,I,N,O,ea,E),i.wireframe?fa(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color);else if(i instanceof THREE.MeshLambertMaterial)za?!i.wireframe&&i.shading==THREE.SmoothShading&& +k.vertexNormalsWorld.length==4?(D.r=t.r=B.r=T.r=Z.r,D.g=t.g=B.g=T.g=Z.g,D.b=t.b=B.b=T.b=Z.b,o(m,k.v1.positionWorld,k.vertexNormalsWorld[0],D),o(m,k.v2.positionWorld,k.vertexNormalsWorld[1],t),o(m,k.v4.positionWorld,k.vertexNormalsWorld[3],B),o(m,k.v3.positionWorld,k.vertexNormalsWorld[2],T),$=wa(D,t,B,T),L(F,J,H,I,ea,E),ma(F,J,H,I,ea,E,0,0,1,0,0,1,$),L(pa,v,N,O,K,G),ma(pa,v,N,O,K,G,1,0,1,1,0,1,$)):(aa.r=Z.r,aa.g=Z.g,aa.b=Z.b,o(m,k.centroidWorld,k.normalWorld,aa),w.r=Math.max(0,Math.min(i.color.r* +aa.r,1)),w.g=Math.max(0,Math.min(i.color.g*aa.g,1)),w.b=Math.max(0,Math.min(i.color.b*aa.b,1)),P(F,J,H,I,N,O,ea,E),i.wireframe?fa(w,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(w)):(P(F,J,H,I,N,O,ea,E),i.wireframe?fa(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ga(i.color));else if(i instanceof THREE.MeshNormalMaterial)w.r=na(k.normalWorld.x),w.g=na(k.normalWorld.y),w.b=na(k.normalWorld.z),P(F,J,H,I,N,O,ea,E),i.wireframe?fa(w,i.wireframeLinewidth,i.wireframeLinecap, +i.wireframeLinejoin):ga(w);else if(i instanceof THREE.MeshDepthMaterial)ca=l.near,X=l.far,D.r=D.g=D.b=1-ka(a.positionScreen.z,ca,X),t.r=t.g=t.b=1-ka(d.positionScreen.z,ca,X),B.r=B.g=B.b=1-ka(f.positionScreen.z,ca,X),T.r=T.g=T.b=1-ka(e.positionScreen.z,ca,X),$=wa(D,t,B,T),L(F,J,H,I,ea,E),ma(F,J,H,I,ea,E,0,0,1,0,0,1,$),L(pa,v,N,O,K,G),ma(pa,v,N,O,K,G,1,0,1,1,0,1,$)}function L(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function P(a,b,c,d,e,f,g,h){k.beginPath(); +k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function fa(a,b,c,e){if(C!=b)k.lineWidth=C=b;if(M!=c)k.lineCap=M=c;if(y!=e)k.lineJoin=y=e;d(a.getContextStyle());k.stroke();W.inflate(b*2)}function ga(a){e(a.getContextStyle());k.fill()}function Ca(a,b,c,d,f,g,h,i,j,l,m,o,n){if(n.image.width!=0){if(n.needsUpdate==!0||la[n.id]==void 0){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;la[n.id]=k.createPattern(n.image,p&&q?"repeat":p&&!q?"repeat-x": +!p&&q?"repeat-y":"no-repeat");n.needsUpdate=!1}e(la[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,r=(n.image.width-1)*n.repeat.x,n=(n.image.height-1)*n.repeat.y,h=(h+p)*r,i=(i+q)*n,j=(j+p)*r,l=(l+q)*n,m=(m+p)*r,o=(o+q)*n;c-=a;d-=b;f-=a;g-=b;j-=h;l-=i;m-=h;o-=i;p=1/(j*o-m*l);n=(o*c-l*f)*p;l=(o*d-l*g)*p;c=(j*f-m*c)*p;d=(j*g-m*d)*p;a=a-n*h-c*i;b=b-l*h-d*i;k.save();k.transform(n,l,c,d,a,b);k.fill();k.restore()}}function ma(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,p;o=n.width-1;p=n.height-1;g*=o; +h*=p;i*=o;j*=p;l*=o;m*=p;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;p=1/(i*m-l*j);o=(m*c-j*e)*p;j=(m*d-j*f)*p;c=(i*e-l*c)*p;d=(i*f-l*d)*p;a=a-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();k.drawImage(n,0,0);k.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ba[0]=e<0?0:e>255?255:e;ba[1]=f<0?0:f>255?255:f;ba[2]=a<0?0:a>255?255:a;ba[4]= +g<0?0:g>255?255:g;ba[5]=h<0?0:h>255?255:h;ba[6]=b<0?0:b>255?255:b;ba[8]=i<0?0:i>255?255:i;ba[9]=j<0?0:j>255?255:j;ba[10]=c<0?0:c>255?255:c;ba[12]=k<0?0:k>255?255:k;ba[13]=l<0?0:l>255?255:l;ba[14]=d<0?0:d>255?255:d;ra.putImageData(Aa,0,0);va.drawImage(qa,0,0);return sa}function ka(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ha(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ja,x,da,ia, +oa,ya,V;this.autoClear?this.clear():k.setTransform(1,0,0,-1,i,m);g.data.vertices=0;g.data.faces=0;f=h.projectScene(a,l,this.sortElements);(za=a.lights.length>0)&&j(a);xa=0;for(Ja=f.length;xa=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +c-f*d-h*e;b.x=i*j+c*-g+l*-h-k*-f;b.y=l*j+c*-f+k*-g-i*-h;b.z=k*j+c*-h+i*-f-l*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D; @@ -72,16 +72,16 @@ b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1 THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),dG&&f.positionScreen.z=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),dC&&f.positionScreen.z0&&v.z<1))L=M[J]=M[J]||new THREE.RenderableParticle,J++,r=L,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+ -e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,H.push(r);g&&H.sort(b);return H}}; +0)))P=n[m]=n[m]||new THREE.RenderableFace4,m++,i=P,i.v1.copy(t),i.v2.copy(y),i.v3.copy(w),i.v4.copy(A);else continue;i.normalWorld.copy(x.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(x.centroid);L.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);w=x.vertexNormals;t=0;for(y=w.length;t0&&v.z<1))L=M[J]=M[J]||new THREE.RenderableParticle,J++,r=L,r.x=v.x/v.w,r.y=v.y/v.w,r.z=v.z,r.rotation=u.rotation.z,r.scale.x=u.scale.x*Math.abs(r.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),r.scale.y=u.scale.y*Math.abs(r.y-(v.y+ +e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),r.materials=u.materials,D.push(r);g&&D.sort(b);return D}}; THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var j,i,l,k,m,n,p,q;a=b.projectScene(c,d);j=0;for(i=a.length;ja.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]];l=a[c[3]];c=f*f;g=f*c;e[0]=this.interpolate(h[0],j[0],k[0],l[0],f,c,g);e[1]=this.interpolate(h[1],j[1],k[1],l[1],f,c,g);e[2]=this.interpolate(h[2],j[2],k[2],l[2],f,c,g);return e}; THREE.Animation.prototype.interpolate=function(a,b,c,e,f,h,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=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+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.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= +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.005;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= @@ -49,7 +49,7 @@ Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListen 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,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),j=c.getLength(),k=f.length,x=0;h=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h=0?e:e+f;e=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var j=g[1]-g[0];this.phi= @@ -57,7 +57,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(g[1]-g[0])/(e[1]-e[0])+g[0]-g 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}),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,g);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&&e(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 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= +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.005;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; @@ -149,7 +149,7 @@ THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THRE THREE.IcosahedronGeometry=function(a){function b(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function c(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,c){var e=f.vertices[a].position,g=f.vertices[c].position;return b((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1, -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var g=0;g0&&a>0&&f+a<1}if(a instanceof THREE.Particle){var d=b(this.origin,this.direction,a.matrixWorld.getPosition());if(d==null||d>a.scale.x)return[];return[{distance:d,point:a.position,face:null,object:a}]}else if(a instanceof THREE.Mesh){d=b(this.origin,this.direction,a.matrixWorld.getPosition());if(d==null||d>a.geometry.boundingSphere.radius*Math.max(a.scale.x, -Math.max(a.scale.y,a.scale.z)))return[];var e,g,f,h,k,i,l,j,n,m,p=a.geometry,q=p.vertices,w=[],d=0;for(e=p.faces.length;d0:j<0)))if(j=l.dot((new THREE.Vector3).sub(f,n))/j,n=n.addSelf(m.multiplyScalar(j)),g instanceof THREE.Face3)c(n,f,h,k)&&(g={distance:this.origin.distanceTo(n),point:n,face:g,object:a},w.push(g));else if(g instanceof THREE.Face4&&(c(n,f,h,i)||c(n,h,k,i)))g={distance:this.origin.distanceTo(n),point:n,face:g,object:a},w.push(g);w.sort(function(a,b){return a.distance-b.distance});return w}else return[]}}; +Math.max(a.scale.y,a.scale.z)))return[];var e,g,f,h,k,i,l,j,m,n,p=a.geometry,q=p.vertices,v=[],d=0;for(e=p.faces.length;d0:j<0)))if(j=l.dot((new THREE.Vector3).sub(f,m))/j,m=m.addSelf(n.multiplyScalar(j)),g instanceof THREE.Face3)c(m,f,h,k)&&(g={distance:this.origin.distanceTo(m),point:m,face:g,object:a},v.push(g));else if(g instanceof THREE.Face4&&(c(m,f,h,i)||c(m,h,k,i)))g={distance:this.origin.distanceTo(m),point:m,face:g,object:a},v.push(g);v.sort(function(a,b){return a.distance-b.distance});return v}else return[]}}; THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,j){h=!1;b=f;c=g;d=l;e=j;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=bf?d:f,e=e>g?e:g);a()};this.add3Points= -function(f,g,l,j,n,m){h?(h=!1,b=fl?f>n?f:n:l>n?l:n,e=g>j?g>m?g:m:j>m?j:m):(b=fl?f>n?f>d?f:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d,e=g>j?g>m?g>e?g:e:m>e?m:e:j>m?j>e?j:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=bf.getRight()?d:f.getRight(),e=e> +function(f,g,l,j,m,n){h?(h=!1,b=fl?f>m?f:m:l>m?l:m,e=g>j?g>n?g:n:j>n?j:n):(b=fl?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d,e=g>j?g>n?g>e?g:e:n>e?n:e:j>n?j>e?j:e:n>e?n:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=bf.getRight()?d:f.getRight(),e=e> f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,k,i,l,j,n,m,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,k||0,i||0,l||1,j||0,n||0,m||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,k,i,l,j,n,m,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=k;this.n32=i;this.n33=l;this.n34=j;this.n41=n;this.n42=m;this.n43=p;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a, +THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,k,i,l,j,m,n,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,k||0,i||0,l||1,j||0,m||0,n||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,k,i,l,j,m,n,p,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=k;this.n32=i;this.n33=l;this.n34=j;this.n41=m;this.n42=n;this.n43=p;this.n44=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a, b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e; a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+ -c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,l=a.n31,j=a.n32,n=a.n33,m=a.n34,p=a.n41,q=a.n42,w=a.n43,v=a.n44,A=b.n11,H=b.n12, -s=b.n13,r=b.n14,o=b.n21,E=b.n22,B=b.n23,x=b.n24,C=b.n31,I=b.n32,J=b.n33,z=b.n34,O=b.n41,L=b.n42,M=b.n43,P=b.n44;this.n11=c*A+d*o+e*C+g*O;this.n12=c*H+d*E+e*I+g*L;this.n13=c*s+d*B+e*J+g*M;this.n14=c*r+d*x+e*z+g*P;this.n21=f*A+h*o+k*C+i*O;this.n22=f*H+h*E+k*I+i*L;this.n23=f*s+h*B+k*J+i*M;this.n24=f*r+h*x+k*z+i*P;this.n31=l*A+j*o+n*C+m*O;this.n32=l*H+j*E+n*I+m*L;this.n33=l*s+j*B+n*J+m*M;this.n34=l*r+j*x+n*z+m*P;this.n41=p*A+q*o+w*C+v*O;this.n42=p*H+q*E+w*I+v*L;this.n43=p*s+q*B+w*J+v*M;this.n44=p*r+q* -x+w*z+v*P;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*= -a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,k=this.n31,i=this.n32,l=this.n33,j=this.n34,n=this.n41,m=this.n42,p=this.n43,q=this.n44;return d*f*i*n-c*h*i*n-d*g*l*n+b*h*l*n+c*g*j*n-b*f*j*n-d*f*k*m+c*h*k*m+d*e*l*m-a*h*l*m-c*e*j*m+a*f*j*m+d*g*k*p-b*h*k*p-d*e*i*p+a*h*i*p+b*e*j*p-a*g*j*p-c*g*k*q+b*f*k*q+c*e*i*q-a*f*i*q-b*e*l*q+a*g*l*q}, +c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,l=a.n31,j=a.n32,m=a.n33,n=a.n34,p=a.n41,q=a.n42,v=a.n43,u=a.n44,C=b.n11,K=b.n12, +t=b.n13,w=b.n14,z=b.n21,y=b.n22,o=b.n23,E=b.n24,D=b.n31,F=b.n32,G=b.n33,A=b.n34,M=b.n41,N=b.n42,O=b.n43,S=b.n44;this.n11=c*C+d*z+e*D+g*M;this.n12=c*K+d*y+e*F+g*N;this.n13=c*t+d*o+e*G+g*O;this.n14=c*w+d*E+e*A+g*S;this.n21=f*C+h*z+k*D+i*M;this.n22=f*K+h*y+k*F+i*N;this.n23=f*t+h*o+k*G+i*O;this.n24=f*w+h*E+k*A+i*S;this.n31=l*C+j*z+m*D+n*M;this.n32=l*K+j*y+m*F+n*N;this.n33=l*t+j*o+m*G+n*O;this.n34=l*w+j*E+m*A+n*S;this.n41=p*C+q*z+v*D+u*M;this.n42=p*K+q*y+v*F+u*N;this.n43=p*t+q*o+v*G+u*O;this.n44=p*w+q* +E+v*A+u*S;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*= +a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,k=this.n31,i=this.n32,l=this.n33,j=this.n34,m=this.n41,n=this.n42,p=this.n43,q=this.n44;return d*f*i*m-c*h*i*m-d*g*l*m+b*h*l*m+c*g*j*m-b*f*j*m-d*f*k*n+c*h*k*n+d*e*l*n-a*h*l*n-c*e*j*n+a*f*j*n+d*g*k*p-b*h*k*p-d*e*i*p+a*h*i*p+b*e*j*p-a*g*j*p-c*g*k*q+b*f*k*q+c*e*i*q-a*f*i*q-b*e*l*q+a*g*l*q}, transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34; a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11; a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34; @@ -41,37 +41,37 @@ a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,k=b*f;b*=h;var i=c*f;c*=h;d*=h;g*= d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length(); c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23= a.n23*e;this.n33=a.n33*e}}; -THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,l=a.n31,j=a.n32,n=a.n33,m=a.n34,p=a.n41,q=a.n42,w=a.n43,v=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*m*q-i*n*q+i*j*w-h*m*w-k*j*v+h*n*v;b.n12=g*n*q-e*m*q-g*j*w+d*m*w+e*j*v-d*n*v;b.n13=e*i*q-g*k*q+g*h*w-d*i*w-e*h*v+d*k*v;b.n14=g*k*j-e*i*j-g*h*n+d*i*n+e*h*m-d*k*m;b.n21=i*n*p-k*m*p-i*l*w+f*m*w+k*l*v-f*n*v;b.n22=e*m*p-g*n*p+g*l*w-c*m*w-e*l*v+c*n*v;b.n23=g*k*p-e*i*p-g*f*w+c*i*w+e*f*v-c*k*v;b.n24= -e*i*l-g*k*l+g*f*n-c*i*n-e*f*m+c*k*m;b.n31=h*m*p-i*j*p+i*l*q-f*m*q-h*l*v+f*j*v;b.n32=g*j*p-d*m*p-g*l*q+c*m*q+d*l*v-c*j*v;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*v+c*h*v;b.n34=g*h*l-d*i*l-g*f*j+c*i*j+d*f*m-c*h*m;b.n41=k*j*p-h*n*p-k*l*q+f*n*q+h*l*w-f*j*w;b.n42=d*n*p-e*j*p+e*l*q-c*n*q-d*l*w+c*j*w;b.n43=e*h*p-d*k*p-e*f*q+c*k*q+d*f*w-c*h*w;b.n44=d*k*l-e*h*l+e*f*j-c*k*j-d*f*n+c*h*n;b.multiplyScalar(1/a.determinant());return b}; +THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,i=a.n24,l=a.n31,j=a.n32,m=a.n33,n=a.n34,p=a.n41,q=a.n42,v=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*n*q-i*m*q+i*j*v-h*n*v-k*j*u+h*m*u;b.n12=g*m*q-e*n*q-g*j*v+d*n*v+e*j*u-d*m*u;b.n13=e*i*q-g*k*q+g*h*v-d*i*v-e*h*u+d*k*u;b.n14=g*k*j-e*i*j-g*h*m+d*i*m+e*h*n-d*k*n;b.n21=i*m*p-k*n*p-i*l*v+f*n*v+k*l*u-f*m*u;b.n22=e*n*p-g*m*p+g*l*v-c*n*v-e*l*u+c*m*u;b.n23=g*k*p-e*i*p-g*f*v+c*i*v+e*f*u-c*k*u;b.n24= +e*i*l-g*k*l+g*f*m-c*i*m-e*f*n+c*k*n;b.n31=h*n*p-i*j*p+i*l*q-f*n*q-h*l*u+f*j*u;b.n32=g*j*p-d*n*p-g*l*q+c*n*q+d*l*u-c*j*u;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*u+c*h*u;b.n34=g*h*l-d*i*l-g*f*j+c*i*j+d*f*n-c*h*n;b.n41=k*j*p-h*m*p-k*l*q+f*m*q+h*l*v-f*j*v;b.n42=d*m*p-e*j*p+e*l*q-c*m*q-d*l*v+c*j*v;b.n43=e*h*p-d*k*p-e*f*q+c*k*q+d*f*v-c*h*v;b.n44=d*k*l-e*h*l+e*f*j-c*k*j-d*f*m+c*h*m;b.multiplyScalar(1/a.determinant());return b}; THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*k;c[6]=a*i;c[7]=a*l;c[8]=a*j;return b}; THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)}; THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,k,i;f=new THREE.Matrix4;h=b-a;k=c-d;i=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/k;f.n23=0;f.n24=-((c+d)/k);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; -THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion; -this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""}; +THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= +!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)=== -1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; +c-f*d-h*e;b.x=i*k+c*-g+l*-h-j*-f;b.y=l*k+c*-f+j*-g-i*-h;b.z=j*k+c*-h+i*-f-l*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c}; THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; -THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; +THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;bthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),dL&&f.positionScreen.z0&&r.z<1))R=H[A]=H[A]||new THREE.RenderableParticle,A++,v=R,v.x=r.x/r.w,v.y=r.y/r.w,v.z=r.z,v.rotation=t.rotation.z,v.scale.x=t.scale.x*Math.abs(v.x-(r.x+e.projectionMatrix.n11)/(r.w+e.projectionMatrix.n14)),v.scale.y=t.scale.y*Math.abs(v.y-(r.y+ -e.projectionMatrix.n22)/(r.w+e.projectionMatrix.n24)),v.materials=t.materials,s.push(v);g&&s.sort(b);return s}}; -THREE.SVGRenderer=function(){function a(a,b,c){var d,e,f,g;d=0;for(e=a.lights.length;d0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(C.sub(f.position,b.centroidWorld),C.normalize(),g=b.normalWorld.dot(C)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function b(b,c,f,h,i,j){g.data.vertices+=3;g.data.faces++;z=d(O++);z.setAttribute("d", -"M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?s.copy(i.color):i instanceof THREE.MeshLambertMaterial?H?(r.r=o.r,r.g=o.g,r.b=o.b,a(j,h,r),s.r=Math.max(0,Math.min(i.color.r*r.r,1)),s.g=Math.max(0,Math.min(i.color.g*r.g,1)),s.b=Math.max(0,Math.min(i.color.b*r.b,1))):s.copy(i.color):i instanceof THREE.MeshDepthMaterial?(x=1-i.__2near/(i.__farPlusNear-h.z*i.__farMinusNear), -s.setRGB(x,x,x)):i instanceof THREE.MeshNormalMaterial&&s.setRGB(e(h.normalWorld.x),e(h.normalWorld.y),e(h.normalWorld.z));i.wireframe?z.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):z.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+i.opacity);k.appendChild(z)}function c(b,c,f,h,i,j,l){g.data.vertices+=4;g.data.faces++; -z=d(O++);z.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");j instanceof THREE.MeshBasicMaterial?s.copy(j.color):j instanceof THREE.MeshLambertMaterial?H?(r.r=o.r,r.g=o.g,r.b=o.b,a(l,i,r),s.r=Math.max(0,Math.min(j.color.r*r.r,1)),s.g=Math.max(0,Math.min(j.color.g*r.g,1)),s.b=Math.max(0,Math.min(j.color.b*r.b,1))):s.copy(j.color):j instanceof -THREE.MeshDepthMaterial?(x=1-j.__2near/(j.__farPlusNear-i.z*j.__farMinusNear),s.setRGB(x,x,x)):j instanceof THREE.MeshNormalMaterial&&s.setRGB(e(i.normalWorld.x),e(i.normalWorld.y),e(i.normalWorld.z));j.wireframe?z.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+j.wireframeLinewidth+"; stroke-opacity: "+j.opacity+"; stroke-linecap: "+j.wireframeLinecap+"; stroke-linejoin: "+j.wireframeLinejoin):z.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+ -j.opacity);k.appendChild(z)}function d(a){I[a]==null&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),M==0&&I[a].setAttribute("shape-rendering","crispEdges"));return I[a]}function e(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var g=this,f=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,l,j,n,m,p,q,w,v=new THREE.Rectangle,A=new THREE.Rectangle,H=!1,s=new THREE.Color(16777215),r=new THREE.Color(16777215),o=new THREE.Color(0),E=new THREE.Color(0), -B=new THREE.Color(0),x,C=new THREE.Vector3,I=[],J=[],z,O,L,M=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(a){switch(a){case "high":M=1;break;case "low":M=0}};this.setSize=function(a,b){i=a;l=b;j=i/2;n=l/2;k.setAttribute("viewBox",-j+" "+-n+" "+i+" "+l);k.setAttribute("width",i);k.setAttribute("height",l);v.set(-j,-n,j,n)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render= -function(a,d){var e,i,l,r,s,x,u,t;this.autoClear&&this.clear();g.data.vertices=0;g.data.faces=0;f=h.projectScene(a,d,this.sortElements);L=O=0;if(H=a.lights.length>0){u=a.lights;o.setRGB(0,0,0);E.setRGB(0,0,0);B.setRGB(0,0,0);e=0;for(i=u.length;e=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),dt&&f.positionScreen.z0&&y.z<1))Q=K[C]=K[C]||new THREE.RenderableParticle,C++,u=Q,u.x=y.x/y.w,u.y=y.y/y.w,u.z=y.z,u.rotation=B.rotation.z,u.scale.x=B.scale.x*Math.abs(u.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),u.scale.y=B.scale.y*Math.abs(u.y-(y.y+ +e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),u.materials=B.materials,w.push(u);g&&w.sort(b);return w}}; +THREE.SVGRenderer=function(){function a(a,b,c){var d,e,f,g;d=0;for(e=a.lights.length;d0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(D.sub(f.position,b.centroidWorld),D.normalize(),g=b.normalWorld.dot(D)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function b(b,c,f,h,i,j){g.data.vertices+=3;g.data.faces++;A=d(M++);A.setAttribute("d", +"M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?t.copy(i.color):i instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(j,h,w),t.r=Math.max(0,Math.min(i.color.r*w.r,1)),t.g=Math.max(0,Math.min(i.color.g*w.g,1)),t.b=Math.max(0,Math.min(i.color.b*w.b,1))):t.copy(i.color):i instanceof THREE.MeshDepthMaterial?(E=1-i.__2near/(i.__farPlusNear-h.z*i.__farMinusNear), +t.setRGB(E,E,E)):i instanceof THREE.MeshNormalMaterial&&t.setRGB(e(h.normalWorld.x),e(h.normalWorld.y),e(h.normalWorld.z));i.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+i.opacity);k.appendChild(A)}function c(b,c,f,h,i,j,m){g.data.vertices+=4;g.data.faces++; +A=d(M++);A.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");j instanceof THREE.MeshBasicMaterial?t.copy(j.color):j instanceof THREE.MeshLambertMaterial?K?(w.r=z.r,w.g=z.g,w.b=z.b,a(m,i,w),t.r=Math.max(0,Math.min(j.color.r*w.r,1)),t.g=Math.max(0,Math.min(j.color.g*w.g,1)),t.b=Math.max(0,Math.min(j.color.b*w.b,1))):t.copy(j.color):j instanceof +THREE.MeshDepthMaterial?(E=1-j.__2near/(j.__farPlusNear-i.z*j.__farMinusNear),t.setRGB(E,E,E)):j instanceof THREE.MeshNormalMaterial&&t.setRGB(e(i.normalWorld.x),e(i.normalWorld.y),e(i.normalWorld.z));j.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+j.wireframeLinewidth+"; stroke-opacity: "+j.opacity+"; stroke-linecap: "+j.wireframeLinecap+"; stroke-linejoin: "+j.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+ +j.opacity);k.appendChild(A)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),O==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function e(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var g=this,f=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,l,j,m,n,p,q,v,u=new THREE.Rectangle,C=new THREE.Rectangle,K=!1,t=new THREE.Color(16777215),w=new THREE.Color(16777215),z=new THREE.Color(0),y=new THREE.Color(0), +o=new THREE.Color(0),E,D=new THREE.Vector3,F=[],G=[],A,M,N,O=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){i=a;l=b;j=i/2;m=l/2;k.setAttribute("viewBox",-j+" "+-m+" "+i+" "+l);k.setAttribute("width",i);k.setAttribute("height",l);u.set(-j,-m,j,m)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render= +function(a,d){var e,i,l,r,t,w,s,x;this.autoClear&&this.clear();g.data.vertices=0;g.data.faces=0;f=h.projectScene(a,d,this.sortElements);N=M=0;if(K=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);y.setRGB(0,0,0);o.setRGB(0,0,0);e=0;for(i=s.length;e>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; +THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;return this},setHSV:function(b,c,d){var f,j,h;if(d==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),j=b*6-f,b=d*(1-c),h=d*(1-c*j),c=d*(1-c*(1-j)),f){case 1:this.r=h;this.g=d;this.b=b;break;case 2:this.r=b;this.g=d;this.b=c;break;case 3:this.r=b;this.g=h;this.b=d;break;case 4:this.r=c;this.g=b;this.b=d;break;case 5:this.r= +d;this.g=b;this.b=h;break;case 6:case 0:this.r=d,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this}, divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)}, @@ -10,80 +10,80 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,d){this.x=b; b.z-c.z;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){this.x/=b.x;this.y/=b.y;this.z/=b.z;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)}, dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y* b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13);Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()< -1.0E-4}};THREE.Vector4=function(b,c,d,e){this.x=b||0;this.y=c||0;this.z=d||0;this.w=e||1}; -THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w||1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;this.w= +1.0E-4}};THREE.Vector4=function(b,c,d,f){this.x=b||0;this.y=c||0;this.z=d||0;this.w=f||1}; +THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w||1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;this.w= b.w-c.w;return this},subSelf:function(b){this.x-=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.z=this.y=this.x=0,this.w=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={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b.matrixWorld.getPosition());if(e==null||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b.matrixWorld.getPosition());if(e==null||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x, -Math.max(b.scale.y,b.scale.z)))return[];var h,g,j,k,p,o,m,r,q,v,C=b.geometry,x=C.vertices,E=[],e=0;for(h=C.faces.length;e0:r<0)))if(r=m.dot((new THREE.Vector3).sub(j,q))/r,q=q.addSelf(v.multiplyScalar(r)),g instanceof THREE.Face3)d(q,j,k,p)&&(g={distance:this.origin.distanceTo(q),point:q,face:g,object:b},E.push(g));else if(g instanceof THREE.Face4&&(d(q,j,k,o)||d(q,k,p,o)))g={distance:this.origin.distanceTo(q),point:q,face:g,object:b},E.push(g);E.sort(function(b,c){return b.distance-c.distance});return E}else return[]}}; -THREE.Rectangle=function(){function b(){g=e-c;j=h-d}var c,d,e,h,g,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(g,j,m,r){k=!1;c=g;d=j;e=m;h=r;b()};this.addPoint=function(g,j){k?(k=!1,c=g,d=j,e=g,h=j):(c=cg?e:g,h=h>j?h:j);b()};this.add3Points= -function(g,j,m,r,q,v){k?(k=!1,c=gm?g>q?g:q:m>q?m:q,h=j>r?j>v?j:v:r>v?r:v):(c=gm?g>q?g>e?g:e:q>e?q:e:m>q?m>e?m:e:q>e?q:e,h=j>r?j>v?j>h?j:h:v>h?v:h:r>v?r>h?r:h:v>h?v:h);b()};this.addRectangle=function(g){k?(k=!1,c=g.getLeft(),d=g.getTop(),e=g.getRight(),h=g.getBottom()):(c=cg.getRight()?e:g.getRight(),h=h> -g.getBottom()?h:g.getBottom());b()};this.inflate=function(g){c-=g;d-=g;e+=g;h+=g;b()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();d=d>g.getTop()?d:g.getTop();e=e=0&&Math.min(h,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;h=e=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,h,g,j,k,p,o,m,r,q,v,C,x){this.set(b||1,c||0,d||0,e||0,h||0,g||1,j||0,k||0,p||0,o||0,m||1,r||0,q||0,v||0,C||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,h,g,j,k,p,o,m,r,q,v,C,x){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=g;this.n23=j;this.n24=k;this.n31=p;this.n32=o;this.n33=m;this.n34=r;this.n41=q;this.n42=v;this.n43=C;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, -c,d){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(b,c).normalize();if(g.length()===0)g.z=1;e.cross(d,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(d,g).normalize());h.cross(g,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=g.x;this.n21=e.y;this.n22=h.y;this.n23=g.y;this.n31=e.z;this.n32=h.z;this.n33=g.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h; -b.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,h=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*h;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+ -d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,h=b.n13,g=b.n14,j=b.n21,k=b.n22,p=b.n23,o=b.n24,m=b.n31,r=b.n32,q=b.n33,v=b.n34,C=b.n41,x=b.n42,E=b.n43,K=b.n44,ya=c.n11,za= -c.n12,ta=c.n13,U=c.n14,t=c.n21,Y=c.n22,L=c.n23,P=c.n24,Q=c.n31,ha=c.n32,qa=c.n33,S=c.n34,J=c.n41,f=c.n42,Ba=c.n43,ra=c.n44;this.n11=d*ya+e*t+h*Q+g*J;this.n12=d*za+e*Y+h*ha+g*f;this.n13=d*ta+e*L+h*qa+g*Ba;this.n14=d*U+e*P+h*S+g*ra;this.n21=j*ya+k*t+p*Q+o*J;this.n22=j*za+k*Y+p*ha+o*f;this.n23=j*ta+k*L+p*qa+o*Ba;this.n24=j*U+k*P+p*S+o*ra;this.n31=m*ya+r*t+q*Q+v*J;this.n32=m*za+r*Y+q*ha+v*f;this.n33=m*ta+r*L+q*qa+v*Ba;this.n34=m*U+r*P+q*S+v*ra;this.n41=C*ya+x*t+E*Q+K*J;this.n42=C*za+x*Y+E*ha+K*f;this.n43= -C*ta+x*L+E*qa+K*Ba;this.n44=C*U+x*P+E*S+K*ra;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*= -b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,h=this.n21,g=this.n22,j=this.n23,k=this.n24,p=this.n31,o=this.n32,m=this.n33,r=this.n34,q=this.n41,v=this.n42,C=this.n43,x=this.n44;return e*j*o*q-d*k*o*q-e*g*m*q+c*k*m*q+d*g*r*q-c*j*r*q-e*j*p*v+d*k*p*v+e*h*m*v-b*k*m*v-d*h*r*v+b*j*r*v+e*g*p*C-c*k*p*C-e*h*o*C+b*k*o*C+c*h*r*C-b*g*r*C-d*g*p*x+c*j* -p*x+d*h*o*x-b*j*o*x-c*h*m*x+b*g*m*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32; +THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,f=[];c=0;for(d=b.length;c0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x, +Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,r,p,n,s,q,w,C=b.geometry,y=C.vertices,F=[],f=0;for(j=C.faces.length;f0:s<0)))if(s=n.dot((new THREE.Vector3).sub(k,q))/s,q=q.addSelf(w.multiplyScalar(s)),h instanceof THREE.Face3)d(q,k,m,r)&&(h={distance:this.origin.distanceTo(q),point:q,face:h,object:b},F.push(h));else if(h instanceof THREE.Face4&&(d(q,k,m,p)||d(q,m,r,p)))h={distance:this.origin.distanceTo(q),point:q,face:h,object:b},F.push(h);F.sort(function(b,c){return b.distance-c.distance});return F}else return[]}}; +THREE.Rectangle=function(){function b(){h=f-c;k=j-d}var c,d,f,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return j};this.set=function(h,k,n,s){m=!1;c=h;d=k;f=n;j=s;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,f=h,j=k):(c=ch?f:h,j=j>k?j:k);b()};this.add3Points= +function(h,k,n,s,q,w){m?(m=!1,c=hn?h>q?h:q:n>q?n:q,j=k>s?k>w?k:w:s>w?s:w):(c=hn?h>q?h>f?h:f:q>f?q:f:n>q?n>f?n:f:q>f?q:f,j=k>s?k>w?k>j?k:j:w>j?w:j:s>w?s>j?s:j:w>j?w:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),j=h.getBottom()):(c=ch.getRight()?f:h.getRight(),j=j> +h.getBottom()?j:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;f+=h;j+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();f=f=0&&Math.min(j,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){m=!0;j=f=d=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]}; +THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,f,j,h,k,m,r,p,n,s,q,w,C,y){this.set(b||1,c||0,d||0,f||0,j||0,h||1,k||0,m||0,r||0,p||0,n||1,s||0,q||0,w||0,C||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,j,h,k,m,r,p,n,s,q,w,C,y){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=r;this.n32=p;this.n33=n;this.n34=s;this.n41=q;this.n42=w;this.n43=C;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, +c,d){var f=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(d,h).normalize());j.cross(h,f).normalize();this.n11=f.x;this.n12=j.x;this.n13=h.x;this.n21=f.y;this.n22=j.y;this.n23=h.y;this.n31=f.z;this.n32=j.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,j=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*j; +b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*j;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*j;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,j=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*j;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*j;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*j;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*j;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+ +d*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 d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,p=b.n24,n=b.n31,s=b.n32,q=b.n33,w=b.n34,C=b.n41,y=b.n42,F=b.n43,L=b.n44,xa=c.n11,ya= +c.n12,ka=c.n13,oa=c.n14,R=c.n21,M=c.n22,v=c.n23,U=c.n24,N=c.n31,Z=c.n32,S=c.n33,V=c.n34,H=c.n41,e=c.n42,ua=c.n43,Fa=c.n44;this.n11=d*xa+f*R+j*N+h*H;this.n12=d*ya+f*M+j*Z+h*e;this.n13=d*ka+f*v+j*S+h*ua;this.n14=d*oa+f*U+j*V+h*Fa;this.n21=k*xa+m*R+r*N+p*H;this.n22=k*ya+m*M+r*Z+p*e;this.n23=k*ka+m*v+r*S+p*ua;this.n24=k*oa+m*U+r*V+p*Fa;this.n31=n*xa+s*R+q*N+w*H;this.n32=n*ya+s*M+q*Z+w*e;this.n33=n*ka+s*v+q*S+w*ua;this.n34=n*oa+s*U+q*V+w*Fa;this.n41=C*xa+y*R+F*N+L*H;this.n42=C*ya+y*M+F*Z+L*e;this.n43= +C*ka+y*v+F*S+L*ua;this.n44=C*oa+y*U+F*V+L*Fa;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*= +b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,r=this.n31,p=this.n32,n=this.n33,s=this.n34,q=this.n41,w=this.n42,C=this.n43,y=this.n44;return f*k*p*q-d*m*p*q-f*h*n*q+c*m*n*q+d*h*s*q-c*k*s*q-f*k*r*w+d*m*r*w+f*j*n*w-b*m*n*w-d*j*s*w+b*k*s*w+f*h*r*C-c*m*r*C-f*j*p*C+b*m*p*C+c*j*s*C-b*h*s*C-d*h*r*y+c*k* +r*y+d*j*p*y-b*k*p*y-c*j*n*y+b*h*n*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32; b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]= this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]= this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0, -0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,g=b.x,j=b.y,k=b.z,p=h*g,o=h*j;this.set(p*g+d,p*j-e*k,p*k+e*j,0,p*j+e*k,o*j+d,o*k-e*g,0,p*k-e*j,o*k+e*g,h*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= -new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,e=b.y,h=b.z,g=Math.cos(d),d=Math.sin(d),j=Math.cos(e),e=Math.sin(e),k=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var p= -j*k,o=j*h,m=e*k,r=e*h;this.n11=p+r*d;this.n12=m*d-o;this.n13=g*e;this.n21=g*h;this.n22=g*k;this.n23=-d;this.n31=o*d-m;this.n32=r+p*d;this.n33=g*j;break;case "ZXY":p=j*k;o=j*h;m=e*k;r=e*h;this.n11=p-r*d;this.n12=-g*h;this.n13=m+o*d;this.n21=o+m*d;this.n22=g*k;this.n23=r-p*d;this.n31=-g*e;this.n32=d;this.n33=g*j;break;case "ZYX":p=g*k;o=g*h;m=d*k;r=d*h;this.n11=j*k;this.n12=m*e-o;this.n13=p*e+r;this.n21=j*h;this.n22=r*e+p;this.n23=o*e-m;this.n31=-e;this.n32=d*j;this.n33=g*j;break;case "YZX":p=g*j;o= -g*e;m=d*j;r=d*e;this.n11=j*k;this.n12=r-p*h;this.n13=m*h+o;this.n21=h;this.n22=g*k;this.n23=-d*k;this.n31=-e*k;this.n32=o*h+m;this.n33=p-r*h;break;case "XZY":p=g*j;o=g*e;m=d*j;r=d*e;this.n11=j*k;this.n12=-h;this.n13=e*k;this.n21=p*h+r;this.n22=g*k;this.n23=o*h-m;this.n31=m*h-o;this.n32=d*k;this.n33=r*h+p;break;default:p=g*k,o=g*h,m=d*k,r=d*h,this.n11=j*k,this.n12=-j*h,this.n13=e,this.n21=o+m*e,this.n22=p-r*e,this.n23=-d*j,this.n31=r-p*e,this.n32=m+o*e,this.n33=g*j}return this},setRotationFromQuaternion:function(b){var c= -b.x,d=b.y,e=b.z,h=b.w,g=c+c,j=d+d,k=e+e,b=c*g,p=c*j;c*=k;var o=d*j;d*=k;e*=k;g*=h;j*=h;h*=k;this.n11=1-(o+e);this.n12=p-h;this.n13=c+j;this.n21=p+h;this.n22=1-(b+e);this.n23=d-g;this.n31=c-j;this.n32=d+g;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var e=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2; -e.identity();e.setRotationFromQuaternion(c);h.setScale(d.x,d.y,d.z);this.multiply(e,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=e.length(); -d.y=h.length();d.z=g.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=d.x;e.n21/=d.x;e.n31/=d.x;e.n12/=d.y;e.n22/=d.y;e.n32/=d.y;e.n13/=d.z;e.n23/=d.z;e.n33/=d.z;c.setFromRotationMatrix(e);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,h=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*h;this.n23= -b.n23*h;this.n33=b.n33*h}}; -THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,h=b.n13,g=b.n14,j=b.n21,k=b.n22,p=b.n23,o=b.n24,m=b.n31,r=b.n32,q=b.n33,v=b.n34,C=b.n41,x=b.n42,E=b.n43,K=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*x-o*q*x+o*r*E-k*v*E-p*r*K+k*q*K;c.n12=g*q*x-h*v*x-g*r*E+e*v*E+h*r*K-e*q*K;c.n13=h*o*x-g*p*x+g*k*E-e*o*E-h*k*K+e*p*K;c.n14=g*p*r-h*o*r-g*k*q+e*o*q+h*k*v-e*p*v;c.n21=o*q*C-p*v*C-o*m*E+j*v*E+p*m*K-j*q*K;c.n22=h*v*C-g*q*C+g*m*E-d*v*E-h*m*K+d*q*K;c.n23=g*p*C-h*o*C-g*j*E+d*o*E+h*j*K-d*p*K;c.n24= -h*o*m-g*p*m+g*j*q-d*o*q-h*j*v+d*p*v;c.n31=k*v*C-o*r*C+o*m*x-j*v*x-k*m*K+j*r*K;c.n32=g*r*C-e*v*C-g*m*x+d*v*x+e*m*K-d*r*K;c.n33=h*o*C-g*k*C+g*j*x-d*o*x-e*j*K+d*k*K;c.n34=g*k*m-e*o*m-g*j*r+d*o*r+e*j*v-d*k*v;c.n41=p*r*C-k*q*C-p*m*x+j*q*x+k*m*E-j*r*E;c.n42=e*q*C-h*r*C+h*m*x-d*q*x-e*m*E+d*r*E;c.n43=h*k*C-e*p*C-h*j*x+d*p*x+e*j*E-d*k*E;c.n44=e*p*m-h*k*m+h*j*r-d*p*r-e*j*q+d*k*q;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,g=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,m=-b.n23*b.n11+b.n21*b.n13,r=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*h;d[2]=b*g;d[3]=b*j;d[4]=b*k;d[5]=b*p;d[6]=b*o;d[7]=b*m;d[8]=b*r;return c}; -THREE.Matrix4.makeFrustum=function(b,c,d,e,h,g){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+h)/(g-h);j.n34=-2*g*h/(g-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var h,b=d*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,d,e)}; -THREE.Matrix4.makeOrtho=function(b,c,d,e,h,g){var j,k,p,o;j=new THREE.Matrix4;k=c-b;p=d-e;o=g-h;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((d+e)/p);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((g+h)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; -THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion; -this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""}; +0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),j=1-d,h=b.x,k=b.y,m=b.z,r=j*h,p=j*k;this.set(r*h+d,r*k-f*m,r*m+f*k,0,r*k+f*m,p*k+d,p*m-f*h,0,r*m-f*k,p*m+f*h,j*m*m+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= +new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,j=b.z,h=Math.cos(d),d=Math.sin(d),k=Math.cos(f),f=Math.sin(f),m=Math.cos(j),j=Math.sin(j);switch(c){case "YXZ":var r= +k*m,p=k*j,n=f*m,s=f*j;this.n11=r+s*d;this.n12=n*d-p;this.n13=h*f;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=p*d-n;this.n32=s+r*d;this.n33=h*k;break;case "ZXY":r=k*m;p=k*j;n=f*m;s=f*j;this.n11=r-s*d;this.n12=-h*j;this.n13=n+p*d;this.n21=p+n*d;this.n22=h*m;this.n23=s-r*d;this.n31=-h*f;this.n32=d;this.n33=h*k;break;case "ZYX":r=h*m;p=h*j;n=d*m;s=d*j;this.n11=k*m;this.n12=n*f-p;this.n13=r*f+s;this.n21=k*j;this.n22=s*f+r;this.n23=p*f-n;this.n31=-f;this.n32=d*k;this.n33=h*k;break;case "YZX":r=h*k;p= +h*f;n=d*k;s=d*f;this.n11=k*m;this.n12=s-r*j;this.n13=n*j+p;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-f*m;this.n32=p*j+n;this.n33=r-s*j;break;case "XZY":r=h*k;p=h*f;n=d*k;s=d*f;this.n11=k*m;this.n12=-j;this.n13=f*m;this.n21=r*j+s;this.n22=h*m;this.n23=p*j-n;this.n31=n*j-p;this.n32=d*m;this.n33=s*j+r;break;default:r=h*m,p=h*j,n=d*m,s=d*j,this.n11=k*m,this.n12=-k*j,this.n13=f,this.n21=p+n*f,this.n22=r-s*f,this.n23=-d*k,this.n31=s-r*f,this.n32=n+p*f,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c= +b.x,d=b.y,f=b.z,j=b.w,h=c+c,k=d+d,m=f+f,b=c*h,r=c*k;c*=m;var p=d*k;d*=m;f*=m;h*=j;k*=j;j*=m;this.n11=1-(p+f);this.n12=r-j;this.n13=c+k;this.n21=r+j;this.n22=1-(b+f);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2; +f.identity();f.setRotationFromQuaternion(c);j.setScale(d.x,d.y,d.z);this.multiply(f,j);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);j.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=f.length(); +d.y=j.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,j=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*j;this.n23= +b.n23*j;this.n33=b.n33*j}}; +THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,p=b.n24,n=b.n31,s=b.n32,q=b.n33,w=b.n34,C=b.n41,y=b.n42,F=b.n43,L=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=r*w*y-p*q*y+p*s*F-m*w*F-r*s*L+m*q*L;c.n12=h*q*y-j*w*y-h*s*F+f*w*F+j*s*L-f*q*L;c.n13=j*p*y-h*r*y+h*m*F-f*p*F-j*m*L+f*r*L;c.n14=h*r*s-j*p*s-h*m*q+f*p*q+j*m*w-f*r*w;c.n21=p*q*C-r*w*C-p*n*F+k*w*F+r*n*L-k*q*L;c.n22=j*w*C-h*q*C+h*n*F-d*w*F-j*n*L+d*q*L;c.n23=h*r*C-j*p*C-h*k*F+d*p*F+j*k*L-d*r*L;c.n24= +j*p*n-h*r*n+h*k*q-d*p*q-j*k*w+d*r*w;c.n31=m*w*C-p*s*C+p*n*y-k*w*y-m*n*L+k*s*L;c.n32=h*s*C-f*w*C-h*n*y+d*w*y+f*n*L-d*s*L;c.n33=j*p*C-h*m*C+h*k*y-d*p*y-f*k*L+d*m*L;c.n34=h*m*n-f*p*n-h*k*s+d*p*s+f*k*w-d*m*w;c.n41=r*s*C-m*q*C-r*n*y+k*q*y+m*n*F-k*s*F;c.n42=f*q*C-j*s*C+j*n*y-d*q*y-f*n*F+d*s*F;c.n43=j*m*C-f*r*C-j*k*y+d*r*y+f*k*F-d*m*F;c.n44=f*r*n-j*m*n+j*k*s-d*r*s-f*k*q+d*m*q;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,r=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,s=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*r;d[6]=b*p;d[7]=b*n;d[8]=b*s;return c}; +THREE.Matrix4.makeFrustum=function(b,c,d,f,j,h){var k;k=new THREE.Matrix4;k.n11=2*j/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*j/(f-d);k.n23=(f+d)/(f-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+j)/(h-j);k.n34=-2*h*j/(h-j);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,d,f){var j,b=d*Math.tan(b*Math.PI/360);j=-b;return THREE.Matrix4.makeFrustum(j*c,b*c,j,b,d,f)}; +THREE.Matrix4.makeOrtho=function(b,c,d,f,j,h){var k,m,r,p;k=new THREE.Matrix4;m=c-b;r=d-f;p=h-j;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/r;k.n23=0;k.n24=-((d+f)/r);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((h+j)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; +THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= +!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)=== --1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var d,e,h;d=0;for(e=this.children.length;d=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var g=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;h=Math.sin((1-e)*g)/j;e=Math.sin(e*g)/j;d.w=b.w*h+c.w*e;d.x=b.x*h+c.x*e;d.y=b.y*h+c.y*e;d.z=b.z*h+c.z*e;return d}; -THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,e,h,g){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; -THREE.Face4=function(b,c,d,e,h,g,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; +this.x,d=this.y,f=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-f*k;this.y=d*b+j*k+f*h-c*m;this.z=f*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,j=b.z,h=this.x,k=this.y,m=this.z,r=this.w,p=r*d+k*j-m*f,n=r*f+m*d-h*j,s=r*j+h*f-k*d,d=-h* +d-k*f-m*j;c.x=p*r+d*-h+n*-m-s*-k;c.y=n*r+d*-k+s*-h-p*-m;c.z=s*r+d*-m+p*-k-n*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;d.w=b.w*j+c.w*f;d.x=b.x*j+c.x*f;d.y=b.y*j+c.y*f;d.z=b.z*j+c.z*f;return d}; +THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,j,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3}; +THREE.Face4=function(b,c,d,f,j,h,k){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; -THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; +THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;cthis.points.length-2?g:g+1;d[3]=g>this.points.length-3?g:g+2;o=this.points[d[0]];m=this.points[d[1]]; -r=this.points[d[2]];q=this.points[d[3]];k=j*j;p=j*k;e.x=c(o.x,m.x,r.x,q.x,j,k,p);e.y=c(o.y,m.y,r.y,q.y,j,k,p);e.z=c(o.z,m.z,r.z,q.z,j,k,p);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;bthis.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];n=this.points[d[1]]; +s=this.points[d[2]];q=this.points[d[3]];m=k*k;r=k*m;f.x=c(p.x,n.x,s.x,q.x,k,m,r);f.y=c(p.y,n.y,s.y,q.y,k,m,r);f.z=c(p.z,n.z,s.z,q.z,k,m,r);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1, -this.LODs[e].object3D.visible=!0;else break;for(;e1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1, +this.LODs[f].object3D.visible=!0;else break;for(;f=0&&h>=0&&g>=0&&j>=0?!0:f<0&&h<0||g<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),g<0?d=Math.max(d,g/(g-j)):j<0&&(e=Math.min(e,g/(g-j))),ef&&j.positionScreen.z0&&U.z<1))Aa=za[ya]=za[ya]||new THREE.RenderableParticle,ya++,K=Aa,K.x=U.x/U.w,K.y=U.y/U.w,K.z=U.z,K.rotation=O.rotation.z,K.scale.x=O.scale.x*Math.abs(K.x- -(U.x+h.projectionMatrix.n11)/(U.w+h.projectionMatrix.n14)),K.scale.y=O.scale.y*Math.abs(K.y-(U.y+h.projectionMatrix.n22)/(U.w+h.projectionMatrix.n24)),K.materials=O.materials,J.push(K);g&&J.sort(c);return J}}; +THREE.Projector=function(){function b(){var b=r[m]=r[m]||new THREE.RenderableVertex;m++;return b}function c(b,c){return c.z-b.z}function d(b,c){var e=0,d=1,f=b.z+b.w,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return f>=0&&j>=0&&h>=0&&k>=0?!0:f<0&&j<0||h<0&&k<0?!1:(f<0?e=Math.max(e,f/(f-j)):j<0&&(d=Math.min(d,f/(f-j))),h<0?e=Math.max(e,h/(h-k)):k<0&&(d=Math.min(d,h/(h-k))),dh&&k.positionScreen.z0&&M.z<1))za=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,L=za,L.x=M.x/M.w,L.y=M.y/M.w,L.z=M.z,L.rotation=Q.rotation.z,L.scale.x=Q.scale.x*Math.abs(L.x- +(M.x+j.projectionMatrix.n11)/(M.w+j.projectionMatrix.n14)),L.scale.y=Q.scale.y*Math.abs(L.y-(M.y+j.projectionMatrix.n22)/(M.w+j.projectionMatrix.n24)),L.materials=Q.materials,oa.push(L);e&&oa.sort(c);return oa}}; THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif", envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif", @@ -150,7 +150,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif", shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec4 shadowColor = vec4( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * shadowColor;\n#endif", shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif"}; -THREE.UniformsUtils={merge:function(b){var c,d,e,h={};for(c=0;c=0)f.bindBuffer(f.ARRAY_BUFFER,g.__webglVertexBuffer),f.vertexAttribPointer(b.position, -3,f.FLOAT,!1,0,0);else if(j.morphTargetBase){c=h.program.attributes;j.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0)):c.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,g.__webglVertexBuffer),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,A=j.morphTargetForcedOrder,o=j.morphTargetInfluences;ep&&(B=D,p=o[B]);f.bindBuffer(f.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[B]);f.vertexAttribPointer(c["morphTarget"+e],3,f.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[e]=p;A[B]=1;p= --1;e++}}h.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=0&&(c=g.__webglCustomAttributes[k],f.bindBuffer(f.ARRAY_BUFFER,c.buffer),f.vertexAttribPointer(b[k],c.size,f.FLOAT,!1,0,0));b.color>=0&&(f.bindBuffer(f.ARRAY_BUFFER,g.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,g.__webglNormalBuffer), -f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,g.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,g.__webglUVBuffer),f.vertexAttribPointer(b.uv,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv)):f.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(f.bindBuffer(f.ARRAY_BUFFER,g.__webglUV2Buffer),f.vertexAttribPointer(b.uv2,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv2)): -f.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(f.bindBuffer(f.ARRAY_BUFFER,g.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,g.__webglSkinWeightsBuffer), -f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0));j instanceof THREE.Mesh?(h.wireframe?(f.lineWidth(h.wireframeLinewidth),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),f.drawElements(f.LINES,g.__webglLineCount,f.UNSIGNED_SHORT,0)):(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),f.drawElements(f.TRIANGLES,g.__webglFaceCount,f.UNSIGNED_SHORT,0)),J.data.vertices+=g.__webglFaceCount,J.data.faces+=g.__webglFaceCount/3,J.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip? -f.LINE_STRIP:f.LINES,f.lineWidth(h.linewidth),f.drawArrays(j,0,g.__webglLineCount),J.data.drawCalls++):j instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,g.__webglParticleCount),J.data.drawCalls++):j instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,g.__webglVertexCount),J.data.drawCalls++)}}function h(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=f.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=f.createBuffer();b.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer), -f.bufferData(f.ARRAY_BUFFER,b.positionArray,f.DYNAMIC_DRAW),f.enableVertexAttribArray(c.attributes.position),f.vertexAttribPointer(c.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,g,h,j,k,o,p,B,D,m,r=b.count*3;for(m=0;m=0;d--)b[d].object==c&&b.splice(d,1)}function ta(b){function c(b){var e=[];d=0;for(f=b.length;d65535&&(m[k].counter+=1,o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[], -materials:j,vertices:0,numMorphTargets:D})),b.geometryGroups[o].faces.push(e),b.geometryGroups[o].vertices+=h}function U(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function t(b){if(b!=V){switch(b){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO, -f.SRC_COLOR);break;default:f.blendEquationSeparate(f.FUNC_ADD,f.FUNC_ADD),f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA)}V=b}}function Y(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,S(c.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,S(c.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,S(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,S(c.minFilter)),f.generateMipmap(b)):(f.texParameteri(b,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE), -f.texParameteri(b,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_MAG_FILTER,qa(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,qa(c.minFilter)))}function L(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=f.createTexture(),b.__webglInit=!0;f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),f.UNSIGNED_BYTE,b.image.data):f.texImage2D(f.TEXTURE_2D, -0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);Y(f.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function P(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=f.createRenderbuffer();b.__webglTexture=f.createTexture();if(c){f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture);Y(f.TEXTURE_CUBE_MAP, -b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=f.createFramebuffer(),f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=f.createFramebuffer(),f.bindTexture(f.TEXTURE_2D,b.__webglTexture),Y(f.TEXTURE_2D,b,b),f.texImage2D(f.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)f.bindFramebuffer(f.FRAMEBUFFER, -b.__webglFramebuffer[d]),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&& -b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,b.width,b.height);c?f.bindTexture(f.TEXTURE_CUBE_MAP,null):f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var e,g;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height, -g=e=0):(c=null,d=Fa,b=xa,e=Aa,g=Ia);c!=va&&(f.bindFramebuffer(f.FRAMEBUFFER,c),f.viewport(e,g,d,b),va=c)}function Q(b){b instanceof THREE.WebGLRenderTargetCube?(f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,b.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null))}function ha(b,c){var d;b=="fragment"?d=f.createShader(f.FRAGMENT_SHADER):b=="vertex"&&(d=f.createShader(f.VERTEX_SHADER)); -f.shaderSource(d,c);f.compileShader(d);if(!f.getShaderParameter(d,f.COMPILE_STATUS))return console.error(f.getShaderInfoLog(d)),console.error(c),null;return d}function qa(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT; -case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT; -case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var J=this,f,Ba=[],ra=null,va=null,T=!0,Z=null,F=null,V=null,N=null,la=null,wa=null,O=null,Aa=0,Ia=0,Fa=0,xa=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, -new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ea=new Float32Array(16),Ra=new Float32Array(16),Ja=new THREE.Vector4,Ua={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Za=b.stencil!==void 0?b.stencil:!0,$a=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ab=b.antialias!==void 0?b.antialias:!1,ua=b.clearColor!==void 0?new THREE.Color(b.clearColor): -new THREE.Color(0),Pa=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ga;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var W,Qa=[],b=THREE.ShaderLib.depthRGBA, -Xa=THREE.UniformsUtils.clone(b.uniforms),Sa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Xa}),Va=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Xa,morphTargets:!0});Sa._shadowPass=!0;Va._shadowPass=!0;try{if(!(f=Ga.getContext("experimental-webgl",{antialias:ab,stencil:Za,preserveDrawingBuffer:$a})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+ -" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(bb){console.error(bb)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(ua.r,ua.g,ua.b,Pa);this.context=f;var Ya=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,u={};u.vertices=new Float32Array(16); -u.faces=new Uint16Array(6);i=0;u.vertices[i++]=-1;u.vertices[i++]=-1;u.vertices[i++]=0;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=-1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=0;u.vertices[i++]=-1;u.vertices[i++]=1;u.vertices[i++]=0;i=u.vertices[i++]=0;u.faces[i++]=0;u.faces[i++]=1;u.faces[i++]=2;u.faces[i++]=0;u.faces[i++]=2;u.faces[i++]=3;u.vertexBuffer=f.createBuffer();u.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER, -u.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,u.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,u.faces,f.STATIC_DRAW);u.program=f.createProgram();f.attachShader(u.program,ha("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(u.program,ha("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=f.getAttribLocation(u.program,"position");u.attributes.uv=f.getAttribLocation(u.program, -"uv");u.uniforms.uvOffset=f.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=f.getUniformLocation(u.program,"uvScale");u.uniforms.rotation=f.getUniformLocation(u.program,"rotation");u.uniforms.scale=f.getUniformLocation(u.program,"scale");u.uniforms.alignment=f.getUniformLocation(u.program,"alignment");u.uniforms.map=f.getUniformLocation(u.program,"map");u.uniforms.opacity=f.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=f.getUniformLocation(u.program,"useScreenCoordinates"); -u.uniforms.affectedByDistance=f.getUniformLocation(u.program,"affectedByDistance");u.uniforms.screenPosition=f.getUniformLocation(u.program,"screenPosition");u.uniforms.modelViewMatrix=f.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=f.getUniformLocation(u.program,"projectionMatrix");var Wa=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,e){Aa=b;Ia=c;Fa=d;xa=e;f.viewport(Aa,Ia,Fa,xa)};this.setScissor= -function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){T=b;f.depthMask(b)};this.setClearColorHex=function(b,c){ua.setHex(b);Pa=c;f.clearColor(ua.r,ua.g,ua.b,Pa)};this.setClearColor=function(b,c){ua.copy(b);Pa=c;f.clearColor(ua.r,ua.g,ua.b,Pa)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT|f.STENCIL_BUFFER_BIT)};this.getContext=function(){return f};this.initMaterial= -function(b,c,d,e){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader= -k.fragmentShader}var o,m,p;o=p=k=0;for(m=c.length;o=0&&f.enableVertexAttribArray(q.position);q.color>=0&&f.enableVertexAttribArray(q.color);q.normal>=0&&f.enableVertexAttribArray(q.normal);q.tangent>=0&&f.enableVertexAttribArray(q.tangent);b.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0&&(f.enableVertexAttribArray(q.skinVertexA),f.enableVertexAttribArray(q.skinVertexB),f.enableVertexAttribArray(q.skinIndex), -f.enableVertexAttribArray(q.skinWeight));if(b.attributes)for(g in b.attributes)q[g]!==void 0&&q[g]>=0&&f.enableVertexAttribArray(q[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g=0&&(f.enableVertexAttribArray(q[t]),b.numSupportedMorphTargets++)};this.render=function(b,c,f,m){var G,u,fa,A,K,R,B,D,F=b.lights,Oa=b.fog;this.shadowMapEnabled&&C(b,c);J.data.vertices=0;J.data.faces=0;J.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0, -!1,c);c.matrixWorldInverse.flattenToArray(Ra);c.projectionMatrix.flattenToArray(Ea);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Ca);this.initWebGLObjects(b);P(f);(this.autoClear||m)&&this.clear();K=b.__webglObjects.length;for(m=0;m=0;m--)if(G=b.__webglObjects[m],G.render){B=G.object;D=G.buffer;fa=G.opaque;g(B);for(G=0;G0||t.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(t.faceUvs.length>1||t.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(v*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(C*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];t=0;for(u=k.numMorphTargets;t=0;h--)d[h]==e&&d.splice(h,1)}else e instanceof -THREE.MarchingCubes&&za(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,pa,o));Aa&&(f.bindBuffer(f.ARRAY_BUFFER, -m.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,W,o));Ba&&sa.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,$,o));qa&&V>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,ia,o));qa&&Y>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,la,o));va&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,ha,o),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer), -f.bufferData(f.ELEMENT_ARRAY_BUFFER,Da,o));w>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,aa,o),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,ca,o),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,da,o),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,ea,o));E&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray, -delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;ya(k)}else if(g instanceof THREE.Ribbon){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=f.DYNAMIC_DRAW;k=C=v=v=void 0;t=g.vertices;m= -g.colors;q=t.length;o=m.length;r=g.__vertexArray;E=g.__colorArray;u=g.__dirtyColors;if(g.__dirtyVertices){for(v=0;v=0)e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position, +3,e.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,B=k.morphTargetForcedOrder,p=k.morphTargetInfluences;fr&&(E=D,r=p[E]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[E]);e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=r;B[E]=1;r= +-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[m],c.size,e.FLOAT,!1,0,0));b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer), +e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)): +e.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinWeightsBuffer), +e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(e.lineWidth(j.wireframeLinewidth),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),e.drawElements(e.LINES,h.__webglLineCount,e.UNSIGNED_SHORT,0)):(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),e.drawElements(e.TRIANGLES,h.__webglFaceCount,e.UNSIGNED_SHORT,0)),H.data.vertices+=h.__webglFaceCount,H.data.faces+=h.__webglFaceCount/3,H.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip? +e.LINE_STRIP:e.LINES,e.lineWidth(j.linewidth),e.drawArrays(k,0,h.__webglLineCount),H.data.drawCalls++):k instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),H.data.drawCalls++):k instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),H.data.drawCalls++)}}function j(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer), +e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,j,k,m,p,r,E,D,n,s=b.count*3;for(n=0;n=0;d--)b[d].object==c&&b.splice(d,1)}function ka(b){function c(b){var f=[];d=0;for(e=b.length;d65535&&(n[m].counter+=1,p=n[m].hash+"_"+n[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[], +materials:k,vertices:0,numMorphTargets:D})),b.geometryGroups[p].faces.push(f),b.geometryGroups[p].vertices+=j}function oa(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(b){if(b!=I){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD); +e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}I=b}}function M(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,V(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,V(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,V(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,V(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S, +e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,S(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,S(c.minFilter)))}function v(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture();e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),e.UNSIGNED_BYTE,b.image.data): +e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);M(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function U(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture); +M(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),M(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER, +b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&& +b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height, +h=f=0):(c=null,d=Da,b=Ea,f=Q,h=za);c!=Ra&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),Ra=c)}function N(b){b instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null))}function Z(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER)); +e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),console.error(c),null;return d}function S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT; +case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT; +case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var H=this,e,ua=[],Fa=null,Ra=null,va=!0,W=null,$=null,I=null,X=null,P=null,ma=null,ga=null,Q=0,za=0,Da=0,Ea=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, +new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Aa=new Float32Array(16),Ca=new Float32Array(16),Ka=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ya=b.stencil!==void 0?b.stencil:!0,Za=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,$a=b.antialias!==void 0?b.antialias:!1,wa=b.clearColor!==void 0?new THREE.Color(b.clearColor): +new THREE.Color(0),Ia=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ga;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var pa,La=[],b=THREE.ShaderLib.depthRGBA, +Wa=THREE.UniformsUtils.clone(b.uniforms),Qa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa}),Ua=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa,morphTargets:!0});Qa._shadowPass=!0;Ua._shadowPass=!0;try{if(!(e=Ga.getContext("experimental-webgl",{antialias:$a,stencil:Ya,preserveDrawingBuffer:Za})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+ +" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(ab){console.error(ab)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(wa.r,wa.g,wa.b,Ia);this.context=e;var Xa=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,u={};u.vertices=new Float32Array(16); +u.faces=new Uint16Array(6);i=0;u.vertices[i++]=-1;u.vertices[i++]=-1;u.vertices[i++]=0;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=-1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=0;u.vertices[i++]=-1;u.vertices[i++]=1;u.vertices[i++]=0;i=u.vertices[i++]=0;u.faces[i++]=0;u.faces[i++]=1;u.faces[i++]=2;u.faces[i++]=0;u.faces[i++]=2;u.faces[i++]=3;u.vertexBuffer=e.createBuffer();u.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER, +u.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,u.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,u.faces,e.STATIC_DRAW);u.program=e.createProgram();e.attachShader(u.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(u.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=e.getAttribLocation(u.program,"position");u.attributes.uv=e.getAttribLocation(u.program, +"uv");u.uniforms.uvOffset=e.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=e.getUniformLocation(u.program,"uvScale");u.uniforms.rotation=e.getUniformLocation(u.program,"rotation");u.uniforms.scale=e.getUniformLocation(u.program,"scale");u.uniforms.alignment=e.getUniformLocation(u.program,"alignment");u.uniforms.map=e.getUniformLocation(u.program,"map");u.uniforms.opacity=e.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=e.getUniformLocation(u.program,"useScreenCoordinates"); +u.uniforms.affectedByDistance=e.getUniformLocation(u.program,"affectedByDistance");u.uniforms.screenPosition=e.getUniformLocation(u.program,"screenPosition");u.uniforms.modelViewMatrix=e.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=e.getUniformLocation(u.program,"projectionMatrix");var Va=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,f){Q=b;za=c;Da=d;Ea=f;e.viewport(Q,za,Da,Ea)};this.setScissor= +function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){va=b;e.depthMask(b)};this.setClearColorHex=function(b,c){wa.setHex(b);Ia=c;e.clearColor(wa.r,wa.g,wa.b,Ia)};this.setClearColor=function(b,c){wa.copy(b);Ia=c;e.clearColor(wa.r,wa.g,wa.b,Ia)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.getContext=function(){return e};this.deallocateObject= +function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer); +e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets){var d=void 0,f=void 0;c.__webglMorphTargetsBuffers=[];d=0;for(f=c.numMorphTargets;d=0&&e.enableVertexAttribArray(r.position);r.color>=0&&e.enableVertexAttribArray(r.color);r.normal>=0&&e.enableVertexAttribArray(r.normal);r.tangent>=0&&e.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(e.enableVertexAttribArray(r.skinVertexA),e.enableVertexAttribArray(r.skinVertexB),e.enableVertexAttribArray(r.skinIndex), +e.enableVertexAttribArray(r.skinWeight));if(b.attributes)for(h in b.attributes)r[h]!==void 0&&r[h]>=0&&e.enableVertexAttribArray(r[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(e.enableVertexAttribArray(r[u]),b.numSupportedMorphTargets++)};this.render=function(b,c,e,n){var J,u,ha,B,v,T,E,D,L=b.lights,Pa=b.fog;this.shadowMapEnabled&&C(b,c);H.data.vertices=0;H.data.faces=0;H.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0, +!1,c);c.matrixWorldInverse.flattenToArray(Ca);c.projectionMatrix.flattenToArray(Aa);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);r(sa);this.initWebGLObjects(b);U(e);(this.autoClear||n)&&this.clear();v=b.__webglObjects.length;for(n=0;n=0;n--)if(J=b.__webglObjects[n],J.render){E=J.object;D=J.buffer;ha=J.opaque;h(E);for(J=0;J0||u.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray= +new Float32Array(p*4);m.__faceArray=new Uint16Array(w*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(C*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];u=0;for(v=m.numMorphTargets;u=0;j--)d[j]==f&&d.splice(j,1)}else f instanceof +THREE.MarchingCubes&&ya(d.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,ra,p));Ca&&(e.bindBuffer(e.ARRAY_BUFFER, +n.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,$,p));Da&&ta.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,aa,p));ua&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ma,p));ua&&Z>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,pa,p));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,p),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer), +e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ba,p));x>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,ca,p),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,da,p),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,ea,p),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,fa,p));F&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray, +delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;xa(m)}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=e.DYNAMIC_DRAW;m=C=w=w=void 0;u=h.vertices;n= +h.colors;r=u.length;p=n.length;s=h.__vertexArray;F=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w + + + three.js - webgl + + + + + + + + + + + + diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index c80c2f161bc4d9048fbea6f536420fe6fa5366e5..e23e70d9d4754605dc8fb9c67963c57c56b05c56 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -295,6 +295,53 @@ THREE.WebGLRenderer = function ( parameters ) { }; + this.deallocateObject = function ( object ) { + + if ( ! object.__webglInit ) return; + + object.__webglInit = false; + + delete object._modelViewMatrix; + + delete object._normalMatrixArray; + delete object._modelViewMatrixArray; + delete object._objectMatrixArray; + + if ( object instanceof THREE.Mesh ) { + + for ( g in object.geometry.geometryGroups ) { + + deleteMeshBuffers( object.geometry.geometryGroups[ g ] ); + + } + + } else if ( object instanceof THREE.Ribbon ) { + + deleteRibbonBuffers( object.geometry ); + + } else if ( object instanceof THREE.Line ) { + + deleteLineBuffers( object.geometry ); + + } else if ( object instanceof THREE.ParticleSystem ) { + + deleteParticleBuffers( object.geometry ); + + } + + }; + + this.deallocateTexture = function ( texture ) { + + if ( ! texture.__webglInit ) return; + + texture.__webglInit = false; + _gl.deleteTexture( texture.__webglTexture ); + + }; + + // + function setupLights ( program, lights ) { var l, ll, light, n, @@ -396,7 +443,9 @@ THREE.WebGLRenderer = function ( parameters ) { }; - function createParticleBuffers ( geometry ) { + // Buffer allocation + + function createParticleBuffers( geometry ) { geometry.__webglVertexBuffer = _gl.createBuffer(); geometry.__webglColorBuffer = _gl.createBuffer(); @@ -450,6 +499,64 @@ THREE.WebGLRenderer = function ( parameters ) { }; + // Buffer deallocation + + function deleteParticleBuffers( geometry ) { + + _gl.deleteBuffer( geometry.__webglVertexBuffer ); + _gl.deleteBuffer( geometry.__webglColorBuffer ); + + }; + + function deleteLineBuffers( geometry ) { + + _gl.deleteBuffer( geometry.__webglVertexBuffer ); + _gl.deleteBuffer( geometry.__webglColorBuffer ); + + }; + + function deleteRibbonBuffers( geometry ) { + + _gl.deleteBuffer( geometry.__webglVertexBuffer ); + _gl.deleteBuffer( geometry.__webglColorBuffer ); + + }; + + function deleteMeshBuffers( geometryGroup ) { + + _gl.deleteBuffer( geometryGroup.__webglVertexBuffer ); + _gl.deleteBuffer( geometryGroup.__webglNormalBuffer ); + _gl.deleteBuffer( geometryGroup.__webglTangentBuffer ); + _gl.deleteBuffer( geometryGroup.__webglColorBuffer ); + _gl.deleteBuffer( geometryGroup.__webglUVBuffer ); + _gl.deleteBuffer( geometryGroup.__webglUV2Buffer ); + + _gl.deleteBuffer( geometryGroup.__webglSkinVertexABuffer ); + _gl.deleteBuffer( geometryGroup.__webglSkinVertexBBuffer ); + _gl.deleteBuffer( geometryGroup.__webglSkinIndicesBuffer ); + _gl.deleteBuffer( geometryGroup.__webglSkinWeightsBuffer ); + + _gl.deleteBuffer( geometryGroup.__webglFaceBuffer ); + _gl.deleteBuffer( geometryGroup.__webglLineBuffer ); + + if ( geometryGroup.numMorphTargets ) { + + var m, ml; + + geometryGroup.__webglMorphTargetsBuffers = []; + + for ( m = 0, ml = geometryGroup.numMorphTargets; m < ml; m ++ ) { + + _gl.deleteBuffer( geometryGroup.__webglMorphTargetsBuffers[ m ] ); + + } + + } + + }; + + // + function initLineBuffers ( geometry ) { var nvertices = geometry.vertices.length; @@ -3951,7 +4058,9 @@ THREE.WebGLRenderer = function ( parameters ) { var g, geometry, geometryGroup; - if ( object._modelViewMatrix == undefined ) { + if ( ! object.__webglInit ) { + + object.__webglInit = true; object._modelViewMatrix = new THREE.Matrix4(); @@ -3961,106 +4070,107 @@ THREE.WebGLRenderer = function ( parameters ) { object.matrixWorld.flattenToArray( object._objectMatrixArray ); - } - if ( object instanceof THREE.Mesh ) { + if ( object instanceof THREE.Mesh ) { - geometry = object.geometry; + geometry = object.geometry; - if ( geometry.geometryGroups == undefined ) { + if ( geometry.geometryGroups == undefined ) { - sortFacesByMaterial( geometry ); + sortFacesByMaterial( geometry ); - } + } - // create separate VBOs per geometry chunk + // create separate VBOs per geometry chunk - for ( g in geometry.geometryGroups ) { + for ( g in geometry.geometryGroups ) { - geometryGroup = geometry.geometryGroups[ g ]; + geometryGroup = geometry.geometryGroups[ g ]; - // initialise VBO on the first access + // initialise VBO on the first access - if ( ! geometryGroup.__webglVertexBuffer ) { + if ( ! geometryGroup.__webglVertexBuffer ) { - createMeshBuffers( geometryGroup ); - initMeshBuffers( geometryGroup, object ); + createMeshBuffers( geometryGroup ); + initMeshBuffers( geometryGroup, object ); - geometry.__dirtyVertices = true; - geometry.__dirtyMorphTargets = true; - geometry.__dirtyElements = true; - geometry.__dirtyUvs = true; - geometry.__dirtyNormals = true; - geometry.__dirtyTangents = true; - geometry.__dirtyColors = true; + geometry.__dirtyVertices = true; + geometry.__dirtyMorphTargets = true; + geometry.__dirtyElements = true; + geometry.__dirtyUvs = true; + geometry.__dirtyNormals = true; + geometry.__dirtyTangents = true; + geometry.__dirtyColors = true; - } + } - addBuffer( scene.__webglObjects, geometryGroup, object ); + addBuffer( scene.__webglObjects, geometryGroup, object ); - } + } - } else if ( object instanceof THREE.Ribbon ) { + } else if ( object instanceof THREE.Ribbon ) { - geometry = object.geometry; + geometry = object.geometry; - if( ! geometry.__webglVertexBuffer ) { + if( ! geometry.__webglVertexBuffer ) { - createRibbonBuffers( geometry ); - initRibbonBuffers( geometry ); + createRibbonBuffers( geometry ); + initRibbonBuffers( geometry ); - geometry.__dirtyVertices = true; - geometry.__dirtyColors = true; + geometry.__dirtyVertices = true; + geometry.__dirtyColors = true; - } + } - addBuffer( scene.__webglObjects, geometry, object ); + addBuffer( scene.__webglObjects, geometry, object ); - } else if ( object instanceof THREE.Line ) { + } else if ( object instanceof THREE.Line ) { - geometry = object.geometry; + geometry = object.geometry; - if( ! geometry.__webglVertexBuffer ) { + if( ! geometry.__webglVertexBuffer ) { - createLineBuffers( geometry ); - initLineBuffers( geometry ); + createLineBuffers( geometry ); + initLineBuffers( geometry ); - geometry.__dirtyVertices = true; - geometry.__dirtyColors = true; + geometry.__dirtyVertices = true; + geometry.__dirtyColors = true; - } + } - addBuffer( scene.__webglObjects, geometry, object ); + addBuffer( scene.__webglObjects, geometry, object ); - } else if ( object instanceof THREE.ParticleSystem ) { + } else if ( object instanceof THREE.ParticleSystem ) { - geometry = object.geometry; + geometry = object.geometry; - if ( ! geometry.__webglVertexBuffer ) { + if ( ! geometry.__webglVertexBuffer ) { - createParticleBuffers( geometry ); - initParticleBuffers( geometry, object ); + createParticleBuffers( geometry ); + initParticleBuffers( geometry, object ); - geometry.__dirtyVertices = true; - geometry.__dirtyColors = true; + geometry.__dirtyVertices = true; + geometry.__dirtyColors = true; - } + } - addBuffer( scene.__webglObjects, geometry, object ); + addBuffer( scene.__webglObjects, geometry, object ); - } else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes ) { + } else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes ) { - addBufferImmediate( scene.__webglObjectsImmediate, object ); + addBufferImmediate( scene.__webglObjectsImmediate, object ); - } else if ( object instanceof THREE.Sprite ) { + } else if ( object instanceof THREE.Sprite ) { - scene.__webglSprites.push( object ); + scene.__webglSprites.push( object ); - } + } - /*else if ( object instanceof THREE.Particle ) { + /*else if ( object instanceof THREE.Particle ) { - }*/ + }*/ + + } }; @@ -4893,8 +5003,8 @@ THREE.WebGLRenderer = function ( parameters ) { if ( ! texture.__webglInit ) { - texture.__webglTexture = _gl.createTexture(); texture.__webglInit = true; + texture.__webglTexture = _gl.createTexture(); }