diff --git a/build/Three.js b/build/Three.js index e95a0e1b5ad1477080fce14fc4cdbabbe78329ac..080ed64ac073ad1e4076a5024d55bc27d78571e4 100755 --- a/build/Three.js +++ b/build/Three.js @@ -1,7 +1,7 @@ // Three.js r41/ROME - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)}; -THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;this.updateHex()},setHSV:function(b,c,d){var e,f,h,j,k,m;if(d==0)e=f=h=0;else switch(j=Math.floor(b*6),k=b*6-j,b=d*(1-c),m=d*(1-c*k),c=d*(1-c*(1-k)),j){case 1:e=m;f=d;h=b;break;case 2:e=b;f=d;h=c;break;case 3:e=b;f=m;h=d;break;case 4:e=c;f=b;h=d;break;case 5:e=d;f=b;h=m;break;case 6:case 0:e=d,f=c,h=b}this.setRGB(e, -f,h)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)}; +THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;this.updateHex()},setHSV:function(b,c,d){var e,g,h,j,k,m;if(d==0)e=g=h=0;else switch(j=Math.floor(b*6),k=b*6-j,b=d*(1-c),m=d*(1-c*k),c=d*(1-c*(1-k)),j){case 1:e=m;g=d;h=b;break;case 2:e=b;g=d;h=c;break;case 3:e=b;g=m;h=d;break;case 4:e=c;g=b;h=d;break;case 5:e=d;g=b;h=m;break;case 6:case 0:e=d,g=c,h=b}this.setRGB(e, +g,h)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)}; THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,c,d){this.set(b||0,c||0,d||0)}; THREE.Vector3.prototype={set:function(b,c,d){this.x=b;this.y=c;this.z=d;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y,b.z+c.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y,b.z-c.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b, @@ -11,69 +11,70 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,c,d,e){this.set(b||0,c||0,d||0,e||1)}; THREE.Vector4.prototype={set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y,b.z+c.z,b.w+c.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y,b.z-c.z,b.w-c.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x* b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,c){this.set(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)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e,f=[];c=0;for(d=b.length;c0&&b>0&&h+b<1}var d,e,f,h,j,k,m,n,p,o,u,t=b.geometry,v=t.vertices,C=[];d=0;for(e=t.faces.length;d0:p<0))if(n=n.dot((new THREE.Vector3).sub(h,o))/p,o=o.addSelf(u.multiplyScalar(n)),f instanceof THREE.Face3)c(o,h,j,k)&&(f={distance:this.origin.distanceTo(o),point:o,face:f,object:b},C.push(f));else if(f instanceof THREE.Face4&&(c(o,h,j,m)||c(o,j,k,m)))f={distance:this.origin.distanceTo(o),point:o,face:f,object:b},C.push(f);return C}}; -THREE.Rectangle=function(){function b(){h=e-c;j=f-d}var c,d,e,f,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,j,p,o){k=!1;c=h;d=j;e=p;f=o;b()};this.addPoint=function(h,j){k?(k=!1,c=h,d=j,e=h,f=j):(c=ch?e:h,f=f>j?f:j);b()};this.add3Points= -function(h,j,p,o,u,t){k?(k=!1,c=hp?h>u?h:u:p>u?p:u,f=j>o?j>t?j:t:o>t?o:t):(c=hp?h>u?h>e?h:e:u>e?u:e:p>u?p>e?p:e:u>e?u:e,f=j>o?j>t?j>f?j:f:t>f?t:f:o>t?o>f?o:f:t>f?t:f);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),d=h.getTop(),e=h.getRight(),f=h.getBottom()):(c=ch.getRight()?e:h.getRight(),f=f> -h.getBottom()?f:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;e+=h;f+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e=0&&Math.min(f,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;f=e=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,f,h,j,k,m,n,p,o,u,t,v,C){this.set(b||1,c||0,d||0,e||0,f||0,h||1,j||0,k||0,m||0,n||0,p||1,o||0,u||0,t||0,v||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,c,d,e,f,h,j,k,m,n,p,o,u,t,v,C){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=n;this.n33=p;this.n34=o;this.n41=u;this.n42=t;this.n43=v;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var e=THREE.Matrix4.__v1, -f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;e.cross(d,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(d,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,f=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*f;b.y=(this.n21*c+this.n22*d+this.n23* -e+this.n24)*f;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*f;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,f=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*f;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*f;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+d*this.n32+e*this.n33;b.normalize(); -return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,f=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,n=b.n24,p=b.n31,o=b.n32,u=b.n33,t=b.n34,v=b.n41,C=b.n42,E=b.n43,y=b.n44,D=c.n11,x=c.n12,I=c.n13,A=c.n14,z=c.n21,S=c.n22, -G=c.n23,M=c.n24,F=c.n31,N=c.n32,g=c.n33,Y=c.n34;this.n11=d*D+e*z+f*F;this.n12=d*x+e*S+f*N;this.n13=d*I+e*G+f*g;this.n14=d*A+e*M+f*Y+h;this.n21=j*D+k*z+m*F;this.n22=j*x+k*S+m*N;this.n23=j*I+k*G+m*g;this.n24=j*A+k*M+m*Y+n;this.n31=p*D+o*z+u*F;this.n32=p*x+o*S+u*N;this.n33=p*I+o*G+u*g;this.n34=p*A+o*M+u*Y+t;this.n41=v*D+C*z+E*F;this.n42=v*x+C*S+E*N;this.n43=v*I+C*G+E*g;this.n44=v*A+C*M+E*Y+y;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]= +THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var e=[],g=c(this.origin,this.direction,b);g&&g0:u<0))if(t=t.dot((new THREE.Vector3).sub(k,p))/u,p=p.addSelf(v.multiplyScalar(t)),j instanceof THREE.Face3)d(p,k,m,n)&&(j={distance:this.origin.distanceTo(p),point:p,face:j,object:b},e.push(j));else if(j instanceof THREE.Face4&&(d(p,k,m, +o)||d(p,m,n,o)))j={distance:this.origin.distanceTo(p),point:p,face:j,object:b},e.push(j);return e}}}; +THREE.Rectangle=function(){function b(){h=e-c;j=g-d}var c,d,e,g,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(h,j,o,t){k=!1;c=h;d=j;e=o;g=t;b()};this.addPoint=function(h,j){k?(k=!1,c=h,d=j,e=h,g=j):(c=ch?e:h,g=g>j?g:j);b()};this.add3Points= +function(h,j,o,t,u,p){k?(k=!1,c=ho?h>u?h:u:o>u?o:u,g=j>t?j>p?j:p:t>p?t:p):(c=ho?h>u?h>e?h:e:u>e?u:e:o>u?o>e?o:e:u>e?u:e,g=j>t?j>p?j>g?j:g:p>g?p:g:t>p?t>g?t:g:p>g?p:g);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),d=h.getTop(),e=h.getRight(),g=h.getBottom()):(c=ch.getRight()?e:h.getRight(),g=g> +h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;e+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e=0&&Math.min(g,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;g=e=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]}; +THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,g,h,j,k,m,n,o,t,u,p,v,C){this.set(b||1,c||0,d||0,e||0,g||0,h||1,j||0,k||0,m||0,n||0,o||1,t||0,u||0,p||0,v||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,c,d,e,g,h,j,k,m,n,o,t,u,p,v,C){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=n;this.n33=o;this.n34=t;this.n41=u;this.n42=p;this.n43=v;this.n44=C;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, +g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;e.cross(d,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(d,h).normalize());g.cross(h,e).normalize();this.n11=e.x;this.n12=g.x;this.n13=h.x;this.n21=e.y;this.n22=g.y;this.n23=h.y;this.n31=e.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,g=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)*g;b.y=(this.n21*c+this.n22*d+this.n23* +e+this.n24)*g;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,g=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*g;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*g;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*g;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*g;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,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,n=b.n24,o=b.n31,t=b.n32,u=b.n33,p=b.n34,v=b.n41,C=b.n42,E=b.n43,y=b.n44,D=c.n11,x=c.n12,I=c.n13,A=c.n14,z=c.n21,S=c.n22, +G=c.n23,M=c.n24,F=c.n31,N=c.n32,f=c.n33,Y=c.n34;this.n11=d*D+e*z+g*F;this.n12=d*x+e*S+g*N;this.n13=d*I+e*G+g*f;this.n14=d*A+e*M+g*Y+h;this.n21=j*D+k*z+m*F;this.n22=j*x+k*S+m*N;this.n23=j*I+k*G+m*f;this.n24=j*A+k*M+m*Y+n;this.n31=o*D+t*z+u*F;this.n32=o*x+t*S+u*N;this.n33=o*I+t*G+u*f;this.n34=o*A+t*M+u*Y+p;this.n41=v*D+C*z+E*F;this.n42=v*x+C*S+E*N;this.n43=v*I+C*G+E*f;this.n44=v*A+C*M+E*Y+y;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]= this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b= -this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,n=this.n32,p=this.n33,o=this.n34,u=this.n41,t=this.n42,v=this.n43,C=this.n44;return e*j*n*u-d*k*n*u-e*h*p*u+c*k*p*u+d*h*o*u-c*j*o*u-e*j*m*t+d*k*m*t+e*f*p*t-b*k*p*t-d*f*o*t+b*j*o*t+e*h*m*v-c*k*m*v-e*f*n*v+b*k*n*v+c*f*o*v-b*h*o*v-d*h*m*C+c*j*m*C+d*f*n*C-b*j*n*C-c*f*p*C+b*h*p*C},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.n11,c=this.n12,d=this.n13,e=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,n=this.n32,o=this.n33,t=this.n34,u=this.n41,p=this.n42,v=this.n43,C=this.n44;return e*j*n*u-d*k*n*u-e*h*o*u+c*k*o*u+d*h*t*u-c*j*t*u-e*j*m*p+d*k*m*p+e*g*o*p-b*k*o*p-d*g*t*p+b*j*t*p+e*h*m*v-c*k*m*v-e*g*n*v+b*k*n*v+c*g*t*v-b*h*t*v-d*h*m*C+c*j*m*C+d*g*n*C-b*j*n*C-c*g*o*C+b*h*o*C},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),f=1-d,h=b.x,j=b.y,k=b.z,m=f*h,n=f*j;this.set(m* -h+d,m*j-e*k,m*k+e*j,0,m*j+e*k,n*j+d,n*k-e*h,0,m*k-e*j,n*k+e*h,f*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){var c=b.x,d=b.y,e=b.z,b=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),j=b*d,k=c*d;this.n11=f*h;this.n12=-f*e;this.n13=d;this.n21=k*h+b*e;this.n22=-k*e+b*h;this.n23=-c*f;this.n31=-j*h+c*e;this.n32=j*e+c*h;this.n33=b*f;return this}, -setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,f=b.w,h=c+c,j=d+d,k=e+e,b=c*h,m=c*j;c*=k;var n=d*j;d*=k;e*=k;h*=f;j*=f;f*=k;this.n11=1-(n+e);this.n12=m-f;this.n13=c+j;this.n21=m+f;this.n22=1-(b+e);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14= -b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,f=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*f;this.n23=b.n23*f;this.n33=b.n33*f}}; -THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,f=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,n=b.n24,p=b.n31,o=b.n32,u=b.n33,t=b.n34,v=b.n41,C=b.n42,E=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*t*C-n*u*C+n*o*E-k*t*E-m*o*y+k*u*y;c.n12=h*u*C-f*t*C-h*o*E+e*t*E+f*o*y-e*u*y;c.n13=f*n*C-h*m*C+h*k*E-e*n*E-f*k*y+e*m*y;c.n14=h*m*o-f*n*o-h*k*u+e*n*u+f*k*t-e*m*t;c.n21=n*u*v-m*t*v-n*p*E+j*t*E+m*p*y-j*u*y;c.n22=f*t*v-h*u*v+h*p*E-d*t*E-f*p*y+d*u*y;c.n23=h*m*v-f*n*v-h*j*E+d*n*E+f*j*y-d*m*y;c.n24= -f*n*p-h*m*p+h*j*u-d*n*u-f*j*t+d*m*t;c.n31=k*t*v-n*o*v+n*p*C-j*t*C-k*p*y+j*o*y;c.n32=h*o*v-e*t*v-h*p*C+d*t*C+e*p*y-d*o*y;c.n33=f*n*v-h*k*v+h*j*C-d*n*C-e*j*y+d*k*y;c.n34=h*k*p-e*n*p-h*j*o+d*n*o+e*j*t-d*k*t;c.n41=m*o*v-k*u*v-m*p*C+j*u*C+k*p*E-j*o*E;c.n42=e*u*v-f*o*v+f*p*C-d*u*C-e*p*E+d*o*E;c.n43=f*k*v-e*m*v-f*j*C+d*m*C+e*j*E-d*k*E;c.n44=e*m*p-f*k*p+f*j*o-d*m*o-e*j*u+d*k*u;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,f=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,o=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*n;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*n;d[7]=b*p;d[8]=b*o;return c}; -THREE.Matrix4.makeFrustum=function(b,c,d,e,f,h){var j;j=new THREE.Matrix4;j.n11=2*f/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*f/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+f)/(h-f);j.n34=-2*h*f/(h-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var f,b=d*Math.tan(b*Math.PI/360);f=-b;return THREE.Matrix4.makeFrustum(f*c,b*c,f,b,d,e)}; -THREE.Matrix4.makeOrtho=function(b,c,d,e,f,h){var j,k,m,n;j=new THREE.Matrix4;k=c-b;m=d-e;n=h-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+e)/m);j.n31=0;j.n32=0;j.n33=-2/n;j.n34=-((h+f)/n);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; +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),g=1-d,h=b.x,j=b.y,k=b.z,m=g*h,n=g*j;this.set(m* +h+d,m*j-e*k,m*k+e*j,0,m*j+e*k,n*j+d,n*k-e*h,0,m*k-e*j,n*k+e*h,g*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){var c=b.x,d=b.y,e=b.z,b=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),j=b*d,k=c*d;this.n11=g*h;this.n12=-g*e;this.n13=d;this.n21=k*h+b*e;this.n22=-k*e+b*h;this.n23=-c*g;this.n31=-j*h+c*e;this.n32=j*e+c*h;this.n33=b*g;return this}, +setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,g=b.w,h=c+c,j=d+d,k=e+e,b=c*h,m=c*j;c*=k;var n=d*j;d*=k;e*=k;h*=g;j*=g;g*=k;this.n11=1-(n+e);this.n12=m-g;this.n13=c+j;this.n21=m+g;this.n22=1-(b+e);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},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,g=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*g;this.n23=b.n23*g;this.n33=b.n33*g}}; +THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,n=b.n24,o=b.n31,t=b.n32,u=b.n33,p=b.n34,v=b.n41,C=b.n42,E=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*p*C-n*u*C+n*t*E-k*p*E-m*t*y+k*u*y;c.n12=h*u*C-g*p*C-h*t*E+e*p*E+g*t*y-e*u*y;c.n13=g*n*C-h*m*C+h*k*E-e*n*E-g*k*y+e*m*y;c.n14=h*m*t-g*n*t-h*k*u+e*n*u+g*k*p-e*m*p;c.n21=n*u*v-m*p*v-n*o*E+j*p*E+m*o*y-j*u*y;c.n22=g*p*v-h*u*v+h*o*E-d*p*E-g*o*y+d*u*y;c.n23=h*m*v-g*n*v-h*j*E+d*n*E+g*j*y-d*m*y;c.n24= +g*n*o-h*m*o+h*j*u-d*n*u-g*j*p+d*m*p;c.n31=k*p*v-n*t*v+n*o*C-j*p*C-k*o*y+j*t*y;c.n32=h*t*v-e*p*v-h*o*C+d*p*C+e*o*y-d*t*y;c.n33=g*n*v-h*k*v+h*j*C-d*n*C-e*j*y+d*k*y;c.n34=h*k*o-e*n*o-h*j*t+d*n*t+e*j*p-d*k*p;c.n41=m*t*v-k*u*v-m*o*C+j*u*C+k*o*E-j*t*E;c.n42=e*u*v-g*t*v+g*o*C-d*u*C-e*o*E+d*t*E;c.n43=g*k*v-e*m*v-g*j*C+d*m*C+e*j*E-d*k*E;c.n44=e*m*o-g*k*o+g*j*t-d*m*t-e*j*u+d*k*u;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*g;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*n;d[7]=b*o;d[8]=b*t;return c}; +THREE.Matrix4.makeFrustum=function(b,c,d,e,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*g/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var g,b=d*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,d,e)}; +THREE.Matrix4.makeOrtho=function(b,c,d,e,g,h){var j,k,m,n;j=new THREE.Matrix4;k=c-b;m=d-e;n=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+e)/m);j.n31=0;j.n32=0;j.n33=-2/n;j.n34=-((h+g)/n);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.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1; this.visible=!0;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={translate:function(b,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,f;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 h=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<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;f=Math.sin((1-e)*h)/j;e=Math.sin(e*h)/j;d.w=b.w*f+c.w*e;d.x=b.x*f+c.x*e;d.y=b.y*f+c.y*e;d.z=b.z*f+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; -THREE.Face3=function(b,c,d,e,f,h){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3}; -THREE.Face4=function(b,c,d,e,f,h,j){this.a=b;this.b=c;this.c=d;this.d=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=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)}; +multiplySelf:function(b){var c=this.x,d=this.y,e=this.z,g=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+g*h+d*k-e*j;this.y=d*b+g*j+e*h-c*k;this.z=e*b+g*k+c*j-d*h;this.w=g*b-c*h-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,n=m*d+j*g-k*e,o= +m*e+k*d-h*g,t=m*g+h*e-j*d,d=-h*d-j*e-k*g;c.x=n*m+d*-h+o*-k-t*-j;c.y=o*m+d*-j+t*-h-n*-k;c.z=t*m+d*-k+n*-j-o*-h;return c}}; +THREE.Quaternion.slerp=function(b,c,d,e){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<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;g=Math.sin((1-e)*h)/j;e=Math.sin(e*h)/j;d.w=b.w*g+c.w*e;d.x=b.x*g+c.x*e;d.y=b.y*g+c.y*e;d.z=b.z*g+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; +THREE.Face3=function(b,c,d,e,g,h){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3}; +THREE.Face4=function(b,c,d,e,g,h,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)}; THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var b,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=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;cthis.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;n=this.points[d[0]];p=this.points[d[1]]; -o=this.points[d[2]];u=this.points[d[3]];k=j*j;m=j*k;e.x=c(n.x,p.x,o.x,u.x,j,k,m);e.y=c(n.y,p.y,o.y,u.y,j,k,m);e.z=c(n.z,p.z,o.z,u.z,j,k,m);return e};this.getControlPointsArray=function(){var b,d,c=this.points.length,e=[];for(b=0;bthis.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;n=this.points[d[0]];o=this.points[d[1]]; +t=this.points[d[2]];u=this.points[d[3]];k=j*j;m=j*k;e.x=c(n.x,o.x,t.x,u.x,j,k,m);e.y=c(n.y,o.y,t.y,u.y,j,k,m);e.z=c(n.z,o.z,t.z,u.z,j,k,m);return e};this.getControlPointsArray=function(){var b,d,c=this.points.length,e=[];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(;eo&&(d=p,p=o,o=d):pt&&(d=u,u=t,t=d):ut&&(d=o,o=t,t=d):op&&(d=u,u=p,p=d):u=0&&h>=0&&j>=0&&k>=0?!0:f<0&&h<0||j<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),j<0?c=Math.max(c,j/(j-k)):k<0&&(e=Math.min(e,j/(j-k))),eI&&j.positionScreen.z=0&&h>=0&&j>=0&&k>=0?!0:g<0&&h<0||j<0&&k<0?!1:(g<0?c=Math.max(c,g/(g-h)):h<0&&(e=Math.min(e,g/(g-h))),j<0?c=Math.max(c,j/(j-k)):k<0&&(e=Math.min(e,j/(j-k))),eI&&j.positionScreen.z0&&A.z<1))P=x[D]=x[D]||new THREE.RenderableParticle,D++,y=P,y.x=A.x/A.w,y.y=A.y/A.w,y.z=A.z,y.rotation=R.rotation.z,y.scale.x=R.scale.x*Math.abs(y.x-(A.x+g.projectionMatrix.n11)/(A.w+ -g.projectionMatrix.n14)),y.scale.y=R.scale.y*Math.abs(y.y-(A.y+g.projectionMatrix.n22)/(A.w+g.projectionMatrix.n24)),y.materials=R.materials,h.push(y);f&&h.sort(c);return h}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,e,f,h;this.domElement=document.createElement("div");this.setSize=function(b,c){d=b;e=c;f=d/2;h=e/2};this.render=function(d,e){var m,n,p,o,u,t,v,C;b=c.projectScene(d,e);m=0;for(n=b.length;m0&&A.z<1))P=x[D]=x[D]||new THREE.RenderableParticle,D++,y=P,y.x=A.x/A.w,y.y=A.y/A.w,y.z=A.z,y.rotation=R.rotation.z,y.scale.x=R.scale.x*Math.abs(y.x-(A.x+f.projectionMatrix.n11)/(A.w+ +f.projectionMatrix.n14)),y.scale.y=R.scale.y*Math.abs(y.y-(A.y+f.projectionMatrix.n22)/(A.w+f.projectionMatrix.n24)),y.materials=R.materials,h.push(y);g&&h.sort(c);return h}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,e,g,h;this.domElement=document.createElement("div");this.setSize=function(b,c){d=b;e=c;g=d/2;h=e/2};this.render=function(d,e){var m,n,o,t,u,p,v,C;b=c.projectScene(d,e);m=0;for(n=b.length;m>1,p=m.height>>1, -h=g.scale.x*u,ia=g.scale.y*t,j=h*n,k=ia*p,qa.set(b.x-j,b.y-k,b.x+j,b.y+k),ra.instersects(qa)&&(v.save(),v.translate(b.x,b.y),v.rotate(-g.rotation),v.scale(h,-ia),v.translate(-n,-p),v.drawImage(m,0,0),v.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(j=g.scale.x*u,k=g.scale.y*t,qa.set(b.x-j,b.y-k,b.x+j,b.y+k),ra.instersects(qa)&&(e(h.color),f(h.color),v.save(),v.translate(b.x,b.y),v.rotate(-g.rotation),v.scale(j,k),h.program(v),v.restore()))}function y(b,g,h,f){c(f.opacity);d(f.blending); -v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(g.positionScreen.x,g.positionScreen.y);v.closePath();if(f instanceof THREE.LineBasicMaterial){b=f.linewidth;if(A!=b)v.lineWidth=A=b;b=f.linecap;if(z!=b)v.lineCap=z=b;b=f.linejoin;if(S!=b)v.lineJoin=S=b;e(f.color);v.stroke();qa.inflate(f.linewidth*2)}}function x(b,g,e,f,k,ia,m,n,o){j.data.vertices+=3;j.data.faces++;c(n.opacity);d(n.blending);O=b.positionScreen.x;V=b.positionScreen.y;L=g.positionScreen.x;$=g.positionScreen.y;T=e.positionScreen.x; -Q=e.positionScreen.y;E(O,V,L,$,T,Q);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],w(O,V,L,$,T,Q,n.map.image,la[f].u,la[f].v,la[k].u,la[k].v,la[ia].u,la[ia].v));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,oa.copy(m.vertexNormalsWorld[0]),ma=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,ya=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(m.vertexNormalsWorld[1]),va=(oa.x*b.n11+oa.y* -b.n12+oa.z*b.n13)*0.5+0.5,Z=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(m.vertexNormalsWorld[2]),K=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,wa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,w(O,V,L,$,T,Q,n.envMap.image,ma,ya,va,Z,K,wa)}else n.wireframe?B(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],w(O,V,L,$,T,Q,n.map.image,la[f].u,la[f].v, -la[k].u,la[k].v,la[ia].u,la[ia].v)),d(THREE.SubtractiveBlending)),Sa?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(P.r=W.r=X.r=sa.r,P.g=W.g=X.g=sa.g,P.b=W.b=X.b=sa.b,p(o,m.v1.positionWorld,m.vertexNormalsWorld[0],P),p(o,m.v2.positionWorld,m.vertexNormalsWorld[1],W),p(o,m.v3.positionWorld,m.vertexNormalsWorld[2],X),ea.r=(W.r+X.r)*0.5,ea.g=(W.g+X.g)*0.5,ea.b=(W.b+X.b)*0.5,da=Pa(P,W,X,ea),w(O,V,L,$,T,Q,da,0,0,1,0,0,1)):(na.r=sa.r,na.g=sa.g,na.b=sa.b,p(o,m.centroidWorld, -m.normalWorld,na),R.r=Math.max(0,Math.min(n.color.r*na.r,1)),R.g=Math.max(0,Math.min(n.color.g*na.g,1)),R.b=Math.max(0,Math.min(n.color.b*na.b,1)),R.updateHex(),n.wireframe?B(R,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(R)):n.wireframe?B(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(n.color);else if(n instanceof THREE.MeshDepthMaterial)ha=h.near,J=h.far,P.r=P.g=P.b=1-Ca(b.positionScreen.z,ha,J),W.r=W.g=W.b=1-Ca(g.positionScreen.z,ha,J),X.r=X.g=X.b=1-Ca(e.positionScreen.z, -ha,J),ea.r=(W.r+X.r)*0.5,ea.g=(W.g+X.g)*0.5,ea.b=(W.b+X.b)*0.5,da=Pa(P,W,X,ea),w(O,V,L,$,T,Q,da,0,0,1,0,0,1);else if(n instanceof THREE.MeshNormalMaterial)R.r=Ha(m.normalWorld.x),R.g=Ha(m.normalWorld.y),R.b=Ha(m.normalWorld.z),R.updateHex(),n.wireframe?B(R,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(R)}function C(b,g,e,f,k,ia,m,n,o){j.data.vertices+=4;j.data.faces++;c(n.opacity);d(n.blending);if(n.map||n.envMap)x(b,g,f,0,1,3,m,n,o),x(k,e,ia,1,2,3,m,n,o);else if(O=b.positionScreen.x, -V=b.positionScreen.y,L=g.positionScreen.x,$=g.positionScreen.y,T=e.positionScreen.x,Q=e.positionScreen.y,fa=f.positionScreen.x,U=f.positionScreen.y,ka=k.positionScreen.x,ga=k.positionScreen.y,ca=ia.positionScreen.x,aa=ia.positionScreen.y,n instanceof THREE.MeshBasicMaterial)I(O,V,L,$,T,Q,fa,U),n.wireframe?B(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(n.color);else if(n instanceof THREE.MeshLambertMaterial)Sa?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length== -4?(P.r=W.r=X.r=ea.r=sa.r,P.g=W.g=X.g=ea.g=sa.g,P.b=W.b=X.b=ea.b=sa.b,p(o,m.v1.positionWorld,m.vertexNormalsWorld[0],P),p(o,m.v2.positionWorld,m.vertexNormalsWorld[1],W),p(o,m.v4.positionWorld,m.vertexNormalsWorld[3],X),p(o,m.v3.positionWorld,m.vertexNormalsWorld[2],ea),da=Pa(P,W,X,ea),E(O,V,L,$,fa,U),w(O,V,L,$,fa,U,da,0,0,1,0,0,1),E(ka,ga,T,Q,ca,aa),w(ka,ga,T,Q,ca,aa,da,1,0,1,1,0,1)):(na.r=sa.r,na.g=sa.g,na.b=sa.b,p(o,m.centroidWorld,m.normalWorld,na),R.r=Math.max(0,Math.min(n.color.r*na.r,1)),R.g= +faces:0};this.setSize=function(b,d){o=b;t=d;u=o/2;p=t/2;n.width=o;n.height=t;ra.set(-u,-p,u,p);y=1;D=0;S=z=A=I=x=null};this.setClearColor=function(b,d){C=b;E=d};this.setClearColorHex=function(b,d){C.setHex(b);E=d};this.clear=function(){v.setTransform(1,0,0,-1,u,p);if(!ia.isEmpty())ia.inflate(1),ia.minSelf(ra),C.hex==0&&E==0?v.clearRect(ia.getX(),ia.getY(),ia.getWidth(),ia.getHeight()):(d(THREE.NormalBlending),c(1),v.fillStyle="rgba("+Math.floor(C.r*255)+","+Math.floor(C.g*255)+","+Math.floor(C.b* +255)+","+E+")",v.fillRect(ia.getX(),ia.getY(),ia.getWidth(),ia.getHeight())),ia.empty()};this.render=function(b,h){function n(b){var d,c,f,e=b.lights;sa.setRGB(0,0,0);Ma.setRGB(0,0,0);Na.setRGB(0,0,0);b=0;for(d=e.length;b>1,n=m.height>>1, +h=f.scale.x*u,ia=f.scale.y*p,j=h*o,k=ia*n,qa.set(b.x-j,b.y-k,b.x+j,b.y+k),ra.instersects(qa)&&(v.save(),v.translate(b.x,b.y),v.rotate(-f.rotation),v.scale(h,-ia),v.translate(-o,-n),v.drawImage(m,0,0),v.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(j=f.scale.x*u,k=f.scale.y*p,qa.set(b.x-j,b.y-k,b.x+j,b.y+k),ra.instersects(qa)&&(e(h.color),g(h.color),v.save(),v.translate(b.x,b.y),v.rotate(-f.rotation),v.scale(j,k),h.program(v),v.restore()))}function y(b,f,h,g){c(g.opacity);d(g.blending); +v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(f.positionScreen.x,f.positionScreen.y);v.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(A!=b)v.lineWidth=A=b;b=g.linecap;if(z!=b)v.lineCap=z=b;b=g.linejoin;if(S!=b)v.lineJoin=S=b;e(g.color);v.stroke();qa.inflate(g.linewidth*2)}}function x(b,f,e,g,k,ia,m,n,p){j.data.vertices+=3;j.data.faces++;c(n.opacity);d(n.blending);O=b.positionScreen.x;V=b.positionScreen.y;L=f.positionScreen.x;$=f.positionScreen.y;T=e.positionScreen.x; +Q=e.positionScreen.y;E(O,V,L,$,T,Q);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],w(O,V,L,$,T,Q,n.map.image,la[g].u,la[g].v,la[k].u,la[k].v,la[ia].u,la[ia].v));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,oa.copy(m.vertexNormalsWorld[0]),ma=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,ya=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(m.vertexNormalsWorld[1]),va=(oa.x*b.n11+oa.y* +b.n12+oa.z*b.n13)*0.5+0.5,Z=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(m.vertexNormalsWorld[2]),K=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,wa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,w(O,V,L,$,T,Q,n.envMap.image,ma,ya,va,Z,K,wa)}else n.wireframe?B(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(la=m.uvs[0],w(O,V,L,$,T,Q,n.map.image,la[g].u,la[g].v, +la[k].u,la[k].v,la[ia].u,la[ia].v)),d(THREE.SubtractiveBlending)),Sa?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(P.r=W.r=X.r=sa.r,P.g=W.g=X.g=sa.g,P.b=W.b=X.b=sa.b,o(p,m.v1.positionWorld,m.vertexNormalsWorld[0],P),o(p,m.v2.positionWorld,m.vertexNormalsWorld[1],W),o(p,m.v3.positionWorld,m.vertexNormalsWorld[2],X),ea.r=(W.r+X.r)*0.5,ea.g=(W.g+X.g)*0.5,ea.b=(W.b+X.b)*0.5,da=Pa(P,W,X,ea),w(O,V,L,$,T,Q,da,0,0,1,0,0,1)):(na.r=sa.r,na.g=sa.g,na.b=sa.b,o(p,m.centroidWorld, +m.normalWorld,na),R.r=Math.max(0,Math.min(n.color.r*na.r,1)),R.g=Math.max(0,Math.min(n.color.g*na.g,1)),R.b=Math.max(0,Math.min(n.color.b*na.b,1)),R.updateHex(),n.wireframe?B(R,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(R)):n.wireframe?B(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(n.color);else if(n instanceof THREE.MeshDepthMaterial)ha=h.near,J=h.far,P.r=P.g=P.b=1-Ca(b.positionScreen.z,ha,J),W.r=W.g=W.b=1-Ca(f.positionScreen.z,ha,J),X.r=X.g=X.b=1-Ca(e.positionScreen.z, +ha,J),ea.r=(W.r+X.r)*0.5,ea.g=(W.g+X.g)*0.5,ea.b=(W.b+X.b)*0.5,da=Pa(P,W,X,ea),w(O,V,L,$,T,Q,da,0,0,1,0,0,1);else if(n instanceof THREE.MeshNormalMaterial)R.r=Ha(m.normalWorld.x),R.g=Ha(m.normalWorld.y),R.b=Ha(m.normalWorld.z),R.updateHex(),n.wireframe?B(R,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(R)}function C(b,f,e,g,k,ia,m,n,p){j.data.vertices+=4;j.data.faces++;c(n.opacity);d(n.blending);if(n.map||n.envMap)x(b,f,g,0,1,3,m,n,p),x(k,e,ia,1,2,3,m,n,p);else if(O=b.positionScreen.x, +V=b.positionScreen.y,L=f.positionScreen.x,$=f.positionScreen.y,T=e.positionScreen.x,Q=e.positionScreen.y,fa=g.positionScreen.x,U=g.positionScreen.y,ka=k.positionScreen.x,ga=k.positionScreen.y,ca=ia.positionScreen.x,aa=ia.positionScreen.y,n instanceof THREE.MeshBasicMaterial)I(O,V,L,$,T,Q,fa,U),n.wireframe?B(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(n.color);else if(n instanceof THREE.MeshLambertMaterial)Sa?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length== +4?(P.r=W.r=X.r=ea.r=sa.r,P.g=W.g=X.g=ea.g=sa.g,P.b=W.b=X.b=ea.b=sa.b,o(p,m.v1.positionWorld,m.vertexNormalsWorld[0],P),o(p,m.v2.positionWorld,m.vertexNormalsWorld[1],W),o(p,m.v4.positionWorld,m.vertexNormalsWorld[3],X),o(p,m.v3.positionWorld,m.vertexNormalsWorld[2],ea),da=Pa(P,W,X,ea),E(O,V,L,$,fa,U),w(O,V,L,$,fa,U,da,0,0,1,0,0,1),E(ka,ga,T,Q,ca,aa),w(ka,ga,T,Q,ca,aa,da,1,0,1,1,0,1)):(na.r=sa.r,na.g=sa.g,na.b=sa.b,o(p,m.centroidWorld,m.normalWorld,na),R.r=Math.max(0,Math.min(n.color.r*na.r,1)),R.g= Math.max(0,Math.min(n.color.g*na.g,1)),R.b=Math.max(0,Math.min(n.color.b*na.b,1)),R.updateHex(),I(O,V,L,$,T,Q,fa,U),n.wireframe?B(R,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(R)):(I(O,V,L,$,T,Q,fa,U),n.wireframe?B(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):D(n.color));else if(n instanceof THREE.MeshNormalMaterial)R.r=Ha(m.normalWorld.x),R.g=Ha(m.normalWorld.y),R.b=Ha(m.normalWorld.z),R.updateHex(),I(O,V,L,$,T,Q,fa,U),n.wireframe?B(R,n.wireframeLinewidth, -n.wireframeLinecap,n.wireframeLinejoin):D(R);else if(n instanceof THREE.MeshDepthMaterial)ha=h.near,J=h.far,P.r=P.g=P.b=1-Ca(b.positionScreen.z,ha,J),W.r=W.g=W.b=1-Ca(g.positionScreen.z,ha,J),X.r=X.g=X.b=1-Ca(f.positionScreen.z,ha,J),ea.r=ea.g=ea.b=1-Ca(e.positionScreen.z,ha,J),da=Pa(P,W,X,ea),E(O,V,L,$,fa,U),w(O,V,L,$,fa,U,da,0,0,1,0,0,1),E(ka,ga,T,Q,ca,aa),w(ka,ga,T,Q,ca,aa,da,1,0,1,1,0,1)}function E(b,d,c,g,e,f){v.beginPath();v.moveTo(b,d);v.lineTo(c,g);v.lineTo(e,f);v.lineTo(b,d);v.closePath()} -function I(b,d,c,g,e,f,h,j){v.beginPath();v.moveTo(b,d);v.lineTo(c,g);v.lineTo(e,f);v.lineTo(h,j);v.lineTo(b,d);v.closePath()}function B(b,d,c,g){if(A!=d)v.lineWidth=A=d;if(z!=c)v.lineCap=z=c;if(S!=g)v.lineJoin=S=g;e(b);v.stroke();qa.inflate(d*2)}function D(b){f(b);v.fill()}function w(b,d,c,g,e,f,h,j,k,ia,n,m,p){var o,na;o=h.width-1;na=h.height-1;j*=o;k*=na;ia*=o;n*=na;m*=o;p*=na;c-=b;g-=d;e-=b;f-=d;ia-=j;n-=k;m-=j;p-=k;o=ia*p-m*n;o!=0&&(na=1/o,o=(p*c-n*e)*na,n=(p*g-n*f)*na,c=(ia*e-m*c)*na,g=(ia* -f-m*g)*na,b=b-o*j-c*k,d=d-n*j-g*k,v.save(),v.transform(o,n,c,g,b,d),v.clip(),v.drawImage(h,0,0),v.restore())}function Pa(b,d,c,g){var e=~~(b.r*255),f=~~(b.g*255),b=~~(b.b*255),h=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255),k=~~(c.r*255),ia=~~(c.g*255),c=~~(c.b*255),n=~~(g.r*255),m=~~(g.g*255),g=~~(g.b*255);ta[0]=e<0?0:e>255?255:e;ta[1]=f<0?0:f>255?255:f;ta[2]=b<0?0:b>255?255:b;ta[4]=h<0?0:h>255?255:h;ta[5]=j<0?0:j>255?255:j;ta[6]=d<0?0:d>255?255:d;ta[8]=k<0?0:k>255?255:k;ta[9]=ia<0?0:ia>255?255:ia;ta[10]= -c<0?0:c>255?255:c;ta[12]=n<0?0:n>255?255:n;ta[13]=m<0?0:m>255?255:m;ta[14]=g<0?0:g>255?255:g;Ka.putImageData(Ta,0,0);Oa.drawImage(Ja,0,0);return La}function Ca(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function Ha(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function za(b,d){var c=d.x-b.x,g=d.y-b.y,e=1/Math.sqrt(c*c+g*g);c*=e;g*=e;d.x+=c;d.y+=g;b.x-=c;b.y-=g}var Qa,Ya,ja,ua,Aa,Ia,Ra,H;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,t);j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,h,this.sortElements); -(Sa=b.lights.length>0)&&n(b);Qa=0;for(Ya=k.length;Qa0&&(c.r+=f.color.r*h,c.g+=f.color.g*h,c.b+=f.color.b*h)):f instanceof THREE.PointLight&&(N.sub(f.position,d.centroidWorld),N.normalize(),h=d.normalWorld.dot(N)*f.intensity,h>0&&(c.r+=f.color.r*h,c.g+=f.color.g*h,c.b+=f.color.b*h))}function c(d,c,g,k,m,p){j.data.vertices+=3;j.data.faces++;O=e(V++);O.setAttribute("d", -"M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?A.hex=m.color.hex:m instanceof THREE.MeshLambertMaterial?I?(z.r=S.r,z.g=S.g,z.b=S.b,b(p,k,z),A.r=Math.max(0,Math.min(m.color.r*z.r,1)),A.g=Math.max(0,Math.min(m.color.g*z.g,1)),A.b=Math.max(0,Math.min(m.color.b*z.b,1)),A.updateHex()):A.hex=m.color.hex:m instanceof THREE.MeshDepthMaterial?(F=1-m.__2near/(m.__farPlusNear- -k.z*m.__farMinusNear),A.setRGB(F,F,F)):m instanceof THREE.MeshNormalMaterial&&A.setRGB(f(k.normalWorld.x),f(k.normalWorld.y),f(k.normalWorld.z));m.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(A.hex.toString(16))+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):O.setAttribute("style","fill: #"+h(A.hex.toString(16))+"; fill-opacity: "+m.opacity);n.appendChild(O)}function d(d,c,g,k, -m,p,o){j.data.vertices+=4;j.data.faces++;O=e(V++);O.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?A.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?I?(z.r=S.r,z.g=S.g,z.b=S.b,b(o,m,z),A.r=Math.max(0,Math.min(p.color.r*z.r,1)),A.g=Math.max(0,Math.min(p.color.g*z.g,1)),A.b=Math.max(0,Math.min(p.color.b* -z.b,1)),A.updateHex()):A.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(F=1-p.__2near/(p.__farPlusNear-m.z*p.__farMinusNear),A.setRGB(F,F,F)):p instanceof THREE.MeshNormalMaterial&&A.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));p.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(A.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):O.setAttribute("style", -"fill: #"+h(A.hex.toString(16))+"; fill-opacity: "+p.opacity);n.appendChild(O)}function e(b){g[b]==null&&(g[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),$==0&&g[b].setAttribute("shape-rendering","crispEdges"));return g[b]}function f(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,m=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,o,u,t,v,C,E,y,D=new THREE.Rectangle,x=new THREE.Rectangle,I= -!1,A=new THREE.Color(16777215),z=new THREE.Color(16777215),S=new THREE.Color(0),G=new THREE.Color(0),M=new THREE.Color(0),F,N=new THREE.Vector3,g=[],Y=[],O,V,L,$=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":$=1;break;case "low":$=0}};this.setSize=function(b,d){p=b;o=d;u=p/2;t=o/2;n.setAttribute("viewBox",-u+" "+-t+" "+p+" "+o);n.setAttribute("width",p);n.setAttribute("height",o);D.set(-u,-t, -u,t)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(b,g){var e,f,p,o,z,A,F,P;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,g,this.sortElements);L=V=0;if(I=b.lights.length>0){F=b.lights;S.setRGB(0,0,0);G.setRGB(0,0,0);M.setRGB(0,0,0);e=0;for(f=F.length;e255?255:e;ta[1]=h<0?0:h>255?255:h;ta[2]=b<0?0:b>255?255:b;ta[4]=g<0?0:g>255?255:g;ta[5]=j<0?0:j>255?255:j;ta[6]=d<0?0:d>255?255:d;ta[8]=k<0?0:k>255?255:k;ta[9]=ia<0?0:ia>255?255:ia;ta[10]= +c<0?0:c>255?255:c;ta[12]=n<0?0:n>255?255:n;ta[13]=m<0?0:m>255?255:m;ta[14]=f<0?0:f>255?255:f;Ka.putImageData(Ta,0,0);Oa.drawImage(Ja,0,0);return La}function Ca(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function Ha(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function za(b,d){var c=d.x-b.x,f=d.y-b.y,e=1/Math.sqrt(c*c+f*f);c*=e;f*=e;d.x+=c;d.y+=f;b.x-=c;b.y-=f}var Qa,Ya,ja,ua,Aa,Ia,Ra,H;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,p);j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,h,this.sortElements); +(Sa=b.lights.length>0)&&n(b);Qa=0;for(Ya=k.length;Qa0&&(c.r+=h.color.r*g,c.g+=h.color.g*g,c.b+=h.color.b*g)):h instanceof THREE.PointLight&&(N.sub(h.position,d.centroidWorld),N.normalize(),g=d.normalWorld.dot(N)*h.intensity,g>0&&(c.r+=h.color.r*g,c.g+=h.color.g*g,c.b+=h.color.b*g))}function c(d,c,f,k,m,o){j.data.vertices+=3;j.data.faces++;O=e(V++);O.setAttribute("d", +"M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?A.hex=m.color.hex:m instanceof THREE.MeshLambertMaterial?I?(z.r=S.r,z.g=S.g,z.b=S.b,b(o,k,z),A.r=Math.max(0,Math.min(m.color.r*z.r,1)),A.g=Math.max(0,Math.min(m.color.g*z.g,1)),A.b=Math.max(0,Math.min(m.color.b*z.b,1)),A.updateHex()):A.hex=m.color.hex:m instanceof THREE.MeshDepthMaterial?(F=1-m.__2near/(m.__farPlusNear- +k.z*m.__farMinusNear),A.setRGB(F,F,F)):m instanceof THREE.MeshNormalMaterial&&A.setRGB(g(k.normalWorld.x),g(k.normalWorld.y),g(k.normalWorld.z));m.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(A.hex.toString(16))+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):O.setAttribute("style","fill: #"+h(A.hex.toString(16))+"; fill-opacity: "+m.opacity);n.appendChild(O)}function d(d,c,f,k, +m,o,p){j.data.vertices+=4;j.data.faces++;O=e(V++);O.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+f.positionScreen.x+","+f.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?A.hex=o.color.hex:o instanceof THREE.MeshLambertMaterial?I?(z.r=S.r,z.g=S.g,z.b=S.b,b(p,m,z),A.r=Math.max(0,Math.min(o.color.r*z.r,1)),A.g=Math.max(0,Math.min(o.color.g*z.g,1)),A.b=Math.max(0,Math.min(o.color.b* +z.b,1)),A.updateHex()):A.hex=o.color.hex:o instanceof THREE.MeshDepthMaterial?(F=1-o.__2near/(o.__farPlusNear-m.z*o.__farMinusNear),A.setRGB(F,F,F)):o instanceof THREE.MeshNormalMaterial&&A.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));o.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(A.hex.toString(16))+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):O.setAttribute("style", +"fill: #"+h(A.hex.toString(16))+"; fill-opacity: "+o.opacity);n.appendChild(O)}function e(b){f[b]==null&&(f[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),$==0&&f[b].setAttribute("shape-rendering","crispEdges"));return f[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,m=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,u,p,v,C,E,y,D=new THREE.Rectangle,x=new THREE.Rectangle,I= +!1,A=new THREE.Color(16777215),z=new THREE.Color(16777215),S=new THREE.Color(0),G=new THREE.Color(0),M=new THREE.Color(0),F,N=new THREE.Vector3,f=[],Y=[],O,V,L,$=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":$=1;break;case "low":$=0}};this.setSize=function(b,d){o=b;t=d;u=o/2;p=t/2;n.setAttribute("viewBox",-u+" "+-p+" "+o+" "+t);n.setAttribute("width",o);n.setAttribute("height",t);D.set(-u,-p, +u,p)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(b,f){var e,g,o,t,z,A,F,P;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,f,this.sortElements);L=V=0;if(I=b.lights.length>0){F=b.lights;S.setRGB(0,0,0);G.setRGB(0,0,0);M.setRGB(0,0,0);e=0;for(g=F.length;e 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + vViewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif", morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif", -default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif"};THREE.UniformsUtils={merge:function(b){var c,d,e,f={};for(c=0;c=0)g.bindBuffer(g.ARRAY_BUFFER,h.__webglVertexBuffer),g.vertexAttribPointer(b.position,3,g.FLOAT,!1,0,0);else{c=f.program.attributes;j.morphTargetBase!==-1?(g.bindBuffer(g.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0)):c.position>=0&&(g.bindBuffer(g.ARRAY_BUFFER, -h.__webglVertexBuffer),g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,m=j.morphTargetForcedOrder,n=j.morphTargetInfluences;ep&&(o=t,p=n[o]);g.bindBuffer(g.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);g.vertexAttribPointer(c["morphTarget"+e],3,g.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[e]=p;m[o]=1;p=-1;e++}}f.program.uniforms.morphTargetInfluences!==null&&g.uniform1fv(f.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(f.attributes)for(k in f.attributes)b[k]!==void 0&&b[k]>=0&&(c=f.attributes[k],c.buffer&&(g.bindBuffer(g.ARRAY_BUFFER, -c.buffer),g.vertexAttribPointer(b[k],c.size,g.FLOAT,!1,0,0)));b.color>=0&&(g.bindBuffer(g.ARRAY_BUFFER,h.__webglColorBuffer),g.vertexAttribPointer(b.color,3,g.FLOAT,!1,0,0));b.normal>=0&&(g.bindBuffer(g.ARRAY_BUFFER,h.__webglNormalBuffer),g.vertexAttribPointer(b.normal,3,g.FLOAT,!1,0,0));b.tangent>=0&&(g.bindBuffer(g.ARRAY_BUFFER,h.__webglTangentBuffer),g.vertexAttribPointer(b.tangent,4,g.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(g.bindBuffer(g.ARRAY_BUFFER,h.__webglUVBuffer),g.vertexAttribPointer(b.uv, -2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv)):g.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(g.bindBuffer(g.ARRAY_BUFFER,h.__webglUV2Buffer),g.vertexAttribPointer(b.uv2,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv2)):g.disableVertexAttribArray(b.uv2));f.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(g.bindBuffer(g.ARRAY_BUFFER,h.__webglSkinVertexABuffer),g.vertexAttribPointer(b.skinVertexA,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,h.__webglSkinVertexBBuffer), -g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),g.vertexAttribPointer(b.skinIndex,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,!1,0,0));j instanceof THREE.Mesh?(f.wireframe?(g.lineWidth(f.wireframeLinewidth),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),g.drawElements(g.LINES,h.__webglLineCount,g.UNSIGNED_SHORT,0)):(g.bindBuffer(g.ELEMENT_ARRAY_BUFFER, -h.__webglFaceBuffer),g.drawElements(g.TRIANGLES,h.__webglFaceCount,g.UNSIGNED_SHORT,0)),N.data.vertices+=h.__webglFaceCount,N.data.faces+=h.__webglFaceCount/3,N.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?g.LINE_STRIP:g.LINES,g.lineWidth(f.linewidth),g.drawArrays(j,0,h.__webglLineCount),N.data.drawCalls++):j instanceof THREE.ParticleSystem?(g.drawArrays(g.POINTS,0,h.__webglParticleCount),N.data.drawCalls++):j instanceof THREE.Ribbon&&(g.drawArrays(g.TRIANGLE_STRIP,0,h.__webglVertexCount), -N.data.drawCalls++)}}function f(b,d,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=g.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=g.createBuffer();b.hasPos&&(g.bindBuffer(g.ARRAY_BUFFER,b.__webglVertexBuffer),g.bufferData(g.ARRAY_BUFFER,b.positionArray,g.DYNAMIC_DRAW),g.enableVertexAttribArray(d.attributes.position),g.vertexAttribPointer(d.attributes.position,3,g.FLOAT,!1,0,0));if(b.hasNormal){g.bindBuffer(g.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var e, -f,h,j,k,m,n,p,o,t,u=b.count*3;for(t=0;t0&&y[0]0&&y[1]0.001&&k.scale>0.001)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/ca,u[0]=t*n,u[1]=t,g.uniform3fv(x.screenPosition,v),g.uniform2fv(x.scale,u),g.uniform1f(x.rotation,k.rotation),g.uniform1f(x.opacity,k.opacity),I(k.blending),z(k.texture,1),g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0)}g.enable(g.CULL_FACE);g.enable(g.DEPTH_TEST);g.depthMask(L)}function E(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)} -function y(b){var d,e,f,h,j;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];j=!1;for(h in f.__webglCustomAttributes)if(f.__webglCustomAttributes[h].needsUpdate){j=!0;break}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||j){j=b;var k=g.DYNAMIC_DRAW;if(f.__inittedArrays){var m=void 0,n=void 0,p=void 0,o=void 0,t=p=void 0,u=void 0,v=void 0,y=void 0,x=void 0,C=void 0,E=void 0, -F=void 0,ha=void 0,z=void 0,A=void 0,D=void 0,I=void 0,B=o=y=o=v=u=void 0,J=void 0,w=J=B=u=void 0,G=void 0,M=w=J=B=p=p=t=y=o=w=J=B=G=w=J=B=G=w=J=B=void 0,da=0,K=0,la=0,L=0,P=0,S=0,N=0,R=0,O=0,H=0,Q=0,J=B=0,U=f.__vertexArray,Z=f.__uvArray,$=f.__uv2Array,fa=f.__normalArray,T=f.__tangentArray,ma=f.__colorArray,V=f.__skinVertexAArray,W=f.__skinVertexBArray,X=f.__skinIndexArray,Y=f.__skinWeightArray,ga=f.__morphTargetsArrays,ca=f.__webglCustomAttributes,w=void 0,aa=f.__faceArray,ea=f.__lineArray,ka=f.__needsSmoothNormals, -C=f.__vertexColorType,x=f.__uvType,E=f.__normalType,pa=j.geometry,ya=pa.__dirtyVertices,va=pa.__dirtyElements,ra=pa.__dirtyUvs,wa=pa.__dirtyNormals,Ua=pa.__dirtyTangents,Va=pa.__dirtyColors,Wa=pa.__dirtyMorphTargets,Da=pa.vertices,Za=f.faces,bb=pa.faces,$a=pa.faceVertexUvs[0],ab=pa.faceVertexUvs[1],Ea=pa.skinVerticesA,Fa=pa.skinVerticesB,Ga=pa.skinIndices,xa=pa.skinWeights,Ba=j instanceof THREE.ShadowVolume?pa.edgeFaces:void 0;morphTargets=pa.morphTargets;if(ca)for(M in ca)ca[M].offset=0,ca[M].offsetSrc= -0;m=0;for(n=Za.length;m=0)f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0);else{c=g.program.attributes;j.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0)):c.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER, +h.__webglVertexBuffer),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,m=j.morphTargetForcedOrder,n=j.morphTargetInfluences;eo&&(p=t,o=n[p]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p]);f.vertexAttribPointer(c["morphTarget"+e],3,f.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[e]=o;m[p]=1;o=-1;e++}}g.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(g.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.attributes)for(k in g.attributes)b[k]!==void 0&&b[k]>=0&&(c=g.attributes[k],c.buffer&&(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,h.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer),f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUVBuffer),f.vertexAttribPointer(b.uv, +2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv)):f.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUV2Buffer),f.vertexAttribPointer(b.uv2,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv2)):f.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexBBuffer), +f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0));j instanceof THREE.Mesh?(g.wireframe?(f.lineWidth(g.wireframeLinewidth),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.drawElements(f.LINES,h.__webglLineCount,f.UNSIGNED_SHORT,0)):(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER, +h.__webglFaceBuffer),f.drawElements(f.TRIANGLES,h.__webglFaceCount,f.UNSIGNED_SHORT,0)),N.data.vertices+=h.__webglFaceCount,N.data.faces+=h.__webglFaceCount/3,N.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?f.LINE_STRIP:f.LINES,f.lineWidth(g.linewidth),f.drawArrays(j,0,h.__webglLineCount),N.data.drawCalls++):j instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,h.__webglParticleCount),N.data.drawCalls++):j instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,h.__webglVertexCount), +N.data.drawCalls++)}}function g(b,d,c){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(d.attributes.position),f.vertexAttribPointer(d.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var e, +h,g,j,k,m,n,o,p,t,u=b.count*3;for(t=0;t0&&y[0]0&&y[1]0.001&&k.scale>0.001)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/ca,u[0]=t*n,u[1]=t,f.uniform3fv(x.screenPosition,v),f.uniform2fv(x.scale,u),f.uniform1f(x.rotation,k.rotation),f.uniform1f(x.opacity,k.opacity),I(k.blending),z(k.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0)}f.enable(f.CULL_FACE);f.enable(f.DEPTH_TEST);f.depthMask(L)}function E(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)} +function y(b){var d,e,h,g,j;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){h=e.geometryGroups[d];j=!1;for(g in h.__webglCustomAttributes)if(h.__webglCustomAttributes[g].needsUpdate){j=!0;break}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||j){j=b;var k=f.DYNAMIC_DRAW;if(h.__inittedArrays){var m=void 0,n=void 0,o=void 0,p=void 0,t=o=void 0,u=void 0,v=void 0,y=void 0,x=void 0,E=void 0,C=void 0, +F=void 0,ha=void 0,z=void 0,A=void 0,D=void 0,I=void 0,B=p=y=p=v=u=void 0,J=void 0,w=J=B=u=void 0,G=void 0,M=w=J=B=o=o=t=y=p=w=J=B=G=w=J=B=G=w=J=B=void 0,da=0,K=0,la=0,L=0,P=0,S=0,N=0,R=0,O=0,H=0,Q=0,J=B=0,U=h.__vertexArray,Z=h.__uvArray,$=h.__uv2Array,fa=h.__normalArray,T=h.__tangentArray,ma=h.__colorArray,V=h.__skinVertexAArray,W=h.__skinVertexBArray,X=h.__skinIndexArray,Y=h.__skinWeightArray,ga=h.__morphTargetsArrays,ca=h.__webglCustomAttributes,w=void 0,aa=h.__faceArray,ea=h.__lineArray,ka=h.__needsSmoothNormals, +E=h.__vertexColorType,x=h.__uvType,C=h.__normalType,pa=j.geometry,ya=pa.__dirtyVertices,va=pa.__dirtyElements,ra=pa.__dirtyUvs,wa=pa.__dirtyNormals,Ua=pa.__dirtyTangents,Va=pa.__dirtyColors,Wa=pa.__dirtyMorphTargets,Da=pa.vertices,Za=h.faces,bb=pa.faces,$a=pa.faceVertexUvs[0],ab=pa.faceVertexUvs[1],Ea=pa.skinVerticesA,Fa=pa.skinVerticesB,Ga=pa.skinIndices,xa=pa.skinWeights,Ba=j instanceof THREE.ShadowVolume?pa.edgeFaces:void 0;morphTargets=pa.morphTargets;if(ca)for(M in ca)ca[M].offset=0,ca[M].offsetSrc= +0;m=0;for(n=Za.length;m0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglColorBuffer),g.bufferData(g.ARRAY_BUFFER,ma,k));wa&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglNormalBuffer),g.bufferData(g.ARRAY_BUFFER,fa,k));Ua&&pa.hasTangents&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglTangentBuffer),g.bufferData(g.ARRAY_BUFFER,T,k));ra&&la>0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglUVBuffer),g.bufferData(g.ARRAY_BUFFER,Z,k));ra&&L>0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglUV2Buffer),g.bufferData(g.ARRAY_BUFFER, -$,k));va&&(g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,aa,k),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,ea,k));H>0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinVertexABuffer),g.bufferData(g.ARRAY_BUFFER,V,k),g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),g.bufferData(g.ARRAY_BUFFER,W,k),g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),g.bufferData(g.ARRAY_BUFFER,X,k),g.bindBuffer(g.ARRAY_BUFFER, -f.__webglSkinWeightsBuffer),g.bufferData(g.ARRAY_BUFFER,Y,k));j.dynamic||(delete f.__inittedArrays,delete f.__colorArray,delete f.__normalArray,delete f.__tangentArray,delete f.__uvArray,delete f.__uv2Array,delete f.__faceArray,delete f.__vertexArray,delete f.__lineArray,delete f.__skinVertexAArray,delete f.__skinVertexBArray,delete f.__skinIndexArray,delete f.__skinWeightArray)}}}e.__dirtyVertices=!1;e.__dirtyMorphTargets=!1;e.__dirtyElements=!1;e.__dirtyUvs=!1;e.__dirtyNormals=!1;e.__dirtyTangents= -!1;e.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=g.DYNAMIC_DRAW;x=b.vertices;f=b.colors;C=x.length;j=f.length;E=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m65535&&(n[k].counter+=1,m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j, -vertices:0,numMorphTargets:p})),b.geometryGroups[m].faces.push(g),b.geometryGroups[m].vertices+=h}function x(b,d,c){b.push({buffer:d,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=Q){switch(b){case THREE.AdditiveBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE);break;case THREE.SubtractiveBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO, -g.SRC_COLOR);break;default:g.blendEquationSeparate(g.FUNC_ADD,g.FUNC_ADD),g.blendFuncSeparate(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA,g.ONE,g.ONE_MINUS_SRC_ALPHA)}Q=b}}function A(b,d,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(g.texParameteri(b,g.TEXTURE_WRAP_S,F(d.wrapS)),g.texParameteri(b,g.TEXTURE_WRAP_T,F(d.wrapT)),g.texParameteri(b,g.TEXTURE_MAG_FILTER,F(d.magFilter)),g.texParameteri(b,g.TEXTURE_MIN_FILTER,F(d.minFilter)),g.generateMipmap(b)):(g.texParameteri(b,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE), -g.texParameteri(b,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texParameteri(b,g.TEXTURE_MAG_FILTER,M(d.magFilter)),g.texParameteri(b,g.TEXTURE_MIN_FILTER,M(d.minFilter)))}function z(b,d){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=g.deleteTexture(b.__webglTexture);b.__webglTexture=g.createTexture();g.bindTexture(g.TEXTURE_2D,b.__webglTexture);g.texImage2D(g.TEXTURE_2D,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,b.image);A(g.TEXTURE_2D,b,b.image);g.bindTexture(g.TEXTURE_2D,null);b.needsUpdate=!1}g.activeTexture(g.TEXTURE0+ -d);g.bindTexture(g.TEXTURE_2D,b.__webglTexture)}function S(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=g.createFramebuffer();b.__webglRenderbuffer=g.createRenderbuffer();b.__webglTexture=g.createTexture();g.bindTexture(g.TEXTURE_2D,b.__webglTexture);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,F(b.wrapS));g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,F(b.wrapT));g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER, -F(b.magFilter));g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,F(b.minFilter));g.texImage2D(g.TEXTURE_2D,0,F(b.format),b.width,b.height,0,F(b.format),F(b.type),null);g.bindRenderbuffer(g.RENDERBUFFER,b.__webglRenderbuffer);g.bindFramebuffer(g.FRAMEBUFFER,b.__webglFramebuffer);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,b.width,b.height),g.framebufferRenderbuffer(g.FRAMEBUFFER, -g.DEPTH_ATTACHMENT,g.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_STENCIL,b.width,b.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,b.__webglRenderbuffer)):g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,b.width,b.height);g.bindTexture(g.TEXTURE_2D,null);g.bindRenderbuffer(g.RENDERBUFFER,null);g.bindFramebuffer(g.FRAMEBUFFER,null)}var d,c;b?(d=b.__webglFramebuffer,c=b.width,b=b.height):(d=null, -c=ga,b=ca);d!=V&&(g.bindFramebuffer(g.FRAMEBUFFER,d),g.viewport(U,ka,c,b),V=d)}function G(b,d){var c;b=="fragment"?c=g.createShader(g.FRAGMENT_SHADER):b=="vertex"&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,d);g.compileShader(c);if(!g.getShaderParameter(c,g.COMPILE_STATUS))return console.error(g.getShaderInfoLog(c)),console.error(d),null;return c}function M(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return g.NEAREST;default:return g.LINEAR}} -function F(b){switch(b){case THREE.RepeatWrapping:return g.REPEAT;case THREE.ClampToEdgeWrapping:return g.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return g.MIRRORED_REPEAT;case THREE.NearestFilter:return g.NEAREST;case THREE.NearestMipMapNearestFilter:return g.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return g.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return g.LINEAR;case THREE.LinearMipMapNearestFilter:return g.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return g.LINEAR_MIPMAP_LINEAR; -case THREE.ByteType:return g.BYTE;case THREE.UnsignedByteType:return g.UNSIGNED_BYTE;case THREE.ShortType:return g.SHORT;case THREE.UnsignedShortType:return g.UNSIGNED_SHORT;case THREE.IntType:return g.INT;case THREE.UnsignedShortType:return g.UNSIGNED_INT;case THREE.FloatType:return g.FLOAT;case THREE.AlphaFormat:return g.ALPHA;case THREE.RGBFormat:return g.RGB;case THREE.RGBAFormat:return g.RGBA;case THREE.LuminanceFormat:return g.LUMINANCE;case THREE.LuminanceAlphaFormat:return g.LUMINANCE_ALPHA}return 0} -var N=this,g,Y=[],O=null,V=null,L=!0,$=null,T=null,Q=null,fa=null,U=0,ka=0,ga=0,ca=0,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],R=new THREE.Matrix4,P=new Float32Array(16),W=new Float32Array(16),X=new THREE.Vector4,ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ha=b.canvas!==void 0?b.canvas:document.createElement("canvas"),J=b.stencil!==void 0?b.stencil: -!0,da=b.antialias!==void 0?b.antialias:!1,la=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ma=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ha;this.sortObjects=this.autoClear=!0;try{if(!(g=ha.getContext("experimental-webgl",{antialias:da,stencil:J})))throw"Error creating WebGL context.";}catch(ya){console.error(ya)}console.log(navigator.userAgent+" | "+g.getParameter(g.VERSION)+" | "+g.getParameter(g.VENDOR)+ -" | "+g.getParameter(g.RENDERER)+" | "+g.getParameter(g.SHADING_LANGUAGE_VERSION));g.clearColor(0,0,0,1);g.clearDepth(1);g.enable(g.DEPTH_TEST);g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(la.r,la.g,la.b,ma);this.context=g;var va=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(J){var Z={};Z.vertices=new Float32Array(12);Z.faces=new Uint16Array(6);Z.darkness= -0.5;Z.vertices[0]=-20;Z.vertices[1]=-20;Z.vertices[2]=-1;Z.vertices[3]=20;Z.vertices[4]=-20;Z.vertices[5]=-1;Z.vertices[6]=20;Z.vertices[7]=20;Z.vertices[8]=-1;Z.vertices[9]=-20;Z.vertices[10]=20;Z.vertices[11]=-1;Z.faces[0]=0;Z.faces[1]=1;Z.faces[2]=2;Z.faces[3]=0;Z.faces[4]=2;Z.faces[5]=3;Z.vertexBuffer=g.createBuffer();Z.elementBuffer=g.createBuffer();g.bindBuffer(g.ARRAY_BUFFER,Z.vertexBuffer);g.bufferData(g.ARRAY_BUFFER,Z.vertices,g.STATIC_DRAW);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.elementBuffer); -g.bufferData(g.ELEMENT_ARRAY_BUFFER,Z.faces,g.STATIC_DRAW);Z.program=g.createProgram();g.attachShader(Z.program,G("fragment",THREE.ShaderLib.shadowPost.fragmentShader));g.attachShader(Z.program,G("vertex",THREE.ShaderLib.shadowPost.vertexShader));g.linkProgram(Z.program);Z.vertexLocation=g.getAttribLocation(Z.program,"position");Z.projectionLocation=g.getUniformLocation(Z.program,"projectionMatrix");Z.darknessLocation=g.getUniformLocation(Z.program,"darkness")}var K={};K.vertices=new Float32Array(16); -K.faces=new Uint16Array(6);b=0;K.vertices[b++]=-1;K.vertices[b++]=-1;K.vertices[b++]=0;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;b=0;K.faces[b++]=0;K.faces[b++]=1;K.faces[b++]=2;K.faces[b++]=0;K.faces[b++]=2;K.faces[b++]=3;K.vertexBuffer=g.createBuffer();K.elementBuffer=g.createBuffer();K.tempTexture=g.createTexture(); -K.occlusionTexture=g.createTexture();g.bindBuffer(g.ARRAY_BUFFER,K.vertexBuffer);g.bufferData(g.ARRAY_BUFFER,K.vertices,g.STATIC_DRAW);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,K.elementBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,K.faces,g.STATIC_DRAW);g.bindTexture(g.TEXTURE_2D,K.tempTexture);g.texImage2D(g.TEXTURE_2D,0,g.RGB,16,16,0,g.RGB,g.UNSIGNED_BYTE,null);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);g.texParameteri(g.TEXTURE_2D, -g.TEXTURE_MAG_FILTER,g.NEAREST);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.NEAREST);g.bindTexture(g.TEXTURE_2D,K.occlusionTexture);g.texImage2D(g.TEXTURE_2D,0,g.RGBA,16,16,0,g.RGBA,g.UNSIGNED_BYTE,null);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.NEAREST);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.NEAREST);g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<= -0?(K.hasVertexTexture=!1,K.program=g.createProgram(),g.attachShader(K.program,G("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),g.attachShader(K.program,G("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(K.hasVertexTexture=!0,K.program=g.createProgram(),g.attachShader(K.program,G("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),g.attachShader(K.program,G("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));g.linkProgram(K.program);K.attributes={};K.uniforms={}; -K.attributes.vertex=g.getAttribLocation(K.program,"position");K.attributes.uv=g.getAttribLocation(K.program,"UV");K.uniforms.renderType=g.getUniformLocation(K.program,"renderType");K.uniforms.map=g.getUniformLocation(K.program,"map");K.uniforms.occlusionMap=g.getUniformLocation(K.program,"occlusionMap");K.uniforms.opacity=g.getUniformLocation(K.program,"opacity");K.uniforms.scale=g.getUniformLocation(K.program,"scale");K.uniforms.rotation=g.getUniformLocation(K.program,"rotation");K.uniforms.screenPosition= -g.getUniformLocation(K.program,"screenPosition");var wa=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]= -0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=g.createBuffer();_sprite.elementBuffer=g.createBuffer();g.bindBuffer(g.ARRAY_BUFFER,_sprite.vertexBuffer);g.bufferData(g.ARRAY_BUFFER,_sprite.vertices,g.STATIC_DRAW);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,_sprite.faces,g.STATIC_DRAW);_sprite.program=g.createProgram(); -g.attachShader(_sprite.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));g.attachShader(_sprite.program,G("vertex",THREE.ShaderLib.sprite.vertexShader));g.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=g.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=g.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=g.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=g.getUniformLocation(_sprite.program, -"uvScale");_sprite.uniforms.rotation=g.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=g.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=g.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=g.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=g.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=g.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance= -g.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=g.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=g.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=g.getUniformLocation(_sprite.program,"projectionMatrix");var ra=!1;this.setSize=function(b,d){ha.width=b;ha.height=d;this.setViewport(0,0,ha.width,ha.height)};this.setViewport=function(b,d,c,e){U=b;ka=d;ga=c;ca=e;g.viewport(U,ka,ga, -ca)};this.setScissor=function(b,d,c,e){g.scissor(b,d,c,e)};this.enableScissorTest=function(b){b?g.enable(g.SCISSOR_TEST):g.disable(g.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){L=b;g.depthMask(b)};this.setClearColorHex=function(b,d){la.setHex(b);ma=d;g.clearColor(la.r,la.g,la.b,ma)};this.setClearColor=function(b,d){la.copy(b);ma=d;g.clearColor(la.r,la.g,la.b,ma)};this.clear=function(){g.clear(g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT|g.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){Z.darkness= -b};this.getContext=function(){return g};this.initMaterial=function(b,d,c,e){var f,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic"); -if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,n,p;m=p=k=0;for(n=d.length;m0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,ma,k));wa&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,fa,k));Ua&&pa.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,T,k));ra&&la>0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,Z,k));ra&&L>0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER, +$,k));va&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,aa,k),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,ea,k));H>0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,V,k),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,W,k),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,X,k),f.bindBuffer(f.ARRAY_BUFFER, +h.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,Y,k));j.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}}e.__dirtyVertices=!1;e.__dirtyMorphTargets=!1;e.__dirtyElements=!1;e.__dirtyUvs=!1;e.__dirtyNormals=!1;e.__dirtyTangents= +!1;e.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=f.DYNAMIC_DRAW;x=b.vertices;h=b.colors;E=x.length;j=h.length;C=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m65535&&(n[k].counter+=1,m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j, +vertices:0,numMorphTargets:o})),b.geometryGroups[m].faces.push(f),b.geometryGroups[m].vertices+=g}function x(b,d,c){b.push({buffer:d,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=Q){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)}Q=b}}function A(b,d,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,F(d.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,F(d.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,F(d.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,F(d.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,M(d.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,M(d.minFilter)))}function z(b,d){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=f.deleteTexture(b.__webglTexture);b.__webglTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,b.__webglTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);A(f.TEXTURE_2D,b,b.image);f.bindTexture(f.TEXTURE_2D,null);b.needsUpdate=!1}f.activeTexture(f.TEXTURE0+ +d);f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function S(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=f.createFramebuffer();b.__webglRenderbuffer=f.createRenderbuffer();b.__webglTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,b.__webglTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,F(b.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,F(b.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER, +F(b.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,F(b.minFilter));f.texImage2D(f.TEXTURE_2D,0,F(b.format),b.width,b.height,0,F(b.format),F(b.type),null);f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer);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);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var d,c;b?(d=b.__webglFramebuffer,c=b.width,b=b.height):(d=null, +c=ga,b=ca);d!=V&&(f.bindFramebuffer(f.FRAMEBUFFER,d),f.viewport(U,ka,c,b),V=d)}function G(b,d){var c;b=="fragment"?c=f.createShader(f.FRAGMENT_SHADER):b=="vertex"&&(c=f.createShader(f.VERTEX_SHADER));f.shaderSource(c,d);f.compileShader(c);if(!f.getShaderParameter(c,f.COMPILE_STATUS))return console.error(f.getShaderInfoLog(c)),console.error(d),null;return c}function M(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}} +function F(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 N=this,f,Y=[],O=null,V=null,L=!0,$=null,T=null,Q=null,fa=null,U=0,ka=0,ga=0,ca=0,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],R=new THREE.Matrix4,P=new Float32Array(16),W=new Float32Array(16),X=new THREE.Vector4,ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ha=b.canvas!==void 0?b.canvas:document.createElement("canvas"),J=b.stencil!==void 0?b.stencil: +!0,da=b.antialias!==void 0?b.antialias:!1,la=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ma=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ha;this.sortObjects=this.autoClear=!0;try{if(!(f=ha.getContext("experimental-webgl",{antialias:da,stencil:J})))throw"Error creating WebGL context.";}catch(ya){console.error(ya)}console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+" | "+f.getParameter(f.VENDOR)+ +" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION));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(la.r,la.g,la.b,ma);this.context=f;var va=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(J){var Z={};Z.vertices=new Float32Array(12);Z.faces=new Uint16Array(6);Z.darkness= +0.5;Z.vertices[0]=-20;Z.vertices[1]=-20;Z.vertices[2]=-1;Z.vertices[3]=20;Z.vertices[4]=-20;Z.vertices[5]=-1;Z.vertices[6]=20;Z.vertices[7]=20;Z.vertices[8]=-1;Z.vertices[9]=-20;Z.vertices[10]=20;Z.vertices[11]=-1;Z.faces[0]=0;Z.faces[1]=1;Z.faces[2]=2;Z.faces[3]=0;Z.faces[4]=2;Z.faces[5]=3;Z.vertexBuffer=f.createBuffer();Z.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,Z.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,Z.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,Z.elementBuffer); +f.bufferData(f.ELEMENT_ARRAY_BUFFER,Z.faces,f.STATIC_DRAW);Z.program=f.createProgram();f.attachShader(Z.program,G("fragment",THREE.ShaderLib.shadowPost.fragmentShader));f.attachShader(Z.program,G("vertex",THREE.ShaderLib.shadowPost.vertexShader));f.linkProgram(Z.program);Z.vertexLocation=f.getAttribLocation(Z.program,"position");Z.projectionLocation=f.getUniformLocation(Z.program,"projectionMatrix");Z.darknessLocation=f.getUniformLocation(Z.program,"darkness")}var K={};K.vertices=new Float32Array(16); +K.faces=new Uint16Array(6);b=0;K.vertices[b++]=-1;K.vertices[b++]=-1;K.vertices[b++]=0;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=1;K.vertices[b++]=-1;K.vertices[b++]=1;K.vertices[b++]=0;K.vertices[b++]=1;b=0;K.faces[b++]=0;K.faces[b++]=1;K.faces[b++]=2;K.faces[b++]=0;K.faces[b++]=2;K.faces[b++]=3;K.vertexBuffer=f.createBuffer();K.elementBuffer=f.createBuffer();K.tempTexture=f.createTexture(); +K.occlusionTexture=f.createTexture();f.bindBuffer(f.ARRAY_BUFFER,K.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,K.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,K.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,K.faces,f.STATIC_DRAW);f.bindTexture(f.TEXTURE_2D,K.tempTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGB,16,16,0,f.RGB,f.UNSIGNED_BYTE,null);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(f.TEXTURE_2D, +f.TEXTURE_MAG_FILTER,f.NEAREST);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST);f.bindTexture(f.TEXTURE_2D,K.occlusionTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,16,16,0,f.RGBA,f.UNSIGNED_BYTE,null);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST);f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<= +0?(K.hasVertexTexture=!1,K.program=f.createProgram(),f.attachShader(K.program,G("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),f.attachShader(K.program,G("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(K.hasVertexTexture=!0,K.program=f.createProgram(),f.attachShader(K.program,G("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),f.attachShader(K.program,G("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));f.linkProgram(K.program);K.attributes={};K.uniforms={}; +K.attributes.vertex=f.getAttribLocation(K.program,"position");K.attributes.uv=f.getAttribLocation(K.program,"UV");K.uniforms.renderType=f.getUniformLocation(K.program,"renderType");K.uniforms.map=f.getUniformLocation(K.program,"map");K.uniforms.occlusionMap=f.getUniformLocation(K.program,"occlusionMap");K.uniforms.opacity=f.getUniformLocation(K.program,"opacity");K.uniforms.scale=f.getUniformLocation(K.program,"scale");K.uniforms.rotation=f.getUniformLocation(K.program,"rotation");K.uniforms.screenPosition= +f.getUniformLocation(K.program,"screenPosition");var wa=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]= +0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=f.createBuffer();_sprite.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,_sprite.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,_sprite.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,_sprite.faces,f.STATIC_DRAW);_sprite.program=f.createProgram(); +f.attachShader(_sprite.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(_sprite.program,G("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=f.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=f.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=f.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=f.getUniformLocation(_sprite.program, +"uvScale");_sprite.uniforms.rotation=f.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=f.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=f.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=f.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=f.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=f.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance= +f.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=f.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=f.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=f.getUniformLocation(_sprite.program,"projectionMatrix");var ra=!1;this.setSize=function(b,d){ha.width=b;ha.height=d;this.setViewport(0,0,ha.width,ha.height)};this.setViewport=function(b,d,c,e){U=b;ka=d;ga=c;ca=e;f.viewport(U,ka,ga, +ca)};this.setScissor=function(b,d,c,e){f.scissor(b,d,c,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){L=b;f.depthMask(b)};this.setClearColorHex=function(b,d){la.setHex(b);ma=d;f.clearColor(la.r,la.g,la.b,ma)};this.setClearColor=function(b,d){la.copy(b);ma=d;f.clearColor(la.r,la.g,la.b,ma)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT|f.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){Z.darkness= +b};this.getContext=function(){return f};this.initMaterial=function(b,d,c,e){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic"); +if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,n,o;m=o=k=0;for(n=d.length;m=0&&g.enableVertexAttribArray(o.position);o.color>=0&&g.enableVertexAttribArray(o.color); -o.normal>=0&&g.enableVertexAttribArray(o.normal);o.tangent>=0&&g.enableVertexAttribArray(o.tangent);b.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(g.enableVertexAttribArray(o.skinVertexA),g.enableVertexAttribArray(o.skinVertexB),g.enableVertexAttribArray(o.skinIndex),g.enableVertexAttribArray(o.skinWeight));if(b.attributes)for(f in b.attributes)o[f]!==void 0&&o[f]>=0&&g.enableVertexAttribArray(o[f]);if(b.morphTargets){b.numSupportedMorphTargets=0;o.morphTarget0>= -0&&(g.enableVertexAttribArray(o.morphTarget0),b.numSupportedMorphTargets++);o.morphTarget1>=0&&(g.enableVertexAttribArray(o.morphTarget1),b.numSupportedMorphTargets++);o.morphTarget2>=0&&(g.enableVertexAttribArray(o.morphTarget2),b.numSupportedMorphTargets++);o.morphTarget3>=0&&(g.enableVertexAttribArray(o.morphTarget3),b.numSupportedMorphTargets++);o.morphTarget4>=0&&(g.enableVertexAttribArray(o.morphTarget4),b.numSupportedMorphTargets++);o.morphTarget5>=0&&(g.enableVertexAttribArray(o.morphTarget5), -b.numSupportedMorphTargets++);o.morphTarget6>=0&&(g.enableVertexAttribArray(o.morphTarget6),b.numSupportedMorphTargets++);o.morphTarget7>=0&&(g.enableVertexAttribArray(o.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(f=this.maxMorphTargets;b0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m* -4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(J*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t=0;f--){if(e=c.__webglObjects[f].object,d==e){c.__webglObjects.splice(f,1);break}}else if(d instanceof THREE.Sprite)for(f=c.__webglSprites.length-1;f>=0;f--)if(e=c.__webglSprites[f],d==e){c.__webglSprites.splice(f,1);break}b.__objectsRemoved.splice(0,1)}d=0;for(c=b.__webglObjects.length;d=0&&f.enableVertexAttribArray(p.position);p.color>=0&&f.enableVertexAttribArray(p.color); +p.normal>=0&&f.enableVertexAttribArray(p.normal);p.tangent>=0&&f.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(f.enableVertexAttribArray(p.skinVertexA),f.enableVertexAttribArray(p.skinVertexB),f.enableVertexAttribArray(p.skinIndex),f.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&f.enableVertexAttribArray(p[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>= +0&&(f.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(f.enableVertexAttribArray(p.morphTarget1),b.numSupportedMorphTargets++);p.morphTarget2>=0&&(f.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(f.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(f.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(f.enableVertexAttribArray(p.morphTarget5), +b.numSupportedMorphTargets++);p.morphTarget6>=0&&(f.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=0&&(f.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m* +4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(J*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t=0;h--){if(e=c.__webglObjects[h].object,d==e){c.__webglObjects.splice(h,1);break}}else if(d instanceof THREE.Sprite)for(h=c.__webglSprites.length-1;h>=0;h--)if(e=c.__webglSprites[h],d==e){c.__webglSprites.splice(h,1);break}b.__objectsRemoved.splice(0,1)}d=0;for(c=b.__webglObjects.length;d1&&(d-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=d;c.s=j;c.v=h;return c}, +THREE.ColorUtils={adjustHSV:function(b,c,d,e){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+d,0,1);g.v=THREE.ColorUtils.clamp(g.v+e,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var d=b.r,e=b.g,g=b.b,h=Math.max(Math.max(d,e),g),j=Math.min(Math.min(d,e),g);if(j==h)j=d=0;else{var k=h-j,j=k/h,d=d==h?(e-g)/k:e==h?2+(g-d)/k:4+(d-e)/k;d/=6;d<0&&(d+=1);d>1&&(d-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=d;c.s=j;c.v=h;return c}, clamp:function(b,c,d){return bd?d:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,e=b.vertices.length,f=d?c.geometry:c,h=b.vertices,j=f.vertices,k=b.faces,m=f.faces,n=b.faceVertexUvs[0],f=f.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,o=j.length;p25&&(h=25);f=(h-1)*0.5;d=Array(h);for(c=e=0;c25&&(h=25);g=(h-1)*0.5;d=Array(h);for(c=e=0;c1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(d==="pos")if(d=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)d.x=f[0]+(h[0]-f[0])*e,d.y=f[1]+(h[1]-f[1])*e,d.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",t,j.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),d.x=f[0],d.y=f[1],d.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(d),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,e,0)}else if(d=== -"rot")THREE.Quaternion.slerp(f,h,b.quaternion,e);else if(d==="scl")d=b.scale,d.x=f[0]+(h[0]-f[0])*e,d.y=f[1]+(h[1]-f[1])*e,d.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&p[0][n]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;tb.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];m=b[d[2]];n=b[d[3]];d=f*f;j=f*d;e[0]=this.interpolate(h[0],k[0],m[0],n[0],f,d,j);e[1]=this.interpolate(h[1],k[1],m[1],n[1],f,d,j);e[2]=this.interpolate(h[2],k[2],m[2],n[2],f,d,j);return e}; -THREE.Animation.prototype.interpolate=function(b,c,d,e,f,h,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*h+b*f+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d=d1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+p),e=e<0?0:1;if(d==="pos")if(d=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)d.x=g[0]+(h[0]-g[0])*e,d.y=g[1]+(h[1]-g[1])*e,d.z=g[2]+(h[2]-g[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",p,j.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",p,k.index+1).pos,e=e*0.33+0.33,g=this.interpolateCatmullRom(this.points,e),d.x=g[0],d.y=g[1],d.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(d),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,e,0)}else if(d=== +"rot")THREE.Quaternion.slerp(g,h,b.quaternion,e);else if(d==="scl")d=b.scale,d.x=g[0]+(h[0]-g[0])*e,d.y=g[1]+(h[1]-g[1])*e,d.z=g[2]+(h[2]-g[2])*e}}if(this.JITCompile&&o[0][n]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;pb.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];m=b[d[2]];n=b[d[3]];d=g*g;j=g*d;e[0]=this.interpolate(h[0],k[0],m[0],n[0],g,d,j);e[1]=this.interpolate(h[1],k[1],m[1],n[1],g,d,j);e[2]=this.interpolate(h[2],k[2],m[2],n[2],g,d,j);return e}; +THREE.Animation.prototype.interpolate=function(b,c,d,e,g,h,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d=d0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[e.length-1]}; THREE.QuakeCamera=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!== @@ -377,16 +378,16 @@ void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this 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 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}};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);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,f=this.position;b.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=f.y+100*Math.cos(this.phi);b.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi= -(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;f=this.position;b.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=f.y+100*Math.cos(this.phi);b.z=f.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), +(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)}this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi= +(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;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);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.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype; THREE.QuakeCamera.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,d,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,j=d.getControlPointsArray(),k=d.getLength(),m=j.length,D=0;h=m-1;d={parent:-1,keys:[]};d.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};d.keys[h]={time:e,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h=0?e:e+f;e=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;var k=j[1]-j[0];this.phi= +window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(b,d,c){var e,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)*h;this.theta=this.lon*h;e=this.phi%g;this.phi=e>=0?e:e+g;e=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;var k=j[1]-j[0];this.phi= TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(j[1]-j[0])/(e[1]-e[0])+j[0]-j[0])/k)*k+j[0];e=this.horizontalAngleMap.srcRange;j=this.horizontalAngleMap.dstRange;k=j[1]-j[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-e[0])*(j[1]-j[0])/(e[1]-e[0])+j[0]-j[0])/k)*k+j[0];e=this.target.position;e.x=100*Math.sin(this.phi)*Math.cos(this.theta);e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,d,c)};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}),k=new THREE.Cube(10,10,20),m=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,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&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,d){return function(){d.apply(b,arguments)}}(this,this.onMouseMove),!1)}; @@ -395,96 +396,96 @@ THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,argument 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(),f=c.size[0]/2,h=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-f)/f;this.moveState.pitchDown=(b.clientY- +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,h=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY- c.offset[1]-h)/h;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,d,e){THREE.Camera.call(this,b,c,d,e);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 f=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,p=0,o=0,u=0,t=0,v=0,C=window.innerWidth/2,E=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*v));b=this.delta*this.movementSpeed;this.translateZ(b*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(b*o);this.translateY(b*u);m&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); -else if(this.forward.y0||this.autoForward&&!(o<0)?1:o));this.translateX(b*t);this.translateY(b*u);m&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); +else if(this.forward.y0){j(0,0,-p-(h||0));for(m=b;m0){j(0,0,p+(f||0)); -for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m0){j(0,0,-o-(h||0));for(m=b;m0){j(0,0,o+(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))}m=0;for(b=this.faces.length;m0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,k,u)))-1);n.push(p)}c.push(n)}for(var t,v,C,f=c.length,d=0;d0)for(e=0;e1&&(t=this.vertices[j].position.clone(), -v=this.vertices[m].position.clone(),C=this.vertices[n].position.clone(),t.normalize(),v.normalize(),C.normalize(),this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(C.x,C.y,C.z)])),this.faceVertexUvs[0].push([p,o,E]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere; -THREE.Torus=function(b,c,d,e){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;b=[];for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){var e=d/this.segmentsT*2*Math.PI,f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d= -1;d<=this.segmentsT;++d){var e=(this.segmentsT+1)*c+d,f=(this.segmentsT+1)*c+d-1,h=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,f,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[e][0],b[e][1]),new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus; -THREE.TorusKnot=function(b,c,d,e,f,h,j){function k(b,c,d,e,f,h){c=d/e*b;d=Math.cos(c);return new THREE.Vector3(f*(2+d)*0.5*Math.cos(b),f*(2+d)*Math.sin(b)*0.5,h*f*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=e||8;this.p=f||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,k,u)))-1);n.push(o)}c.push(n)}for(var p,v,C,g=c.length,d=0;d0)for(e=0;e1&&(p=this.vertices[j].position.clone(), +v=this.vertices[m].position.clone(),C=this.vertices[n].position.clone(),p.normalize(),v.normalize(),C.normalize(),this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(C.x,C.y,C.z)])),this.faceVertexUvs[0].push([o,t,E]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere; +THREE.Torus=function(b,c,d,e){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;b=[];for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){var e=d/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d= +1;d<=this.segmentsT;++d){var e=(this.segmentsT+1)*c+d,g=(this.segmentsT+1)*c+d-1,h=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[e][0],b[e][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus; +THREE.TorusKnot=function(b,c,d,e,g,h,j){function k(b,c,d,e,h,g){c=d/e*b;d=Math.cos(c);return new THREE.Vector3(h*(2+d)*0.5*Math.cos(b),h*(2+d)*Math.sin(b)*0.5,g*h*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=e||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(b,c){var d=p(b,c),e=p(b,c+1),g=p(b,c+2);return(p(b,c+3)<<24)+(g<<16)+(e<<8)+d}function m(b,c){var d=p(b,c);return(p(b,c+1)<<8)+d}function n(b,c){var d=p(b,c);return d>127?d-256:d}function p(b, -c){return b.charCodeAt(c)&255}function o(c){var d,e,g;d=f(b,c);e=f(b,c+z);g=f(b,c+S);c=m(b,c+G);THREE.BinaryLoader.prototype.f3(y,d,e,g,c)}function u(c){var d,e,g,h,j,n;d=f(b,c);e=f(b,c+z);g=f(b,c+S);h=m(b,c+G);j=f(b,c+M);n=f(b,c+F);c=f(b,c+N);THREE.BinaryLoader.prototype.f3n(y,I,d,e,g,h,j,n,c)}function t(c){var d,e,h,j;d=f(b,c);e=f(b,c+g);h=f(b,c+Y);j=f(b,c+O);c=m(b,c+V);THREE.BinaryLoader.prototype.f4(y,d,e,h,j,c)}function v(c){var d,e,h,j,n,o,p,t;d=f(b,c);e=f(b,c+g);h=f(b,c+Y);j=f(b,c+O);n=m(b, -c+V);o=f(b,c+L);p=f(b,c+$);t=f(b,c+T);c=f(b,c+Q);THREE.BinaryLoader.prototype.f4n(y,I,d,e,h,j,n,o,p,t,c)}function C(c){var d,e;d=f(b,c);e=f(b,c+fa);c=f(b,c+U);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],A[d*2],A[d*2+1],A[e*2],A[e*2+1],A[c*2],A[c*2+1])}function E(c){var d,e,g;d=f(b,c);e=f(b,c+ka);g=f(b,c+ga);c=f(b,c+ca);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],A[d*2],A[d*2+1],A[e*2],A[e*2+1],A[g*2],A[g*2+1],A[c*2],A[c*2+1])}var y=this,D=0,x,I=[],A=[],z,S,G,M,F,N,g,Y,O,V,L,$,T,Q, -fa,U,ka,ga,ca,aa,R,P,W,X,ea;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,e,c);x={signature:b.substr(D,8),header_bytes:p(b,D+8),vertex_coordinate_bytes:p(b,D+9),normal_coordinate_bytes:p(b,D+10),uv_coordinate_bytes:p(b,D+11),vertex_index_bytes:p(b,D+12),normal_index_bytes:p(b,D+13),uv_index_bytes:p(b,D+14),material_index_bytes:p(b,D+15),nvertices:f(b,D+16),nnormals:f(b,D+16+4),nuvs:f(b,D+16+8),ntri_flat:f(b,D+16+12),ntri_smooth:f(b,D+16+16),ntri_flat_uv:f(b,D+16+20),ntri_smooth_uv:f(b, -D+16+24),nquad_flat:f(b,D+16+28),nquad_smooth:f(b,D+16+32),nquad_flat_uv:f(b,D+16+36),nquad_smooth_uv:f(b,D+16+40)};D+=x.header_bytes;z=x.vertex_index_bytes;S=x.vertex_index_bytes*2;G=x.vertex_index_bytes*3;M=x.vertex_index_bytes*3+x.material_index_bytes;F=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;N=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;g=x.vertex_index_bytes;Y=x.vertex_index_bytes*2;O=x.vertex_index_bytes*3;V=x.vertex_index_bytes*4;L=x.vertex_index_bytes* +255<<8)+b.colorDiffuse[2]*255,h.color=j,h.opacity=b.transparency;else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&c)j=document.createElement("canvas"),h.lightMap=new THREE.Texture(j),h.lightMap.sourceFile=b.mapLightmap,e(h.lightMap,c+"/"+b.mapLightmap);return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype; +THREE.JSONLoader.prototype.load=function(b){var c=this,d=b.model,e=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(d),b=new Worker(d);b.onmessage=function(b){c.createModel(b.data,e,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())}; +THREE.JSONLoader.prototype.createModel=function(b,c,d){var e=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(e,b.materials,d);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var d,g,m,n,o,t,u,p,v,C,E,y,D,x,I=b.faces;t=b.vertices;var A=b.normals,z=b.colors,S=0;for(d=0;d>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function g(b,c){var d=o(b,c),e=o(b,c+1),f=o(b,c+2);return(o(b,c+3)<<24)+(f<<16)+(e<<8)+d}function m(b,c){var d=o(b,c);return(o(b,c+1)<<8)+d}function n(b,c){var d=o(b,c);return d>127?d-256:d}function o(b, +c){return b.charCodeAt(c)&255}function t(c){var d,e,f;d=g(b,c);e=g(b,c+z);f=g(b,c+S);c=m(b,c+G);THREE.BinaryLoader.prototype.f3(y,d,e,f,c)}function u(c){var d,e,f,h,j,n;d=g(b,c);e=g(b,c+z);f=g(b,c+S);h=m(b,c+G);j=g(b,c+M);n=g(b,c+F);c=g(b,c+N);THREE.BinaryLoader.prototype.f3n(y,I,d,e,f,h,j,n,c)}function p(c){var d,e,h,j;d=g(b,c);e=g(b,c+f);h=g(b,c+Y);j=g(b,c+O);c=m(b,c+V);THREE.BinaryLoader.prototype.f4(y,d,e,h,j,c)}function v(c){var d,e,h,j,n,o,p,t;d=g(b,c);e=g(b,c+f);h=g(b,c+Y);j=g(b,c+O);n=m(b, +c+V);o=g(b,c+L);p=g(b,c+$);t=g(b,c+T);c=g(b,c+Q);THREE.BinaryLoader.prototype.f4n(y,I,d,e,h,j,n,o,p,t,c)}function C(c){var d,e;d=g(b,c);e=g(b,c+fa);c=g(b,c+U);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],A[d*2],A[d*2+1],A[e*2],A[e*2+1],A[c*2],A[c*2+1])}function E(c){var d,e,f;d=g(b,c);e=g(b,c+ka);f=g(b,c+ga);c=g(b,c+ca);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],A[d*2],A[d*2+1],A[e*2],A[e*2+1],A[f*2],A[f*2+1],A[c*2],A[c*2+1])}var y=this,D=0,x,I=[],A=[],z,S,G,M,F,N,f,Y,O,V,L,$,T,Q, +fa,U,ka,ga,ca,aa,R,P,W,X,ea;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,e,c);x={signature:b.substr(D,8),header_bytes:o(b,D+8),vertex_coordinate_bytes:o(b,D+9),normal_coordinate_bytes:o(b,D+10),uv_coordinate_bytes:o(b,D+11),vertex_index_bytes:o(b,D+12),normal_index_bytes:o(b,D+13),uv_index_bytes:o(b,D+14),material_index_bytes:o(b,D+15),nvertices:g(b,D+16),nnormals:g(b,D+16+4),nuvs:g(b,D+16+8),ntri_flat:g(b,D+16+12),ntri_smooth:g(b,D+16+16),ntri_flat_uv:g(b,D+16+20),ntri_smooth_uv:g(b, +D+16+24),nquad_flat:g(b,D+16+28),nquad_smooth:g(b,D+16+32),nquad_flat_uv:g(b,D+16+36),nquad_smooth_uv:g(b,D+16+40)};D+=x.header_bytes;z=x.vertex_index_bytes;S=x.vertex_index_bytes*2;G=x.vertex_index_bytes*3;M=x.vertex_index_bytes*3+x.material_index_bytes;F=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;N=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;f=x.vertex_index_bytes;Y=x.vertex_index_bytes*2;O=x.vertex_index_bytes*3;V=x.vertex_index_bytes*4;L=x.vertex_index_bytes* 4+x.material_index_bytes;$=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes;T=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*2;Q=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*3;fa=x.uv_index_bytes;U=x.uv_index_bytes*2;ka=x.uv_index_bytes;ga=x.uv_index_bytes*2;ca=x.uv_index_bytes*3;c=x.vertex_index_bytes*3+x.material_index_bytes;ea=x.vertex_index_bytes*4+x.material_index_bytes;aa=x.ntri_flat*c;R=x.ntri_smooth*(c+x.normal_index_bytes*3);P=x.ntri_flat_uv* (c+x.uv_index_bytes*3);W=x.ntri_smooth_uv*(c+x.normal_index_bytes*3+x.uv_index_bytes*3);X=x.nquad_flat*ea;c=x.nquad_smooth*(ea+x.normal_index_bytes*4);ea=x.nquad_flat_uv*(ea+x.uv_index_bytes*4);D+=function(c){for(var e,f,g,h=x.vertex_coordinate_bytes*3,k=c+x.nvertices*h;c1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(z,M);object.name=t;object.position.set(x[0],x[1],x[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;L.scene.addObject(object);L.objects[t]=object;if(D.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);L.scene.collisions.colliders.push(b)}if(D.castsShadow)b=new THREE.ShadowVolume(z),L.scene.addChild(b), -b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},L.triggers[object.name]=b)}}else x=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(x[0],x[1],x[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,L.scene.addObject(object), -L.objects[t]=object,L.empties[t]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},L.triggers[object.name]=b)}function m(b){return function(c){L.geometries[b]=c;k();g-=1;d.onLoadComplete();p()}}function n(b){return function(c){L.geometries[b]=c}}function p(){d.callbackProgress({totalModels:O,totalTextures:V,loadedModels:O-g,loadedTextures:V-Y},L);d.onLoadProgress();g==0&&Y==0&&c(L)}var o,u,t,v,C,E,y,D,x,I,A,z,S,G,M,F,N,g,Y,O,V,L;F=b.data;b=new THREE.BinaryLoader;N=new THREE.JSONLoader; -Y=g=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var $=!1;for(t in F.objects)if(D=F.objects[t],D.meshCollider){$=!0;break}if($)L.scene.collisions=new THREE.CollisionSystem;if(F.transform){$=F.transform.position;I=F.transform.rotation;var T=F.transform.scale;$&&L.scene.position.set($[0],$[1],$[2]);I&&L.scene.rotation.set(I[0],I[1],I[2]);T&&L.scene.scale.set(T[0],T[1],T[2]);($||I||T)&&L.scene.updateMatrix()}$=function(){Y-= -1;p();d.onLoadComplete()};for(C in F.cameras){I=F.cameras[C];if(I.type=="perspective")S=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")S=new THREE.Camera,S.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);x=I.position;I=I.target;S.position.set(x[0],x[1],x[2]);S.target.position.set(I[0],I[1],I[2]);L.cameras[C]=S}for(v in F.lights){C=F.lights[v];S=C.color!==void 0?C.color:16777215;I=C.intensity!==void 0?C.intensity:1;if(C.type=="directional")x= +h;c+=g)d=n(b,c),e=n(b,c+x.normal_coordinate_bytes),f=n(b,c+x.normal_coordinate_bytes*2),I.push(d/127,e/127,f/127);return x.nnormals*g}(D);D+=function(c){for(var e,f,g=x.uv_coordinate_bytes*2,h=c+x.nuvs*g;c1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(z,M);object.name=p;object.position.set(x[0],x[1],x[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;L.scene.addObject(object);L.objects[p]=object;if(D.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);L.scene.collisions.colliders.push(b)}if(D.castsShadow)b=new THREE.ShadowVolume(z),L.scene.addChild(b), +b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},L.triggers[object.name]=b)}}else x=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(x[0],x[1],x[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,L.scene.addObject(object), +L.objects[p]=object,L.empties[p]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},L.triggers[object.name]=b)}function m(b){return function(c){L.geometries[b]=c;k();f-=1;d.onLoadComplete();o()}}function n(b){return function(c){L.geometries[b]=c}}function o(){d.callbackProgress({totalModels:O,totalTextures:V,loadedModels:O-f,loadedTextures:V-Y},L);d.onLoadProgress();f==0&&Y==0&&c(L)}var t,u,p,v,C,E,y,D,x,I,A,z,S,G,M,F,N,f,Y,O,V,L;F=b.data;b=new THREE.BinaryLoader;N=new THREE.JSONLoader; +Y=f=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var $=!1;for(p in F.objects)if(D=F.objects[p],D.meshCollider){$=!0;break}if($)L.scene.collisions=new THREE.CollisionSystem;if(F.transform){$=F.transform.position;I=F.transform.rotation;var T=F.transform.scale;$&&L.scene.position.set($[0],$[1],$[2]);I&&L.scene.rotation.set(I[0],I[1],I[2]);T&&L.scene.scale.set(T[0],T[1],T[2]);($||I||T)&&L.scene.updateMatrix()}$=function(){Y-= +1;o();d.onLoadComplete()};for(C in F.cameras){I=F.cameras[C];if(I.type=="perspective")S=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")S=new THREE.Camera,S.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);x=I.position;I=I.target;S.position.set(x[0],x[1],x[2]);S.target.position.set(I[0],I[1],I[2]);L.cameras[C]=S}for(v in F.lights){C=F.lights[v];S=C.color!==void 0?C.color:16777215;I=C.intensity!==void 0?C.intensity:1;if(C.type=="directional")x= C.direction,light=new THREE.DirectionalLight(S,I),light.position.set(x[0],x[1],x[2]),light.position.normalize();else if(C.type=="point")x=C.position,light=new THREE.PointLight(S,I),light.position.set(x[0],x[1],x[2]);L.scene.addLight(light);L.lights[v]=light}for(E in F.fogs)v=F.fogs[E],v.type=="linear"?G=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(G=new THREE.FogExp2(0,v.density)),I=v.color,G.color.setRGB(I[0],I[1],I[2]),L.fogs[E]=G;if(L.cameras&&F.defaults.camera)L.currentCamera=L.cameras[F.defaults.camera]; -if(L.fogs&&F.defaults.fog)L.scene.fog=L.fogs[F.defaults.fog];I=F.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(I[0],I[1],I[2]);L.bgColorAlpha=F.defaults.bgalpha;for(o in F.geometries)if(E=F.geometries[o],E.type=="bin_mesh"||E.type=="ascii_mesh")g+=1,d.onLoadStart();O=g;for(o in F.geometries)E=F.geometries[o],E.type=="cube"?(z=new THREE.Cube(E.width,E.height,E.depth,E.segmentsWidth,E.segmentsHeight,E.segmentsDepth,null,E.flipped,E.sides),L.geometries[o]=z):E.type=="plane"?(z=new THREE.Plane(E.width, -E.height,E.segmentsWidth,E.segmentsHeight),L.geometries[o]=z):E.type=="sphere"?(z=new THREE.Sphere(E.radius,E.segmentsWidth,E.segmentsHeight),L.geometries[o]=z):E.type=="cylinder"?(z=new THREE.Cylinder(E.numSegs,E.topRad,E.botRad,E.height,E.topOffset,E.botOffset),L.geometries[o]=z):E.type=="torus"?(z=new THREE.Torus(E.radius,E.tube,E.segmentsR,E.segmentsT),L.geometries[o]=z):E.type=="icosahedron"?(z=new THREE.Icosahedron(E.subdivisions),L.geometries[o]=z):E.type=="bin_mesh"?b.load({model:e(E.url, -F.urlBaseType),callback:m(o)}):E.type=="ascii_mesh"?N.load({model:e(E.url,F.urlBaseType),callback:m(o)}):E.type=="embedded_mesh"&&(E=F.embeds[E.id])&&N.createModel(E,n(o),"");for(y in F.textures)if(o=F.textures[y],o.url instanceof Array){Y+=o.url.length;for(b=0;b=this.maxCount-3&&k(this)};this.begin=function(){this.count=0; -this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(m=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);n=Math.floor(n+k);n>this.size-1&&(n=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 v,C,E,y,D,x;o0&&(this.field[E+v]+=y)}}};this.addPlaneX=function(b,c){var f,h,j,k,m,n=this.size,p=this.yd,o=this.zd,u=this.field,t=n*Math.sqrt(b/c);t>n&&(t=n);for(f=0;f0)for(h=0;hp&&(v=p);for(h=0;h0){m=h*o;for(f=0;fsize&&(dist=size);for(j=0;j0){m=zd*j;for(h=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 u=Math.floor(n-k);u<1&&(u=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var p=Math.floor(o-k);p<1&&(p=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size- +1);for(var v,C,E,y,D,x;t0&&(this.field[E+v]+=y)}}};this.addPlaneX=function(b,c){var g,h,j,k,m,n=this.size,o=this.yd,t=this.zd,u=this.field,p=n*Math.sqrt(b/c);p>n&&(p=n);for(g=0;g0)for(h=0;ho&&(v=o);for(h=0;h0){m=h*t;for(g=0;gsize&&(dist=size);for(j=0;j0){m=zd*j;for(h=0;hh?this.hits.push(f):this.hits.unshift(f),h=e;return this.hits}; +THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,d,e,g,h=0;c=0;for(d=this.colliders.length;ch?this.hits.push(g):this.hits.unshift(g),h=e;return this.hits}; THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var d=0;c[d]instanceof THREE.MeshCollider;){var e=this.rayMesh(b,c[d]);if(e.distc.length)return null;return c[d]}; 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 d=this.makeRayLocal(b,c.mesh),e=Number.MAX_VALUE,f,h=0;h=k*f))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);Math.abs(h.x)>Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=k.y-c.y,h=d.y-c.y, -f=e.y-c.y,k=k.z-c.z,d=d.z-c.z,e=e.z-c.z):(b=k.x-c.x,h=d.x-c.x,f=e.x-c.x,k=k.y-c.y,d=d.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(b=k.x-c.x,h=d.x-c.x,f=e.x-c.x,k=k.z-c.z,d=d.z-c.z,e=e.z-c.z):(b=k.x-c.x,h=d.x-c.x,f=e.x-c.x,k=k.y-c.y,d=d.y-c.y,e=e.y-c.y);c=h*e-d*f;if(c==0)return Number.MAX_VALUE;c=1/c;e=(b*e-k*f)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*k-d*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return j}; +THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var d=this.makeRayLocal(b,c.mesh),e=Number.MAX_VALUE,g,h=0;h=k*g))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);Math.abs(h.x)>Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=k.y-c.y,h=d.y-c.y, +g=e.y-c.y,k=k.z-c.z,d=d.z-c.z,e=e.z-c.z):(b=k.x-c.x,h=d.x-c.x,g=e.x-c.x,k=k.y-c.y,d=d.y-c.y,e=e.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(b=k.x-c.x,h=d.x-c.x,g=e.x-c.x,k=k.z-c.z,d=d.z-c.z,e=e.z-c.z):(b=k.x-c.x,h=d.x-c.x,g=e.x-c.x,k=k.y-c.y,d=d.y-c.y,e=e.y-c.y);c=h*e-d*g;if(c==0)return Number.MAX_VALUE;c=1/c;e=(b*e-k*g)*c;if(!(e>=0))return Number.MAX_VALUE;c*=h*k-d*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return j}; THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var d=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,d);var e=THREE.CollisionSystem.__r;e.origin.copy(b.origin);e.direction.copy(b.direction);d.multiplyVector3(e.origin);d.rotateAxis(e.direction);e.direction.normalize();return e}; -THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;c.dynamic&&c.mesh&&c.mesh.matrixWorld?d=this.makeRayLocal(b,c.mesh):(d=THREE.CollisionSystem.__r,d.origin.copy(b.origin),d.direction.copy(b.direction));var e=0,f=0,h=0,j=0,k=0,m=0,n=!0;d.origin.xc.max.x&&(e=c.max.x-d.origin.x,e/=d.direction.x,n=!1,j=1);d.origin.yc.max.y&&(f=c.max.y-d.origin.y,f/=d.direction.y, -n=!1,k=1);d.origin.zc.max.z&&(h=c.max.z-d.origin.z,h/=d.direction.z,n=!1,m=1);if(n)return-1;n=0;f>e&&(n=1,e=f);h>e&&(n=2,e=h);switch(n){case 0:k=d.origin.y+d.direction.y*e;if(kc.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*e;if(dc.max.z)return Number.MAX_VALUE;c.normal.set(j,0,0);break;case 1:j=d.origin.x+d.direction.x*e;if(jc.max.x)return Number.MAX_VALUE;d=d.origin.z+d.direction.z* +THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;c.dynamic&&c.mesh&&c.mesh.matrixWorld?d=this.makeRayLocal(b,c.mesh):(d=THREE.CollisionSystem.__r,d.origin.copy(b.origin),d.direction.copy(b.direction));var e=0,g=0,h=0,j=0,k=0,m=0,n=!0;d.origin.xc.max.x&&(e=c.max.x-d.origin.x,e/=d.direction.x,n=!1,j=1);d.origin.yc.max.y&&(g=c.max.y-d.origin.y,g/=d.direction.y, +n=!1,k=1);d.origin.zc.max.z&&(h=c.max.z-d.origin.z,h/=d.direction.z,n=!1,m=1);if(n)return-1;n=0;g>e&&(n=1,e=g);h>e&&(n=2,e=h);switch(n){case 0:k=d.origin.y+d.direction.y*e;if(kc.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*e;if(dc.max.z)return Number.MAX_VALUE;c.normal.set(j,0,0);break;case 1:j=d.origin.x+d.direction.x*e;if(jc.max.x)return Number.MAX_VALUE;d=d.origin.z+d.direction.z* e;if(dc.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:j=d.origin.x+d.direction.x*e;if(jc.max.x)return Number.MAX_VALUE;k=d.origin.y+d.direction.y*e;if(kc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,m)}return e};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var d=b.direction.dot(c.normal),e=c.point.dot(c.normal);if(d<0)d=(e-b.origin.dot(c.normal))/d;else return Number.MAX_VALUE;return d>0?d:Number.MAX_VALUE}; THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq=0)return Math.abs(e)-Math.sqrt(d);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,d=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]),d=new THREE.BoxCollider(d,c);d.mesh=b;return d};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}; diff --git a/build/custom/ThreeCanvas.js b/build/custom/ThreeCanvas.js index 74d5bec8308f2866f785fd426cef5a5a8a334a54..beacda8416f94c3c322c55bc59f4912f38f6745f 100644 --- a/build/custom/ThreeCanvas.js +++ b/build/custom/ThreeCanvas.js @@ -1,7 +1,7 @@ // ThreeCanvas.js r41/ROME - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(a){this.setHex(a)}; -THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,h,j;if(c==0)d=e=g=0;else switch(f=Math.floor(a*6),h=a*6-f,a=c*(1-b),j=c*(1-b*h),b=c*(1-b*(1-h)),f){case 1:d=j;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=j;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=j;break;case 6:case 0:d=c,e=b,g=a}this.setRGB(d, -e,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)}; +THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,f,g,e,h,j;if(c==0)d=f=g=0;else switch(e=Math.floor(a*6),h=a*6-e,a=c*(1-b),j=c*(1-b*h),b=c*(1-b*(1-h)),e){case 1:d=j;f=c;g=a;break;case 2:d=a;f=c;g=b;break;case 3:d=a;f=j;g=c;break;case 4:d=b;f=a;g=c;break;case 5:d=c;f=a;g=j;break;case 6:case 0:d=c,f=b,g=a}this.setRGB(d, +f,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)}; THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a, @@ -11,58 +11,59 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)}; THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d,e=[];b=0;for(c=a.length;b0&&a>0&&f+a<1}var c,d,e,g,f,h,j,i,o,m,k,n=a.geometry,l=n.vertices,q=[];c=0;for(d=n.faces.length;c0:o<0))if(i=i.dot((new THREE.Vector3).sub(g,m))/o,m=m.addSelf(k.multiplyScalar(i)),e instanceof THREE.Face3)b(m,g,f,h)&&(e={distance:this.origin.distanceTo(m),point:m,face:e,object:a},q.push(e));else if(e instanceof THREE.Face4&&(b(m,g,f,j)||b(m,f,h,j)))e={distance:this.origin.distanceTo(m),point:m,face:e,object:a},q.push(e);return q}}; -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,m){h=!1;b=f;c=g;d=o;e=m;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,m,k,n){h?(h=!1,b=fo?f>k?f:k:o>k?o:k,e=g>m?g>n?g:n:m>n?m:n):(b=fo?f>k?f>d?f:d:k>d?k:d:o>k?o>d?o:d:k>d?k:d,e=g>m?g>n?g>e?g:e:n>e?n:e:m>n?m>e?m: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={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,i,o,m,k,n,l,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,j||0,i||0,o||1,m||0,k||0,n||0,l||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,j,i,o,m,k,n,l,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=j;this.n32=i;this.n33=o;this.n34=m;this.n41=k;this.n42=n;this.n43=l;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,j=a.n23,i=a.n24,o=a.n31,m=a.n32,k=a.n33,n=a.n34,l=a.n41,q=a.n42,x=a.n43,t=a.n44,H=b.n11,L=b.n12,y=b.n13,C=b.n14,p=b.n21,N=b.n22, -r=b.n23,v=b.n24,z=b.n31,R=b.n32,aa=b.n33,$=b.n34;this.n11=c*H+d*p+e*z;this.n12=c*L+d*N+e*R;this.n13=c*y+d*r+e*aa;this.n14=c*C+d*v+e*$+g;this.n21=f*H+h*p+j*z;this.n22=f*L+h*N+j*R;this.n23=f*y+h*r+j*aa;this.n24=f*C+h*v+j*$+i;this.n31=o*H+m*p+k*z;this.n32=o*L+m*N+k*R;this.n33=o*y+m*r+k*aa;this.n34=o*C+m*v+k*$+n;this.n41=l*H+q*p+x*z;this.n42=l*L+q*N+x*R;this.n43=l*y+q*r+x*aa;this.n44=l*C+q*v+x*$+t;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,i=this.n32,o=this.n33,m=this.n34,k=this.n41,n=this.n42,l=this.n43,q=this.n44;return d*f*i*k-c*h*i*k-d*g*o*k+b*h*o*k+c*g*m*k-b*f*m*k-d*f*j*n+c*h*j*n+d*e*o*n-a*h*o*n-c*e*m*n+a*f*m*n+d*g*j*l-b*h*j*l-d*e*i*l+a*h*i*l+b*e*m*l-a*g*m*l-c*g*j*q+b*f*j*q+c*e*i*q-a*f*i*q-b*e*o*q+a*g*o*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= +THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b0&&a>0&&e+a<1}if(a instanceof THREE.Particle){var d=[],f=b(this.origin,this.direction,a);f&&f0:n<0))if(p=p.dot((new THREE.Vector3).sub(h,l))/n,l=l.addSelf(k.multiplyScalar(p)),e instanceof THREE.Face3)c(l,h,j,i)&&(e={distance:this.origin.distanceTo(l),point:l,face:e,object:a},d.push(e));else if(e instanceof THREE.Face4&&(c(l,h,j, +m)||c(l,j,i,m)))e={distance:this.origin.distanceTo(l),point:l,face:e,object:a},d.push(e);return d}}}; +THREE.Rectangle=function(){function a(){g=d-b;e=f-c}var b,c,d,f,g,e,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return e};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,m,p){h=!1;b=e;c=g;d=m;f=p;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=be?d:e,f=f>g?f:g);a()};this.add3Points= +function(e,g,m,p,n,l){h?(h=!1,b=em?e>n?e:n:m>n?m:n,f=g>p?g>l?g:l:p>l?p:l):(b=em?e>n?e>d?e:d:n>d?n:d:m>n?m>d?m:d:n>d?n:d,f=g>p?g>l?g>f?g:f:l>f?l:f:p>l?p>f?p:f:l>f?l:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=be.getRight()?d:e.getRight(),f=f> +e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]}; +THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,g,e,h,j,i,m,p,n,l,k,q){this.set(a||1,b||0,c||0,d||0,f||0,g||1,e||0,h||0,j||0,i||0,m||1,p||0,n||0,l||0,k||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,e,h,j,i,m,p,n,l,k,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=e;this.n24=h;this.n31=j;this.n32=i;this.n33=m;this.n34=p;this.n41=n;this.n42=l;this.n43=k;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, +f=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());f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=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)*f;a.y=(this.n21*b+this.n22*c+this.n23* +d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;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,f=a.n13,g=a.n14,e=a.n21,h=a.n22,j=a.n23,i=a.n24,m=a.n31,p=a.n32,n=a.n33,l=a.n34,k=a.n41,q=a.n42,u=a.n43,t=a.n44,G=b.n11,K=b.n12,x=b.n13,B=b.n14,o=b.n21,M=b.n22, +r=b.n23,v=b.n24,y=b.n31,Q=b.n32,$=b.n33,Z=b.n34;this.n11=c*G+d*o+f*y;this.n12=c*K+d*M+f*Q;this.n13=c*x+d*r+f*$;this.n14=c*B+d*v+f*Z+g;this.n21=e*G+h*o+j*y;this.n22=e*K+h*M+j*Q;this.n23=e*x+h*r+j*$;this.n24=e*B+h*v+j*Z+i;this.n31=m*G+p*o+n*y;this.n32=m*K+p*M+n*Q;this.n33=m*x+p*r+n*$;this.n34=m*B+p*v+n*Z+l;this.n41=k*G+q*o+u*y;this.n42=k*K+q*M+u*Q;this.n43=k*x+q*r+u*$;this.n44=k*B+q*v+u*Z+t;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,f=this.n21,g=this.n22,e=this.n23,h=this.n24,j=this.n31,i=this.n32,m=this.n33,p=this.n34,n=this.n41,l=this.n42,k=this.n43,q=this.n44;return d*e*i*n-c*h*i*n-d*g*m*n+b*h*m*n+c*g*p*n-b*e*p*n-d*e*j*l+c*h*j*l+d*f*m*l-a*h*m*l-c*f*p*l+a*e*p*l+d*g*j*k-b*h*j*k-d*f*i*k+a*h*i*k+b*f*p*k-a*g*p*k-c*g*j*q+b*e*j*q+c*f*i*q-a*e*i*q-b*f*m*q+a*g*m*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;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,j=e*g,i=e*f;this.set(j* -g+c,j*f-d*h,j*h+d*f,0,j*f+d*h,i*f+c,i*h-d*g,0,j*h-d*f,i*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){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;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 i=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(i+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+i);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},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,j=a.n23,i=a.n24,o=a.n31,m=a.n32,k=a.n33,n=a.n34,l=a.n41,q=a.n42,x=a.n43,t=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*n*q-i*k*q+i*m*x-h*n*x-j*m*t+h*k*t;b.n12=g*k*q-e*n*q-g*m*x+d*n*x+e*m*t-d*k*t;b.n13=e*i*q-g*j*q+g*h*x-d*i*x-e*h*t+d*j*t;b.n14=g*j*m-e*i*m-g*h*k+d*i*k+e*h*n-d*j*n;b.n21=i*k*l-j*n*l-i*o*x+f*n*x+j*o*t-f*k*t;b.n22=e*n*l-g*k*l+g*o*x-c*n*x-e*o*t+c*k*t;b.n23=g*j*l-e*i*l-g*f*x+c*i*x+e*f*t-c*j*t;b.n24= -e*i*o-g*j*o+g*f*k-c*i*k-e*f*n+c*j*n;b.n31=h*n*l-i*m*l+i*o*q-f*n*q-h*o*t+f*m*t;b.n32=g*m*l-d*n*l-g*o*q+c*n*q+d*o*t-c*m*t;b.n33=e*i*l-g*h*l+g*f*q-c*i*q-d*f*t+c*h*t;b.n34=g*h*o-d*i*o-g*f*m+c*i*m+d*f*n-c*h*n;b.n41=j*m*l-h*k*l-j*o*q+f*k*q+h*o*x-f*m*x;b.n42=d*k*l-e*m*l+e*o*q-c*k*q-d*o*x+c*m*x;b.n43=e*h*l-d*j*l-e*f*q+c*j*q+d*f*x-c*h*x;b.n44=d*j*o-e*h*o+e*f*m-c*j*m-d*f*k+c*h*k;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,i=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;if(a==0)throw"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*i;c[7]=a*o;c[8]=a*m;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,j,i;f=new THREE.Matrix4;h=b-a;j=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/j;f.n23=0;f.n24=-((c+d)/j);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; +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),f=1-c,g=a.x,e=a.y,h=a.z,j=f*g,i=f*e;this.set(j* +g+c,j*e-d*h,j*h+d*e,0,j*e+d*h,i*e+c,i*h-d*g,0,j*h-d*e,i*h+d*g,f*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){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),e=a*c,h=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*f;this.n31=-e*g+b*d;this.n32=e*d+b*g;this.n33=a*f;return this}, +setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,e=c+c,h=d+d,a=b*g,j=b*e;b*=h;var i=c*e;c*=h;d*=h;g*=f;e*=f;f*=h;this.n11=1-(i+d);this.n12=j-f;this.n13=b+e;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-e;this.n32=c+g;this.n33=1-(a+i);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},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,f=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*f;this.n23=a.n23*f;this.n33=a.n33*f}}; +THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,e=a.n21,h=a.n22,j=a.n23,i=a.n24,m=a.n31,p=a.n32,n=a.n33,l=a.n34,k=a.n41,q=a.n42,u=a.n43,t=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*l*q-i*n*q+i*p*u-h*l*u-j*p*t+h*n*t;b.n12=g*n*q-f*l*q-g*p*u+d*l*u+f*p*t-d*n*t;b.n13=f*i*q-g*j*q+g*h*u-d*i*u-f*h*t+d*j*t;b.n14=g*j*p-f*i*p-g*h*n+d*i*n+f*h*l-d*j*l;b.n21=i*n*k-j*l*k-i*m*u+e*l*u+j*m*t-e*n*t;b.n22=f*l*k-g*n*k+g*m*u-c*l*u-f*m*t+c*n*t;b.n23=g*j*k-f*i*k-g*e*u+c*i*u+f*e*t-c*j*t;b.n24= +f*i*m-g*j*m+g*e*n-c*i*n-f*e*l+c*j*l;b.n31=h*l*k-i*p*k+i*m*q-e*l*q-h*m*t+e*p*t;b.n32=g*p*k-d*l*k-g*m*q+c*l*q+d*m*t-c*p*t;b.n33=f*i*k-g*h*k+g*e*q-c*i*q-d*e*t+c*h*t;b.n34=g*h*m-d*i*m-g*e*p+c*i*p+d*e*l-c*h*l;b.n41=j*p*k-h*n*k-j*m*q+e*n*q+h*m*u-e*p*u;b.n42=d*n*k-f*p*k+f*m*q-c*n*q-d*m*u+c*p*u;b.n43=f*h*k-d*j*k-f*e*q+c*j*q+d*e*u-c*h*u;b.n44=d*j*m-f*h*m+f*e*p-c*j*p-d*e*n+c*h*n;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,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,e=-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,i=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*e+a.n31*i;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*e;c[4]=a*h;c[5]=a*j;c[6]=a*i;c[7]=a*m;c[8]=a*p;return b}; +THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var e;e=new THREE.Matrix4;e.n11=2*f/(b-a);e.n12=0;e.n13=(b+a)/(b-a);e.n14=0;e.n21=0;e.n22=2*f/(d-c);e.n23=(d+c)/(d-c);e.n24=0;e.n31=0;e.n32=0;e.n33=-(g+f)/(g-f);e.n34=-2*g*f/(g-f);e.n41=0;e.n42=0;e.n43=-1;e.n44=0;return e};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)}; +THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var e,h,j,i;e=new THREE.Matrix4;h=b-a;j=c-d;i=g-f;e.n11=2/h;e.n12=0;e.n13=0;e.n14=-((b+a)/h);e.n21=0;e.n22=2/j;e.n23=0;e.n24=-((c+d)/j);e.n31=0;e.n32=0;e.n33=-2/i;e.n34=-((g+f)/i);e.n41=0;e.n42=0;e.n43=0;e.n44=1;return e};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1; this.visible=!0;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={translate:function(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.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.set(a||0,b||0)}; +multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-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,f=a.z,g=this.x,e=this.y,h=this.z,j=this.w,i=j*c+e*f-h*d,m= +j*d+h*c-g*f,p=j*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=i*j+c*-g+m*-h-p*-e;b.y=m*j+c*-e+p*-g-i*-h;b.z=p*j+c*-h+i*-e-m*-g;return b}}; +THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<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;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Face3=function(a,b,c,d,f,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=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3}; +THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;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=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)}; THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var 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=this.boundingSphere===null?0:this.boundingSphere.radius,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))),dP&&f.positionScreen.z0&&C.z<1))F=L[H]=L[H]||new THREE.RenderableParticle,H++,t=F,t.x=C.x/C.w,t.y=C.y/C.w,t.z=C.z,t.rotation=s.rotation.z,t.scale.x=s.scale.x*Math.abs(t.x-(C.x+e.projectionMatrix.n11)/(C.w+e.projectionMatrix.n14)),t.scale.y=s.scale.y*Math.abs(t.y-(C.y+ -e.projectionMatrix.n22)/(C.w+e.projectionMatrix.n24)),t.materials=s.materials,J.push(t);g&&J.sort(b);return J}}; -THREE.CanvasRenderer=function(a){function b(a){if(t!=a)l.globalAlpha=t=a}function c(a){if(H!=a){switch(a){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}H=a}}function d(a){if(L!=a.hex)L=a.hex,l.strokeStyle="#"+g(L.toString(16))}function e(a){if(y!=a.hex)y=a.hex,l.fillStyle="#"+g(y.toString(16))}function g(a){for(;a.length<6;)a="0"+a;return a} -var f=this,h=null,j=new THREE.Projector,a=a||{},i=a.canvas!==void 0?a.canvas:document.createElement("canvas"),o,m,k,n,l=i.getContext("2d"),q=new THREE.Color(0),x=0,t=1,H=0,L=null,y=null,C=null,p=null,N=null,r,v,z,R,aa=new THREE.RenderableVertex,$=new THREE.RenderableVertex,J,P,S,M,E,A,O,w,K,I,T,pa,s=new THREE.Color(0),F=new THREE.Color(0),D=new THREE.Color(0),G=new THREE.Color(0),U=new THREE.Color(0),X,da,Y,ba,Ba,Ca,Da,Ea,Fa,Ga,la=new THREE.Rectangle,ea=new THREE.Rectangle,W=new THREE.Rectangle,za= -!1,ca=new THREE.Color,Z=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,Q=new THREE.Vector3,qa,ra,Aa,fa,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);fa=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){o=a;m=b;k=o/2;n=m/2;i.width=o;i.height=m;la.set(-k,-n,k,n);t=1;H=0;N=p=C=y=L=null};this.setClearColor=function(a,b){q=a;x=b};this.setClearColorHex=function(a,b){q.setHex(a);x=b};this.clear=function(){l.setTransform(1,0,0,-1,k,n);if(!ea.isEmpty())ea.inflate(1),ea.minSelf(la),q.hex==0&&x==0?l.clearRect(ea.getX(),ea.getY(),ea.getWidth(),ea.getHeight()):(c(THREE.NormalBlending),b(1),l.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b* -255)+","+x+")",l.fillRect(ea.getX(),ea.getY(),ea.getWidth(),ea.getHeight())),ea.empty()};this.render=function(a,g){function i(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,p=m.height>>1,g=f.scale.x* -k,j=f.scale.y*n,h=g*u,i=j*p,W.set(a.x-h,a.y-i,a.x+h,a.y+i),la.instersects(W)&&(l.save(),l.translate(a.x,a.y),l.rotate(-f.rotation),l.scale(g,-j),l.translate(-u,-p),l.drawImage(m,0,0),l.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*k,i=f.scale.y*n,W.set(a.x-h,a.y-i,a.x+h,a.y+i),la.instersects(W)&&(d(g.color),e(g.color),l.save(),l.translate(a.x,a.y),l.rotate(-f.rotation),l.scale(h,i),g.program(l),l.restore()))}function q(a,e,f,g){b(g.opacity);c(g.blending);l.beginPath();l.moveTo(a.positionScreen.x, -a.positionScreen.y);l.lineTo(e.positionScreen.x,e.positionScreen.y);l.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(C!=a)l.lineWidth=C=a;a=g.linecap;if(p!=a)l.lineCap=p=a;a=g.linejoin;if(N!=a)l.lineJoin=N=a;d(g.color);l.stroke();W.inflate(g.linewidth*2)}}function t(a,d,e,h,l,i,j,u,k){f.data.vertices+=3;f.data.faces++;b(u.opacity);c(u.blending);J=a.positionScreen.x;P=a.positionScreen.y;S=d.positionScreen.x;M=d.positionScreen.y;E=e.positionScreen.x;A=e.positionScreen.y;y(J,P, -S,M,E,A);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(ba=j.uvs[0],ha(J,P,S,M,E,A,u.map.image,ba[h].u,ba[h].v,ba[l].u,ba[l].v,ba[i].u,ba[i].v));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=g.matrixWorldInverse,Q.copy(j.vertexNormalsWorld[0]),Ba=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ca=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(j.vertexNormalsWorld[1]),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(j.vertexNormalsWorld[2]),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,ha(J,P,S,M,E,A,u.envMap.image,Ba,Ca,Da,Ea,Fa,Ga)}else u.wireframe?H(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):ia(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&(ba=j.uvs[0],ha(J,P,S,M,E,A,u.map.image,ba[h].u,ba[h].v,ba[l].u,ba[l].v,ba[i].u,ba[i].v)),c(THREE.SubtractiveBlending)), -za?!u.wireframe&&u.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3?(F.r=D.r=G.r=Z.r,F.g=D.g=G.g=Z.g,F.b=D.b=G.b=Z.b,m(k,j.v1.positionWorld,j.vertexNormalsWorld[0],F),m(k,j.v2.positionWorld,j.vertexNormalsWorld[1],D),m(k,j.v3.positionWorld,j.vertexNormalsWorld[2],G),U.r=(D.r+G.r)*0.5,U.g=(D.g+G.g)*0.5,U.b=(D.b+G.b)*0.5,Y=wa(F,D,G,U),ha(J,P,S,M,E,A,Y,0,0,1,0,0,1)):(ca.r=Z.r,ca.g=Z.g,ca.b=Z.b,m(k,j.centroidWorld,j.normalWorld,ca),s.r=Math.max(0,Math.min(u.color.r*ca.r,1)),s.g=Math.max(0, -Math.min(u.color.g*ca.g,1)),s.b=Math.max(0,Math.min(u.color.b*ca.b,1)),s.updateHex(),u.wireframe?H(s,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):ia(s)):u.wireframe?H(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):ia(u.color);else if(u instanceof THREE.MeshDepthMaterial)X=g.near,da=g.far,F.r=F.g=F.b=1-ma(a.positionScreen.z,X,da),D.r=D.g=D.b=1-ma(d.positionScreen.z,X,da),G.r=G.g=G.b=1-ma(e.positionScreen.z,X,da),U.r=(D.r+G.r)*0.5,U.g=(D.g+G.g)*0.5,U.b=(D.b+G.b)* -0.5,Y=wa(F,D,G,U),ha(J,P,S,M,E,A,Y,0,0,1,0,0,1);else if(u instanceof THREE.MeshNormalMaterial)s.r=na(j.normalWorld.x),s.g=na(j.normalWorld.y),s.b=na(j.normalWorld.z),s.updateHex(),u.wireframe?H(s,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):ia(s)}function x(a,d,e,h,j,l,i,k,n){f.data.vertices+=4;f.data.faces++;b(k.opacity);c(k.blending);if(k.map||k.envMap)t(a,d,h,0,1,3,i,k,n),t(j,e,l,1,2,3,i,k,n);else if(J=a.positionScreen.x,P=a.positionScreen.y,S=d.positionScreen.x,M=d.positionScreen.y, -E=e.positionScreen.x,A=e.positionScreen.y,O=h.positionScreen.x,w=h.positionScreen.y,K=j.positionScreen.x,I=j.positionScreen.y,T=l.positionScreen.x,pa=l.positionScreen.y,k instanceof THREE.MeshBasicMaterial)L(J,P,S,M,E,A,O,w),k.wireframe?H(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ia(k.color);else if(k instanceof THREE.MeshLambertMaterial)za?!k.wireframe&&k.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(F.r=D.r=G.r=U.r=Z.r,F.g=D.g=G.g=U.g=Z.g,F.b=D.b=G.b=U.b= -Z.b,m(n,i.v1.positionWorld,i.vertexNormalsWorld[0],F),m(n,i.v2.positionWorld,i.vertexNormalsWorld[1],D),m(n,i.v4.positionWorld,i.vertexNormalsWorld[3],G),m(n,i.v3.positionWorld,i.vertexNormalsWorld[2],U),Y=wa(F,D,G,U),y(J,P,S,M,O,w),ha(J,P,S,M,O,w,Y,0,0,1,0,0,1),y(K,I,E,A,T,pa),ha(K,I,E,A,T,pa,Y,1,0,1,1,0,1)):(ca.r=Z.r,ca.g=Z.g,ca.b=Z.b,m(n,i.centroidWorld,i.normalWorld,ca),s.r=Math.max(0,Math.min(k.color.r*ca.r,1)),s.g=Math.max(0,Math.min(k.color.g*ca.g,1)),s.b=Math.max(0,Math.min(k.color.b*ca.b, -1)),s.updateHex(),L(J,P,S,M,E,A,O,w),k.wireframe?H(s,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ia(s)):(L(J,P,S,M,E,A,O,w),k.wireframe?H(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ia(k.color));else if(k instanceof THREE.MeshNormalMaterial)s.r=na(i.normalWorld.x),s.g=na(i.normalWorld.y),s.b=na(i.normalWorld.z),s.updateHex(),L(J,P,S,M,E,A,O,w),k.wireframe?H(s,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):ia(s);else if(k instanceof THREE.MeshDepthMaterial)X= -g.near,da=g.far,F.r=F.g=F.b=1-ma(a.positionScreen.z,X,da),D.r=D.g=D.b=1-ma(d.positionScreen.z,X,da),G.r=G.g=G.b=1-ma(h.positionScreen.z,X,da),U.r=U.g=U.b=1-ma(e.positionScreen.z,X,da),Y=wa(F,D,G,U),y(J,P,S,M,O,w),ha(J,P,S,M,O,w,Y,0,0,1,0,0,1),y(K,I,E,A,T,pa),ha(K,I,E,A,T,pa,Y,1,0,1,1,0,1)}function y(a,b,c,d,e,f){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,f);l.lineTo(a,b);l.closePath()}function L(a,b,c,d,e,f,g,h){l.beginPath();l.moveTo(a,b);l.lineTo(c,d);l.lineTo(e,f);l.lineTo(g,h);l.lineTo(a, -b);l.closePath()}function H(a,b,c,e){if(C!=b)l.lineWidth=C=b;if(p!=c)l.lineCap=p=c;if(N!=e)l.lineJoin=N=e;d(a);l.stroke();W.inflate(b*2)}function ia(a){e(a);l.fill()}function ha(a,b,c,d,e,f,g,h,i,k,j,m,n){var o,p;o=g.width-1;p=g.height-1;h*=o;i*=p;k*=o;j*=p;m*=o;n*=p;c-=a;d-=b;e-=a;f-=b;k-=h;j-=i;m-=h;n-=i;o=k*n-m*j;o!=0&&(p=1/o,o=(n*c-j*e)*p,j=(n*d-j*f)*p,c=(k*e-m*c)*p,d=(k*f-m*d)*p,a=a-o*h-c*i,b=b-j*h-d*i,l.save(),l.transform(o,j,c,d,a,b),l.clip(),l.drawImage(g,0,0),l.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);fa[0]=e<0?0:e>255?255:e;fa[1]=f<0?0:f>255?255:f;fa[2]=a<0?0:a>255?255:a;fa[4]=g<0?0:g>255?255:g;fa[5]=h<0?0:h>255?255:h;fa[6]=b<0?0:b>255?255:b;fa[8]=i<0?0:i>255?255:i;fa[9]=j<0?0:j>255?255:j;fa[10]=c<0?0:c>255?255:c;fa[12]=k<0?0:k>255?255:k;fa[13]=l<0?0:l>255?255:l;fa[14]=d<0?0:d>255?255:d;ra.putImageData(Aa,0,0);va.drawImage(qa, -0,0);return sa}function ma(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 ja(a,b){var c=b.x-a.x,d=b.y-a.y,e=1/Math.sqrt(c*c+d*d);c*=e;d*=e;b.x+=c;b.y+=d;a.x-=c;a.y-=d}var xa,Ha,B,ga,ka,oa,ya,V;this.autoClear?this.clear():l.setTransform(1,0,0,-1,k,n);f.data.vertices=0;f.data.faces=0;h=j.projectScene(a,g,this.sortElements);(za=a.lights.length>0)&&i(a);xa=0;for(Ha=h.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))),dO&&e.positionScreen.z0&&B.z<1))E=K[G]=K[G]||new THREE.RenderableParticle,G++,t=E,t.x=B.x/B.w,t.y=B.y/B.w,t.z=B.z,t.rotation=s.rotation.z,t.scale.x=s.scale.x*Math.abs(t.x-(B.x+f.projectionMatrix.n11)/(B.w+f.projectionMatrix.n14)),t.scale.y=s.scale.y*Math.abs(t.y-(B.y+ +f.projectionMatrix.n22)/(B.w+f.projectionMatrix.n24)),t.materials=s.materials,I.push(t);g&&I.sort(b);return I}}; +THREE.CanvasRenderer=function(a){function b(a){if(t!=a)k.globalAlpha=t=a}function c(a){if(G!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}G=a}}function d(a){if(K!=a.hex)K=a.hex,k.strokeStyle="#"+g(K.toString(16))}function f(a){if(x!=a.hex)x=a.hex,k.fillStyle="#"+g(x.toString(16))}function g(a){for(;a.length<6;)a="0"+a;return a} +var e=this,h=null,j=new THREE.Projector,a=a||{},i=a.canvas!==void 0?a.canvas:document.createElement("canvas"),m,p,n,l,k=i.getContext("2d"),q=new THREE.Color(0),u=0,t=1,G=0,K=null,x=null,B=null,o=null,M=null,r,v,y,Q,$=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,I,O,R,L,D,z,N,w,J,H,S,oa,s=new THREE.Color(0),E=new THREE.Color(0),C=new THREE.Color(0),F=new THREE.Color(0),T=new THREE.Color(0),W,ca,X,aa,Ba,Ca,Da,Ea,Fa,Ga,ka=new THREE.Rectangle,da=new THREE.Rectangle,V=new THREE.Rectangle,ya= +!1,ba=new THREE.Color,Y=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,P=new THREE.Vector3,pa,qa,za,ea,ra,ua,a=16;pa=document.createElement("canvas");pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);za=qa.getImageData(0,0,2,2);ea=za.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.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){m=a;p=b;n=m/2;l=p/2;i.width=m;i.height=p;ka.set(-n,-l,n,l);t=1;G=0;M=o=B=x=K=null};this.setClearColor=function(a,b){q=a;u=b};this.setClearColorHex=function(a,b){q.setHex(a);u=b};this.clear=function(){k.setTransform(1,0,0,-1,n,l);if(!da.isEmpty())da.inflate(1),da.minSelf(ka),q.hex==0&&u==0?k.clearRect(da.getX(),da.getY(),da.getWidth(),da.getHeight()):(c(THREE.NormalBlending),b(1),k.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b* +255)+","+u+")",k.fillRect(da.getX(),da.getY(),da.getWidth(),da.getHeight())),da.empty()};this.render=function(a,g){function i(a){var b,c,d,f=a.lights;Y.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);a=0;for(b=f.length;a>1,o=j.height>>1,g=e.scale.x* +n,m=e.scale.y*l,h=g*Aa,i=m*o,V.set(a.x-h,a.y-i,a.x+h,a.y+i),ka.instersects(V)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-m),k.translate(-Aa,-o),k.drawImage(j,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*n,i=e.scale.y*l,V.set(a.x-h,a.y-i,a.x+h,a.y+i),ka.instersects(V)&&(d(g.color),f(g.color),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,i),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(B!=a)k.lineWidth=B=a;a=g.linecap;if(o!=a)k.lineCap=o=a;a=g.linejoin;if(M!=a)k.lineJoin=M=a;d(g.color);k.stroke();V.inflate(g.linewidth*2)}}function t(a,d,f,h,k,i,l,j,n){e.data.vertices+=3;e.data.faces++;b(j.opacity);c(j.blending);I=a.positionScreen.x;O=a.positionScreen.y;R=d.positionScreen.x;L=d.positionScreen.y;D=f.positionScreen.x; +z=f.positionScreen.y;x(I,O,R,L,D,z);if(j instanceof THREE.MeshBasicMaterial)if(j.map)j.map.mapping instanceof THREE.UVMapping&&(aa=l.uvs[0],ga(I,O,R,L,D,z,j.map.image,aa[h].u,aa[h].v,aa[k].u,aa[k].v,aa[i].u,aa[i].v));else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=g.matrixWorldInverse,P.copy(l.vertexNormalsWorld[0]),Ba=(P.x*a.n11+P.y*a.n12+P.z*a.n13)*0.5+0.5,Ca=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,P.copy(l.vertexNormalsWorld[1]),Da=(P.x*a.n11+P.y*a.n12+P.z* +a.n13)*0.5+0.5,Ea=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,P.copy(l.vertexNormalsWorld[2]),Fa=(P.x*a.n11+P.y*a.n12+P.z*a.n13)*0.5+0.5,Ga=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,ga(I,O,R,L,D,z,j.envMap.image,Ba,Ca,Da,Ea,Fa,Ga)}else j.wireframe?G(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshLambertMaterial)j.map&&!j.wireframe&&(j.map.mapping instanceof THREE.UVMapping&&(aa=l.uvs[0],ga(I,O,R,L,D,z,j.map.image,aa[h].u,aa[h].v,aa[k].u, +aa[k].v,aa[i].u,aa[i].v)),c(THREE.SubtractiveBlending)),ya?!j.wireframe&&j.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==3?(E.r=C.r=F.r=Y.r,E.g=C.g=F.g=Y.g,E.b=C.b=F.b=Y.b,m(n,l.v1.positionWorld,l.vertexNormalsWorld[0],E),m(n,l.v2.positionWorld,l.vertexNormalsWorld[1],C),m(n,l.v3.positionWorld,l.vertexNormalsWorld[2],F),T.r=(C.r+F.r)*0.5,T.g=(C.g+F.g)*0.5,T.b=(C.b+F.b)*0.5,X=va(E,C,F,T),ga(I,O,R,L,D,z,X,0,0,1,0,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,l.centroidWorld,l.normalWorld,ba),s.r= +Math.max(0,Math.min(j.color.r*ba.r,1)),s.g=Math.max(0,Math.min(j.color.g*ba.g,1)),s.b=Math.max(0,Math.min(j.color.b*ba.b,1)),s.updateHex(),j.wireframe?G(s,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(s)):j.wireframe?G(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshDepthMaterial)W=g.near,ca=g.far,E.r=E.g=E.b=1-la(a.positionScreen.z,W,ca),C.r=C.g=C.b=1-la(d.positionScreen.z,W,ca),F.r=F.g=F.b=1-la(f.positionScreen.z, +W,ca),T.r=(C.r+F.r)*0.5,T.g=(C.g+F.g)*0.5,T.b=(C.b+F.b)*0.5,X=va(E,C,F,T),ga(I,O,R,L,D,z,X,0,0,1,0,0,1);else if(j instanceof THREE.MeshNormalMaterial)s.r=ma(l.normalWorld.x),s.g=ma(l.normalWorld.y),s.b=ma(l.normalWorld.z),s.updateHex(),j.wireframe?G(s,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(s)}function u(a,d,f,h,j,l,k,i,n){e.data.vertices+=4;e.data.faces++;b(i.opacity);c(i.blending);if(i.map||i.envMap)t(a,d,h,0,1,3,k,i,n),t(j,f,l,1,2,3,k,i,n);else if(I=a.positionScreen.x,O= +a.positionScreen.y,R=d.positionScreen.x,L=d.positionScreen.y,D=f.positionScreen.x,z=f.positionScreen.y,N=h.positionScreen.x,w=h.positionScreen.y,J=j.positionScreen.x,H=j.positionScreen.y,S=l.positionScreen.x,oa=l.positionScreen.y,i instanceof THREE.MeshBasicMaterial)K(I,O,R,L,D,z,N,w),i.wireframe?G(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color);else if(i instanceof THREE.MeshLambertMaterial)ya?!i.wireframe&&i.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length== +4?(E.r=C.r=F.r=T.r=Y.r,E.g=C.g=F.g=T.g=Y.g,E.b=C.b=F.b=T.b=Y.b,m(n,k.v1.positionWorld,k.vertexNormalsWorld[0],E),m(n,k.v2.positionWorld,k.vertexNormalsWorld[1],C),m(n,k.v4.positionWorld,k.vertexNormalsWorld[3],F),m(n,k.v3.positionWorld,k.vertexNormalsWorld[2],T),X=va(E,C,F,T),x(I,O,R,L,N,w),ga(I,O,R,L,N,w,X,0,0,1,0,0,1),x(J,H,D,z,S,oa),ga(J,H,D,z,S,oa,X,1,0,1,1,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,k.centroidWorld,k.normalWorld,ba),s.r=Math.max(0,Math.min(i.color.r*ba.r,1)),s.g=Math.max(0,Math.min(i.color.g* +ba.g,1)),s.b=Math.max(0,Math.min(i.color.b*ba.b,1)),s.updateHex(),K(I,O,R,L,D,z,N,w),i.wireframe?G(s,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(s)):(K(I,O,R,L,D,z,N,w),i.wireframe?G(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color));else if(i instanceof THREE.MeshNormalMaterial)s.r=ma(k.normalWorld.x),s.g=ma(k.normalWorld.y),s.b=ma(k.normalWorld.z),s.updateHex(),K(I,O,R,L,D,z,N,w),i.wireframe?G(s,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin): +ha(s);else if(i instanceof THREE.MeshDepthMaterial)W=g.near,ca=g.far,E.r=E.g=E.b=1-la(a.positionScreen.z,W,ca),C.r=C.g=C.b=1-la(d.positionScreen.z,W,ca),F.r=F.g=F.b=1-la(h.positionScreen.z,W,ca),T.r=T.g=T.b=1-la(f.positionScreen.z,W,ca),X=va(E,C,F,T),x(I,O,R,L,N,w),ga(I,O,R,L,N,w,X,0,0,1,0,0,1),x(J,H,D,z,S,oa),ga(J,H,D,z,S,oa,X,1,0,1,1,0,1)}function x(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 K(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 G(a,b,c,e){if(B!=b)k.lineWidth=B=b;if(o!=c)k.lineCap=o=c;if(M!=e)k.lineJoin=M=e;d(a);k.stroke();V.inflate(b*2)}function ha(a){f(a);k.fill()}function ga(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,p;o=g.width-1;p=g.height-1;h*=o;i*=p;j*=o;l*=p;m*=o;n*=p;c-=a;d-=b;e-=a;f-=b;j-=h;l-=i;m-=h;n-=i;o=j*n-m*l;o!=0&&(p=1/o,o=(n*c-l*e)*p,l=(n*d-l*f)*p,c=(j*e-m*c)*p,d=(j*f-m*d)*p,a=a-o*h-c*i,b=b-l*h-d*i,k.save(),k.transform(o,l,c,d,a,b), +k.clip(),k.drawImage(g,0,0),k.restore())}function va(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);ea[0]=e<0?0:e>255?255:e;ea[1]=f<0?0:f>255?255:f;ea[2]=a<0?0:a>255?255:a;ea[4]=g<0?0:g>255?255:g;ea[5]=h<0?0:h>255?255:h;ea[6]=b<0?0:b>255?255:b;ea[8]=i<0?0:i>255?255:i;ea[9]=j<0?0:j>255?255:j;ea[10]=c<0?0:c>255?255:c;ea[12]=k<0?0:k>255?255:k;ea[13]=l<0?0:l>255?255:l; +ea[14]=d<0?0:d>255?255:d;qa.putImageData(za,0,0);ua.drawImage(pa,0,0);return ra}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ma(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=1/Math.sqrt(c*c+d*d);c*=e;d*=e;b.x+=c;b.y+=d;a.x-=c;a.y-=d}var wa,Ha,A,fa,ja,na,xa,U;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,l);e.data.vertices=0;e.data.faces=0;h=j.projectScene(a,g,this.sortElements);(ya=a.lights.length>0)&&i(a);wa=0;for(Ha=h.length;wa>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)}; @@ -11,33 +11,34 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)}; THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d,e=[];b=0;for(c=a.length;b0&&a>0&&f+a<1}var c,d,e,g,f,h,j,i,l,k,m,n=a.geometry,p=n.vertices,q=[];c=0;for(d=n.faces.length;c0:l<0))if(i=i.dot((new THREE.Vector3).sub(g,k))/l,k=k.addSelf(m.multiplyScalar(i)),e instanceof THREE.Face3)b(k,g,f,h)&&(e={distance:this.origin.distanceTo(k),point:k,face:e,object:a},q.push(e));else if(e instanceof THREE.Face4&&(b(k,g,f,j)||b(k,f,h,j)))e={distance:this.origin.distanceTo(k),point:k,face:e,object:a},q.push(e);return q}}; -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,k){h=!1;b=f;c=g;d=l;e=k;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,k,m,n){h?(h=!1,b=fl?f>m?f:m:l>m?l:m,e=g>k?g>n?g:n:k>n?k: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>k?g>n?g>e?g:e:n>e?n:e:k>n?k>e?k: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> +THREE.Ray.prototype={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=[],e=b(this.origin,this.direction,a);e&&e0:n<0))if(m=m.dot((new THREE.Vector3).sub(h,l))/n,l=l.addSelf(p.multiplyScalar(m)),f instanceof THREE.Face3)c(l,h,k,i)&&(f={distance:this.origin.distanceTo(l),point:l,face:f,object:a},d.push(f));else if(f instanceof THREE.Face4&&(c(l,h,k, +j)||c(l,k,i,j)))f={distance:this.origin.distanceTo(l),point:l,face:f,object:a},d.push(f);return d}}}; +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,j,m){h=!1;b=f;c=g;d=j;e=m;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,j,m,n,l){h?(h=!1,b=fj?f>n?f:n:j>n?j:n,e=g>m?g>l?g:l:m>l?m:l):(b=fj?f>n?f>d?f:d:n>d?n:d:j>n?j>d?j:d:n>d?n:d,e=g>m?g>l?g>e?g:e:l>e?l:e:m>l?m>e?m:e:l>e?l: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={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,i,l,k,m,n,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,j||0,i||0,l||1,k||0,m||0,n||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,j,i,l,k,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=j;this.n32=i;this.n33=l;this.n34=k;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, +THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,k,i,j,m,n,l,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,k||0,i||0,j||1,m||0,n||0,l||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,k,i,j,m,n,l,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=j;this.n34=m;this.n41=n;this.n42=l;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,j=a.n23,i=a.n24,l=a.n31,k=a.n32,m=a.n33,n=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44,H=b.n11,K=b.n12,A=b.n13,v=b.n14,o=b.n21,I=b.n22, -z=b.n23,D=b.n24,E=b.n31,O=b.n32,P=b.n33,Q=b.n34;this.n11=c*H+d*o+e*E;this.n12=c*K+d*I+e*O;this.n13=c*A+d*z+e*P;this.n14=c*v+d*D+e*Q+g;this.n21=f*H+h*o+j*E;this.n22=f*K+h*I+j*O;this.n23=f*A+h*z+j*P;this.n24=f*v+h*D+j*Q+i;this.n31=l*H+k*o+m*E;this.n32=l*K+k*I+m*O;this.n33=l*A+k*z+m*P;this.n34=l*v+k*D+m*Q+n;this.n41=p*H+q*o+t*E;this.n42=p*K+q*I+t*O;this.n43=p*A+q*z+t*P;this.n44=p*v+q*D+t*Q+r;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]= +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,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44,H=b.n11,K=b.n12,A=b.n13,v=b.n14,o=b.n21,I=b.n22, +z=b.n23,D=b.n24,E=b.n31,O=b.n32,P=b.n33,Q=b.n34;this.n11=c*H+d*o+e*E;this.n12=c*K+d*I+e*O;this.n13=c*A+d*z+e*P;this.n14=c*v+d*D+e*Q+g;this.n21=f*H+h*o+k*E;this.n22=f*K+h*I+k*O;this.n23=f*A+h*z+k*P;this.n24=f*v+h*D+k*Q+i;this.n31=j*H+m*o+n*E;this.n32=j*K+m*I+n*O;this.n33=j*A+m*z+n*P;this.n34=j*v+m*D+n*Q+l;this.n41=p*H+q*o+s*E;this.n42=p*K+q*I+s*O;this.n43=p*A+q*z+s*P;this.n44=p*v+q*D+s*Q+r;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,i=this.n32,l=this.n33,k=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*k*m-b*f*k*m-d*f*j*n+c*h*j*n+d*e*l*n-a*h*l*n-c*e*k*n+a*f*k*n+d*g*j*p-b*h*j*p-d*e*i*p+a*h*i*p+b*e*k*p-a*g*k*p-c*g*j*q+b*f*j*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.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,j=this.n33,m=this.n34,n=this.n41,l=this.n42,p=this.n43,q=this.n44;return d*f*i*n-c*h*i*n-d*g*j*n+b*h*j*n+c*g*m*n-b*f*m*n-d*f*k*l+c*h*k*l+d*e*j*l-a*h*j*l-c*e*m*l+a*f*m*l+d*g*k*p-b*h*k*p-d*e*i*p+a*h*i*p+b*e*m*p-a*g*m*p-c*g*k*q+b*f*k*q+c*e*i*q-a*f*i*q-b*e*j*q+a*g*j*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;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,j=e*g,i=e*f;this.set(j* -g+c,j*f-d*h,j*h+d*f,0,j*f+d*h,i*f+c,i*h-d*g,0,j*h-d*f,i*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; +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,k=e*g,i=e*f;this.set(k* +g+c,k*f-d*h,k*h+d*f,0,k*f+d*h,i*f+c,i*h-d*g,0,k*h-d*f,i*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){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;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 i=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(i+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+i);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},extractPosition:function(a){this.n14= +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,k=b*f;b*=h;var i=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(i+d);this.n12=k-e;this.n13=b+f;this.n21=k+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+i);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},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,j=a.n23,i=a.n24,l=a.n31,k=a.n32,m=a.n33,n=a.n34,p=a.n41,q=a.n42,t=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*n*q-i*m*q+i*k*t-h*n*t-j*k*r+h*m*r;b.n12=g*m*q-e*n*q-g*k*t+d*n*t+e*k*r-d*m*r;b.n13=e*i*q-g*j*q+g*h*t-d*i*t-e*h*r+d*j*r;b.n14=g*j*k-e*i*k-g*h*m+d*i*m+e*h*n-d*j*n;b.n21=i*m*p-j*n*p-i*l*t+f*n*t+j*l*r-f*m*r;b.n22=e*n*p-g*m*p+g*l*t-c*n*t-e*l*r+c*m*r;b.n23=g*j*p-e*i*p-g*f*t+c*i*t+e*f*r-c*j*r;b.n24= -e*i*l-g*j*l+g*f*m-c*i*m-e*f*n+c*j*n;b.n31=h*n*p-i*k*p+i*l*q-f*n*q-h*l*r+f*k*r;b.n32=g*k*p-d*n*p-g*l*q+c*n*q+d*l*r-c*k*r;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*r+c*h*r;b.n34=g*h*l-d*i*l-g*f*k+c*i*k+d*f*n-c*h*n;b.n41=j*k*p-h*m*p-j*l*q+f*m*q+h*l*t-f*k*t;b.n42=d*m*p-e*k*p+e*l*q-c*m*q-d*l*t+c*k*t;b.n43=e*h*p-d*j*p-e*f*q+c*j*q+d*f*t-c*h*t;b.n44=d*j*l-e*h*l+e*f*k-c*j*k-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,i=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*i;if(a==0)throw"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*i;c[7]=a*l;c[8]=a*k;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,j=a.n31,m=a.n32,n=a.n33,l=a.n34,p=a.n41,q=a.n42,s=a.n43,r=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=k*l*q-i*n*q+i*m*s-h*l*s-k*m*r+h*n*r;b.n12=g*n*q-e*l*q-g*m*s+d*l*s+e*m*r-d*n*r;b.n13=e*i*q-g*k*q+g*h*s-d*i*s-e*h*r+d*k*r;b.n14=g*k*m-e*i*m-g*h*n+d*i*n+e*h*l-d*k*l;b.n21=i*n*p-k*l*p-i*j*s+f*l*s+k*j*r-f*n*r;b.n22=e*l*p-g*n*p+g*j*s-c*l*s-e*j*r+c*n*r;b.n23=g*k*p-e*i*p-g*f*s+c*i*s+e*f*r-c*k*r;b.n24= +e*i*j-g*k*j+g*f*n-c*i*n-e*f*l+c*k*l;b.n31=h*l*p-i*m*p+i*j*q-f*l*q-h*j*r+f*m*r;b.n32=g*m*p-d*l*p-g*j*q+c*l*q+d*j*r-c*m*r;b.n33=e*i*p-g*h*p+g*f*q-c*i*q-d*f*r+c*h*r;b.n34=g*h*j-d*i*j-g*f*m+c*i*m+d*f*l-c*h*l;b.n41=k*m*p-h*n*p-k*j*q+f*n*q+h*j*s-f*m*s;b.n42=d*n*p-e*m*p+e*j*q-c*n*q-d*j*s+c*m*s;b.n43=e*h*p-d*k*p-e*f*q+c*k*q+d*f*s-c*h*s;b.n44=d*k*j-e*h*j+e*f*m-c*k*m-d*f*n+c*h*n;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,j=-a.n23*a.n11+a.n21*a.n13,m=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*j;c[8]=a*m;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,j,i;f=new THREE.Matrix4;h=b-a;j=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/j;f.n23=0;f.n24=-((c+d)/j);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.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.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1; this.visible=!0;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={translate:function(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)=== @@ -46,8 +47,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a=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.set(a||0,b||0)}; @@ -67,17 +68,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c 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.Sound)this.sounds.indexOf(a)===-1&&this.sounds.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&&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))),d=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))),dV&&f.positionScreen.zV&&f.positionScreen.z0&&v.z<1))J=K[H]=K[H]||new THREE.RenderableParticle,H++,r=J,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,A.push(r);g&&A.sort(b);return A}}; -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;j>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)}; @@ -11,33 +11,34 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)}; THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x* a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d,e=[];b=0;for(c=a.length;b0&&a>0&&f+a<1}var c,d,e,g,f,h,j,m,n,k,i,o=a.geometry,p=o.vertices,q=[];c=0;for(d=o.faces.length;c0:n<0))if(m=m.dot((new THREE.Vector3).sub(g,k))/n,k=k.addSelf(i.multiplyScalar(m)),e instanceof THREE.Face3)b(k,g,f,h)&&(e={distance:this.origin.distanceTo(k),point:k,face:e,object:a},q.push(e));else if(e instanceof THREE.Face4&&(b(k,g,f,j)||b(k,f,h,j)))e={distance:this.origin.distanceTo(k),point:k,face:e,object:a},q.push(e);return q}}; -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,k){h=!1;b=f;c=g;d=n;e=k;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,k,i,o){h?(h=!1,b=fn?f>i?f:i:n>i?n:i,e=g>k?g>o?g:o:k>o?k:o):(b=fn?f>i?f>d?f:d:i>d?i:d:n>i?n>d?n:d:i>d?i:d,e=g>k?g>o?g>e?g:e:o>e?o:e:k>o?k>e?k:e:o>e?o: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> +THREE.Ray.prototype={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=[],e=b(this.origin,this.direction,a);e&&e0:k<0))if(m=m.dot((new THREE.Vector3).sub(h,j))/k,j=j.addSelf(p.multiplyScalar(m)),f instanceof THREE.Face3)c(j,h,i,n)&&(f={distance:this.origin.distanceTo(j),point:j,face:f,object:a},d.push(f));else if(f instanceof THREE.Face4&&(c(j,h,i, +o)||c(j,i,n,o)))f={distance:this.origin.distanceTo(j),point:j,face:f,object:a},d.push(f);return d}}}; +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,m){h=!1;b=f;c=g;d=o;e=m;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,m,k,j){h?(h=!1,b=fo?f>k?f:k:o>k?o:k,e=g>m?g>j?g:j:m>j?m:j):(b=fo?f>k?f>d?f:d:k>d?k:d:o>k?o>d?o:d:k>d?k:d,e=g>m?g>j?g>e?g:e:j>e?j:e:m>j?m>e?m:e:j>e?j: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={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,m,n,k,i,o,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,j||0,m||0,n||1,k||0,i||0,o||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,j,m,n,k,i,o,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=j;this.n32=m;this.n33=n;this.n34=k;this.n41=i;this.n42=o;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, +THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,n,o,m,k,j,p,q){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,h||0,i||0,n||0,o||1,m||0,k||0,j||0,p||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,h,i,n,o,m,k,j,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=n;this.n33=o;this.n34=m;this.n41=k;this.n42=j;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,j=a.n23,m=a.n24,n=a.n31,k=a.n32,i=a.n33,o=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44,G=b.n11,y=b.n12,E=b.n13,r=b.n14,l=b.n21,z=b.n22, -A=b.n23,C=b.n24,v=b.n31,L=b.n32,F=b.n33,J=b.n34;this.n11=c*G+d*l+e*v;this.n12=c*y+d*z+e*L;this.n13=c*E+d*A+e*F;this.n14=c*r+d*C+e*J+g;this.n21=f*G+h*l+j*v;this.n22=f*y+h*z+j*L;this.n23=f*E+h*A+j*F;this.n24=f*r+h*C+j*J+m;this.n31=n*G+k*l+i*v;this.n32=n*y+k*z+i*L;this.n33=n*E+k*A+i*F;this.n34=n*r+k*C+i*J+o;this.n41=p*G+q*l+t*v;this.n42=p*y+q*z+t*L;this.n43=p*E+q*A+t*F;this.n44=p*r+q*C+t*J+u;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]= +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,n=a.n24,o=a.n31,m=a.n32,k=a.n33,j=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44,G=b.n11,y=b.n12,E=b.n13,r=b.n14,l=b.n21,z=b.n22, +A=b.n23,C=b.n24,v=b.n31,L=b.n32,F=b.n33,J=b.n34;this.n11=c*G+d*l+e*v;this.n12=c*y+d*z+e*L;this.n13=c*E+d*A+e*F;this.n14=c*r+d*C+e*J+g;this.n21=f*G+h*l+i*v;this.n22=f*y+h*z+i*L;this.n23=f*E+h*A+i*F;this.n24=f*r+h*C+i*J+n;this.n31=o*G+m*l+k*v;this.n32=o*y+m*z+k*L;this.n33=o*E+m*A+k*F;this.n34=o*r+m*C+k*J+j;this.n41=p*G+q*l+t*v;this.n42=p*y+q*z+t*L;this.n43=p*E+q*A+t*F;this.n44=p*r+q*C+t*J+u;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,m=this.n32,n=this.n33,k=this.n34,i=this.n41,o=this.n42,p=this.n43,q=this.n44;return d*f*m*i-c*h*m*i-d*g*n*i+b*h*n*i+c*g*k*i-b*f*k*i-d*f*j*o+c*h*j*o+d*e*n*o-a*h*n*o-c*e*k*o+a*f*k*o+d*g*j*p-b*h*j*p-d*e*m*p+a*h*m*p+b*e*k*p-a*g*k*p-c*g*j*q+b*f*j*q+c*e*m*q-a*f*m*q-b*e*n*q+a*g*n*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.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,n=this.n32,o=this.n33,m=this.n34,k=this.n41,j=this.n42,p=this.n43,q=this.n44;return d*f*n*k-c*h*n*k-d*g*o*k+b*h*o*k+c*g*m*k-b*f*m*k-d*f*i*j+c*h*i*j+d*e*o*j-a*h*o*j-c*e*m*j+a*f*m*j+d*g*i*p-b*h*i*p-d*e*n*p+a*h*n*p+b*e*m*p-a*g*m*p-c*g*i*q+b*f*i*q+c*e*n*q-a*f*n*q-b*e*o*q+a*g*o*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;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,j=e*g,m=e*f;this.set(j* -g+c,j*f-d*h,j*h+d*f,0,j*f+d*h,m*f+c,m*h-d*g,0,j*h-d*f,m*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; +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,n=e*f;this.set(i* +g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,n*f+c,n*h-d*g,0,i*h-d*f,n*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){var b=a.x,c=a.y,d=a.z,a=Math.cos(b),b=Math.sin(b),e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),f=a*c,h=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=h*g+a*d;this.n22=-h*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;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 m=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(m+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+m);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},extractPosition:function(a){this.n14= +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 n=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(n+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+n);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},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,j=a.n23,m=a.n24,n=a.n31,k=a.n32,i=a.n33,o=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=j*o*q-m*i*q+m*k*t-h*o*t-j*k*u+h*i*u;b.n12=g*i*q-e*o*q-g*k*t+d*o*t+e*k*u-d*i*u;b.n13=e*m*q-g*j*q+g*h*t-d*m*t-e*h*u+d*j*u;b.n14=g*j*k-e*m*k-g*h*i+d*m*i+e*h*o-d*j*o;b.n21=m*i*p-j*o*p-m*n*t+f*o*t+j*n*u-f*i*u;b.n22=e*o*p-g*i*p+g*n*t-c*o*t-e*n*u+c*i*u;b.n23=g*j*p-e*m*p-g*f*t+c*m*t+e*f*u-c*j*u;b.n24= -e*m*n-g*j*n+g*f*i-c*m*i-e*f*o+c*j*o;b.n31=h*o*p-m*k*p+m*n*q-f*o*q-h*n*u+f*k*u;b.n32=g*k*p-d*o*p-g*n*q+c*o*q+d*n*u-c*k*u;b.n33=e*m*p-g*h*p+g*f*q-c*m*q-d*f*u+c*h*u;b.n34=g*h*n-d*m*n-g*f*k+c*m*k+d*f*o-c*h*o;b.n41=j*k*p-h*i*p-j*n*q+f*i*q+h*n*t-f*k*t;b.n42=d*i*p-e*k*p+e*n*q-c*i*q-d*n*t+c*k*t;b.n43=e*h*p-d*j*p-e*f*q+c*j*q+d*f*t-c*h*t;b.n44=d*j*n-e*h*n+e*f*k-c*j*k-d*f*i+c*h*i;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,m=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*m;if(a==0)throw"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*m;c[7]=a*n;c[8]=a*k;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,i=a.n23,n=a.n24,o=a.n31,m=a.n32,k=a.n33,j=a.n34,p=a.n41,q=a.n42,t=a.n43,u=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=i*j*q-n*k*q+n*m*t-h*j*t-i*m*u+h*k*u;b.n12=g*k*q-e*j*q-g*m*t+d*j*t+e*m*u-d*k*u;b.n13=e*n*q-g*i*q+g*h*t-d*n*t-e*h*u+d*i*u;b.n14=g*i*m-e*n*m-g*h*k+d*n*k+e*h*j-d*i*j;b.n21=n*k*p-i*j*p-n*o*t+f*j*t+i*o*u-f*k*u;b.n22=e*j*p-g*k*p+g*o*t-c*j*t-e*o*u+c*k*u;b.n23=g*i*p-e*n*p-g*f*t+c*n*t+e*f*u-c*i*u;b.n24= +e*n*o-g*i*o+g*f*k-c*n*k-e*f*j+c*i*j;b.n31=h*j*p-n*m*p+n*o*q-f*j*q-h*o*u+f*m*u;b.n32=g*m*p-d*j*p-g*o*q+c*j*q+d*o*u-c*m*u;b.n33=e*n*p-g*h*p+g*f*q-c*n*q-d*f*u+c*h*u;b.n34=g*h*o-d*n*o-g*f*m+c*n*m+d*f*j-c*h*j;b.n41=i*m*p-h*k*p-i*o*q+f*k*q+h*o*t-f*m*t;b.n42=d*k*p-e*m*p+e*o*q-c*k*q-d*o*t+c*m*t;b.n43=e*h*p-d*i*p-e*f*q+c*i*q+d*f*t-c*h*t;b.n44=d*i*o-e*h*o+e*f*m-c*i*m-d*f*k+c*h*k;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,n=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*n;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*n;c[7]=a*o;c[8]=a*m;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,j,m;f=new THREE.Matrix4;h=b-a;j=c-d;m=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/m;f.n34=-((g+e)/m);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.makeOrtho=function(a,b,c,d,e,g){var f,h,i,n;f=new THREE.Matrix4;h=b-a;i=c-d;n=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/n;f.n34=-((g+e)/n);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.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1; this.visible=!0;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={translate:function(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)=== @@ -46,18 +47,18 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,d=this.children.length;a=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.set(a||0,b||0)}; THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var 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=this.boundingSphere===null?0:this.boundingSphere.radius,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))),d=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))),dE&&f.positionScreen.zE&&f.positionScreen.z0&&r.z<1))w=y[G]=y[G]||new THREE.RenderableParticle,G++,u=w,u.x=r.x/r.w,u.y=r.y/r.w,u.z=r.z,u.rotation=s.rotation.z,u.scale.x=s.scale.x*Math.abs(u.x-(r.x+e.projectionMatrix.n11)/(r.w+e.projectionMatrix.n14)),u.scale.y=s.scale.y*Math.abs(u.y-(r.y+ e.projectionMatrix.n22)/(r.w+e.projectionMatrix.n24)),u.materials=s.materials,B.push(u);g&&B.sort(b);return B}}; 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&&(L.sub(f.position,b.centroidWorld),L.normalize(),g=b.normalWorld.dot(L)*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,h,j,i,k){f.data.vertices+=3;f.data.faces++;B=d(Q++);B.setAttribute("d", "M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");i instanceof THREE.MeshBasicMaterial?r.hex=i.color.hex:i instanceof THREE.MeshLambertMaterial?E?(l.r=z.r,l.g=z.g,l.b=z.b,a(k,j,l),r.r=Math.max(0,Math.min(i.color.r*l.r,1)),r.g=Math.max(0,Math.min(i.color.g*l.g,1)),r.b=Math.max(0,Math.min(i.color.b*l.b,1)),r.updateHex()):r.hex=i.color.hex:i instanceof THREE.MeshDepthMaterial?(v=1-i.__2near/(i.__farPlusNear- -j.z*i.__farMinusNear),r.setRGB(v,v,v)):i instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));i.wireframe?B.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):B.setAttribute("style","fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+i.opacity);m.appendChild(B)}function c(b,c,h,i, +j.z*i.__farMinusNear),r.setRGB(v,v,v)):i instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));i.wireframe?B.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+i.wireframeLinewidth+"; stroke-opacity: "+i.opacity+"; stroke-linecap: "+i.wireframeLinecap+"; stroke-linejoin: "+i.wireframeLinejoin):B.setAttribute("style","fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+i.opacity);n.appendChild(B)}function c(b,c,h,i, j,k,o){f.data.vertices+=4;f.data.faces++;B=d(Q++);B.setAttribute("d","M "+b.positionScreen.x+" "+b.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");k instanceof THREE.MeshBasicMaterial?r.hex=k.color.hex:k instanceof THREE.MeshLambertMaterial?E?(l.r=z.r,l.g=z.g,l.b=z.b,a(o,j,l),r.r=Math.max(0,Math.min(k.color.r*l.r,1)),r.g=Math.max(0,Math.min(k.color.g*l.g,1)),r.b=Math.max(0,Math.min(k.color.b* l.b,1)),r.updateHex()):r.hex=k.color.hex:k instanceof THREE.MeshDepthMaterial?(v=1-k.__2near/(k.__farPlusNear-j.z*k.__farMinusNear),r.setRGB(v,v,v)):k instanceof THREE.MeshNormalMaterial&&r.setRGB(e(j.normalWorld.x),e(j.normalWorld.y),e(j.normalWorld.z));k.wireframe?B.setAttribute("style","fill: none; stroke: #"+g(r.hex.toString(16))+"; stroke-width: "+k.wireframeLinewidth+"; stroke-opacity: "+k.opacity+"; stroke-linecap: "+k.wireframeLinecap+"; stroke-linejoin: "+k.wireframeLinejoin):B.setAttribute("style", -"fill: #"+g(r.hex.toString(16))+"; fill-opacity: "+k.opacity);m.appendChild(B)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),N==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}function g(a){for(;a.length<6;)a="0"+a;return a}var f=this,h=null,j=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,k,i,o,p,q,t,u,G=new THREE.Rectangle,y=new THREE.Rectangle,E= -!1,r=new THREE.Color(16777215),l=new THREE.Color(16777215),z=new THREE.Color(0),A=new THREE.Color(0),C=new THREE.Color(0),v,L=new THREE.Vector3,F=[],J=[],B,Q,S,N=1;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(a){switch(a){case "high":N=1;break;case "low":N=0}};this.setSize=function(a,b){n=a;k=b;i=n/2;o=k/2;m.setAttribute("viewBox",-i+" "+-o+" "+n+" "+k);m.setAttribute("width",n);m.setAttribute("height",k);G.set(-i,-o, -i,o)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(a,d){var e,k,l,n,r,v,s,w;this.autoClear&&this.clear();f.data.vertices=0;f.data.faces=0;h=j.projectScene(a,d,this.sortElements);S=Q=0;if(E=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);A.setRGB(0,0,0);C.setRGB(0,0,0);e=0;for(k=s.length;e1?1:a}function g(a){for(;a.length<6;)a="0"+a;return a}var f=this,h=null,i=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,m,k,j,p,q,t,u,G=new THREE.Rectangle,y=new THREE.Rectangle,E= +!1,r=new THREE.Color(16777215),l=new THREE.Color(16777215),z=new THREE.Color(0),A=new THREE.Color(0),C=new THREE.Color(0),v,L=new THREE.Vector3,F=[],J=[],B,Q,S,N=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(a){switch(a){case "high":N=1;break;case "low":N=0}};this.setSize=function(a,b){o=a;m=b;k=o/2;j=m/2;n.setAttribute("viewBox",-k+" "+-j+" "+o+" "+m);n.setAttribute("width",o);n.setAttribute("height",m);G.set(-k,-j, +k,j)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(a,d){var e,o,l,m,r,v,s,w;this.autoClear&&this.clear();f.data.vertices=0;f.data.faces=0;h=i.projectScene(a,d,this.sortElements);S=Q=0;if(E=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);A.setRGB(0,0,0);C.setRGB(0,0,0);e=0;for(o=s.length;e0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,e,f){this.set(b||0,d||0,e||0,f||1)}; THREE.Vector4.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x* b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f,g=[];d=0;for(e=b.length;d0&&b>0&&h+b<1}var e,f,g,i,h,j,k,o,r,n,v,q=b.geometry,z=q.vertices,C=[];e=0;for(f=q.faces.length;e0:r<0))if(o=o.dot((new THREE.Vector3).sub(i,n))/r,n=n.addSelf(v.multiplyScalar(o)),g instanceof THREE.Face3)d(n,i,h,j)&&(g={distance:this.origin.distanceTo(n),point:n,face:g,object:b},C.push(g));else if(g instanceof THREE.Face4&&(d(n,i,h,k)||d(n,h,j,k)))g={distance:this.origin.distanceTo(n),point:n,face:g,object:b},C.push(g);return C}}; -THREE.Rectangle=function(){function b(){i=f-d;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,r,n){j=!1;d=h;e=i;f=r;g=n;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=dh?f:h,g=g>i?g:i);b()};this.add3Points= -function(h,i,r,n,v,q){j?(j=!1,d=hr?h>v?h:v:r>v?r:v,g=i>n?i>q?i:q:n>q?n:q):(d=hr?h>v?h>f?h:f:v>f?v:f:r>v?r>f?r:f:v>f?v:f,g=i>n?i>q?i>g?i:g:q>g?q:g:n>q?n>g?n:g:q>g?q:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=dh.getRight()?f:h.getRight(),g=g> +THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f=[];d=0;for(e=b.length;d0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=[],g=d(this.origin,this.direction,b);g&&g0:r<0))if(q=q.dot((new THREE.Vector3).sub(j,v))/r,v=v.addSelf(z.multiplyScalar(q)),h instanceof THREE.Face3)e(v,j,k,o)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},f.push(h));else if(h instanceof THREE.Face4&&(e(v,j,k, +n)||e(v,k,o,n)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},f.push(h);return f}}}; +THREE.Rectangle=function(){function b(){i=f-d;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,n,q){j=!1;d=h;e=i;f=n;g=q;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=dh?f:h,g=g>i?g:i);b()};this.add3Points= +function(h,i,n,q,r,v){j?(j=!1,d=hn?h>r?h:r:n>r?n:r,g=i>q?i>v?i:v:q>v?q:v):(d=hn?h>r?h>f?h:f:r>f?r:f:n>r?n>f?n:f:r>f?r:f,g=i>q?i>v?i>g?i:g:v>g?v:g:q>v?q>g?q:g:v>g?v:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=dh.getRight()?f:h.getRight(),g=g> h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){d-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){d=d>h.getLeft()?d:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;g=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,g,i,h,j,k,o,r,n,v,q,z,C){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,k||0,o||0,r||1,n||0,v||0,q||0,z||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,k,o,r,n,v,q,z,C){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=k;this.n32=o;this.n33=r;this.n34=n;this.n41=v;this.n42=q;this.n43=z;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1, +THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,g,i,h,j,k,o,n,q,r,v,z,C){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,k||0,o||0,n||1,q||0,r||0,v||0,z||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,k,o,n,q,r,v,z,C){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=k;this.n32=o;this.n33=n;this.n34=q;this.n41=r;this.n42=v;this.n43=z;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1, g=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());g.cross(i,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=i.x;this.n21=f.y;this.n22=g.y;this.n23=i.y;this.n31=f.z;this.n32=g.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,g=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23* f+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+e*this.n32+f*this.n33;b.normalize(); -return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,r=b.n31,n=b.n32,v=b.n33,q=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44,S=d.n11,Q=d.n12,L=d.n13,B=d.n14,x=d.n21,R=d.n22, -J=d.n23,aa=d.n24,E=d.n31,$=d.n32,c=d.n33,ja=d.n34;this.n11=e*S+f*x+g*E;this.n12=e*Q+f*R+g*$;this.n13=e*L+f*J+g*c;this.n14=e*B+f*aa+g*ja+i;this.n21=h*S+j*x+k*E;this.n22=h*Q+j*R+k*$;this.n23=h*L+j*J+k*c;this.n24=h*B+j*aa+k*ja+o;this.n31=r*S+n*x+v*E;this.n32=r*Q+n*R+v*$;this.n33=r*L+n*J+v*c;this.n34=r*B+n*aa+v*ja+q;this.n41=z*S+C*x+D*E;this.n42=z*Q+C*R+D*$;this.n43=z*L+C*J+D*c;this.n44=z*B+C*aa+D*ja+y;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31; +return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,n=b.n31,q=b.n32,r=b.n33,v=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44,S=d.n11,Q=d.n12,L=d.n13,B=d.n14,x=d.n21,R=d.n22, +J=d.n23,aa=d.n24,E=d.n31,$=d.n32,c=d.n33,ja=d.n34;this.n11=e*S+f*x+g*E;this.n12=e*Q+f*R+g*$;this.n13=e*L+f*J+g*c;this.n14=e*B+f*aa+g*ja+i;this.n21=h*S+j*x+k*E;this.n22=h*Q+j*R+k*$;this.n23=h*L+j*J+k*c;this.n24=h*B+j*aa+k*ja+o;this.n31=n*S+q*x+r*E;this.n32=n*Q+q*R+r*$;this.n33=n*L+q*J+r*c;this.n34=n*B+q*aa+r*ja+v;this.n41=z*S+C*x+D*E;this.n42=z*Q+C*R+D*$;this.n43=z*L+C*J+D*c;this.n44=z*B+C*aa+D*ja+y;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31; e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b= -this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,r=this.n33,n=this.n34,v=this.n41,q=this.n42,z=this.n43,C=this.n44;return f*h*o*v-e*j*o*v-f*i*r*v+d*j*r*v+e*i*n*v-d*h*n*v-f*h*k*q+e*j*k*q+f*g*r*q-b*j*r*q-e*g*n*q+b*h*n*q+f*i*k*z-d*j*k*z-f*g*o*z+b*j*o*z+d*g*n*z-b*i*n*z-e*i*k*C+d*h*k*C+e*g*o*C-b*h*o*C-d*g*r*C+b*i*r*C},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.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,n=this.n33,q=this.n34,r=this.n41,v=this.n42,z=this.n43,C=this.n44;return f*h*o*r-e*j*o*r-f*i*n*r+d*j*n*r+e*i*q*r-d*h*q*r-f*h*k*v+e*j*k*v+f*g*n*v-b*j*n*v-e*g*q*v+b*h*q*v+f*i*k*z-d*j*k*z-f*g*o*z+b*j*o*z+d*g*q*z-b*i*q*z-e*i*k*C+d*h*k*C+e*g*o*C-b*h*o*C-d*g*n*C+b*i*n*C},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32= this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21; this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]= this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(b, @@ -33,9 +34,9 @@ i+e,k*h-f*j,k*j+f*h,0,k*h+f*j,o*h+e,o*j-f*i,0,k*j-f*h,o*j+f*i,g*j*j+e,0,0,0,0,1) this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,e=b.y,f=b.z,b=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),h=b*e,j=d*e;this.n11=g*i;this.n12=-g*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*g;this.n31=-h*i+d*f;this.n32=h*f+d*i;this.n33=b*g;return this}, setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,k=d*h;d*=j;var o=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(o+f);this.n12=k-g;this.n13=d+h;this.n21=k+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;this.n32=e+i;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14= b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; -THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,r=b.n31,n=b.n32,v=b.n33,q=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=k*q*C-o*v*C+o*n*D-j*q*D-k*n*y+j*v*y;d.n12=i*v*C-g*q*C-i*n*D+f*q*D+g*n*y-f*v*y;d.n13=g*o*C-i*k*C+i*j*D-f*o*D-g*j*y+f*k*y;d.n14=i*k*n-g*o*n-i*j*v+f*o*v+g*j*q-f*k*q;d.n21=o*v*z-k*q*z-o*r*D+h*q*D+k*r*y-h*v*y;d.n22=g*q*z-i*v*z+i*r*D-e*q*D-g*r*y+e*v*y;d.n23=i*k*z-g*o*z-i*h*D+e*o*D+g*h*y-e*k*y;d.n24= -g*o*r-i*k*r+i*h*v-e*o*v-g*h*q+e*k*q;d.n31=j*q*z-o*n*z+o*r*C-h*q*C-j*r*y+h*n*y;d.n32=i*n*z-f*q*z-i*r*C+e*q*C+f*r*y-e*n*y;d.n33=g*o*z-i*j*z+i*h*C-e*o*C-f*h*y+e*j*y;d.n34=i*j*r-f*o*r-i*h*n+e*o*n+f*h*q-e*j*q;d.n41=k*n*z-j*v*z-k*r*C+h*v*C+j*r*D-h*n*D;d.n42=f*v*z-g*n*z+g*r*C-e*v*C-f*r*D+e*n*D;d.n43=g*j*z-f*k*z-g*h*C+e*k*C+f*h*D-e*j*D;d.n44=f*k*r-g*j*r+g*h*n-e*k*n-f*h*v+e*j*v;d.multiplyScalar(1/b.determinant());return d}; -THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,k=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,r=-b.n23*b.n11+b.n21*b.n13,n=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*o;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*k;e[6]=b*o;e[7]=b*r;e[8]=b*n;return d}; +THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,k=b.n23,o=b.n24,n=b.n31,q=b.n32,r=b.n33,v=b.n34,z=b.n41,C=b.n42,D=b.n43,y=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=k*v*C-o*r*C+o*q*D-j*v*D-k*q*y+j*r*y;d.n12=i*r*C-g*v*C-i*q*D+f*v*D+g*q*y-f*r*y;d.n13=g*o*C-i*k*C+i*j*D-f*o*D-g*j*y+f*k*y;d.n14=i*k*q-g*o*q-i*j*r+f*o*r+g*j*v-f*k*v;d.n21=o*r*z-k*v*z-o*n*D+h*v*D+k*n*y-h*r*y;d.n22=g*v*z-i*r*z+i*n*D-e*v*D-g*n*y+e*r*y;d.n23=i*k*z-g*o*z-i*h*D+e*o*D+g*h*y-e*k*y;d.n24= +g*o*n-i*k*n+i*h*r-e*o*r-g*h*v+e*k*v;d.n31=j*v*z-o*q*z+o*n*C-h*v*C-j*n*y+h*q*y;d.n32=i*q*z-f*v*z-i*n*C+e*v*C+f*n*y-e*q*y;d.n33=g*o*z-i*j*z+i*h*C-e*o*C-f*h*y+e*j*y;d.n34=i*j*n-f*o*n-i*h*q+e*o*q+f*h*v-e*j*v;d.n41=k*q*z-j*r*z-k*n*C+h*r*C+j*n*D-h*q*D;d.n42=f*r*z-g*q*z+g*n*C-e*r*C-f*n*D+e*q*D;d.n43=g*j*z-f*k*z-g*h*C+e*k*C+f*h*D-e*j*D;d.n44=f*k*n-g*j*n+g*h*q-e*k*q-f*h*r+e*j*r;d.multiplyScalar(1/b.determinant());return d}; +THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,k=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,q=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*i;e[3]=b*h;e[4]=b*j;e[5]=b*k;e[6]=b*o;e[7]=b*n;e[8]=b*q;return d}; THREE.Matrix4.makeFrustum=function(b,d,e,f,g,i){var h;h=new THREE.Matrix4;h.n11=2*g/(d-b);h.n12=0;h.n13=(d+b)/(d-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(i+g)/(i-g);h.n34=-2*i*g/(i-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,d,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,f)}; THREE.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,k,o;h=new THREE.Matrix4;j=d-b;k=e-f;o=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((e+f)/k);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((i+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.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1; @@ -46,8 +47,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m this.scale),this.matrixWorldNeedsUpdate=!1,d=!0;for(var b=0,f=this.children.length;b=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;g=Math.sin((1-f)*i)/h;f=Math.sin(f*i)/h;e.w=b.w*g+d.w*f;e.x=b.x*g+d.x*f;e.y=b.y*g+d.y*f;e.z=b.z*g+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; THREE.Face3=function(b,d,e,f,g,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,d,e,f,g,i,h){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; @@ -56,15 +57,15 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.f e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,g,i,h,j=new THREE.Vector3,k=new THREE.Vector3;f=0;for(g=this.faces.length;f0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;dthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;dthis.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;o=this.points[e[0]];r=this.points[e[1]]; -n=this.points[e[2]];v=this.points[e[3]];j=h*h;k=h*j;f.x=d(o.x,r.x,n.x,v.x,h,j,k);f.y=d(o.y,r.y,n.y,v.y,h,j,k);f.z=d(o.z,r.z,n.z,v.z,h,j,k);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;bthis.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;o=this.points[e[0]];n=this.points[e[1]]; +q=this.points[e[2]];r=this.points[e[3]];j=h*h;k=h*j;f.x=d(o.x,n.x,q.x,r.x,h,j,k);f.y=d(o.y,n.y,q.y,r.y,h,j,k);f.z=d(o.z,n.z,q.z,r.z,h,j,k);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1, this.LODs[f].object3D.visible=!0;else break;for(;fn&&(e=r,r=n,n=e):rq&&(e=v,v=q,q=e):vq&&(e=n,n=q,q=e):nv&&(e=r,r=v,v=e):r=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?d=Math.max(d,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),h<0?d=Math.max(d,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),e=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?d=Math.max(d,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),h<0?d=Math.max(d,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),eL&&h.positionScreen.zL&&h.positionScreen.z0&&B.z<1))fa=Q[S]=Q[S]||new THREE.RenderableParticle,S++,y=fa,y.x=B.x/B.w,y.y=B.y/B.w,y.z=B.z,y.rotation=P.rotation.z,y.scale.x=P.scale.x*Math.abs(y.x- (B.x+c.projectionMatrix.n11)/(B.w+c.projectionMatrix.n14)),y.scale.y=P.scale.y*Math.abs(y.y-(B.y+c.projectionMatrix.n22)/(B.w+c.projectionMatrix.n24)),y.materials=P.materials,i.push(y);g&&i.sort(d);return i}}; @@ -177,40 +178,40 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;", THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}}; THREE.WebGLRenderer=function(b){function d(b,d,e){var f,g,h,i=b.vertices,j=i.length,k=b.colors,o=k.length,p=b.__vertexArray,G=b.__colorArray,ua=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){P.multiplySelf(e.matrixWorld);for(f=0;f=0)c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=g.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER, -h.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;fn&&(p=G,n=o[p]);c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[p]=1;n=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(g.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.attributes)for(j in g.attributes)b[j]!==void 0&&b[j]>=0&&(d=g.attributes[j],d.buffer&&(c.bindBuffer(c.ARRAY_BUFFER, -d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0)));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.vertexAttribPointer(b.uv, -2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer), -c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(g.wireframe?(c.lineWidth(g.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.drawElements(c.LINES,h.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, -h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),$.data.vertices+=h.__webglFaceCount,$.data.faces+=h.__webglFaceCount/3,$.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(g.linewidth),c.drawArrays(i,0,h.__webglLineCount),$.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),$.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount), +k.image.__webglTextureCube)}}else x(k,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);(f instanceof +THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,la);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,la);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix, +!1,la),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,d,f,h,g,i){if(h.opacity!=0){var j,b=e(b,d,f,h,i).attributes;if(!h.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER, +g.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;fn&&(p=G,n=o[p]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[p]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[p]=1;n=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(h.attributes)for(j in h.attributes)b[j]!==void 0&&b[j]>=0&&(d=h.attributes[j],d.buffer&&(c.bindBuffer(c.ARRAY_BUFFER, +d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0)));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.vertexAttribPointer(b.uv, +2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer), +c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER, +g.__webglFaceBuffer),c.drawElements(c.TRIANGLES,g.__webglFaceCount,c.UNSIGNED_SHORT,0)),$.data.vertices+=g.__webglFaceCount,$.data.faces+=g.__webglFaceCount/3,$.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(h.linewidth),c.drawArrays(i,0,g.__webglLineCount),$.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,g.__webglParticleCount),$.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,g.__webglVertexCount), $.data.drawCalls++)}}function g(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f, g,h,i,j,k,o,p,G,n,r=b.count*3;for(n=0;n0&&z[0]0&&z[1]0.001&&j.scale>0.001)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/H,v[0]=r*o,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)} +b.__webglLensFlares[f].object,k.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(k),d.projectionMatrix.multiplyVector3(k),v[0]=k.x,v[1]=k.y,v[2]=k.z,z[0]=v[0]*p+p,z[1]=v[1]*n+n,t.hasVertexTexture||z[0]>0&&z[0]0&&z[1]0.001&&j.scale>0.001)v[0]=j.x,v[1]=j.y,v[2]=j.z,r=j.size*j.scale/H,q[0]=r*o,q[1]=r,c.uniform3fv(y.screenPosition,v),c.uniform2fv(y.scale,q),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)} function y(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,o=void 0,n=void 0,p=void 0,G=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,z=void 0,y=void 0, x=void 0,C=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=p=q=p=v=r=void 0,A=void 0,m=A=s=r=void 0,F=void 0,J=m=A=s=n=n=G=q=p=m=A=s=F=m=A=s=F=m=A=s=void 0,B=0,E=0,O=0,P=0,H=0,M=0,T=0,N=0,ca=0,w=0,da=0,A=s=0,L=g.__vertexArray,Z=g.__uvArray,$=g.__uv2Array,Q=g.__normalArray,U=g.__tangentArray,ea=g.__colorArray,V=g.__skinVertexAArray,W=g.__skinVertexBArray,X=g.__skinIndexArray,Y=g.__skinWeightArray,aa=g.__morphTargetsArrays,R=g.__webglCustomAttributes,m=void 0,ma=g.__faceArray,S=g.__lineArray,ja=g.__needsSmoothNormals, z=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ha=ga.__dirtyVertices,ia=ga.__dirtyElements,fa=ga.__dirtyUvs,ka=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,ra=ga.faces,sa=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],xa=ga.skinVerticesA,ya=ga.skinVerticesB,za=ga.skinIndices,va=ga.skinWeights,wa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0;morphTargets=ga.morphTargets;if(R)for(J in R)R[J].offset=0,R[J].offsetSrc= @@ -272,10 +273,10 @@ r=k;j=0;for(k=r.length;j=0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>= 0&&(c.enableVertexAttribArray(n.morphTarget0),b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5), b.numSupportedMorphTargets++);n.morphTarget6>=0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b + + + three.js canvas - interactive particles + + + + + + + + + + + + + + diff --git a/examples/js/Stats.js b/examples/js/Stats.js index 5d85f6264334ebaa9943a7a4bbf4d335c09085c9..5d89bffc7fff31c551ad996faf0fe463e199dd98 100644 --- a/examples/js/Stats.js +++ b/examples/js/Stats.js @@ -1,10 +1,10 @@ -// stats.js r5 - http://github.com/mrdoob/stats.js -var Stats=function(){function w(d,K,n){var u,f,c;for(f=0;f<30;f++)for(u=0;u<73;u++){c=(u+f*74)*4;d[c]=d[c+4];d[c+1]=d[c+5];d[c+2]=d[c+6]}for(f=0;f<30;f++){c=(73+f*74)*4;if(f'+q+" MS ("+D+"-"+E+")";r.putImageData(F,0,0);J=l;if(l> -z+1E3){o=Math.round(y*1E3/(l-z));A=Math.min(A,o);B=Math.max(B,o);w(C.data,Math.min(30,30-o/100*30),"fps");g.innerHTML=''+o+" FPS ("+A+"-"+B+")";p.putImageData(C,0,0);if(x==3){s=performance.memory.usedJSHeapSize*9.54E-7;G=Math.min(G,s);H=Math.max(H,s);w(I.data,Math.min(30,30-s/2),"mem");k.innerHTML=''+Math.round(s)+" MEM ("+Math.round(G)+"-"+Math.round(H)+")";t.putImageData(I,0,0)}z=l;y=0}}}}; +// stats.js r6 - http://github.com/mrdoob/stats.js +var Stats=function(){function s(a,g,d){var f,c,e;for(c=0;c<30;c++)for(f=0;f<73;f++)e=(f+c*74)*4,a[e]=a[e+4],a[e+1]=a[e+5],a[e+2]=a[e+6];for(c=0;c<30;c++)e=(73+c*74)*4,c'+n+" MS ("+z+"-"+A+")";o.putImageData(B,0,0);F=j;if(j> +v+1E3){l=Math.round(u*1E3/(j-v));w=Math.min(w,l);x=Math.max(x,l);s(y.data,Math.min(30,30-l/100*30),"fps");d.innerHTML=''+l+" FPS ("+w+"-"+x+")";m.putImageData(y,0,0);if(t==3)p=performance.memory.usedJSHeapSize*9.54E-7,C=Math.min(C,p),D=Math.max(D,p),s(E.data,Math.min(30,30-p/2),"mb"),i.innerHTML=''+Math.round(p)+" MB ("+Math.round(C)+"-"+Math.round(D)+")",q.putImageData(E,0,0);v=j;u=0}}}}; diff --git a/examples/js/Tween.js b/examples/js/Tween.js index bf809530e665efdc00af097932d8663da0e753e1..71cd13a0b105ee116ae97b7c2cb46079ff59a067 100644 --- a/examples/js/Tween.js +++ b/examples/js/Tween.js @@ -1,12 +1,12 @@ -// Tween.js - http://github.com/sole/tween.js -var TWEEN=TWEEN||function(){var a,e,d,b=[];this.add=function(h){b.push(h)};this.remove=function(h){a=b.indexOf(h);a!==-1&&b.splice(a,1)};this.update=function(){a=0;e=b.length;for(d=(new Date).getTime();a1?1:c;g=n(c);for(f in d)a[f]=e[f]+d[f]*g;k!==null&&k.call(a,g);if(c==1){l!==null&&l.call(a);j!==null&&j.start();return false}return true}};TWEEN.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}};TWEEN.Easing.Linear.EaseNone=function(a){return a}; +// tween.js r1 - http://github.com/sole/tween.js +var TWEEN=TWEEN||function(){var a,e,c,d,f=[];return{start:function(g){c=setInterval(this.update,1E3/(g||60))},stop:function(){clearInterval(c)},add:function(g){f.push(g)},remove:function(g){a=f.indexOf(g);a!==-1&&f.splice(a,1)},update:function(){a=0;e=f.length;for(d=(new Date).getTime();a1?1:b;i=n(b);for(h in c)a[h]=e[h]+c[h]*i;l!==null&&l.call(a,i);if(b==1){m!==null&&m.call(a);k!==null&&k.start();return false}return true}};TWEEN.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}};TWEEN.Easing.Linear.EaseNone=function(a){return a}; TWEEN.Easing.Quadratic.EaseIn=function(a){return a*a};TWEEN.Easing.Quadratic.EaseOut=function(a){return-a*(a-2)};TWEEN.Easing.Quadratic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)};TWEEN.Easing.Cubic.EaseIn=function(a){return a*a*a};TWEEN.Easing.Cubic.EaseOut=function(a){return--a*a*a+1};TWEEN.Easing.Cubic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a;return 0.5*((a-=2)*a*a+2)};TWEEN.Easing.Quartic.EaseIn=function(a){return a*a*a*a}; TWEEN.Easing.Quartic.EaseOut=function(a){return-(--a*a*a*a-1)};TWEEN.Easing.Quartic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a*a;return-0.5*((a-=2)*a*a*a-2)};TWEEN.Easing.Quintic.EaseIn=function(a){return a*a*a*a*a};TWEEN.Easing.Quintic.EaseOut=function(a){return(a-=1)*a*a*a*a+1};TWEEN.Easing.Quintic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a*a*a;return 0.5*((a-=2)*a*a*a*a+2)};TWEEN.Easing.Sinusoidal.EaseIn=function(a){return-Math.cos(a*Math.PI/2)+1}; TWEEN.Easing.Sinusoidal.EaseOut=function(a){return Math.sin(a*Math.PI/2)};TWEEN.Easing.Sinusoidal.EaseInOut=function(a){return-0.5*(Math.cos(Math.PI*a)-1)};TWEEN.Easing.Exponential.EaseIn=function(a){return a==0?0:Math.pow(2,10*(a-1))};TWEEN.Easing.Exponential.EaseOut=function(a){return a==1?1:-Math.pow(2,-10*a)+1};TWEEN.Easing.Exponential.EaseInOut=function(a){if(a==0)return 0;if(a==1)return 1;if((a*=2)<1)return 0.5*Math.pow(2,10*(a-1));return 0.5*(-Math.pow(2,-10*(a-1))+2)}; -TWEEN.Easing.Circular.EaseIn=function(a){return-(Math.sqrt(1-a*a)-1)};TWEEN.Easing.Circular.EaseOut=function(a){return Math.sqrt(1- --a*a)};TWEEN.Easing.Circular.EaseInOut=function(a){if((a/=0.5)<1)return-0.5*(Math.sqrt(1-a*a)-1);return 0.5*(Math.sqrt(1-(a-=2)*a)+1)};TWEEN.Easing.Elastic.EaseIn=function(a){var e,d=0.1,b=0.4;if(a==0)return 0;if(a==1)return 1;b||(b=0.3);if(!d||d<1){d=1;e=b/4}else e=b/(2*Math.PI)*Math.asin(1/d);return-(d*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/b))}; -TWEEN.Easing.Elastic.EaseOut=function(a){var e,d=0.1,b=0.4;if(a==0)return 0;if(a==1)return 1;b||(b=0.3);if(!d||d<1){d=1;e=b/4}else e=b/(2*Math.PI)*Math.asin(1/d);return d*Math.pow(2,-10*a)*Math.sin((a-e)*2*Math.PI/b)+1}; -TWEEN.Easing.Elastic.EaseInOut=function(a){var e,d=0.1,b=0.4;if(a==0)return 0;if(a==1)return 1;b||(b=0.3);if(!d||d<1){d=1;e=b/4}else e=b/(2*Math.PI)*Math.asin(1/d);if((a*=2)<1)return-0.5*d*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/b);return d*Math.pow(2,-10*(a-=1))*Math.sin((a-e)*2*Math.PI/b)*0.5+1};TWEEN.Easing.Back.EaseIn=function(a){return a*a*(2.70158*a-1.70158)};TWEEN.Easing.Back.EaseOut=function(a){return(a-=1)*a*(2.70158*a+1.70158)+1}; +TWEEN.Easing.Circular.EaseIn=function(a){return-(Math.sqrt(1-a*a)-1)};TWEEN.Easing.Circular.EaseOut=function(a){return Math.sqrt(1- --a*a)};TWEEN.Easing.Circular.EaseInOut=function(a){if((a/=0.5)<1)return-0.5*(Math.sqrt(1-a*a)-1);return 0.5*(Math.sqrt(1-(a-=2)*a)+1)};TWEEN.Easing.Elastic.EaseIn=function(a){var e,c=0.1,d=0.4;if(a==0)return 0;if(a==1)return 1;d||(d=0.3);if(!c||c<1){c=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/c);return-(c*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/d))}; +TWEEN.Easing.Elastic.EaseOut=function(a){var e,c=0.1,d=0.4;if(a==0)return 0;if(a==1)return 1;d||(d=0.3);if(!c||c<1){c=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/c);return c*Math.pow(2,-10*a)*Math.sin((a-e)*2*Math.PI/d)+1}; +TWEEN.Easing.Elastic.EaseInOut=function(a){var e,c=0.1,d=0.4;if(a==0)return 0;if(a==1)return 1;d||(d=0.3);if(!c||c<1){c=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/c);if((a*=2)<1)return-0.5*c*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/d);return c*Math.pow(2,-10*(a-=1))*Math.sin((a-e)*2*Math.PI/d)*0.5+1};TWEEN.Easing.Back.EaseIn=function(a){return a*a*(2.70158*a-1.70158)};TWEEN.Easing.Back.EaseOut=function(a){return(a-=1)*a*(2.70158*a+1.70158)+1}; TWEEN.Easing.Back.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*(3.5949095*a-2.5949095);return 0.5*((a-=2)*a*(3.5949095*a+2.5949095)+2)};TWEEN.Easing.Bounce.EaseIn=function(a){return 1-TWEEN.Easing.Bounce.EaseOut(1-a)};TWEEN.Easing.Bounce.EaseOut=function(a){return(a/=1)<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}; TWEEN.Easing.Bounce.EaseInOut=function(a){if(a<0.5)return TWEEN.Easing.Bounce.EaseIn(a*2)*0.5;return TWEEN.Easing.Bounce.EaseOut(a*2-1)*0.5+0.5}; diff --git a/examples/webgl_interactive_cubes_tween.html b/examples/webgl_interactive_cubes_tween.html new file mode 100644 index 0000000000000000000000000000000000000000..23700b534f1279e0d33789d2b263ff38810a9058 --- /dev/null +++ b/examples/webgl_interactive_cubes_tween.html @@ -0,0 +1,165 @@ + + + + three.js webgl - interactive cubes + + + + + + + + + + + + + + + diff --git a/src/core/Matrix4.js b/src/core/Matrix4.js index 7cb5d3ca098d688365cea0999a7a40548695561a..71f0baf5be6f5c33fca9c74edb3ef50ab12e79ab 100644 --- a/src/core/Matrix4.js +++ b/src/core/Matrix4.js @@ -476,61 +476,63 @@ THREE.Matrix4.prototype = { return this; }, - - getPosition : function() { - - if( !this.position ) { - + + 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 ) { - + 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 ) { - + 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 ) { - + getColumnZ: function() { + + if ( ! this.columnZ ) { + this.columnZ = new THREE.Vector3(); - + } - + this.columnZ.set( this.n13, this.n23, this.n33 ); - + return this.columnZ; + }, - setRotationFromEuler : function( v ) { + setRotationFromEuler: function( v ) { var x = v.x, y = v.y, z = v.z, a = Math.cos( x ), b = Math.sin( x ), @@ -554,7 +556,7 @@ THREE.Matrix4.prototype = { }, - setRotationFromQuaternion : function( q ) { + setRotationFromQuaternion: function( q ) { var x = q.x, y = q.y, z = q.z, w = q.w, x2 = x + x, y2 = y + y, z2 = z + z, @@ -578,7 +580,7 @@ THREE.Matrix4.prototype = { }, - scale : function ( v ) { + scale: function ( v ) { var x = v.x, y = v.y, z = v.z; @@ -591,7 +593,7 @@ THREE.Matrix4.prototype = { }, - extractPosition : function ( m ) { + extractPosition: function ( m ) { this.n14 = m.n14; this.n24 = m.n24; @@ -599,7 +601,7 @@ THREE.Matrix4.prototype = { }, - extractRotation : function ( m, s ) { + extractRotation: function ( m, s ) { var invScaleX = 1 / s.x, invScaleY = 1 / s.y, invScaleZ = 1 / s.z; @@ -628,7 +630,7 @@ THREE.Matrix4.makeInvert = function ( m1, m2 ) { n31 = m1.n31, n32 = m1.n32, n33 = m1.n33, n34 = m1.n34, n41 = m1.n41, n42 = m1.n42, n43 = m1.n43, n44 = m1.n44; - if( m2 === undefined ) m2 = new THREE.Matrix4(); + if ( m2 === undefined ) m2 = new THREE.Matrix4(); m2.n11 = n23*n34*n42 - n24*n33*n42 + n24*n32*n43 - n22*n34*n43 - n23*n32*n44 + n22*n33*n44; m2.n12 = n14*n33*n42 - n13*n34*n42 - n14*n32*n43 + n12*n34*n43 + n13*n32*n44 - n12*n33*n44; @@ -673,10 +675,12 @@ THREE.Matrix4.makeInvert3x3 = function ( m1 ) { idet; // no inverse - if (det == 0) { - throw "matrix not invertible"; + if ( det == 0 ) { + + console.error( 'THREE.Matrix4.makeInvert3x3: Matrix not invertible.' ); + } - + idet = 1.0 / det; m33m[ 0 ] = idet * a11; m33m[ 1 ] = idet * a21; m33m[ 2 ] = idet * a31; diff --git a/src/core/Ray.js b/src/core/Ray.js index bac9ebe31707a023231da7cf7c9c51e54ad32aa6..6e57d4b56956ae7a7d9dcfd47c0d9a76b95d9d1e 100644 --- a/src/core/Ray.js +++ b/src/core/Ray.js @@ -11,26 +11,20 @@ THREE.Ray = function ( origin, direction ) { THREE.Ray.prototype = { - intersectScene : function ( scene ) { + intersectScene: function ( scene ) { return this.intersectObjects( scene.objects ); }, - intersectObjects : function ( objects ) { + intersectObjects: function ( objects ) { var i, l, object, intersects = []; for ( i = 0, l = objects.length; i < l; i ++ ) { - object = objects[ i ]; - - if ( object instanceof THREE.Mesh ) { - - intersects = intersects.concat( this.intersectObject( object ) ); - - } + intersects = intersects.concat( this.intersectObject( objects[ i ] ) ); } @@ -40,70 +34,93 @@ THREE.Ray.prototype = { }, - intersectObject : function ( object ) { + intersectObject: function ( object ) { - var f, fl, face, a, b, c, d, normal, - dot, scalar, - origin, direction, - geometry = object.geometry, - vertices = geometry.vertices, - objMatrix, - intersect, intersects = [], - intersectPoint; + if ( object instanceof THREE.Particle ) { - for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) { + var intersects = [], + distance = distanceFromIntersection( this.origin, this.direction, object ); - face = geometry.faces[ f ]; + if ( distance && distance < object.scale.x ) { - origin = this.origin.clone(); - direction = this.direction.clone(); + intersects.push( { - objMatrix = object.matrixWorld; + distance: distance, + point: object.position, + object: object - a = objMatrix.multiplyVector3( vertices[ face.a ].position.clone() ); - b = objMatrix.multiplyVector3( vertices[ face.b ].position.clone() ); - c = objMatrix.multiplyVector3( vertices[ face.c ].position.clone() ); - d = face instanceof THREE.Face4 ? objMatrix.multiplyVector3( vertices[ face.d ].position.clone() ) : null; + } ); - normal = object.matrixRotationWorld.multiplyVector3( face.normal.clone() ); - dot = direction.dot( normal ); + } - if ( object.doubleSided || ( object.flipSided ? dot > 0 : dot < 0 ) ) { // Math.abs( dot ) > 0.0001 + return intersects; - scalar = normal.dot( new THREE.Vector3().sub( a, origin ) ) / dot; - intersectPoint = origin.addSelf( direction.multiplyScalar( scalar ) ); + } else if ( object instanceof THREE.Mesh ) { - if ( face instanceof THREE.Face3 ) { + var f, fl, face, a, b, c, d, normal, + dot, scalar, + origin, direction, + geometry = object.geometry, + vertices = geometry.vertices, + objMatrix, + intersect, intersects = [], + intersectPoint; - if ( pointInFace3( intersectPoint, a, b, c ) ) { + for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) { - intersect = { + face = geometry.faces[ f ]; - distance: this.origin.distanceTo( intersectPoint ), - point: intersectPoint, - face: face, - object: object + origin = this.origin.clone(); + direction = this.direction.clone(); - }; + objMatrix = object.matrixWorld; - intersects.push( intersect ); + a = objMatrix.multiplyVector3( vertices[ face.a ].position.clone() ); + b = objMatrix.multiplyVector3( vertices[ face.b ].position.clone() ); + c = objMatrix.multiplyVector3( vertices[ face.c ].position.clone() ); + d = face instanceof THREE.Face4 ? objMatrix.multiplyVector3( vertices[ face.d ].position.clone() ) : null; - } + normal = object.matrixRotationWorld.multiplyVector3( face.normal.clone() ); + dot = direction.dot( normal ); + + if ( object.doubleSided || ( object.flipSided ? dot > 0 : dot < 0 ) ) { // Math.abs( dot ) > 0.0001 + + scalar = normal.dot( new THREE.Vector3().sub( a, origin ) ) / dot; + intersectPoint = origin.addSelf( direction.multiplyScalar( scalar ) ); + + if ( face instanceof THREE.Face3 ) { + + if ( pointInFace3( intersectPoint, a, b, c ) ) { + + intersect = { + + distance: this.origin.distanceTo( intersectPoint ), + point: intersectPoint, + face: face, + object: object + + }; - } else if ( face instanceof THREE.Face4 ) { + intersects.push( intersect ); - if ( pointInFace3( intersectPoint, a, b, d ) || pointInFace3( intersectPoint, b, c, d ) ) { + } - intersect = { + } else if ( face instanceof THREE.Face4 ) { - distance: this.origin.distanceTo( intersectPoint ), - point: intersectPoint, - face: face, - object: object + if ( pointInFace3( intersectPoint, a, b, d ) || pointInFace3( intersectPoint, b, c, d ) ) { - }; + intersect = { - intersects.push( intersect ); + distance: this.origin.distanceTo( intersectPoint ), + point: intersectPoint, + face: face, + object: object + + }; + + intersects.push( intersect ); + + } } @@ -111,9 +128,25 @@ THREE.Ray.prototype = { } + return intersects; + } - return intersects; + function distanceFromIntersection( origin, direction, object ) { + + var vector, dot, intersect, distance; + + vector = object.position.clone().subSelf( origin ); + dot = vector.dot( direction ); + + if ( dot < 0 ) return false; // Object is behind origin + + intersect = origin.clone().addSelf( direction.clone().multiplyScalar( dot ) ); + distance = object.position.distanceTo( intersect ); + + return distance; + + } // http://www.blackpawn.com/texts/pointinpoly/default.html diff --git a/src/renderers/Projector.js b/src/renderers/Projector.js index bd32729405cf40d209aec0c43873f916ba1c5d13..f0dc2af9f7518c5dd20d16e6b85e10d973639fcf 100644 --- a/src/renderers/Projector.js +++ b/src/renderers/Projector.js @@ -98,7 +98,7 @@ THREE.Projector = function() { _face4Count = 0; _lineCount = 0; _particleCount = 0; - + camera.matrixAutoUpdate && camera.update( undefined, true ); scene.update( undefined, false, camera );