From 6141390dab37c9608a20caab26266d84469743b5 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Mon, 5 Sep 2011 22:28:49 +0200 Subject: [PATCH] Simplified `CylinderGeometry` params. --- build/Three.js | 754 +++++++++++----------- build/custom/ThreeExtras.js | 14 +- examples/scenes/test_scene.js | 10 +- examples/webgl_geometries.html | 2 +- src/extras/geometries/CylinderGeometry.js | 7 +- src/extras/loaders/SceneLoader.js | 2 +- src/extras/objects/Trident.js | 2 +- 7 files changed, 394 insertions(+), 397 deletions(-) diff --git a/build/Three.js b/build/Three.js index 8a8a127010..807f769f40 100644 --- a/build/Three.js +++ b/build/Three.js @@ -1,6 +1,6 @@ // Three.js r45dev - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this}; -THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,h,m;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),h=b*6-f,b=e*(1-c),m=e*(1-c*h),c=e*(1-c*(1-h)),f){case 1:this.r=m;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=m;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r= +THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,k,m;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),k=b*6-f,b=e*(1-c),m=e*(1-c*k),c=e*(1-c*(1-k)),f){case 1:this.r=m;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=m;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r= e;this.g=b;this.b=m;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this}, @@ -16,82 +16,82 @@ b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;thi normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c0&&b>0&&k+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x, -Math.max(b.scale.y,b.scale.z)))return[];var h,m,k,n,v,p,u,t,x,w,z=b.geometry,y=z.vertices,B=[],f=0;for(h=z.faces.length;f0:t<0)))if(t=u.dot((new THREE.Vector3).sub(k,x))/t,x=x.addSelf(w.multiplyScalar(t)),m instanceof THREE.Face3)e(x,k,n,v)&&(m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},B.push(m));else if(m instanceof THREE.Face4&&(e(x,k,n,p)||e(x,n,v,p)))m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},B.push(m);B.sort(function(b,e){return b.distance-e.distance});return B}else return[]}}; -THREE.Rectangle=function(){function b(){m=f-c;k=h-e}var c,e,f,h,m,k,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,u,t){n=!1;c=k;e=m;f=u;h=t;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=ck?f:k,h=h>m?h:m);b()};this.add3Points= -function(k,m,u,t,x,w){n?(n=!1,c=ku?k>x?k:x:u>x?u:x,h=m>t?m>w?m:w:t>w?t:w):(c=ku?k>x?k>f?k:f:x>f?x:f:u>x?u>f?u:f:x>f?x:f,h=m>t?m>w?m>h?m:h:w>h?w:h:t>w?t>h?t:h:w>h?w:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=ck.getRight()?f:k.getRight(),h=h> -k.getBottom()?h:k.getBottom());b()};this.inflate=function(k){c-=k;e-=k;f+=k;h+=k;b()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){n=!0;h=f=e=c=0;b()};this.isEmpty=function(){return n}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,h,m,k,n,v,p,u,t,x,w,z,y){this.set(b||1,c||0,e||0,f||0,h||0,m||1,k||0,n||0,v||0,p||0,u||1,t||0,x||0,w||0,z||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,v,p,u,t,x,w,z,y){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=m;this.n23=k;this.n24=n;this.n31=v;this.n32=p;this.n33=u;this.n34=t;this.n41=x;this.n42=w;this.n43=z;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, -c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h; -b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+ -e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,v=b.n23,p=b.n24,u=b.n31,t=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,B=b.n43,D=b.n44,G=c.n11,H=c.n12, -E=c.n13,N=c.n14,F=c.n21,I=c.n22,C=c.n23,K=c.n24,U=c.n31,L=c.n32,O=c.n33,S=c.n34,P=c.n41,o=c.n42,W=c.n43,na=c.n44;this.n11=e*G+f*F+h*U+m*P;this.n12=e*H+f*I+h*L+m*o;this.n13=e*E+f*C+h*O+m*W;this.n14=e*N+f*K+h*S+m*na;this.n21=k*G+n*F+v*U+p*P;this.n22=k*H+n*I+v*L+p*o;this.n23=k*E+n*C+v*O+p*W;this.n24=k*N+n*K+v*S+p*na;this.n31=u*G+t*F+x*U+w*P;this.n32=u*H+t*I+x*L+w*o;this.n33=u*E+t*C+x*O+w*W;this.n34=u*N+t*K+x*S+w*na;this.n41=z*G+y*F+B*U+D*P;this.n42=z*H+y*I+B*L+D*o;this.n43=z*E+y*C+B*O+D*W;this.n44=z* +Math.max(b.scale.y,b.scale.z)))return[];var k,m,h,n,t,u,p,v,x,w,z=b.geometry,y=z.vertices,B=[],f=0;for(k=z.faces.length;f0:v<0)))if(v=p.dot((new THREE.Vector3).sub(h,x))/v,x=x.addSelf(w.multiplyScalar(v)),m instanceof THREE.Face3)e(x,h,n,t)&&(m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},B.push(m));else if(m instanceof THREE.Face4&&(e(x,h,n,u)||e(x,n,t,u)))m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},B.push(m);B.sort(function(b,e){return b.distance-e.distance});return B}else return[]}}; +THREE.Rectangle=function(){function b(){m=f-c;h=k-e}var c,e,f,k,m,h,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return k};this.set=function(h,m,p,v){n=!1;c=h;e=m;f=p;k=v;b()};this.addPoint=function(h,m){n?(n=!1,c=h,e=m,f=h,k=m):(c=ch?f:h,k=k>m?k:m);b()};this.add3Points= +function(h,m,p,v,x,w){n?(n=!1,c=hp?h>x?h:x:p>x?p:x,k=m>v?m>w?m:w:v>w?v:w):(c=hp?h>x?h>f?h:f:x>f?x:f:p>x?p>f?p:f:x>f?x:f,k=m>v?m>w?m>k?m:k:w>k?w:k:v>w?v>k?v:k:w>k?w:k);b()};this.addRectangle=function(h){n?(n=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),k=h.getBottom()):(c=ch.getRight()?f:h.getRight(),k=k> +h.getBottom()?k:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;k+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f=0&&Math.min(k,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){n=!0;k=f=e=c=0;b()};this.isEmpty=function(){return n}};THREE.Matrix3=function(){this.m=[]}; +THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,k,m,h,n,t,u,p,v,x,w,z,y){this.set(b||1,c||0,e||0,f||0,k||0,m||1,h||0,n||0,t||0,u||0,p||1,v||0,x||0,w||0,z||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,k,m,h,n,t,u,p,v,x,w,z,y){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=k;this.n22=m;this.n23=h;this.n24=n;this.n31=t;this.n32=u;this.n33=p;this.n34=v;this.n41=x;this.n42=w;this.n43=z;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, +c,e){var f=THREE.Matrix4.__v1,k=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());k.cross(m,f).normalize();this.n11=f.x;this.n12=k.x;this.n13=m.x;this.n21=f.y;this.n22=k.y;this.n23=m.y;this.n31=f.z;this.n32=k.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,k=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*k; +b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*k;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*k;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,k=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*k;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*k;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*k;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*k;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+ +e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,k=b.n13,m=b.n14,h=b.n21,n=b.n22,t=b.n23,u=b.n24,p=b.n31,v=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,B=b.n43,D=b.n44,G=c.n11,H=c.n12, +E=c.n13,N=c.n14,F=c.n21,I=c.n22,C=c.n23,K=c.n24,U=c.n31,L=c.n32,O=c.n33,S=c.n34,P=c.n41,o=c.n42,W=c.n43,na=c.n44;this.n11=e*G+f*F+k*U+m*P;this.n12=e*H+f*I+k*L+m*o;this.n13=e*E+f*C+k*O+m*W;this.n14=e*N+f*K+k*S+m*na;this.n21=h*G+n*F+t*U+u*P;this.n22=h*H+n*I+t*L+u*o;this.n23=h*E+n*C+t*O+u*W;this.n24=h*N+n*K+t*S+u*na;this.n31=p*G+v*F+x*U+w*P;this.n32=p*H+v*I+x*L+w*o;this.n33=p*E+v*C+x*O+w*W;this.n34=p*N+v*K+x*S+w*na;this.n41=z*G+y*F+B*U+D*P;this.n42=z*H+y*I+B*L+D*o;this.n43=z*E+y*C+B*O+D*W;this.n44=z* N+y*K+B*S+D*na;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*= -b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,m=this.n22,k=this.n23,n=this.n24,v=this.n31,p=this.n32,u=this.n33,t=this.n34,x=this.n41,w=this.n42,z=this.n43,y=this.n44;return f*k*p*x-e*n*p*x-f*m*u*x+c*n*u*x+e*m*t*x-c*k*t*x-f*k*v*w+e*n*v*w+f*h*u*w-b*n*u*w-e*h*t*w+b*k*t*w+f*m*v*z-c*n*v*z-f*h*p*z+b*n*p*z+c*h*t*z-b*m*t*z-e*m*v*y+c*k*v*y+e*h*p*y-b*k*p*y-c*h* -u*y+b*m*u*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34= +b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,k=this.n21,m=this.n22,h=this.n23,n=this.n24,t=this.n31,u=this.n32,p=this.n33,v=this.n34,x=this.n41,w=this.n42,z=this.n43,y=this.n44;return f*h*u*x-e*n*u*x-f*m*p*x+c*n*p*x+e*m*v*x-c*h*v*x-f*h*t*w+e*n*t*w+f*k*p*w-b*n*p*w-e*k*v*w+b*h*v*w+f*m*t*z-c*n*t*z-f*k*u*z+b*n*u*z+c*k*v*z-b*m*v*z-e*m*t*y+c*h*t*y+e*k*u*y-b*h*u*y-c*k* +p*y+b*m*p*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34= this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]= this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]= this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0, -0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,m=b.x,k=b.y,n=b.z,v=h*m,p=h*k;this.set(v*m+e,v*k-f*n,v*n+f*k,0,v*k+f*n,p*k+e,p*n-f*m,0,v*n-f*k,p*n+f*m,h*n*n+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= -new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,h=b.z,m=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var v= -k*n,p=k*h,u=f*n,t=f*h;this.n11=v+t*e;this.n12=u*e-p;this.n13=m*f;this.n21=m*h;this.n22=m*n;this.n23=-e;this.n31=p*e-u;this.n32=t+v*e;this.n33=m*k;break;case "ZXY":v=k*n;p=k*h;u=f*n;t=f*h;this.n11=v-t*e;this.n12=-m*h;this.n13=u+p*e;this.n21=p+u*e;this.n22=m*n;this.n23=t-v*e;this.n31=-m*f;this.n32=e;this.n33=m*k;break;case "ZYX":v=m*n;p=m*h;u=e*n;t=e*h;this.n11=k*n;this.n12=u*f-p;this.n13=v*f+t;this.n21=k*h;this.n22=t*f+v;this.n23=p*f-u;this.n31=-f;this.n32=e*k;this.n33=m*k;break;case "YZX":v=m*k;p= -m*f;u=e*k;t=e*f;this.n11=k*n;this.n12=t-v*h;this.n13=u*h+p;this.n21=h;this.n22=m*n;this.n23=-e*n;this.n31=-f*n;this.n32=p*h+u;this.n33=v-t*h;break;case "XZY":v=m*k;p=m*f;u=e*k;t=e*f;this.n11=k*n;this.n12=-h;this.n13=f*n;this.n21=v*h+t;this.n22=m*n;this.n23=p*h-u;this.n31=u*h-p;this.n32=e*n;this.n33=t*h+v;break;default:v=m*n,p=m*h,u=e*n,t=e*h,this.n11=k*n,this.n12=-k*h,this.n13=f,this.n21=p+u*f,this.n22=v-t*f,this.n23=-e*k,this.n31=t-v*f,this.n32=u+p*f,this.n33=m*k}return this},setRotationFromQuaternion:function(b){var c= -b.x,e=b.y,f=b.z,h=b.w,m=c+c,k=e+e,n=f+f,b=c*m,v=c*k;c*=n;var p=e*k;e*=n;f*=n;m*=h;k*=h;h*=n;this.n11=1-(p+f);this.n12=v-h;this.n13=c+k;this.n21=v+h;this.n22=1-(b+f);this.n23=e-m;this.n31=c-k;this.n32=e+m;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2; -f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);m.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); -e.y=h.length();e.z=m.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23= -b.n23*h;this.n33=b.n33*h}}; -THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,v=b.n23,p=b.n24,u=b.n31,t=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,B=b.n43,D=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=v*w*y-p*x*y+p*t*B-n*w*B-v*t*D+n*x*D;c.n12=m*x*y-h*w*y-m*t*B+f*w*B+h*t*D-f*x*D;c.n13=h*p*y-m*v*y+m*n*B-f*p*B-h*n*D+f*v*D;c.n14=m*v*t-h*p*t-m*n*x+f*p*x+h*n*w-f*v*w;c.n21=p*x*z-v*w*z-p*u*B+k*w*B+v*u*D-k*x*D;c.n22=h*w*z-m*x*z+m*u*B-e*w*B-h*u*D+e*x*D;c.n23=m*v*z-h*p*z-m*k*B+e*p*B+h*k*D-e*v*D;c.n24= -h*p*u-m*v*u+m*k*x-e*p*x-h*k*w+e*v*w;c.n31=n*w*z-p*t*z+p*u*y-k*w*y-n*u*D+k*t*D;c.n32=m*t*z-f*w*z-m*u*y+e*w*y+f*u*D-e*t*D;c.n33=h*p*z-m*n*z+m*k*y-e*p*y-f*k*D+e*n*D;c.n34=m*n*u-f*p*u-m*k*t+e*p*t+f*k*w-e*n*w;c.n41=v*t*z-n*x*z-v*u*y+k*x*y+n*u*B-k*t*B;c.n42=f*x*z-h*t*z+h*u*y-e*x*y-f*u*B+e*t*B;c.n43=h*n*z-f*v*z-h*k*y+e*v*y+f*k*B-e*n*B;c.n44=f*v*u-h*n*u+h*k*t-e*v*t-f*k*x+e*n*x;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,v=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,u=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*m;e[3]=b*k;e[4]=b*n;e[5]=b*v;e[6]=b*p;e[7]=b*u;e[8]=b*t;return c}; -THREE.Matrix4.makeFrustum=function(b,c,e,f,h,m){var k;k=new THREE.Matrix4;k.n11=2*h/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*h/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(m+h)/(m-h);k.n34=-2*m*h/(m-h);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)}; -THREE.Matrix4.makeOrtho=function(b,c,e,f,h,m){var k,n,v,p;k=new THREE.Matrix4;n=c-b;v=e-f;p=m-h;k.n11=2/n;k.n12=0;k.n13=0;k.n14=-((c+b)/n);k.n21=0;k.n22=2/v;k.n23=0;k.n24=-((e+f)/v);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((m+h)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; +0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),k=1-e,m=b.x,h=b.y,n=b.z,t=k*m,u=k*h;this.set(t*m+e,t*h-f*n,t*n+f*h,0,t*h+f*n,u*h+e,u*n-f*m,0,t*n-f*h,u*n+f*m,k*n*n+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= +new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,k=b.z,m=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),n=Math.cos(k),k=Math.sin(k);switch(c){case "YXZ":var t= +h*n,u=h*k,p=f*n,v=f*k;this.n11=t+v*e;this.n12=p*e-u;this.n13=m*f;this.n21=m*k;this.n22=m*n;this.n23=-e;this.n31=u*e-p;this.n32=v+t*e;this.n33=m*h;break;case "ZXY":t=h*n;u=h*k;p=f*n;v=f*k;this.n11=t-v*e;this.n12=-m*k;this.n13=p+u*e;this.n21=u+p*e;this.n22=m*n;this.n23=v-t*e;this.n31=-m*f;this.n32=e;this.n33=m*h;break;case "ZYX":t=m*n;u=m*k;p=e*n;v=e*k;this.n11=h*n;this.n12=p*f-u;this.n13=t*f+v;this.n21=h*k;this.n22=v*f+t;this.n23=u*f-p;this.n31=-f;this.n32=e*h;this.n33=m*h;break;case "YZX":t=m*h;u= +m*f;p=e*h;v=e*f;this.n11=h*n;this.n12=v-t*k;this.n13=p*k+u;this.n21=k;this.n22=m*n;this.n23=-e*n;this.n31=-f*n;this.n32=u*k+p;this.n33=t-v*k;break;case "XZY":t=m*h;u=m*f;p=e*h;v=e*f;this.n11=h*n;this.n12=-k;this.n13=f*n;this.n21=t*k+v;this.n22=m*n;this.n23=u*k-p;this.n31=p*k-u;this.n32=e*n;this.n33=v*k+t;break;default:t=m*n,u=m*k,p=e*n,v=e*k,this.n11=h*n,this.n12=-h*k,this.n13=f,this.n21=u+p*f,this.n22=t-v*f,this.n23=-e*h,this.n31=v-t*f,this.n32=p+u*f,this.n33=m*h}return this},setRotationFromQuaternion:function(b){var c= +b.x,e=b.y,f=b.z,k=b.w,m=c+c,h=e+e,n=f+f,b=c*m,t=c*h;c*=n;var u=e*h;e*=n;f*=n;m*=k;h*=k;k*=n;this.n11=1-(u+f);this.n12=t-k;this.n13=c+h;this.n21=t+k;this.n22=1-(b+f);this.n23=e-m;this.n31=c-h;this.n32=e+m;this.n33=1-(b+u);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,k=THREE.Matrix4.__m2; +f.identity();f.setRotationFromQuaternion(c);k.setScale(e.x,e.y,e.z);this.multiply(f,k);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,k=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);k.set(this.n12,this.n22,this.n32);m.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); +e.y=k.length();e.z=m.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,k=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*k;this.n23= +b.n23*k;this.n33=b.n33*k}}; +THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,k=b.n13,m=b.n14,h=b.n21,n=b.n22,t=b.n23,u=b.n24,p=b.n31,v=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,B=b.n43,D=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*w*y-u*x*y+u*v*B-n*w*B-t*v*D+n*x*D;c.n12=m*x*y-k*w*y-m*v*B+f*w*B+k*v*D-f*x*D;c.n13=k*u*y-m*t*y+m*n*B-f*u*B-k*n*D+f*t*D;c.n14=m*t*v-k*u*v-m*n*x+f*u*x+k*n*w-f*t*w;c.n21=u*x*z-t*w*z-u*p*B+h*w*B+t*p*D-h*x*D;c.n22=k*w*z-m*x*z+m*p*B-e*w*B-k*p*D+e*x*D;c.n23=m*t*z-k*u*z-m*h*B+e*u*B+k*h*D-e*t*D;c.n24= +k*u*p-m*t*p+m*h*x-e*u*x-k*h*w+e*t*w;c.n31=n*w*z-u*v*z+u*p*y-h*w*y-n*p*D+h*v*D;c.n32=m*v*z-f*w*z-m*p*y+e*w*y+f*p*D-e*v*D;c.n33=k*u*z-m*n*z+m*h*y-e*u*y-f*h*D+e*n*D;c.n34=m*n*p-f*u*p-m*h*v+e*u*v+f*h*w-e*n*w;c.n41=t*v*z-n*x*z-t*p*y+h*x*y+n*p*B-h*v*B;c.n42=f*x*z-k*v*z+k*p*y-e*x*y-f*p*B+e*v*B;c.n43=k*n*z-f*t*z-k*h*y+e*t*y+f*h*B-e*n*B;c.n44=f*t*p-k*n*p+k*h*v-e*t*v-f*h*x+e*n*x;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,k=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,t=-b.n32*b.n11+b.n31*b.n12,u=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*u;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*k;e[2]=b*m;e[3]=b*h;e[4]=b*n;e[5]=b*t;e[6]=b*u;e[7]=b*p;e[8]=b*v;return c}; +THREE.Matrix4.makeFrustum=function(b,c,e,f,k,m){var h;h=new THREE.Matrix4;h.n11=2*k/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*k/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(m+k)/(m-k);h.n34=-2*m*k/(m-k);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var k,b=e*Math.tan(b*Math.PI/360);k=-b;return THREE.Matrix4.makeFrustum(k*c,b*c,k,b,e,f)}; +THREE.Matrix4.makeOrtho=function(b,c,e,f,k,m){var h,n,t,u;h=new THREE.Matrix4;n=c-b;t=e-f;u=m-k;h.n11=2/n;h.n12=0;h.n13=0;h.n14=-((c+b)/n);h.n21=0;h.n22=2/t;h.n23=0;h.n24=-((e+f)/t);h.n31=0;h.n32=0;h.n33=-2/u;h.n34=-((m+k)/u);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3}; THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add: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)}},remove:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,h;e=0;for(f=this.children.length;e=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),fE&&k.positionScreen.z0&&I.z<1))ja=H[G]=H[G]||new THREE.RenderableParticle,G++,D=ja,D.x=I.x/I.w,D.y=I.y/I.w,D.z= -I.z,D.rotation=X.rotation.z,D.scale.x=X.scale.x*Math.abs(D.x-(I.x+h.projectionMatrix.n11)/(I.w+h.projectionMatrix.n14)),D.scale.y=X.scale.y*Math.abs(D.y-(I.y+h.projectionMatrix.n22)/(I.w+h.projectionMatrix.n24)),D.materials=X.materials,N.push(D);m&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)}; -THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),m=Math.cos(e),e=Math.sin(e),k=b*c,n=f*h;this.w=k*m-n*e;this.x=k*e+n*m;this.y=f*c*m+b*h*e;this.z=b*h*m-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e); +THREE.Projector=function(){function b(){var b=t[n]=t[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,h=b.z+b.w,k=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return h>=0&&k>=0&&m>=0&&n>=0?!0:h<0&&k<0||m<0&&n<0?!1:(h<0?c=Math.max(c,h/(h-k)):k<0&&(f=Math.min(f,h/(h-k))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),fE&&h.positionScreen.z0&&I.z<1))ka=H[G]=H[G]||new THREE.RenderableParticle,G++,D=ka,D.x=I.x/I.w,D.y=I.y/I.w,D.z= +I.z,D.rotation=X.rotation.z,D.scale.x=X.scale.x*Math.abs(D.x-(I.x+k.projectionMatrix.n11)/(I.w+k.projectionMatrix.n14)),D.scale.y=X.scale.y*Math.abs(D.y-(I.y+k.projectionMatrix.n22)/(I.w+k.projectionMatrix.n24)),D.materials=X.materials,N.push(D);m&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)}; +THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,k=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-k),k=Math.sin(-k),m=Math.cos(e),e=Math.sin(e),h=b*c,n=f*k;this.w=h*m-n*e;this.x=h*e+n*m;this.y=f*c*m+b*k*e;this.z=b*k*m-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e); this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c= -this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,m=this.x,k=this.y,n=this.z,v=this.w,p=v*e+k*h-n*f,u=v*f+n*e-m*h,t=v*h+m*f-k*e,e=-m* -e-k*f-n*h;c.x=p*v+e*-m+u*-n-t*-k;c.y=u*v+e*-k+t*-m-p*-n;c.z=t*v+e*-n+p*-k-u*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; -THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,m){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3}; -THREE.Face4=function(b,c,e,f,h,m,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; +this.x,e=this.y,f=this.z,k=this.w,m=b.x,h=b.y,n=b.z,b=b.w;this.x=c*b+k*m+e*n-f*h;this.y=e*b+k*h+f*m-c*n;this.z=f*b+k*n+c*h-e*m;this.w=k*b-c*m-e*h-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,k=b.z,m=this.x,h=this.y,n=this.z,t=this.w,u=t*e+h*k-n*f,p=t*f+n*e-m*k,v=t*k+m*f-h*e,e=-m* +e-h*f-n*k;c.x=u*t+e*-m+p*-n-v*-h;c.y=p*t+e*-h+v*-m-u*-n;c.z=v*t+e*-n+u*-h-p*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var k=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(k)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(k),h=Math.sqrt(1-k*k);if(Math.abs(h)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;k=Math.sin((1-f)*m)/h;f=Math.sin(f*m)/h;e.w=b.w*k+c.w*f;e.x=b.x*k+c.x*f;e.y=b.y*k+c.y*f;e.z=b.z*k+c.z*f;return e}; +THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,k,m){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3}; +THREE.Face4=function(b,c,e,f,k,m,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=k instanceof THREE.Vector3?k:new THREE.Vector3;this.vertexNormals=k instanceof Array?k:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;cthis.points.length-2?m:m+1;e[3]=m>this.points.length-3?m:m+2;p=this.points[e[0]];u=this.points[e[1]]; -t=this.points[e[2]];x=this.points[e[3]];n=k*k;v=k*n;f.x=c(p.x,u.x,t.x,x.x,k,n,v);f.y=c(p.y,u.y,t.y,x.y,k,n,v);f.z=c(p.z,u.z,t.z,x.z,k,n,v);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;bthis.points.length-2?m:m+1;e[3]=m>this.points.length-3?m:m+2;u=this.points[e[0]];p=this.points[e[1]]; +v=this.points[e[2]];x=this.points[e[3]];n=h*h;t=h*n;f.x=c(u.x,p.x,v.x,x.x,h,n,t);f.y=c(u.y,p.y,v.y,x.y,h,n,t);f.z=c(u.z,p.z,v.z,x.z,h,n,t);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1, this.LODs[f].object3D.visible=!0;else break;for(;f0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b* -255)+","+y+")"),w.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))),$.empty())};this.render=function(b,v){function p(b){var e,c,f,k=b.lights;ka.setRGB(0,0,0);ya.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(e=k.length;b>1,u=la.height>>1,m=k.scale.x*t,v=k.scale.y*x,o=m*p,n=v*u,T.set(b.x-o,b.y-n,b.x+o,b.y+n),M.instersects(T)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-v),w.translate(-p,-u),w.drawImage(la,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,T.set(b.x-o,b.y-n,b.x+o,b.y+n),M.instersects(T)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n),m.program(w), -w.restore()))}function D(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(E!=b)w.lineWidth=E=b;b=m.linecap;if(N!=b)w.lineCap=N=b;b=m.linejoin;if(F!=b)w.lineJoin=F=b;f(m.color.getContextStyle());w.stroke();T.inflate(m.linewidth*2)}}function y(b,f,k,h,n,t,la,p,w){m.data.vertices+=3;m.data.faces++;c(p.opacity);e(p.blending);S=b.positionScreen.x; -P=b.positionScreen.y;o=f.positionScreen.x;W=f.positionScreen.y;na=k.positionScreen.x;R=k.positionScreen.y;G(S,P,o,W,na,R);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ra=la.uvs[0],Ya(S,P,o,W,na,R,ra[h].u,ra[h].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,oa.copy(la.vertexNormalsWorld[0]),sa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ca=-(oa.x*b.n21+oa.y* -b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(la.vertexNormalsWorld[1]),wa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Aa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(la.vertexNormalsWorld[2]),za=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Fa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,Ya(S,P,o,W,na,R,sa,Ca,wa,Aa,za,Fa,p.envMap)}else p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ka(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof -THREE.UVMapping&&(ra=la.uvs[0],Ya(S,P,o,W,na,R,ra[h].u,ra[h].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,p.map)),e(THREE.SubtractiveBlending)),xa?!p.wireframe&&p.shading==THREE.SmoothShading&&la.vertexNormalsWorld.length==3?(ca.r=X.r=ja.r=ka.r,ca.g=X.g=ja.g=ka.g,ca.b=X.b=ja.b=ka.b,u(w,la.v1.positionWorld,la.vertexNormalsWorld[0],ca),u(w,la.v2.positionWorld,la.vertexNormalsWorld[1],X),u(w,la.v3.positionWorld,la.vertexNormalsWorld[2],ja),ea.r=(X.r+ja.r)*0.5,ea.g=(X.g+ja.g)*0.5,ea.b=(X.b+ja.b)*0.5,va=Wa(ca,X, -ja,ea),Sa(S,P,o,W,na,R,0,0,1,0,0,1,va)):(ha.r=ka.r,ha.g=ka.g,ha.b=ka.b,u(w,la.centroidWorld,la.normalWorld,ha),Z.r=Math.max(0,Math.min(p.color.r*ha.r,1)),Z.g=Math.max(0,Math.min(p.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ha.b,1)),p.wireframe?Ja(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ka(Z)):p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ka(p.color);else if(p instanceof THREE.MeshDepthMaterial)V=v.near,pa=v.far,ca.r=ca.g=ca.b=1- -Na(b.positionScreen.z,V,pa),X.r=X.g=X.b=1-Na(f.positionScreen.z,V,pa),ja.r=ja.g=ja.b=1-Na(k.positionScreen.z,V,pa),ea.r=(X.r+ja.r)*0.5,ea.g=(X.g+ja.g)*0.5,ea.b=(X.b+ja.b)*0.5,va=Wa(ca,X,ja,ea),Sa(S,P,o,W,na,R,0,0,1,0,0,1,va);else if(p instanceof THREE.MeshNormalMaterial)Z.r=Ta(la.normalWorld.x),Z.g=Ta(la.normalWorld.y),Z.b=Ta(la.normalWorld.z),p.wireframe?Ja(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ka(Z)}function B(b,f,k,h,n,p,la,t,w){m.data.vertices+=4;m.data.faces++;c(t.opacity); -e(t.blending);if(t.map||t.envMap)y(b,f,h,0,1,3,la,t,w),y(n,k,p,1,2,3,la,t,w);else if(S=b.positionScreen.x,P=b.positionScreen.y,o=f.positionScreen.x,W=f.positionScreen.y,na=k.positionScreen.x,R=k.positionScreen.y,ia=h.positionScreen.x,aa=h.positionScreen.y,ma=n.positionScreen.x,fa=n.positionScreen.y,ga=p.positionScreen.x,da=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)H(S,P,o,W,na,R,ia,aa),t.wireframe?Ja(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ka(t.color);else if(t instanceof -THREE.MeshLambertMaterial)xa?!t.wireframe&&t.shading==THREE.SmoothShading&&la.vertexNormalsWorld.length==4?(ca.r=X.r=ja.r=ea.r=ka.r,ca.g=X.g=ja.g=ea.g=ka.g,ca.b=X.b=ja.b=ea.b=ka.b,u(w,la.v1.positionWorld,la.vertexNormalsWorld[0],ca),u(w,la.v2.positionWorld,la.vertexNormalsWorld[1],X),u(w,la.v4.positionWorld,la.vertexNormalsWorld[3],ja),u(w,la.v3.positionWorld,la.vertexNormalsWorld[2],ea),va=Wa(ca,X,ja,ea),G(S,P,o,W,ia,aa),Sa(S,P,o,W,ia,aa,0,0,1,0,0,1,va),G(ma,fa,na,R,ga,da),Sa(ma,fa,na,R,ga,da,1, -0,1,1,0,1,va)):(ha.r=ka.r,ha.g=ka.g,ha.b=ka.b,u(w,la.centroidWorld,la.normalWorld,ha),Z.r=Math.max(0,Math.min(t.color.r*ha.r,1)),Z.g=Math.max(0,Math.min(t.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(t.color.b*ha.b,1)),H(S,P,o,W,na,R,ia,aa),t.wireframe?Ja(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ka(Z)):(H(S,P,o,W,na,R,ia,aa),t.wireframe?Ja(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ka(t.color));else if(t instanceof THREE.MeshNormalMaterial)Z.r=Ta(la.normalWorld.x), -Z.g=Ta(la.normalWorld.y),Z.b=Ta(la.normalWorld.z),H(S,P,o,W,na,R,ia,aa),t.wireframe?Ja(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ka(Z);else if(t instanceof THREE.MeshDepthMaterial)V=v.near,pa=v.far,ca.r=ca.g=ca.b=1-Na(b.positionScreen.z,V,pa),X.r=X.g=X.b=1-Na(f.positionScreen.z,V,pa),ja.r=ja.g=ja.b=1-Na(h.positionScreen.z,V,pa),ea.r=ea.g=ea.b=1-Na(k.positionScreen.z,V,pa),va=Wa(ca,X,ja,ea),G(S,P,o,W,ia,aa),Sa(S,P,o,W,ia,aa,0,0,1,0,0,1,va),G(ma,fa,na,R,ga,da),Sa(ma,fa,na,R,ga, -da,1,0,1,1,0,1,va)}function G(b,e,c,f,k,h){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(b,e);w.closePath()}function H(b,e,c,f,k,h,m,o){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,e);w.closePath()}function Ja(b,e,c,k){if(E!=e)w.lineWidth=E=e;if(N!=c)w.lineCap=N=c;if(F!=k)w.lineJoin=F=k;f(b.getContextStyle());w.stroke();T.inflate(e*2)}function Ka(b){h(b.getContextStyle());w.fill()}function Ya(b,e,c,f,k,m,o,n,t,p,la,v,u){if(u.image.width!=0){if(u.needsUpdate== -!0||qa[u.id]==void 0){var x=u.wrapS==THREE.RepeatWrapping,Da=u.wrapT==THREE.RepeatWrapping;qa[u.id]=w.createPattern(u.image,x&&Da?"repeat":x&&!Da?"repeat-x":!x&&Da?"repeat-y":"no-repeat");u.needsUpdate=!1}h(qa[u.id]);var x=u.offset.x/u.repeat.x,Da=u.offset.y/u.repeat.y,M=(u.image.width-1)*u.repeat.x,u=(u.image.height-1)*u.repeat.y,o=(o+x)*M,n=(n+Da)*u,t=(t+x)*M,p=(p+Da)*u,la=(la+x)*M,v=(v+Da)*u;c-=b;f-=e;k-=b;m-=e;t-=o;p-=n;la-=o;v-=n;x=1/(t*v-la*p);u=(v*c-p*k)*x;p=(v*f-p*m)*x;c=(t*k-la*c)*x;f=(t* -m-la*f)*x;b=b-u*o-c*n;e=e-p*o-f*n;w.save();w.transform(u,p,c,f,b,e);w.fill();w.restore()}}function Sa(b,e,c,f,k,h,m,o,n,p,t,la,v){var u,x;u=v.width-1;x=v.height-1;m*=u;o*=x;n*=u;p*=x;t*=u;la*=x;c-=b;f-=e;k-=b;h-=e;n-=m;p-=o;t-=m;la-=o;x=1/(n*la-t*p);u=(la*c-p*k)*x;p=(la*f-p*h)*x;c=(n*k-t*c)*x;f=(n*h-t*f)*x;b=b-u*m-c*o;e=e-p*m-f*o;w.save();w.transform(u,p,c,f,b,e);w.clip();w.drawImage(v,0,0);w.restore()}function Wa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255), -e=~~(e.b*255),n=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),t=~~(f.r*255),v=~~(f.g*255),f=~~(f.b*255);Ba[0]=k<0?0:k>255?255:k;Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=e<0?0:e>255?255:e;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=c<0?0:c>255?255:c;Ba[12]=t<0?0:t>255?255:t;Ba[13]=v<0?0:v>255?255:v;Ba[14]=f<0?0:f>255?255:f;Ga.putImageData(la,0,0);Da.drawImage(Y,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(b){b= -(b+1)*0.5;return b<0?0:b>1?1:b}function La(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Xa,bb,ua,Ea,Ma,Ua,J,A;this.autoClear?this.clear():w.setTransform(1,0,0,-1,t,x);m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,v,this.sortElements);(xa=b.lights.length>0)&&p(b);Xa=0;for(bb=k.length;Xa0&&(e(THREE.NormalBlending),c(1),k("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b* +255)+","+y+")"),w.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))),$.empty())};this.render=function(b,u){function t(b){var e,c,f,h=b.lights;la.setRGB(0,0,0);ya.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(e=h.length;b>1,p=ja.height>>1,m=h.scale.x*v,u=h.scale.y*x,o=m*t,n=u*p,T.set(b.x-o,b.y-n,b.x+o,b.y+n),M.instersects(T)&&(w.save(),w.translate(b.x,b.y),w.rotate(-h.rotation),w.scale(m,-u),w.translate(-t,-p),w.drawImage(ja,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=h.scale.x*v,n=h.scale.y*x,T.set(b.x-o,b.y-n,b.x+o,b.y+n),M.instersects(T)&&(f(m.color.getContextStyle()),k(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-h.rotation),w.scale(o,n),m.program(w), +w.restore()))}function D(b,h,k,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(h.positionScreen.x,h.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(E!=b)w.lineWidth=E=b;b=m.linecap;if(N!=b)w.lineCap=N=b;b=m.linejoin;if(F!=b)w.lineJoin=F=b;f(m.color.getContextStyle());w.stroke();T.inflate(m.linewidth*2)}}function y(b,f,h,k,n,v,ja,w,t){m.data.vertices+=3;m.data.faces++;c(w.opacity);e(w.blending);S=b.positionScreen.x; +P=b.positionScreen.y;o=f.positionScreen.x;W=f.positionScreen.y;na=h.positionScreen.x;R=h.positionScreen.y;G(S,P,o,W,na,R);if(w instanceof THREE.MeshBasicMaterial)if(w.map)w.map.mapping instanceof THREE.UVMapping&&(ra=ja.uvs[0],Ya(S,P,o,W,na,R,ra[k].u,ra[k].v,ra[n].u,ra[n].v,ra[v].u,ra[v].v,w.map));else if(w.envMap){if(w.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,oa.copy(ja.vertexNormalsWorld[0]),sa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ca=-(oa.x*b.n21+oa.y* +b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ja.vertexNormalsWorld[1]),wa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Aa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ja.vertexNormalsWorld[2]),za=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Fa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,Ya(S,P,o,W,na,R,sa,Ca,wa,Aa,za,Fa,w.envMap)}else w.wireframe?Ja(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Ka(w.color);else if(w instanceof THREE.MeshLambertMaterial)w.map&&!w.wireframe&&(w.map.mapping instanceof +THREE.UVMapping&&(ra=ja.uvs[0],Ya(S,P,o,W,na,R,ra[k].u,ra[k].v,ra[n].u,ra[n].v,ra[v].u,ra[v].v,w.map)),e(THREE.SubtractiveBlending)),xa?!w.wireframe&&w.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==3?(ca.r=X.r=ka.r=la.r,ca.g=X.g=ka.g=la.g,ca.b=X.b=ka.b=la.b,p(t,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ca),p(t,ja.v2.positionWorld,ja.vertexNormalsWorld[1],X),p(t,ja.v3.positionWorld,ja.vertexNormalsWorld[2],ka),ea.r=(X.r+ka.r)*0.5,ea.g=(X.g+ka.g)*0.5,ea.b=(X.b+ka.b)*0.5,va=Wa(ca,X, +ka,ea),Sa(S,P,o,W,na,R,0,0,1,0,0,1,va)):(ha.r=la.r,ha.g=la.g,ha.b=la.b,p(t,ja.centroidWorld,ja.normalWorld,ha),Z.r=Math.max(0,Math.min(w.color.r*ha.r,1)),Z.g=Math.max(0,Math.min(w.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(w.color.b*ha.b,1)),w.wireframe?Ja(Z,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Ka(Z)):w.wireframe?Ja(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Ka(w.color);else if(w instanceof THREE.MeshDepthMaterial)V=u.near,pa=u.far,ca.r=ca.g=ca.b=1- +Na(b.positionScreen.z,V,pa),X.r=X.g=X.b=1-Na(f.positionScreen.z,V,pa),ka.r=ka.g=ka.b=1-Na(h.positionScreen.z,V,pa),ea.r=(X.r+ka.r)*0.5,ea.g=(X.g+ka.g)*0.5,ea.b=(X.b+ka.b)*0.5,va=Wa(ca,X,ka,ea),Sa(S,P,o,W,na,R,0,0,1,0,0,1,va);else if(w instanceof THREE.MeshNormalMaterial)Z.r=Ta(ja.normalWorld.x),Z.g=Ta(ja.normalWorld.y),Z.b=Ta(ja.normalWorld.z),w.wireframe?Ja(Z,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Ka(Z)}function B(b,f,h,k,n,w,ja,v,t){m.data.vertices+=4;m.data.faces++;c(v.opacity); +e(v.blending);if(v.map||v.envMap)y(b,f,k,0,1,3,ja,v,t),y(n,h,w,1,2,3,ja,v,t);else if(S=b.positionScreen.x,P=b.positionScreen.y,o=f.positionScreen.x,W=f.positionScreen.y,na=h.positionScreen.x,R=h.positionScreen.y,ia=k.positionScreen.x,aa=k.positionScreen.y,ma=n.positionScreen.x,fa=n.positionScreen.y,ga=w.positionScreen.x,da=w.positionScreen.y,v instanceof THREE.MeshBasicMaterial)H(S,P,o,W,na,R,ia,aa),v.wireframe?Ja(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ka(v.color);else if(v instanceof +THREE.MeshLambertMaterial)xa?!v.wireframe&&v.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==4?(ca.r=X.r=ka.r=ea.r=la.r,ca.g=X.g=ka.g=ea.g=la.g,ca.b=X.b=ka.b=ea.b=la.b,p(t,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ca),p(t,ja.v2.positionWorld,ja.vertexNormalsWorld[1],X),p(t,ja.v4.positionWorld,ja.vertexNormalsWorld[3],ka),p(t,ja.v3.positionWorld,ja.vertexNormalsWorld[2],ea),va=Wa(ca,X,ka,ea),G(S,P,o,W,ia,aa),Sa(S,P,o,W,ia,aa,0,0,1,0,0,1,va),G(ma,fa,na,R,ga,da),Sa(ma,fa,na,R,ga,da,1, +0,1,1,0,1,va)):(ha.r=la.r,ha.g=la.g,ha.b=la.b,p(t,ja.centroidWorld,ja.normalWorld,ha),Z.r=Math.max(0,Math.min(v.color.r*ha.r,1)),Z.g=Math.max(0,Math.min(v.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(v.color.b*ha.b,1)),H(S,P,o,W,na,R,ia,aa),v.wireframe?Ja(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ka(Z)):(H(S,P,o,W,na,R,ia,aa),v.wireframe?Ja(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ka(v.color));else if(v instanceof THREE.MeshNormalMaterial)Z.r=Ta(ja.normalWorld.x), +Z.g=Ta(ja.normalWorld.y),Z.b=Ta(ja.normalWorld.z),H(S,P,o,W,na,R,ia,aa),v.wireframe?Ja(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ka(Z);else if(v instanceof THREE.MeshDepthMaterial)V=u.near,pa=u.far,ca.r=ca.g=ca.b=1-Na(b.positionScreen.z,V,pa),X.r=X.g=X.b=1-Na(f.positionScreen.z,V,pa),ka.r=ka.g=ka.b=1-Na(k.positionScreen.z,V,pa),ea.r=ea.g=ea.b=1-Na(h.positionScreen.z,V,pa),va=Wa(ca,X,ka,ea),G(S,P,o,W,ia,aa),Sa(S,P,o,W,ia,aa,0,0,1,0,0,1,va),G(ma,fa,na,R,ga,da),Sa(ma,fa,na,R,ga, +da,1,0,1,1,0,1,va)}function G(b,e,c,f,h,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(h,k);w.lineTo(b,e);w.closePath()}function H(b,e,c,f,h,k,m,o){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(h,k);w.lineTo(m,o);w.lineTo(b,e);w.closePath()}function Ja(b,e,c,h){if(E!=e)w.lineWidth=E=e;if(N!=c)w.lineCap=N=c;if(F!=h)w.lineJoin=F=h;f(b.getContextStyle());w.stroke();T.inflate(e*2)}function Ka(b){k(b.getContextStyle());w.fill()}function Ya(b,e,c,f,h,m,o,n,v,ja,u,t,p){if(p.image.width!=0){if(p.needsUpdate== +!0||qa[p.id]==void 0){var x=p.wrapS==THREE.RepeatWrapping,Da=p.wrapT==THREE.RepeatWrapping;qa[p.id]=w.createPattern(p.image,x&&Da?"repeat":x&&!Da?"repeat-x":!x&&Da?"repeat-y":"no-repeat");p.needsUpdate=!1}k(qa[p.id]);var x=p.offset.x/p.repeat.x,Da=p.offset.y/p.repeat.y,M=(p.image.width-1)*p.repeat.x,p=(p.image.height-1)*p.repeat.y,o=(o+x)*M,n=(n+Da)*p,v=(v+x)*M,ja=(ja+Da)*p,u=(u+x)*M,t=(t+Da)*p;c-=b;f-=e;h-=b;m-=e;v-=o;ja-=n;u-=o;t-=n;x=1/(v*t-u*ja);p=(t*c-ja*h)*x;ja=(t*f-ja*m)*x;c=(v*h-u*c)*x;f= +(v*m-u*f)*x;b=b-p*o-c*n;e=e-ja*o-f*n;w.save();w.transform(p,ja,c,f,b,e);w.fill();w.restore()}}function Sa(b,e,c,f,h,k,m,o,n,v,ja,u,t){var p,x;p=t.width-1;x=t.height-1;m*=p;o*=x;n*=p;v*=x;ja*=p;u*=x;c-=b;f-=e;h-=b;k-=e;n-=m;v-=o;ja-=m;u-=o;x=1/(n*u-ja*v);p=(u*c-v*h)*x;v=(u*f-v*k)*x;c=(n*h-ja*c)*x;f=(n*k-ja*f)*x;b=b-p*m-c*o;e=e-v*m-f*o;w.save();w.transform(p,v,c,f,b,e);w.clip();w.drawImage(t,0,0);w.restore()}function Wa(b,e,c,f){var h=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255), +e=~~(e.b*255),n=~~(c.r*255),v=~~(c.g*255),c=~~(c.b*255),w=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Ba[0]=h<0?0:h>255?255:h;Ba[1]=k<0?0:k>255?255:k;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=e<0?0:e>255?255:e;Ba[8]=n<0?0:n>255?255:n;Ba[9]=v<0?0:v>255?255:v;Ba[10]=c<0?0:c>255?255:c;Ba[12]=w<0?0:w>255?255:w;Ba[13]=u<0?0:u>255?255:u;Ba[14]=f<0?0:f>255?255:f;Ga.putImageData(ja,0,0);Da.drawImage(Y,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(b){b= +(b+1)*0.5;return b<0?0:b>1?1:b}function La(b,e){var c=e.x-b.x,f=e.y-b.y,h=c*c+f*f;h!=0&&(h=1/Math.sqrt(h),c*=h,f*=h,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Xa,bb,ua,Ea,Ma,Ua,J,A;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,x);m.data.vertices=0;m.data.faces=0;h=n.projectScene(b,u,this.sortElements);(xa=b.lights.length>0)&&t(b);Xa=0;for(bb=h.length;Xa0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(U.sub(h.position,e.centroidWorld),U.normalize(),m=e.normalWorld.dot(U)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,p){m.data.vertices+=3;m.data.faces++;S=f(P++);S.setAttribute("d", -"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?E.copy(n.color):n instanceof THREE.MeshLambertMaterial?H?(N.r=F.r,N.g=F.g,N.b=F.b,b(p,o,N),E.r=Math.max(0,Math.min(n.color.r*N.r,1)),E.g=Math.max(0,Math.min(n.color.g*N.g,1)),E.b=Math.max(0,Math.min(n.color.b*N.b,1))):E.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear), -E.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&E.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?S.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):S.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+n.opacity);v.appendChild(S)}function e(e,c,k,o,n,p,t){m.data.vertices+=4;m.data.faces++; -S=f(P++);S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?E.copy(p.color):p instanceof THREE.MeshLambertMaterial?H?(N.r=F.r,N.g=F.g,N.b=F.b,b(t,n,N),E.r=Math.max(0,Math.min(p.color.r*N.r,1)),E.g=Math.max(0,Math.min(p.color.g*N.g,1)),E.b=Math.max(0,Math.min(p.color.b*N.b,1))):E.copy(p.color):p instanceof -THREE.MeshDepthMaterial?(K=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),E.setRGB(K,K,K)):p instanceof THREE.MeshNormalMaterial&&E.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));p.wireframe?S.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):S.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+ -p.opacity);v.appendChild(S)}function f(b){L[b]==null&&(L[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),W==0&&L[b].setAttribute("shape-rendering","crispEdges"));return L[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,v=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,u,t,x,w,z,y,B,D=new THREE.Rectangle,G=new THREE.Rectangle,H=!1,E=new THREE.Color(16777215),N=new THREE.Color(16777215),F=new THREE.Color(0),I=new THREE.Color(0), -C=new THREE.Color(0),K,U=new THREE.Vector3,L=[],O=[],S,P,o,W=1;this.domElement=v;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":W=1;break;case "low":W=0}};this.setSize=function(b,e){p=b;u=e;t=p/2;x=u/2;v.setAttribute("viewBox",-t+" "+-x+" "+p+" "+u);v.setAttribute("width",p);v.setAttribute("height",u);D.set(-t,-x,t,x)};this.clear=function(){for(;v.childNodes.length>0;)v.removeChild(v.childNodes[0])};this.render= -function(b,f){var h,p,u,E,N,L,K,ca;this.autoClear&&this.clear();m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,f,this.sortElements);o=P=0;if(H=b.lights.length>0){K=b.lights;F.setRGB(0,0,0);I.setRGB(0,0,0);C.setRGB(0,0,0);h=0;for(p=K.length;h0&&(c.r+=k.color.r*m,c.g+=k.color.g*m,c.b+=k.color.b*m)):k instanceof THREE.PointLight&&(U.sub(k.position,e.centroidWorld),U.normalize(),m=e.normalWorld.dot(U)*k.intensity,m>0&&(c.r+=k.color.r*m,c.g+=k.color.g*m,c.b+=k.color.b*m))}function c(e,c,h,o,n,v){m.data.vertices+=3;m.data.faces++;S=f(P++);S.setAttribute("d", +"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?E.copy(n.color):n instanceof THREE.MeshLambertMaterial?H?(N.r=F.r,N.g=F.g,N.b=F.b,b(v,o,N),E.r=Math.max(0,Math.min(n.color.r*N.r,1)),E.g=Math.max(0,Math.min(n.color.g*N.g,1)),E.b=Math.max(0,Math.min(n.color.b*N.b,1))):E.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear), +E.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&E.setRGB(k(o.normalWorld.x),k(o.normalWorld.y),k(o.normalWorld.z));n.wireframe?S.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):S.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(S)}function e(e,c,h,o,n,v,w){m.data.vertices+=4;m.data.faces++; +S=f(P++);S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");v instanceof THREE.MeshBasicMaterial?E.copy(v.color):v instanceof THREE.MeshLambertMaterial?H?(N.r=F.r,N.g=F.g,N.b=F.b,b(w,n,N),E.r=Math.max(0,Math.min(v.color.r*N.r,1)),E.g=Math.max(0,Math.min(v.color.g*N.g,1)),E.b=Math.max(0,Math.min(v.color.b*N.b,1))):E.copy(v.color):v instanceof +THREE.MeshDepthMaterial?(K=1-v.__2near/(v.__farPlusNear-n.z*v.__farMinusNear),E.setRGB(K,K,K)):v instanceof THREE.MeshNormalMaterial&&E.setRGB(k(n.normalWorld.x),k(n.normalWorld.y),k(n.normalWorld.z));v.wireframe?S.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):S.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+ +v.opacity);t.appendChild(S)}function f(b){L[b]==null&&(L[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),W==0&&L[b].setAttribute("shape-rendering","crispEdges"));return L[b]}function k(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,h=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,p,v,x,w,z,y,B,D=new THREE.Rectangle,G=new THREE.Rectangle,H=!1,E=new THREE.Color(16777215),N=new THREE.Color(16777215),F=new THREE.Color(0),I=new THREE.Color(0), +C=new THREE.Color(0),K,U=new THREE.Vector3,L=[],O=[],S,P,o,W=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":W=1;break;case "low":W=0}};this.setSize=function(b,e){u=b;p=e;v=u/2;x=p/2;t.setAttribute("viewBox",-v+" "+-x+" "+u+" "+p);t.setAttribute("width",u);t.setAttribute("height",p);D.set(-v,-x,v,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render= +function(b,f){var k,u,p,E,N,L,K,ca;this.autoClear&&this.clear();m.data.vertices=0;m.data.faces=0;h=n.projectScene(b,f,this.sortElements);o=P=0;if(H=b.lights.length>0){K=b.lights;F.setRGB(0,0,0);I.setRGB(0,0,0);C.setRGB(0,0,0);k=0;for(u=K.length;k= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * shadowColor;\n#endif", shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif"}; -THREE.UniformsUtils={merge:function(b){var c,e,f,h={};for(c=0;c=0)o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position, -3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,p=m.morphTargetForcedOrder,t=m.morphTargetInfluences;fu&&(v=w,u=t[v]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=u;p[v]=1;u= --1;f++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=0&&(c=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer), -o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)): -o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer), -o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),P.data.vertices+=h.__webglFaceCount,P.data.faces+=h.__webglFaceCount/3,P.data.drawCalls++):m instanceof THREE.Line?(m=m.type==THREE.LineStrip? -o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),P.data.drawCalls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),P.data.drawCalls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),P.data.drawCalls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer), -o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,p,t,u,v,w,x=b.count*3;for(w=0;w=0)o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(b.position, +3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=h.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,v=m.morphTargetForcedOrder,w=m.morphTargetInfluences;fu&&(p=t,u=w[p]);o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[p]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=u;v[p]=1;u= +-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(h.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>=0&&(c=k.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglNormalBuffer), +o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)): +o.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinWeightsBuffer), +o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(h.wireframe?(o.lineWidth(h.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer),o.drawElements(o.LINES,k.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),o.drawElements(o.TRIANGLES,k.__webglFaceCount,o.UNSIGNED_SHORT,0)),P.data.vertices+=k.__webglFaceCount,P.data.faces+=k.__webglFaceCount/3,P.data.drawCalls++):m instanceof THREE.Line?(m=m.type==THREE.LineStrip? +o.LINE_STRIP:o.LINES,o.lineWidth(h.linewidth),o.drawArrays(m,0,k.__webglLineCount),P.data.drawCalls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,k.__webglParticleCount),P.data.drawCalls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,k.__webglVertexCount),P.data.drawCalls++)}}function k(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer), +o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,v,w,u,p,t,x=b.count*3;for(t=0;t=0;c--)b[c].object==e&&b.splice(c,1)}function E(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[], -materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[v])}function N(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(b){if(b!=fa){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO, +var c,f,h,k,m,n,o,v,w={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h65535&&(w[o].counter+=1,v=w[o].hash+"_"+w[o].counter,b.geometryGroups[v]==void 0&&(b.geometryGroups[v]={faces:[], +materials:n,vertices:0,numMorphTargets:p})),b.geometryGroups[v].faces.push(h),b.geometryGroups[v].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])}function N(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(b){if(b!=fa){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO, o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}fa=b}}function I(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,S(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,S(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,S(e.magFilter)),o.texParameteri(b, o.TEXTURE_MIN_FILTER,S(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,O(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,O(e.minFilter)))}function C(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D, 0,S(b.format),b.image.width,b.image.height,0,S(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);I(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function K(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer(); b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);I(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),I(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type), null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height), o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER, -null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=ea,b=qa,f=X,h=ja);e!=R&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),R=e)}function U(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function L(b, +null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=ea,b=qa,f=X,h=ka);e!=R&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),R=e)}function U(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function L(b, e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(e),null;return c}function O(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE; case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT; -case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var P=this,o,W=[],na=null,R=null,ia=!0,aa=null,ma=null,fa=null,ga=null,da=null,Z=null,ca=null,X=0,ja=0,ea=0,qa= +case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var P=this,o,W=[],na=null,R=null,ia=!0,aa=null,ma=null,fa=null,ga=null,da=null,Z=null,ca=null,X=0,ka=0,ea=0,qa= 0,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],pa=new THREE.Matrix4,va=new Float32Array(16),ra=new Float32Array(16),sa=new THREE.Vector4,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},wa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?b.stencil:!0,za=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Fa=b.antialias!== void 0?b.antialias:!1,M=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),$=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=wa;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled= -!1;this.shadowMapSoft=!0;var T,xa=[],b=THREE.ShaderLib.depthRGBA,ha=THREE.UniformsUtils.clone(b.uniforms),ka=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ha}),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ha,morphTargets:!0});ka._shadowPass=!0;ya._shadowPass=!0;try{if(!(o=wa.getContext("experimental-webgl",{antialias:Fa,stencil:Aa,preserveDrawingBuffer:za})))throw"Error creating WebGL context."; +!1;this.shadowMapSoft=!0;var T,xa=[],b=THREE.ShaderLib.depthRGBA,ha=THREE.UniformsUtils.clone(b.uniforms),la=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ha}),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ha,morphTargets:!0});la._shadowPass=!0;ya._shadowPass=!0;try{if(!(o=wa.getContext("experimental-webgl",{antialias:Fa,stencil:Aa,preserveDrawingBuffer:za})))throw"Error creating WebGL context."; console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(ta){console.error(ta)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(M.r,M.g,M.b,$);this.context= o;var oa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,Y={};Y.vertices=new Float32Array(16);Y.faces=new Uint16Array(6);i=0;Y.vertices[i++]=-1;Y.vertices[i++]=-1;Y.vertices[i++]=0;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=-1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=1;Y.vertices[i++]=0;Y.vertices[i++]=-1;Y.vertices[i++]=1;Y.vertices[i++]=0;i=Y.vertices[i++]=0;Y.faces[i++]=0;Y.faces[i++]=1;Y.faces[i++]=2;Y.faces[i++]=0;Y.faces[i++]=2;Y.faces[i++]= 3;Y.vertexBuffer=o.createBuffer();Y.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,Y.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,Y.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,Y.faces,o.STATIC_DRAW);Y.program=o.createProgram();o.attachShader(Y.program,L("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(Y.program,L("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(Y.program);Y.attributes={};Y.uniforms= {};Y.attributes.position=o.getAttribLocation(Y.program,"position");Y.attributes.uv=o.getAttribLocation(Y.program,"uv");Y.uniforms.uvOffset=o.getUniformLocation(Y.program,"uvOffset");Y.uniforms.uvScale=o.getUniformLocation(Y.program,"uvScale");Y.uniforms.rotation=o.getUniformLocation(Y.program,"rotation");Y.uniforms.scale=o.getUniformLocation(Y.program,"scale");Y.uniforms.alignment=o.getUniformLocation(Y.program,"alignment");Y.uniforms.map=o.getUniformLocation(Y.program,"map");Y.uniforms.opacity=o.getUniformLocation(Y.program, "opacity");Y.uniforms.useScreenCoordinates=o.getUniformLocation(Y.program,"useScreenCoordinates");Y.uniforms.affectedByDistance=o.getUniformLocation(Y.program,"affectedByDistance");Y.uniforms.screenPosition=o.getUniformLocation(Y.program,"screenPosition");Y.uniforms.modelViewMatrix=o.getUniformLocation(Y.program,"modelViewMatrix");Y.uniforms.projectionMatrix=o.getUniformLocation(Y.program,"projectionMatrix");var Ga=!1;this.setSize=function(b,e){wa.width=b;wa.height=e;this.setViewport(0,0,wa.width, -wa.height)};this.setViewport=function(b,e,c,f){X=b;ja=e;ea=c;qa=f;o.viewport(X,ja,ea,qa)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ia=b;o.depthMask(b)};this.setClearColorHex=function(b,e){M.setHex(b);$=e;o.clearColor(M.r,M.g,M.b,$)};this.setClearColor=function(b,e){M.copy(b);$=e;o.clearColor(M.r,M.g,M.b,$)};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT| +wa.height)};this.setViewport=function(b,e,c,f){X=b;ka=e;ea=c;qa=f;o.viewport(X,ka,ea,qa)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ia=b;o.depthMask(b)};this.setClearColorHex=function(b,e){M.setHex(b);$=e;o.clearColor(M.r,M.g,M.b,$)};this.setClearColor=function(b,e){M.copy(b);$=e;o.clearColor(M.r,M.g,M.b,$)};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT| o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer); o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer);o.deleteBuffer(e.__webglSkinIndicesBuffer);o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex), -o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(h in b.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(o.enableVertexAttribArray(w[M]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){K(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);o.clear(b)};this.render=function(b,c,o,u){var M,T,D,$,G,H,E,V,ka=b.lights, -C=b.fog;this.shadowMapEnabled&&z(b,c);P.data.vertices=0;P.data.faces=0;P.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ra);c.projectionMatrix.flattenToArray(va);pa.multiply(c.projectionMatrix,c.matrixWorldInverse);v(pa);this.initWebGLObjects(b);K(o);(this.autoClear||u)&&this.clear();G=b.__webglObjects.length;for(u=0;u=0;u--)if(M=b.__webglObjects[u],M.render){E=M.object;V=M.buffer;D=M.opaque;m(E);for(M=0;M=0&&o.enableVertexAttribArray(t.position);t.color>=0&&o.enableVertexAttribArray(t.color);t.normal>=0&&o.enableVertexAttribArray(t.normal);t.tangent>=0&&o.enableVertexAttribArray(t.tangent);b.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0&&(o.enableVertexAttribArray(t.skinVertexA),o.enableVertexAttribArray(t.skinVertexB),o.enableVertexAttribArray(t.skinIndex), +o.enableVertexAttribArray(t.skinWeight));if(b.attributes)for(h in b.attributes)t[h]!==void 0&&t[h]>=0&&o.enableVertexAttribArray(t[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(o.enableVertexAttribArray(t[M]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){K(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);o.clear(b)};this.render=function(b,c,o,p){var M,T,D,$,G,H,E,V,la=b.lights, +C=b.fog;this.shadowMapEnabled&&z(b,c);P.data.vertices=0;P.data.faces=0;P.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ra);c.projectionMatrix.flattenToArray(va);pa.multiply(c.projectionMatrix,c.matrixWorldInverse);t(pa);this.initWebGLObjects(b);K(o);(this.autoClear||p)&&this.clear();G=b.__webglObjects.length;for(p=0;p=0;p--)if(M=b.__webglObjects[p],M.render){E=M.object;V=M.buffer;D=M.opaque;m(E);for(M=0;M0||x.faceVertexUvs.length>0)n.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(t*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)n.__skinVertexAArray= -new Float32Array(t*4),n.__skinVertexBArray=new Float32Array(t*4),n.__skinIndexArray=new Float32Array(t*4),n.__skinWeightArray=new Float32Array(t*4);n.__faceArray=new Uint16Array(T*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(z*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];x=0;for(M=n.numMorphTargets;x0||x.faceVertexUvs.length>0)n.__uvArray=new Float32Array(p*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray= +new Float32Array(p*4),n.__skinVertexBArray=new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(T*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(z*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];x=0;for(M=n.numMorphTargets;x=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,sa,$));Fa&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ma,$));Za&&wa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,Z,$));za&&S>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ja,$));za&&ra>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer), -o.bufferData(o.ARRAY_BUFFER,fa,$));Aa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,qa,$),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ia,$));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,$),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ea,$),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER, -ta,$),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,da,$));T&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals= -!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=z=T=T=void 0;x=h.vertices;p=h.colors;u=x.length;t=p.length;w=h.__vertexArray;$=h.__colorArray;M=h.__dirtyColors;if(h.__dirtyVertices){for(T=0;T0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,sa,$));Fa&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ma,$));Za&&wa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,Z,$));za&&S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ka,$));za&&ra>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer), +o.bufferData(o.ARRAY_BUFFER,fa,$));Aa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,qa,$),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ia,$));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,$),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ea,$),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER, +ta,$),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,da,$));T&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals= +!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=z=T=T=void 0;x=h.vertices;v=h.colors;w=x.length;p=v.length;t=h.__vertexArray;$=h.__colorArray;M=h.__dirtyColors;if(h.__dirtyVertices){for(T=0;T1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=k;c.v=m;return c}, +THREE.ColorUtils={adjustHSV:function(b,c,e,f){var k=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,k);k.h=THREE.ColorUtils.clamp(k.h+c,0,1);k.s=THREE.ColorUtils.clamp(k.s+e,0,1);k.v=THREE.ColorUtils.clamp(k.v+f,0,1);b.setHSV(k.h,k.s,k.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,k=b.b,m=Math.max(Math.max(e,f),k),h=Math.min(Math.min(e,f),k);if(h==m)h=e=0;else{var n=m-h,h=n/m,e=e==m?(f-k)/n:f==m?2+(k-e)/n:4+(e-f)/n;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=m;return c}, clamp:function(b,c,e){return be?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,h=e?c.geometry:c,m=b.vertices,k=h.vertices,n=b.faces,v=h.faces,p=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var u=0,t=k.length;u1&&(f=1-f,h=1-h);m=1-f-h;k.copy(b);k.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);k.addSelf(n);n.copy(e);n.multiplyScalar(m);k.addSelf(n);return k},randomPointInFace:function(b, -c,e){var f,h,m;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,m=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,m);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;m=c.vertices[b.c].position;var c=c.vertices[b.d].position,k;e?b._area1&&b._area2?(e=b._area1,k=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),k=THREE.GeometryUtils.triangleArea(h,m,c),b._area1=e,b._area2=k):(e=THREE.GeometryUtils.triangleArea(f, -h,c),k=THREE.GeometryUtils.triangleArea(h,m,c));return THREE.GeometryUtils.random()*(e+k)b?e(c,h-1):p[h]1&&(f=1-f,k=1-k);m=1-f-k;h.copy(b);h.multiplyScalar(f);n.copy(c);n.multiplyScalar(k);h.addSelf(n);n.copy(e);n.multiplyScalar(m);h.addSelf(n);return h},randomPointInFace:function(b, +c,e){var f,k,m;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,k=c.vertices[b.b].position,m=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,k,m);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;k=c.vertices[b.b].position;m=c.vertices[b.c].position;var c=c.vertices[b.d].position,h;e?b._area1&&b._area2?(e=b._area1,h=b._area2):(e=THREE.GeometryUtils.triangleArea(f,k,c),h=THREE.GeometryUtils.triangleArea(k,m,c),b._area1=e,b._area2=h):(e=THREE.GeometryUtils.triangleArea(f, +k,c),h=THREE.GeometryUtils.triangleArea(k,m,c));return THREE.GeometryUtils.random()*(e+h)b?e(c,h-1):u[h] 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"}, cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"}}}; THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPoint(c/b));return e};THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e}; -THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==b+1)return this.cacheArcLengths;var c=[],e,f=this.getPoint(0),h,m=0;c.push(0);for(h=1;h<=b;h++)e=this.getPoint(h/b),m+=e.distanceTo(f),c.push(m),f=e;return this.cacheArcLengths=c}; -THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,h=e.length,m;m=c?c:b*e[h-1];time=Date.now();for(var k=0,n=h-1,v;k<=n;)if(f=Math.floor(k+(n-k)/2),v=e[f]-m,v<0)k=f+1;else if(v>0)n=f-1;else{n=f;break}f=n;if(e[f]==m)return f/(h-1);k=e[f];return e=(f+(m-k)/(e[f+1]-k))/(h-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)}; +THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==b+1)return this.cacheArcLengths;var c=[],e,f=this.getPoint(0),k,m=0;c.push(0);for(k=1;k<=b;k++)e=this.getPoint(k/b),m+=e.distanceTo(f),c.push(m),f=e;return this.cacheArcLengths=c}; +THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,k=e.length,m;m=c?c:b*e[k-1];time=Date.now();for(var h=0,n=k-1,t;h<=n;)if(f=Math.floor(h+(n-h)/2),t=e[f]-m,t<0)h=f+1;else if(t>0)n=f-1;else{n=f;break}f=n;if(e[f]==m)return f/(k-1);h=e[f];return e=(f+(m-h)/(e[f+1]-h))/(k-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)}; THREE.Curve.prototype.getTangent=function(b){var c=b-1.0E-4;b+=1.0E-4;c<0&&(c=0);b>1&&(b=1);var c=this.getPoint(c),b=this.getPoint(b),e=new THREE.Vector2;e.sub(b,c);return e.unit()};THREE.LineCurve=function(b,c){b instanceof THREE.Vector2?(this.v1=b,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(b,c,e,f){this.constructor(new THREE.Vector2(b,c),new THREE.Vector2(e,f))};THREE.LineCurve.prototype=new THREE.Curve; THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(b).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(b){return this.getPoint(b)};THREE.LineCurve.prototype.getTangent=function(){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.normalize();return b}; THREE.QuadraticBezierCurve=function(b,c,e){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),b=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),e=new THREE.Vector2(f[4],f[5]);this.v0=b;this.v1=c;this.v2=e};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,b)};THREE.QuadraticBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,b);c.normalize();return c}; -THREE.CubicBezierCurve=function(b,c,e,f){if(!(c instanceof THREE.Vector2))var h=Array.prototype.slice.call(arguments),b=new THREE.Vector2(h[0],h[1]),c=new THREE.Vector2(h[2],h[3]),e=new THREE.Vector2(h[4],h[5]),f=new THREE.Vector2(h[6],h[7]);this.v0=b;this.v1=c;this.v2=e;this.v3=f};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; +THREE.CubicBezierCurve=function(b,c,e,f){if(!(c instanceof THREE.Vector2))var k=Array.prototype.slice.call(arguments),b=new THREE.Vector2(k[0],k[1]),c=new THREE.Vector2(k[2],k[3]),e=new THREE.Vector2(k[4],k[5]),f=new THREE.Vector2(k[6],k[7]);this.v0=b;this.v1=c;this.v2=e;this.v3=f};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b3(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,b)};THREE.CubicBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,b);c.normalize();return c}; THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve; -THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,h;h=(f.length-1)*b;b=Math.floor(h);h-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,h);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,h);return c};THREE.ArcCurve=function(b,c,e,f,h,m){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=h;this.aClockwise=m}; +THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,k;k=(f.length-1)*b;b=Math.floor(k);k-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,k);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,k);return c};THREE.ArcCurve=function(b,c,e,f,k,m){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=k;this.aClockwise=m}; THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(b=1-b);b=this.aStartAngle+b*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(b),this.aY+this.aRadius*Math.sin(b))}; -THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentCubicBezier:function(b,c,e,f,h){return-3*c*(1-b)*(1-b)+3*e*(1-b)*(1-b)-6*b*e*(1-b)+6*b*f*(1-b)-3*b*b*f+3*b*b*h},tangentSpline:function(b){return 6*b*b-6*b+(3*b*b-4*b+1)+(-6*b*b+6*b)+(3*b*b-2*b)},interpolate:function(b,c,e,f,h){var b=(e-b)*0.5,f=(f-c)*0.5,m=h*h;return(2*c-2*e+b+f)*h*m+(-3*c+3*e-2*b-f)*m+b*h+c}}; +THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentCubicBezier:function(b,c,e,f,k){return-3*c*(1-b)*(1-b)+3*e*(1-b)*(1-b)-6*b*e*(1-b)+6*b*f*(1-b)-3*b*b*f+3*b*b*k},tangentSpline:function(b){return 6*b*b-6*b+(3*b*b-4*b+1)+(-6*b*b+6*b)+(3*b*b-2*b)},interpolate:function(b,c,e,f,k){var b=(e-b)*0.5,f=(f-c)*0.5,m=k*k;return(2*c-2*e+b+f)*k*m+(-3*c+3*e-2*b-f)*m+b*k+c}}; THREE.Curve.create=function(b,c){b.prototype=new THREE.Curve;b.prototype.constructor=b;b.prototype.getPoint=c;return b};THREE.LineCurve3=THREE.Curve.create(function(b,c){this.v1=b;this.v2=c},function(b){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(b);c.addSelf(this.v1);return c}); THREE.QuadraticBezierCurve3=THREE.Curve.create(function(b,c,e){this.v0=b;this.v1=c;this.v2=e},function(b){var c,e;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);e=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);b=THREE.Shape.Utils.b2(b,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,e,b)});THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(b){this.curves.push(b)}; THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};THREE.CurvePath.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.getCurveLengths(),b=0;b=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};THREE.CurvePath.prototype.getLength=function(){var b=this.getCurveLengths();return b[b.length-1]}; THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var b=[],c=0,e,f=this.curves.length;for(e=0;ec)c=m.x;else if(m.xe)e=m.y;else if(m.yc)c=m.x;else if(m.xe)e=m.y;else if(m.y0?(k=e[e.length-1],w=k.x,z=k.y):(k=this.actions[f-1].args,w=k[k.length-2],z=k[k.length-1]);for(k=1;k<=b;k++)y=k/b,m=THREE.Shape.Utils.b2(y,w,t,n),y=THREE.Shape.Utils.b2(y,z,x, -v),e.push(new THREE.Vector2(m,y));break;case THREE.PathActions.BEZIER_CURVE_TO:n=m[4];v=m[5];t=m[0];x=m[1];p=m[2];u=m[3];e.length>0?(k=e[e.length-1],w=k.x,z=k.y):(k=this.actions[f-1].args,w=k[k.length-2],z=k[k.length-1]);for(k=1;k<=b;k++)y=k/b,m=THREE.Shape.Utils.b3(y,w,t,p,n),y=THREE.Shape.Utils.b3(y,z,x,u,v),e.push(new THREE.Vector2(m,y));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];y=b*m[0].length;k=k.concat(m[0]);m=new THREE.SplineCurve(k); -for(k=1;k<=y;k++)e.push(m.getPointAt(k/y));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=m[0];v=m[1];p=m[2];t=m[3];y=m[4];x=!!m[5];u=k[k.length-2];w=k[k.length-1];k.length==0&&(u=w=0);z=y-t;var B=b*2;for(k=1;k<=B;k++)y=k/B,x||(y=1-y),y=t+y*z,m=u+n+p*Math.cos(y),y=w+v+p*Math.sin(y),e.push(new THREE.Vector2(m,y))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; -THREE.Path.prototype.nltransform=function(b,c,e,f,h,m){var k=this.getPoints(),n,v,p,u,t;n=0;for(v=k.length;n0?(h=e[e.length-1],w=h.x,z=h.y):(h=this.actions[f-1].args,w=h[h.length-2],z=h[h.length-1]);for(h=1;h<=b;h++)y=h/b,m=THREE.Shape.Utils.b2(y,w,v,n),y=THREE.Shape.Utils.b2(y,z,x, +t),e.push(new THREE.Vector2(m,y));break;case THREE.PathActions.BEZIER_CURVE_TO:n=m[4];t=m[5];v=m[0];x=m[1];u=m[2];p=m[3];e.length>0?(h=e[e.length-1],w=h.x,z=h.y):(h=this.actions[f-1].args,w=h[h.length-2],z=h[h.length-1]);for(h=1;h<=b;h++)y=h/b,m=THREE.Shape.Utils.b3(y,w,v,u,n),y=THREE.Shape.Utils.b3(y,z,x,p,t),e.push(new THREE.Vector2(m,y));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[f-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];y=b*m[0].length;h=h.concat(m[0]);m=new THREE.SplineCurve(h); +for(h=1;h<=y;h++)e.push(m.getPointAt(h/y));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;n=m[0];t=m[1];u=m[2];v=m[3];y=m[4];x=!!m[5];p=h[h.length-2];w=h[h.length-1];h.length==0&&(p=w=0);z=y-v;var B=b*2;for(h=1;h<=B;h++)y=h/B,x||(y=1-y),y=v+y*z,m=p+n+u*Math.cos(y),y=w+t+u*Math.sin(y),e.push(new THREE.Vector2(m,y))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; +THREE.Path.prototype.nltransform=function(b,c,e,f,k,m){var h=this.getPoints(),n,t,u,p,v;n=0;for(t=h.length;n=0?n-1:e.length-1;m=k-1>=0?k-1:p.length-1;var y=[p[k],e[n],e[h]];t=THREE.FontUtils.Triangulate.area(y);var B=[p[k],p[m],e[n]];x=THREE.FontUtils.Triangulate.area(B);w=n;u=k;n+=1;k+=-1;n<0&&(n+=e.length);n%= -e.length;k<0&&(k+=p.length);k%=p.length;h=n-1>=0?n-1:e.length-1;m=k-1>=0?k-1:p.length-1;y=[p[k],e[n],e[h]];y=THREE.FontUtils.Triangulate.area(y);B=[p[k],p[m],e[n]];B=THREE.FontUtils.Triangulate.area(B);t+x>y+B&&(n=w,k=u,n<0&&(n+=e.length),n%=e.length,k<0&&(k+=p.length),k%=p.length,h=n-1>=0?n-1:e.length-1,m=k-1>=0?k-1:p.length-1);t=e.slice(0,n);x=e.slice(n);w=p.slice(k);u=p.slice(0,k);m=[p[k],p[m],e[n]];z.push([p[k],e[n],e[h]]);z.push(m);e=t.concat(w).concat(u).concat(x)}return{shape:e,isolatedPts:z, -allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),m,k,n,v,p={};m=0;for(k=f.length;m=0?n-1:e.length-1;m=h-1>=0?h-1:u.length-1;var y=[u[h],e[n],e[k]];v=THREE.FontUtils.Triangulate.area(y);var B=[u[h],u[m],e[n]];x=THREE.FontUtils.Triangulate.area(B);w=n;p=h;n+=1;h+=-1;n<0&&(n+=e.length);n%= +e.length;h<0&&(h+=u.length);h%=u.length;k=n-1>=0?n-1:e.length-1;m=h-1>=0?h-1:u.length-1;y=[u[h],e[n],e[k]];y=THREE.FontUtils.Triangulate.area(y);B=[u[h],u[m],e[n]];B=THREE.FontUtils.Triangulate.area(B);v+x>y+B&&(n=w,h=p,n<0&&(n+=e.length),n%=e.length,h<0&&(h+=u.length),h%=u.length,k=n-1>=0?n-1:e.length-1,m=h-1>=0?h-1:u.length-1);v=e.slice(0,n);x=e.slice(n);w=u.slice(h);p=u.slice(0,h);m=[u[h],u[m],e[n]];z.push([u[h],e[n],e[k]]);z.push(m);e=v.concat(w).concat(p).concat(x)}return{shape:e,isolatedPts:z, +allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,k=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),m,h,n,t,u={};m=0;for(h=f.length;m1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",w,k.index-1).pos,this.points[1]=h,this.points[2]=m,this.points[3]=this.getNextKeyWith("pos",w,n.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== -"rot")THREE.Quaternion.slerp(h,m,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f}}if(this.JITCompile&&u[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;wb.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];v=b[e[2]];p=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],v[0],p[0],h,e,k);f[1]=this.interpolate(m[1],n[1],v[1],p[1],h,e,k);f[2]=this.interpolate(m[2],n[2],v[2],p[2],h,e,k);return f}; -THREE.Animation.prototype.interpolate=function(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=k[0]+(m[0]-k[0])*f,e.y=k[1]+(m[1]-k[1])*f,e.z=k[2]+(m[2]-k[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",w,h.index-1).pos,this.points[1]=k,this.points[2]=m,this.points[3]=this.getNextKeyWith("pos",w,n.index+1).pos,f=f*0.33+0.33,k=this.interpolateCatmullRom(this.points,f),e.x=k[0],e.y=k[1],e.z=k[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== +"rot")THREE.Quaternion.slerp(k,m,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=k[0]+(m[0]-k[0])*f,e.y=k[1]+(m[1]-k[1])*f,e.z=k[2]+(m[2]-k[2])*f}}if(this.JITCompile&&p[0][u]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;wb.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];t=b[e[2]];u=b[e[3]];e=k*k;h=k*e;f[0]=this.interpolate(m[0],n[0],t[0],u[0],k,e,h);f[1]=this.interpolate(m[1],n[1],t[1],u[1],k,e,h);f[2]=this.interpolate(m[2],n[2],t[2],u[2],k,e,h);return f}; +THREE.Animation.prototype.interpolate=function(b,c,e,f,k,m,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*m+b*k+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]}; THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.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!== @@ -426,152 +426,152 @@ 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 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update= function(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.position.ythis.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.translateZ(c);this.moveLeft&&this.translateX(-c); -this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown&&this.translateY(-c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target.position,h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b= -1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)* +this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown&&this.translateY(-c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target.position,k=this.position;b.x=k.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=k.y+100*Math.cos(this.phi);b.z=k.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b= +1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;k=this.position;b.x=k.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=k.y+100*Math.cos(this.phi);b.z=k.z+100*Math.sin(this.phi)* Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)}; THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))}; -THREE.PathCamera=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),v=m.length,G=0;k=v-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k=0?f:f+h;f=this.verticalAngleMap.srcRange;k=this.verticalAngleMap.dstRange;var n=k[1]-k[0];this.phi= -TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/n)*n+k[0];f=this.horizontalAngleMap.srcRange;k=this.horizontalAngleMap.dstRange;n=k[1]-k[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/n)*n+k[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,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}),k=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),v=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(v,k);b.position.set(0,10,0);this.animation= +window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var k=Math.PI*2,m=Math.PI/180;this.update=function(b,e,c){var f,h;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)*m;this.theta=this.lon*m;f=this.phi%k;this.phi=f>=0?f:f+k;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var n=h[1]-h[0];this.phi= +TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/n)*n+h[0];f=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;n=h[1]-h[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/n)*n+h[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,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}),h=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),t=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(t,h);b.position.set(0,10,0);this.animation= c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove), !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0; THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward= b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier= 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}}; this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break; -case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),h=c.size[0]/2,m=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-h)/h;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(),k=c.size[0]/2,m=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-k)/k;this.moveState.pitchDown=(b.clientY- c.offset[1]-m)/m;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff* this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward|| this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!= document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this, this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype; -THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Matrix4,v=!1,p=1,u=0,t=0,x=0,w=0,z=0,y=window.innerWidth/2,B=window.innerHeight/2;this.update= -function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*w),this.rotateVertically(b*z));b=this.delta*this.movementSpeed;this.translateZ(b*(u>0||this.autoForward&&!(u<0)?1:u));this.translateX(b*t);this.translateY(b*x);v&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); -else if(this.forward.y0||this.autoForward&&!(p<0)?1:p));this.translateX(b*v);this.translateY(b*x);t&&(this.roll+=this.rollSpeed*this.delta*u);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); +else if(this.forward.y1?e.normalize():e.z=Math.sqrt(1-f*f);h=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(h).setLength(e.x));f.addSelf(h.setLength(e.z));return f}; -this.rotateCamera=function(){var b=Math.acos(m.dot(k)/m.length()/k.length());if(b){var c=(new THREE.Vector3).cross(m,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(h);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?m=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(v.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b),this.staticMoving?n=v:n.y+=(v.y-n.y)*this.dynamicDampingFactor)}; -this.panCamera=function(){var b=u.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?p=u:p.addSelf(b.sub(u,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), -h.lengthSq()1?e.normalize():e.z=Math.sqrt(1-f*f);k=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(k).setLength(e.x));f.addSelf(k.setLength(e.z));return f}; +this.rotateCamera=function(){var b=Math.acos(m.dot(h)/m.length()/h.length());if(b){var c=(new THREE.Vector3).cross(m,h).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(k);e.multiplyVector3(this.up);e.multiplyVector3(h);this.staticMoving?m=h:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(t.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(k.multiplyScalar(b),this.staticMoving?n=t:n.y+=(t.y-n.y)*this.dynamicDampingFactor)}; +this.panCamera=function(){var b=p.clone().subSelf(u);if(b.lengthSq()){b.multiplyScalar(k.length()*this.panSpeed);var c=k.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?u=p:u.addSelf(b.sub(p,u).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), +k.lengthSq()0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;nb&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(L=b.length;--L>=0;){ga=L;da=L-1;da<0&&(da=b.length- -1);for(var c=0,e=w+u*2,c=0;c=0;S--){P=S/u;o=v*(1-P);P=p*Math.sin(P*Math.PI/2);L=0;for(O=G.length;L0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(h=0;hb&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function k(b){for(L=b.length;--L>=0;){ga=L;da=L-1;da<0&&(da=b.length- +1);for(var c=0,e=w+p*2,c=0;c=0;S--){P=S/p;o=t*(1-P);P=u*Math.sin(P*Math.PI/2);L=0;for(O=G.length;L0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,n,x)))-1);p.push(u)}c.push(p)}for(var w,z,y,h=c.length,e=0;e0)for(f=0;f1&&(w= -this.vertices[k].position.clone(),z=this.vertices[v].position.clone(),y=this.vertices[p].position.clone(),w.normalize(),z.normalize(),y.normalize(),this.faces.push(new THREE.Face3(k,v,p,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([u,t,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,k=Math.PI,m=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,n,x)))-1);u.push(p)}c.push(u)}for(var w,z,y,k=c.length,e=0;e0)for(f=0;f1&&(w= +this.vertices[h].position.clone(),z=this.vertices[t].position.clone(),y=this.vertices[u].position.clone(),w.normalize(),z.normalize(),y.normalize(),this.faces.push(new THREE.Face3(h,t,u,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([p,v,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c= -this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[],b=0;b0)for(p=0;p2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}v=p;h<=v&&(v=0);p=v+1;h<=p&&(p=0);u=p+1;h<=u&&(u=0);var x;a:{x=b;var w=v,z=p,y=u,B=h,D=k,G=void 0,H=void 0,E=void 0, +this.getFace(),e=this.size/c.resolution,f=0,k=String(b).split(""),m=k.length,h=[],b=0;b0)for(u=0;u2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}t=u;k<=t&&(t=0);u=t+1;k<=u&&(u=0);p=u+1;k<=p&&(p=0);var x;a:{x=b;var w=t,z=u,y=p,B=k,D=h,G=void 0,H=void 0,E=void 0, N=void 0,F=void 0,I=void 0,C=void 0,K=void 0,U=void 0,H=x[D[w]].x,E=x[D[w]].y,N=x[D[z]].x,F=x[D[z]].y,I=x[D[y]].x,C=x[D[y]].y;if(1.0E-10>(N-H)*(C-E)-(F-E)*(I-H))x=!1;else{for(G=0;G=0&&S>=0&&o>=0){x=!1; -break a}}x=!0}}if(x){m.push([b[k[v]],b[k[p]],b[k[u]]]);n.push([k[v],k[p],k[u]]);v=p;for(u=p+1;u>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=u(b,c),f=u(b,c+1),k=u(b,c+2);return(u(b,c+3)<<24)+(k<<16)+(f<<8)+e}function v(b,c){var e=u(b,c);return(u(b,c+1)<<8)+e}function p(b,c){var e=u(b,c);return e>127?e-256:e}function u(b,c){return b.charCodeAt(c)&255}function t(c){var e, -f,k;e=h(b,c);f=h(b,c+F);k=h(b,c+I);c=v(b,c+C);D.faces.push(new THREE.Face3(e,f,k,null,null,D.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+F);k=h(b,c+I);m=v(b,c+C);o=h(b,c+K);p=h(b,c+U);c=h(b,c+L);m=D.materials[m];var u=E[p*3],t=E[p*3+1];p=E[p*3+2];var w=E[c*3],M=E[c*3+1],c=E[c*3+2];D.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(E[o*3],E[o*3+1],E[o*3+2]),new THREE.Vector3(u,t,p),new THREE.Vector3(w,M,c)],null,m))}function w(c){var e,f,k,m;e=h(b,c);f=h(b,c+O);k=h(b,c+S);m=h(b, -c+P);c=v(b,c+o);D.faces.push(new THREE.Face4(e,f,k,m,null,null,D.materials[c]))}function z(c){var e,f,k,m,p,u,t,w;e=h(b,c);f=h(b,c+O);k=h(b,c+S);m=h(b,c+P);p=v(b,c+o);u=h(b,c+W);t=h(b,c+na);w=h(b,c+R);c=h(b,c+ia);p=D.materials[p];var x=E[t*3],M=E[t*3+1];t=E[t*3+2];var y=E[w*3],T=E[w*3+1];w=E[w*3+2];var z=E[c*3],B=E[c*3+1],c=E[c*3+2];D.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(E[u*3],E[u*3+1],E[u*3+2]),new THREE.Vector3(x,M,t),new THREE.Vector3(y,T,w),new THREE.Vector3(z,B,c)],null,p))} -function y(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+ma);c=N[e*2];m=N[e*2+1];e=N[f*2];var o=D.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function B(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+fa);k=h(b,c+ga);m=h(b,c+da);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[k*2];var t=D.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f, -k));v.push(new THREE.UV(u,m));t.push(v)}var D=this,G=0,H,E=[],N=[],F,I,C,K,U,L,O,S,P,o,W,na,R,ia,aa,ma,fa,ga,da,Z,ca,X,ja,ea,qa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(D,f,c);H={signature:b.substr(G,8),header_bytes:u(b,G+8),vertex_coordinate_bytes:u(b,G+9),normal_coordinate_bytes:u(b,G+10),uv_coordinate_bytes:u(b,G+11),vertex_index_bytes:u(b,G+12),normal_index_bytes:u(b,G+13),uv_index_bytes:u(b,G+14),material_index_bytes:u(b,G+15),nvertices:h(b,G+16),nnormals:h(b,G+16+4),nuvs:h(b, -G+16+8),ntri_flat:h(b,G+16+12),ntri_smooth:h(b,G+16+16),ntri_flat_uv:h(b,G+16+20),ntri_smooth_uv:h(b,G+16+24),nquad_flat:h(b,G+16+28),nquad_smooth:h(b,G+16+32),nquad_flat_uv:h(b,G+16+36),nquad_smooth_uv:h(b,G+16+40)};G+=H.header_bytes;F=H.vertex_index_bytes;I=H.vertex_index_bytes*2;C=H.vertex_index_bytes*3;K=H.vertex_index_bytes*3+H.material_index_bytes;U=H.vertex_index_bytes*3+H.material_index_bytes+H.normal_index_bytes;L=H.vertex_index_bytes*3+H.material_index_bytes+H.normal_index_bytes*2;O=H.vertex_index_bytes; +THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,k,m){var h=new XMLHttpRequest,n=f+"/"+b,t=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,k,c):alert("Couldn't load ["+n+"] ["+h.status+"]"):h.readyState==3?m&&(t==0&&(t=h.getResponseHeader("Content-Length")),m({total:t,loaded:h.responseText.length})):h.readyState==2&&(t=h.getResponseHeader("Content-Length"))};h.open("GET",n,!0);h.overrideMimeType("text/plain; charset=x-user-defined"); +h.setRequestHeader("Content-Type","text/plain");h.send(null)}; +THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var k=function(c){function e(b,c){var f=p(b,c),h=p(b,c+1),k=p(b,c+2),m=p(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function k(b,c){var e=p(b,c),f=p(b,c+1),h=p(b,c+2);return(p(b,c+3)<<24)+(h<<16)+(f<<8)+e}function t(b,c){var e=p(b,c);return(p(b,c+1)<<8)+e}function u(b,c){var e=p(b,c);return e>127?e-256:e}function p(b,c){return b.charCodeAt(c)&255}function v(c){var e, +f,h;e=k(b,c);f=k(b,c+F);h=k(b,c+I);c=t(b,c+C);D.faces.push(new THREE.Face3(e,f,h,null,null,D.materials[c]))}function x(c){var e,f,h,m,o,p;e=k(b,c);f=k(b,c+F);h=k(b,c+I);m=t(b,c+C);o=k(b,c+K);p=k(b,c+U);c=k(b,c+L);m=D.materials[m];var v=E[p*3],u=E[p*3+1];p=E[p*3+2];var w=E[c*3],M=E[c*3+1],c=E[c*3+2];D.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(E[o*3],E[o*3+1],E[o*3+2]),new THREE.Vector3(v,u,p),new THREE.Vector3(w,M,c)],null,m))}function w(c){var e,f,h,m;e=k(b,c);f=k(b,c+O);h=k(b,c+S);m=k(b, +c+P);c=t(b,c+o);D.faces.push(new THREE.Face4(e,f,h,m,null,null,D.materials[c]))}function z(c){var e,f,h,m,p,v,u,w;e=k(b,c);f=k(b,c+O);h=k(b,c+S);m=k(b,c+P);p=t(b,c+o);v=k(b,c+W);u=k(b,c+na);w=k(b,c+R);c=k(b,c+ia);p=D.materials[p];var x=E[u*3],M=E[u*3+1];u=E[u*3+2];var y=E[w*3],T=E[w*3+1];w=E[w*3+2];var z=E[c*3],B=E[c*3+1],c=E[c*3+2];D.faces.push(new THREE.Face4(e,f,h,m,[new THREE.Vector3(E[v*3],E[v*3+1],E[v*3+2]),new THREE.Vector3(x,M,u),new THREE.Vector3(y,T,w),new THREE.Vector3(z,B,c)],null,p))} +function y(c){var e,f,h,m;e=k(b,c);f=k(b,c+aa);h=k(b,c+ma);c=N[e*2];m=N[e*2+1];e=N[f*2];var o=D.faceVertexUvs[0];f=N[f*2+1];var p=N[h*2];h=N[h*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}function B(c){var e,f,h,m,o,p;e=k(b,c);f=k(b,c+fa);h=k(b,c+ga);m=k(b,c+da);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[h*2];var t=D.faceVertexUvs[0];h=N[h*2+1];var v=N[m*2];m=N[m*2+1];var u=[];u.push(new THREE.UV(c,o));u.push(new THREE.UV(e,p));u.push(new THREE.UV(f, +h));u.push(new THREE.UV(v,m));t.push(u)}var D=this,G=0,H,E=[],N=[],F,I,C,K,U,L,O,S,P,o,W,na,R,ia,aa,ma,fa,ga,da,Z,ca,X,ka,ea,qa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(D,f,c);H={signature:b.substr(G,8),header_bytes:p(b,G+8),vertex_coordinate_bytes:p(b,G+9),normal_coordinate_bytes:p(b,G+10),uv_coordinate_bytes:p(b,G+11),vertex_index_bytes:p(b,G+12),normal_index_bytes:p(b,G+13),uv_index_bytes:p(b,G+14),material_index_bytes:p(b,G+15),nvertices:k(b,G+16),nnormals:k(b,G+16+4),nuvs:k(b, +G+16+8),ntri_flat:k(b,G+16+12),ntri_smooth:k(b,G+16+16),ntri_flat_uv:k(b,G+16+20),ntri_smooth_uv:k(b,G+16+24),nquad_flat:k(b,G+16+28),nquad_smooth:k(b,G+16+32),nquad_flat_uv:k(b,G+16+36),nquad_smooth_uv:k(b,G+16+40)};G+=H.header_bytes;F=H.vertex_index_bytes;I=H.vertex_index_bytes*2;C=H.vertex_index_bytes*3;K=H.vertex_index_bytes*3+H.material_index_bytes;U=H.vertex_index_bytes*3+H.material_index_bytes+H.normal_index_bytes;L=H.vertex_index_bytes*3+H.material_index_bytes+H.normal_index_bytes*2;O=H.vertex_index_bytes; S=H.vertex_index_bytes*2;P=H.vertex_index_bytes*3;o=H.vertex_index_bytes*4;W=H.vertex_index_bytes*4+H.material_index_bytes;na=H.vertex_index_bytes*4+H.material_index_bytes+H.normal_index_bytes;R=H.vertex_index_bytes*4+H.material_index_bytes+H.normal_index_bytes*2;ia=H.vertex_index_bytes*4+H.material_index_bytes+H.normal_index_bytes*3;aa=H.uv_index_bytes;ma=H.uv_index_bytes*2;fa=H.uv_index_bytes;ga=H.uv_index_bytes*2;da=H.uv_index_bytes*3;c=H.vertex_index_bytes*3+H.material_index_bytes;qa=H.vertex_index_bytes* -4+H.material_index_bytes;Z=H.ntri_flat*c;ca=H.ntri_smooth*(c+H.normal_index_bytes*3);X=H.ntri_flat_uv*(c+H.uv_index_bytes*3);ja=H.ntri_smooth_uv*(c+H.normal_index_bytes*3+H.uv_index_bytes*3);ea=H.nquad_flat*qa;c=H.nquad_smooth*(qa+H.normal_index_bytes*4);qa=H.nquad_flat_uv*(qa+H.uv_index_bytes*4);G+=function(c){for(var f,h,m,n=H.vertex_coordinate_bytes*3,o=c+H.nvertices*n;c=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[]; -for(y=0;y1){o=new THREE.MeshFaceMaterial;for(j=0;j=0){y=o.invBindMatrices[u];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[]; +for(y=0;y1){o=new THREE.MeshFaceMaterial;for(j=0;j1?e[1].substr(0,c):"0";e[1].length1?e[1].substr(0,c):"0";e[1].length=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;fc){v=p.output[o];break}m=v!==void 0?v instanceof THREE.Matrix4?m.multiply(m,v):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14, -c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};u.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;bc){u=t.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14, +c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b3)for(h=2;h=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c1&&(U=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(F,U);object.name=w;object.position.set(H[0],H[1],H[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;R.scene.addObject(object);R.objects[w]=object;G.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),R.scene.collisions.colliders.push(b)); if(G.castsShadow)b=new THREE.ShadowVolume(F),R.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},R.triggers[object.name]=b)}}else H=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(H[0],H[1],H[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], -s[1],s[2]),object.visible=G.visible!==void 0?G.visible:!1,R.scene.addObject(object),R.objects[w]=object,R.empties[w]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},R.triggers[object.name]=b)}function v(b){return function(c){R.geometries[b]=c;n();P-=1;e.onLoadComplete();u()}}function p(b){return function(c){R.geometries[b]=c}}function u(){e.callbackProgress({totalModels:W,totalTextures:na,loadedModels:W-P,loadedTextures:na-o},R);e.onLoadProgress();P==0&&o==0&&c(R)} -var t,x,w,z,y,B,D,G,H,E,N,F,I,C,K,U,L,O,S,P,o,W,na,R;O=b.data;K=new THREE.BinaryLoader;S=new THREE.JSONLoader;o=P=0;R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in O.objects)if(G=O.objects[w],G.meshCollider){b=!0;break}if(b)R.scene.collisions=new THREE.CollisionSystem;if(O.transform){b=O.transform.position;E=O.transform.rotation;var ia=O.transform.scale;b&&R.scene.position.set(b[0],b[1],b[2]);E&&R.scene.rotation.set(E[0], -E[1],E[2]);ia&&R.scene.scale.set(ia[0],ia[1],ia[2]);(b||E||ia)&&R.scene.updateMatrix()}b=function(){o-=1;u();e.onLoadComplete()};for(y in O.cameras){E=O.cameras[y];if(E.type=="perspective")I=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")I=new THREE.Camera,I.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);H=E.position;E=E.target;I.position.set(H[0],H[1],H[2]);I.target.position.set(E[0],E[1],E[2]);R.cameras[y]=I}for(z in O.lights)y=O.lights[z], +s[1],s[2]),object.visible=G.visible!==void 0?G.visible:!1,R.scene.addObject(object),R.objects[w]=object,R.empties[w]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},R.triggers[object.name]=b)}function t(b){return function(c){R.geometries[b]=c;n();P-=1;e.onLoadComplete();p()}}function u(b){return function(c){R.geometries[b]=c}}function p(){e.callbackProgress({totalModels:W,totalTextures:na,loadedModels:W-P,loadedTextures:na-o},R);e.onLoadProgress();P==0&&o==0&&c(R)} +var v,x,w,z,y,B,D,G,H,E,N,F,I,C,K,U,L,O,S,P,o,W,na,R;O=b.data;K=new THREE.BinaryLoader;S=new THREE.JSONLoader;o=P=0;R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in O.objects)if(G=O.objects[w],G.meshCollider){b=!0;break}if(b)R.scene.collisions=new THREE.CollisionSystem;if(O.transform){b=O.transform.position;E=O.transform.rotation;var ia=O.transform.scale;b&&R.scene.position.set(b[0],b[1],b[2]);E&&R.scene.rotation.set(E[0], +E[1],E[2]);ia&&R.scene.scale.set(ia[0],ia[1],ia[2]);(b||E||ia)&&R.scene.updateMatrix()}b=function(){o-=1;p();e.onLoadComplete()};for(y in O.cameras){E=O.cameras[y];if(E.type=="perspective")I=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")I=new THREE.Camera,I.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);H=E.position;E=E.target;I.position.set(H[0],H[1],H[2]);I.target.position.set(E[0],E[1],E[2]);R.cameras[y]=I}for(z in O.lights)y=O.lights[z], I=y.color!==void 0?y.color:16777215,E=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(H=y.direction,L=new THREE.DirectionalLight(I,E),L.position.set(H[0],H[1],H[2]),L.position.normalize()):y.type=="point"?(H=y.position,d=y.distance,L=new THREE.PointLight(I,E,d),L.position.set(H[0],H[1],H[2])):y.type=="ambient"&&(L=new THREE.AmbientLight(I)),R.scene.addLight(L),R.lights[z]=L;for(B in O.fogs)z=O.fogs[B],z.type=="linear"?C=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(C=new THREE.FogExp2(0, -z.density)),E=z.color,C.color.setRGB(E[0],E[1],E[2]),R.fogs[B]=C;if(R.cameras&&O.defaults.camera)R.currentCamera=R.cameras[O.defaults.camera];if(R.fogs&&O.defaults.fog)R.scene.fog=R.fogs[O.defaults.fog];E=O.defaults.bgcolor;R.bgColor=new THREE.Color;R.bgColor.setRGB(E[0],E[1],E[2]);R.bgColorAlpha=O.defaults.bgalpha;for(t in O.geometries)if(B=O.geometries[t],B.type=="bin_mesh"||B.type=="ascii_mesh")P+=1,e.onLoadStart();W=P;for(t in O.geometries)B=O.geometries[t],B.type=="cube"?(F=new THREE.CubeGeometry(B.width, -B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),R.geometries[t]=F):B.type=="plane"?(F=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),R.geometries[t]=F):B.type=="sphere"?(F=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),R.geometries[t]=F):B.type=="cylinder"?(F=new THREE.CylinderGeometry(B.topRad,B.height,B.numSegs,1,B.topRad,B.botRad),R.geometries[t]=F):B.type=="torus"?(F=new THREE.TorusGeometry(B.radius,B.tube, -B.segmentsR,B.segmentsT),R.geometries[t]=F):B.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(B.subdivisions),R.geometries[t]=F):B.type=="bin_mesh"?K.load({model:f(B.url,O.urlBaseType),callback:v(t)}):B.type=="ascii_mesh"?S.load({model:f(B.url,O.urlBaseType),callback:v(t)}):B.type=="embedded_mesh"&&(B=O.embeds[B.id])&&S.createModel(B,p(t),"");for(D in O.textures)if(t=O.textures[D],t.url instanceof Array){o+=t.url.length;for(K=0;K=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var m=0,k=0;k>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,k=0;k<8;k++){for(var m=0,h=0;h>1^-(n&1);e[8*h+k]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(k=h=0;k=this.maxCount-3&&n(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&&(v=this.size-1);var x=Math.floor(p-n);x<1&&(x=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var w=Math.floor(u-n);w<1&&(w=1);n=Math.floor(u+n);n>this.size-1&&(n=this.size- -1);for(var z,y,B,D,G,H;t0&&(this.field[B+z]+=D)}}};this.addPlaneX=function(b,c){var h,m,k,n,v,p=this.size,u=this.yd,t=this.zd,x=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(h=0;h0)for(m=0;mu&&(z=u);for(m=0;m0){v=m*t;for(h=0;hsize&&(dist=size);for(k=0;k0){v=zd*k;for(m=0;m=this.maxCount-3&&n(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&&(t=this.size-1);var x=Math.floor(u-n);x<1&&(x=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var w=Math.floor(p-n);w<1&&(w=1);n=Math.floor(p+n);n>this.size-1&&(n=this.size- +1);for(var z,y,B,D,G,H;v0&&(this.field[B+z]+=D)}}};this.addPlaneX=function(b,c){var k,m,h,n,t,u=this.size,p=this.yd,v=this.zd,x=this.field,w=u*Math.sqrt(b/c);w>u&&(w=u);for(k=0;k0)for(m=0;mp&&(z=p);for(m=0;m0){t=m*v;for(k=0;ksize&&(dist=size);for(h=0;h0){t=zd*h;for(m=0;mm?this.hits.push(h):this.hits.unshift(h),m=f;return this.hits}; +THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,k,m=0;c=0;for(e=this.colliders.length;cm?this.hits.push(k):this.hits.unshift(k),m=f;return this.hits}; THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.distc.length)return null;return c[e]}; THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,m=0;m=n*h))return Number.MAX_VALUE;k/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(k);n.addSelf(b.origin);Math.abs(m.x)> -Math.abs(m.y)?Math.abs(m.x)>Math.abs(m.z)?(b=n.y-c.y,m=e.y-c.y,h=f.y-c.y,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(m.y)>Math.abs(m.z)?(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y);c=m*f-e*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-n*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=m*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k}; +THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,k,m=0;m=n*k))return Number.MAX_VALUE;h/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(h);n.addSelf(b.origin);Math.abs(m.x)> +Math.abs(m.y)?Math.abs(m.x)>Math.abs(m.z)?(b=n.y-c.y,m=e.y-c.y,k=f.y-c.y,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,m=e.x-c.x,k=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(m.y)>Math.abs(m.z)?(b=n.x-c.x,m=e.x-c.x,k=f.x-c.x,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,m=e.x-c.x,k=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y);c=m*f-e*k;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-n*k)*c;if(!(f>=0))return Number.MAX_VALUE;c*=m*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h}; THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f}; -THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,m=0,k=0,n=0,v=0,p=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,k=1);e.origin.yc.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y, -p=!1,n=1);e.origin.zc.max.z&&(m=c.max.z-e.origin.z,m/=e.direction.z,p=!1,v=1);if(p)return-1;p=0;h>f&&(p=1,f=h);m>f&&(p=2,f=m);switch(p){case 0:n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(kc.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z* -f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case 2:k=e.origin.x+e.direction.x*f;if(kc.max.x)return Number.MAX_VALUE;n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,v)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE}; +THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,k=0,m=0,h=0,n=0,t=0,u=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,u=!1,h=1);e.origin.yc.max.y&&(k=c.max.y-e.origin.y,k/=e.direction.y, +u=!1,n=1);e.origin.zc.max.z&&(m=c.max.z-e.origin.z,m/=e.direction.z,u=!1,t=1);if(u)return-1;u=0;k>f&&(u=1,f=k);m>f&&(u=2,f=m);switch(u){case 0:n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(hc.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z* +f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case 2:h=e.origin.x+e.direction.x*f;if(hc.max.x)return Number.MAX_VALUE;n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,t)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE}; THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c}; THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,v,p,u;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z= -2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); -var z=new THREE.Scene;z.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(v!==e.aspect||p!==e.near||u!==e.fov){v=e.aspect;p=e.near;u=e.fov;var D=e.projectionMatrix.clone(),G=125/30*0.5,H=G*p/125,E=p*Math.tan(u*Math.PI/360),N;k.n14=G;n.n14=-G;G=-E*v+H;N=E*v+H;D.n11=2*p/(N-G);D.n13=(N+G)/(N-G);h.projectionMatrix=D.clone();G=-E*v-H;N=E*v-H;D.n11=2*p/(N-G); -D.n13=(N+G)/(N-G);m.projectionMatrix=D.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,t,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=p;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,z,w)}}; -if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,m,k=new THREE.Camera,n=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;m=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far; -k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);n.projectionMatrix=k.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,m);f.call(c,b,k);this.setViewport(h,0,h,m);f.call(c,b,n,!1)}}; +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,k=new THREE.Camera,m=new THREE.Camera,h=new THREE.Matrix4,n=new THREE.Matrix4,t,u,p;k.useTarget=m.useTarget=!1;k.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},v=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z= +2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:v},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); +var z=new THREE.Scene;z.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);v.width=b;v.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(t!==e.aspect||u!==e.near||p!==e.fov){t=e.aspect;u=e.near;p=e.fov;var D=e.projectionMatrix.clone(),G=125/30*0.5,H=G*u/125,E=u*Math.tan(p*Math.PI/360),N;h.n14=G;n.n14=-G;G=-E*t+H;N=E*t+H;D.n11=2*u/(N-G);D.n13=(N+G)/(N-G);k.projectionMatrix=D.clone();G=-E*t-H;N=E*t-H;D.n11=2*u/(N-G); +D.n13=(N+G)/(N-G);m.projectionMatrix=D.clone()}k.matrix=e.matrixWorld.clone().multiplySelf(n);k.update(null,!0);k.position.copy(e.position);k.near=u;k.far=e.far;f.call(c,b,k,v,!0);m.matrix=e.matrixWorld.clone().multiplySelf(h);m.update(null,!0);m.position.copy(e.position);m.near=u;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,z,w)}}; +if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,k,m,h=new THREE.Camera,n=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);k=b/2;m=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far; +h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);n.projectionMatrix=h.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,k,m);f.call(c,b,h);this.setViewport(k,0,k,m);f.call(c,b,n,!1)}}; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index a937b643c5..022bda08c8 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -132,11 +132,11 @@ THREE.CubeGeometry=function(a,b,c,e,h,g,f,k,l){function m(a,c,b,f,k,l,m,o){var t L,l+N*(p+1)+L,l+1+N*(p+1)+L,l+1+N*p+L,null,null,o)),n.faceVertexUvs[0].push([new THREE.UV(l/x,p/v),new THREE.UV(l/x,(p+1)/v),new THREE.UV((l+1)/x,(p+1)/v),new THREE.UV((l+1)/x,p/v)])}THREE.Geometry.call(this);var n=this,o=a/2,p=b/2,t=c/2,k=k?-1:1;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var v in l)this.sides[v]!=void 0&&(this.sides[v]= l[v]);this.sides.px&&m("z","y",1*k,-1,c,b,-o,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,c,b,o,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,c,p,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,c,-p,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,b,t,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,b,-t,this.materials[5]);(function(){for(var a=[],c=[],b=0,e=n.vertices.length;b0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(k=0;k0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(f=0;f0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(f=0;fa&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(h).addSelf(k).subSelf(a).clone()}function h(a){for(B=a.length;--B>=0;){T=B;R=B-1;R<0&&(R=a.length- 1);for(var c=0,b=t+n*2,c=0;cg?this.hits.push(h):this.hits.unshift(h),g=e;return this.hits}; diff --git a/examples/scenes/test_scene.js b/examples/scenes/test_scene.js index af8a4fdee3..ec588ba68e 100644 --- a/examples/scenes/test_scene.js +++ b/examples/scenes/test_scene.js @@ -186,22 +186,20 @@ var scene = { "cylinder": { "type" : "cylinder", - "numSegs" : 32, "topRad" : 5, "botRad" : 5, "height" : 50, - "topOffset": 0, - "botOffset": 0 + "radSegs" : 32, + "heightSegs": 1 }, "cone": { "type" : "cylinder", - "numSegs" : 32, "topRad" : 0, "botRad" : 5, "height" : 50, - "topOffset": 0, - "botOffset": 0 + "radSegs" : 32, + "heightSegs" : 1 }, "WaltHead": { diff --git a/examples/webgl_geometries.html b/examples/webgl_geometries.html index 1b3c898d93..5a2e0b6f35 100644 --- a/examples/webgl_geometries.html +++ b/examples/webgl_geometries.html @@ -66,7 +66,7 @@ scene.add( object ); - objects[ 1 ] = object = new THREE.Mesh( new THREE.CylinderGeometry( 50, 100, 40, 5, 25, 75 ), material ); + objects[ 1 ] = object = new THREE.Mesh( new THREE.CylinderGeometry( 25, 75, 100, 40, 5 ), material ); object.position.z = 200; scene.add( object ); diff --git a/src/extras/geometries/CylinderGeometry.js b/src/extras/geometries/CylinderGeometry.js index a7db42a349..faa993b18c 100644 --- a/src/extras/geometries/CylinderGeometry.js +++ b/src/extras/geometries/CylinderGeometry.js @@ -2,13 +2,12 @@ * @author mr.doob / http://mrdoob.com/ */ -THREE.CylinderGeometry = function ( radius, height, segmentsRadius, segmentsHeight, radiusTop, radiusBottom ) { +THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRadius, segmentsHeight ) { THREE.Geometry.call( this ); - var radius = radius || 20; - var radiusTop = radiusTop != null ? radiusTop : radius; - var radiusBottom = radiusBottom != null ? radiusBottom : radius; + var radiusTop = radiusTop != null ? radiusTop : 20; + var radiusBottom = radiusBottom != null ? radiusBottom : 20; var height = height || 100; var heightHalf = height / 2; var segmentsX = segmentsRadius || 8; diff --git a/src/extras/loaders/SceneLoader.js b/src/extras/loaders/SceneLoader.js index 4beba64580..32195f24f6 100644 --- a/src/extras/loaders/SceneLoader.js +++ b/src/extras/loaders/SceneLoader.js @@ -502,7 +502,7 @@ THREE.SceneLoader.prototype = { } else if ( g.type == "cylinder" ) { - geometry = new THREE.CylinderGeometry( g.topRad, g.height, g.numSegs, 1, g.topRad, g.botRad ); + geometry = new THREE.CylinderGeometry( g.topRad, g.botRad, g.height, g.radSegs, g.heightSegs ); result.geometries[ dg ] = geometry; } else if ( g.type == "torus" ) { diff --git a/src/extras/objects/Trident.js b/src/extras/objects/Trident.js index 6f985249cd..f262326071 100644 --- a/src/extras/objects/Trident.js +++ b/src/extras/objects/Trident.js @@ -11,7 +11,7 @@ THREE.Trident = function () { lineGeometry.vertices.push( new THREE.Vertex() ); lineGeometry.vertices.push( new THREE.Vertex( new THREE.Vector3( 0, 100, 0 ) ) ); - var coneGeometry = new THREE.CylinderGeometry( 5, 25, 5, 1, 0, 5 ); + var coneGeometry = new THREE.CylinderGeometry( 0, 5, 25, 5, 1 ); // x -- GitLab