From 98629744d358d84f6336d08fb00b25e3c56f3b98 Mon Sep 17 00:00:00 2001 From: zz85 Date: Tue, 4 Oct 2011 23:16:22 +0800 Subject: [PATCH] option to honor old vertex colors with subdivisionModifier.useOldVertexColors = true --- build/Three.js | 926 ++++++++++---------- examples/canvas_geometry_subdivison.html | 8 +- src/extras/modifiers/SubdivisionModifier.js | 35 +- 3 files changed, 484 insertions(+), 485 deletions(-) diff --git a/build/Three.js b/build/Three.js index e86f8d17..66b0f526 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,m,k;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),m=b*6-f,b=e*(1-c),k=e*(1-c*m),c=e*(1-c*(1-m)),f){case 1:this.r=k;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=k;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r= +THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,h,k;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),h=b*6-f,b=e*(1-c),k=e*(1-c*h),c=e*(1-c*(1-h)),f){case 1:this.r=k;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=k;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r= e;this.g=b;this.b=k;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this}, @@ -15,85 +15,85 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,e,f){this.x= c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())}, normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,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 m,k,h,n,o,t,w,v,x,u,z=b.geometry,y=z.vertices,A=[],f=0;for(m=z.faces.length;f0:v<0)))if(v=w.dot((new THREE.Vector3).sub(h,x))/v,x=x.addSelf(u.multiplyScalar(v)),k instanceof THREE.Face3)e(x,h,n,o)&&(k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},A.push(k));else if(k instanceof THREE.Face4&&(e(x,h,n,t)||e(x,n,o,t)))k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},A.push(k);A.sort(function(b,e){return b.distance-e.distance});return A}else return[]}}; -THREE.Rectangle=function(){function b(){k=f-c;h=m-e}var c,e,f,m,k,h,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return m};this.set=function(k,h,w,v){n=!1;c=k;e=h;f=w;m=v;b()};this.addPoint=function(k,h){n?(n=!1,c=k,e=h,f=k,m=h):(c=ck?f:k,m=m>h?m:h);b()};this.add3Points= -function(k,h,w,v,x,u){n?(n=!1,c=kw?k>x?k:x:w>x?w:x,m=h>v?h>u?h:u:v>u?v:u):(c=kw?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,m=h>v?h>u?h>m?h:m:u>m?u:m:v>u?v>m?v:m:u>m?u:m);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),m=k.getBottom()):(c=ck.getRight()?f:k.getRight(),m=m> -k.getBottom()?m:k.getBottom());b()};this.inflate=function(k){c-=k;e-=k;f+=k;m+=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(m,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){n=!0;m=f=e=c=0;b()};this.isEmpty=function(){return n}};THREE.Matrix3=function(){this.m=[]}; +c=c.clone().subSelf(e),h=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(h),k=c.dot(c),c=c.dot(h),h=1/(b*k-e*e),k=(k*f-e*c)*h,b=(b*c-e*f)*h;return k>0&&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,k,m,n,t,v,w,u,x,p,y=b.geometry,A=y.vertices,z=[],f=0;for(h=y.faces.length;f0:u<0)))if(u=w.dot((new THREE.Vector3).sub(m,x))/u,x=x.addSelf(p.multiplyScalar(u)),k instanceof THREE.Face3)e(x,m,n,t)&&(k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},z.push(k));else if(k instanceof THREE.Face4&&(e(x,m,n,v)||e(x,n,t,v)))k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},z.push(k);z.sort(function(b,e){return b.distance-e.distance});return z}else return[]}}; +THREE.Rectangle=function(){function b(){k=f-c;m=h-e}var c,e,f,h,k,m,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return m};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,w,u){n=!1;c=k;e=m;f=w;h=u;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,w,u,x,p){n?(n=!1,c=kw?k>x?k:x:w>x?w:x,h=m>u?m>p?m:p:u>p?u:p):(c=kw?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,h=m>u?m>p?m>h?m:h:p>h?p:h:u>p?u>h?u:h:p>h?p: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,m,k,h,n,o,t,w,v,x,u,z,y){this.set(b!==void 0?b:1,c||0,e||0,f||0,m||0,k!==void 0?k:1,h||0,n||0,o||0,t||0,w!==void 0?w:1,v||0,x||0,u||0,z||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,m,k,h,n,o,t,w,v,x,u,z,y){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=m;this.n22=k;this.n23=h;this.n24=n;this.n31=o;this.n32=t;this.n33=w;this.n34=v;this.n41=x;this.n42=u;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,m=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());m.cross(k,f).normalize();this.n11=f.x;this.n12=m.x;this.n13=k.x;this.n21=f.y;this.n22=m.y;this.n23=k.y;this.n31=f.z;this.n32=m.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,m=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)*m; -b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*m;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*m;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,m=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*m;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*m;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*m;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*m;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,m=b.n13,k=b.n14,h=b.n21,n=b.n22,o=b.n23,t=b.n24,w=b.n31,v=b.n32,x=b.n33,u=b.n34,z=b.n41,y=b.n42,A=b.n43,C=b.n44,E=c.n11,D=c.n12, -G=c.n13,I=c.n14,M=c.n21,H=c.n22,B=c.n23,L=c.n24,P=c.n31,K=c.n32,Q=c.n33,R=c.n34,$=c.n41,X=c.n42,p=c.n43,da=c.n44;this.n11=e*E+f*M+m*P+k*$;this.n12=e*D+f*H+m*K+k*X;this.n13=e*G+f*B+m*Q+k*p;this.n14=e*I+f*L+m*R+k*da;this.n21=h*E+n*M+o*P+t*$;this.n22=h*D+n*H+o*K+t*X;this.n23=h*G+n*B+o*Q+t*p;this.n24=h*I+n*L+o*R+t*da;this.n31=w*E+v*M+x*P+u*$;this.n32=w*D+v*H+x*K+u*X;this.n33=w*G+v*B+x*Q+u*p;this.n34=w*I+v*L+x*R+u*da;this.n41=z*E+y*M+A*P+C*$;this.n42=z*D+y*H+A*K+C*X;this.n43=z*G+y*B+A*Q+C*p;this.n44=z* -I+y*L+A*R+C*da;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,m=this.n21,k=this.n22,h=this.n23,n=this.n24,o=this.n31,t=this.n32,w=this.n33,v=this.n34,x=this.n41,u=this.n42,z=this.n43,y=this.n44;return f*h*t*x-e*n*t*x-f*k*w*x+c*n*w*x+e*k*v*x-c*h*v*x-f*h*o*u+e*n*o*u+f*m*w*u-b*n*w*u-e*m*v*u+b*h*v*u+f*k*o*z-c*n*o*z-f*m*t*z+b*n*t*z+c*m*v*z-b*k*v*z-e*k*o*y+c*h*o*y+e*m*t*y-b*h*t*y-c*m* -w*y+b*k*w*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= +THREE.Matrix4=function(b,c,e,f,h,k,m,n,t,v,w,u,x,p,y,A){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,t||0,v||0,w!==void 0?w:1,u||0,x||0,p||0,y||0,A!==void 0?A:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,t,v,w,u,x,p,y,A){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=t;this.n32=v;this.n33=w;this.n34=u;this.n41=x;this.n42=p;this.n43=y;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, +c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h; +b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+ +e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,A=b.n42,z=b.n43,E=b.n44,F=c.n11,D=c.n12, +H=c.n13,N=c.n14,O=c.n21,K=c.n22,G=c.n23,B=c.n24,da=c.n31,J=c.n32,R=c.n33,S=c.n34,Y=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*F+f*O+h*da+k*Y;this.n12=e*D+f*K+h*J+k*W;this.n13=e*H+f*G+h*R+k*o;this.n14=e*N+f*B+h*S+k*ea;this.n21=m*F+n*O+t*da+v*Y;this.n22=m*D+n*K+t*J+v*W;this.n23=m*H+n*G+t*R+v*o;this.n24=m*N+n*B+t*S+v*ea;this.n31=w*F+u*O+x*da+p*Y;this.n32=w*D+u*K+x*J+p*W;this.n33=w*H+u*G+x*R+p*o;this.n34=w*N+u*B+x*S+p*ea;this.n41=y*F+A*O+z*da+E*Y;this.n42=y*D+A*K+z*J+E*W;this.n43=y*H+A*G+z*R+E*o;this.n44= +y*N+A*B+z*S+E*ea;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*= +b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,m=this.n23,n=this.n24,t=this.n31,v=this.n32,w=this.n33,u=this.n34,x=this.n41,p=this.n42,y=this.n43,A=this.n44;return f*m*v*x-e*n*v*x-f*k*w*x+c*n*w*x+e*k*u*x-c*m*u*x-f*m*t*p+e*n*t*p+f*h*w*p-b*n*w*p-e*h*u*p+b*m*u*p+f*k*t*y-c*n*t*y-f*h*v*y+b*n*v*y+c*h*u*y-b*k*u*y-e*k*t*A+c*m*t*A+e*h*v*A-b*m*v*A-c*h* +w*A+b*k*w*A},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),m=1-e,k=b.x,h=b.y,n=b.z,o=m*k,t=m*h;this.set(o*k+e,o*h-f*n,o*n+f*h,0,o*h+f*n,t*h+e,t*n-f*k,0,o*n-f*h,t*n+f*k,m*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,m=b.z,k=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),n=Math.cos(m),m=Math.sin(m);switch(c){case "YXZ":var o= -h*n,t=h*m,w=f*n,v=f*m;this.n11=o+v*e;this.n12=w*e-t;this.n13=k*f;this.n21=k*m;this.n22=k*n;this.n23=-e;this.n31=t*e-w;this.n32=v+o*e;this.n33=k*h;break;case "ZXY":o=h*n;t=h*m;w=f*n;v=f*m;this.n11=o-v*e;this.n12=-k*m;this.n13=w+t*e;this.n21=t+w*e;this.n22=k*n;this.n23=v-o*e;this.n31=-k*f;this.n32=e;this.n33=k*h;break;case "ZYX":o=k*n;t=k*m;w=e*n;v=e*m;this.n11=h*n;this.n12=w*f-t;this.n13=o*f+v;this.n21=h*m;this.n22=v*f+o;this.n23=t*f-w;this.n31=-f;this.n32=e*h;this.n33=k*h;break;case "YZX":o=k*h;t= -k*f;w=e*h;v=e*f;this.n11=h*n;this.n12=v-o*m;this.n13=w*m+t;this.n21=m;this.n22=k*n;this.n23=-e*n;this.n31=-f*n;this.n32=t*m+w;this.n33=o-v*m;break;case "XZY":o=k*h;t=k*f;w=e*h;v=e*f;this.n11=h*n;this.n12=-m;this.n13=f*n;this.n21=o*m+v;this.n22=k*n;this.n23=t*m-w;this.n31=w*m-t;this.n32=e*n;this.n33=v*m+o;break;default:o=k*n,t=k*m,w=e*n,v=e*m,this.n11=h*n,this.n12=-h*m,this.n13=f,this.n21=t+w*f,this.n22=o-v*f,this.n23=-e*h,this.n31=v-o*f,this.n32=w+t*f,this.n33=k*h}return this},setRotationFromQuaternion:function(b){var c= -b.x,e=b.y,f=b.z,m=b.w,k=c+c,h=e+e,n=f+f,b=c*k,o=c*h;c*=n;var t=e*h;e*=n;f*=n;k*=m;h*=m;m*=n;this.n11=1-(t+f);this.n12=o-m;this.n13=c+h;this.n21=o+m;this.n22=1-(b+f);this.n23=e-k;this.n31=c-h;this.n32=e+k;this.n33=1-(b+t);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,m=THREE.Matrix4.__m2; -f.identity();f.setRotationFromQuaternion(c);m.setScale(e.x,e.y,e.z);this.multiply(f,m);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,m=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);m.set(this.n12,this.n22,this.n32);k.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); -e.y=m.length();e.z=k.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,m=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*m;this.n23= -b.n23*m;this.n33=b.n33*m}}; -THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,m=b.n13,k=b.n14,h=b.n21,n=b.n22,o=b.n23,t=b.n24,w=b.n31,v=b.n32,x=b.n33,u=b.n34,z=b.n41,y=b.n42,A=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*u*y-t*x*y+t*v*A-n*u*A-o*v*C+n*x*C;c.n12=k*x*y-m*u*y-k*v*A+f*u*A+m*v*C-f*x*C;c.n13=m*t*y-k*o*y+k*n*A-f*t*A-m*n*C+f*o*C;c.n14=k*o*v-m*t*v-k*n*x+f*t*x+m*n*u-f*o*u;c.n21=t*x*z-o*u*z-t*w*A+h*u*A+o*w*C-h*x*C;c.n22=m*u*z-k*x*z+k*w*A-e*u*A-m*w*C+e*x*C;c.n23=k*o*z-m*t*z-k*h*A+e*t*A+m*h*C-e*o*C;c.n24= -m*t*w-k*o*w+k*h*x-e*t*x-m*h*u+e*o*u;c.n31=n*u*z-t*v*z+t*w*y-h*u*y-n*w*C+h*v*C;c.n32=k*v*z-f*u*z-k*w*y+e*u*y+f*w*C-e*v*C;c.n33=m*t*z-k*n*z+k*h*y-e*t*y-f*h*C+e*n*C;c.n34=k*n*w-f*t*w-k*h*v+e*t*v+f*h*u-e*n*u;c.n41=o*v*z-n*x*z-o*w*y+h*x*y+n*w*A-h*v*A;c.n42=f*x*z-m*v*z+m*w*y-e*x*y-f*w*A+e*v*A;c.n43=m*n*z-f*o*z-m*h*y+e*o*y+f*h*A-e*n*A;c.n44=f*o*w-m*n*w+m*h*v-e*o*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,m=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,w=-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*t;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*m;e[2]=b*k;e[3]=b*h;e[4]=b*n;e[5]=b*o;e[6]=b*t;e[7]=b*w;e[8]=b*v;return c}; -THREE.Matrix4.makeFrustum=function(b,c,e,f,m,k){var h;h=new THREE.Matrix4;h.n11=2*m/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*m/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(k+m)/(k-m);h.n34=-2*k*m/(k-m);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var m,b=e*Math.tan(b*Math.PI/360);m=-b;return THREE.Matrix4.makeFrustum(m*c,b*c,m,b,e,f)}; -THREE.Matrix4.makeOrtho=function(b,c,e,f,m,k){var h,n,o,t;h=new THREE.Matrix4;n=c-b;o=e-f;t=k-m;h.n11=2/n;h.n12=0;h.n13=0;h.n14=-((c+b)/n);h.n21=0;h.n22=2/o;h.n23=0;h.n24=-((e+f)/o);h.n31=0;h.n32=0;h.n33=-2/t;h.n34=-((k+m)/t);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; +0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,k=b.x,m=b.y,n=b.z,t=h*k,v=h*m;this.set(t*k+e,t*m-f*n,t*n+f*m,0,t*m+f*n,v*m+e,v*n-f*k,0,t*n-f*m,v*n+f*k,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,k=Math.cos(e),e=Math.sin(e),m=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var t= +m*n,v=m*h,w=f*n,u=f*h;this.n11=t+u*e;this.n12=w*e-v;this.n13=k*f;this.n21=k*h;this.n22=k*n;this.n23=-e;this.n31=v*e-w;this.n32=u+t*e;this.n33=k*m;break;case "ZXY":t=m*n;v=m*h;w=f*n;u=f*h;this.n11=t-u*e;this.n12=-k*h;this.n13=w+v*e;this.n21=v+w*e;this.n22=k*n;this.n23=u-t*e;this.n31=-k*f;this.n32=e;this.n33=k*m;break;case "ZYX":t=k*n;v=k*h;w=e*n;u=e*h;this.n11=m*n;this.n12=w*f-v;this.n13=t*f+u;this.n21=m*h;this.n22=u*f+t;this.n23=v*f-w;this.n31=-f;this.n32=e*m;this.n33=k*m;break;case "YZX":t=k*m;v= +k*f;w=e*m;u=e*f;this.n11=m*n;this.n12=u-t*h;this.n13=w*h+v;this.n21=h;this.n22=k*n;this.n23=-e*n;this.n31=-f*n;this.n32=v*h+w;this.n33=t-u*h;break;case "XZY":t=k*m;v=k*f;w=e*m;u=e*f;this.n11=m*n;this.n12=-h;this.n13=f*n;this.n21=t*h+u;this.n22=k*n;this.n23=v*h-w;this.n31=w*h-v;this.n32=e*n;this.n33=u*h+t;break;default:t=k*n,v=k*h,w=e*n,u=e*h,this.n11=m*n,this.n12=-m*h,this.n13=f,this.n21=v+w*f,this.n22=t-u*f,this.n23=-e*m,this.n31=u-t*f,this.n32=w+v*f,this.n33=k*m}return this},setRotationFromQuaternion:function(b){var c= +b.x,e=b.y,f=b.z,h=b.w,k=c+c,m=e+e,n=f+f,b=c*k,t=c*m;c*=n;var v=e*m;e*=n;f*=n;k*=h;m*=h;h*=n;this.n11=1-(v+f);this.n12=t-h;this.n13=c+m;this.n21=t+h;this.n22=1-(b+f);this.n23=e-k;this.n31=c-m;this.n32=e+k;this.n33=1-(b+v);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2; +f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);k.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); +e.y=h.length();e.z=k.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23= +b.n23*h;this.n33=b.n33*h}}; +THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,A=b.n42,z=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*p*A-v*x*A+v*u*z-n*p*z-t*u*E+n*x*E;c.n12=k*x*A-h*p*A-k*u*z+f*p*z+h*u*E-f*x*E;c.n13=h*v*A-k*t*A+k*n*z-f*v*z-h*n*E+f*t*E;c.n14=k*t*u-h*v*u-k*n*x+f*v*x+h*n*p-f*t*p;c.n21=v*x*y-t*p*y-v*w*z+m*p*z+t*w*E-m*x*E;c.n22=h*p*y-k*x*y+k*w*z-e*p*z-h*w*E+e*x*E;c.n23=k*t*y-h*v*y-k*m*z+e*v*z+h*m*E-e*t*E;c.n24= +h*v*w-k*t*w+k*m*x-e*v*x-h*m*p+e*t*p;c.n31=n*p*y-v*u*y+v*w*A-m*p*A-n*w*E+m*u*E;c.n32=k*u*y-f*p*y-k*w*A+e*p*A+f*w*E-e*u*E;c.n33=h*v*y-k*n*y+k*m*A-e*v*A-f*m*E+e*n*E;c.n34=k*n*w-f*v*w-k*m*u+e*v*u+f*m*p-e*n*p;c.n41=t*u*y-n*x*y-t*w*A+m*x*A+n*w*z-m*u*z;c.n42=f*x*y-h*u*y+h*w*A-e*x*A-f*w*z+e*u*z;c.n43=h*n*y-f*t*y-h*m*A+e*t*A+f*m*z-e*n*z;c.n44=f*t*w-h*n*w+h*m*u-e*t*u-f*m*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,k=b.n32*b.n21-b.n31*b.n22,m=-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,v=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*m+b.n31*v;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*m;e[4]=b*n;e[5]=b*t;e[6]=b*v;e[7]=b*w;e[8]=b*u;return c}; +THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var m;m=new THREE.Matrix4;m.n11=2*h/(c-b);m.n12=0;m.n13=(c+b)/(c-b);m.n14=0;m.n21=0;m.n22=2*h/(f-e);m.n23=(f+e)/(f-e);m.n24=0;m.n31=0;m.n32=0;m.n33=-(k+h)/(k-h);m.n34=-2*k*h/(k-h);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)}; +THREE.Matrix4.makeOrtho=function(b,c,e,f,h,k){var m,n,t,v;m=new THREE.Matrix4;n=c-b;t=e-f;v=k-h;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((c+b)/n);m.n21=0;m.n22=2/t;m.n23=0;m.n24=-((e+f)/t);m.n31=0;m.n32=0;m.n33=-2/v;m.n34=-((k+h)/v);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};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.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3}; 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,e=this.children.indexOf(b);if(e!==-1){b.parent=void 0;for(this.children.splice(e,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,c){var e,f,m;e=0;for(f=this.children.length;e=0&&m>=0&&h>=0&&n>=0?!0:k<0&&m<0||h<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),h<0?c=Math.max(c,h/(h-n)):n<0&&(f=Math.min(f,h/(h-n))),fp&&h.positionScreen.z0&&H.z<1))ga=D[E]=D[E]||new THREE.RenderableParticle,E++,C=ga,C.x=H.x/H.w,C.y=H.y/H.w,C.z=H.z,C.rotation= -V.rotation.z,C.scale.x=V.scale.x*Math.abs(C.x-(H.x+k.projectionMatrix.n11)/(H.w+k.projectionMatrix.n14)),C.scale.y=V.scale.y*Math.abs(C.y-(H.y+k.projectionMatrix.n22)/(H.w+k.projectionMatrix.n24)),C.materials=V.materials,I.push(C);m&&I.sort(c);return I}};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=Math.PI/360,e=b.x*c,f=b.y*c,m=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-m),m=Math.sin(-m),k=Math.cos(e),e=Math.sin(e),h=b*c,n=f*m;this.w=h*k-n*e;this.x=h*e+n*k;this.y=f*c*k+b*m*e;this.z=b*m*k-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,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=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))),fo&&m.positionScreen.z0&&K.z<1))ga=D[F]=D[F]||new THREE.RenderableParticle,F++,E=ga,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation= +X.rotation.z,E.scale.x=X.scale.x*Math.abs(E.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),E.scale.y=X.scale.y*Math.abs(E.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),E.materials=X.materials,N.push(E);h&&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=Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e); this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c= -this.x,e=this.y,f=this.z,m=this.w,k=b.x,h=b.y,n=b.z,b=b.w;this.x=c*b+m*k+e*n-f*h;this.y=e*b+m*h+f*k-c*n;this.z=f*b+m*n+c*h-e*k;this.w=m*b-c*k-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,m=b.z,k=this.x,h=this.y,n=this.z,o=this.w,t=o*e+h*m-n*f,w=o*f+n*e-k*m,v=o*m+k*f-h*e,e=-k* -e-h*f-n*m;c.x=t*o+e*-k+w*-n-v*-h;c.y=w*o+e*-h+v*-k-t*-n;c.z=v*o+e*-n+t*-h-w*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var m=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(m)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(m),h=Math.sqrt(1-m*m);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;m=Math.sin((1-f)*k)/h;f=Math.sin(f*k)/h;e.w=b.w*m+c.w*f;e.x=b.x*m+c.x*f;e.y=b.y*m+c.y*f;e.z=b.z*m+c.z*f;return e}; -THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,m,k){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=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.Face4=function(b,c,e,f,m,k,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=m instanceof THREE.Vector3?m:new THREE.Vector3;this.vertexNormals=m instanceof Array?m:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; +this.x,e=this.y,f=this.z,h=this.w,k=b.x,m=b.y,n=b.z,b=b.w;this.x=c*b+h*k+e*n-f*m;this.y=e*b+h*m+f*k-c*n;this.z=f*b+h*n+c*m-e*k;this.w=h*b-c*k-e*m-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,k=this.x,m=this.y,n=this.z,t=this.w,v=t*e+m*h-n*f,w=t*f+n*e-k*h,u=t*h+k*f-m*e,e=-k* +e-m*f-n*h;c.x=v*t+e*-k+w*-n-u*-m;c.y=w*t+e*-m+u*-k-v*-n;c.z=u*t+e*-n+v*-m-w*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*k)/m;f=Math.sin(f*k)/m;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; +THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,k){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3}; +THREE.Face4=function(b,c,e,f,h,k,m){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];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.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,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var e=0,f=this.vertices.length;e0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, +e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,k,h,o){n=b.vertices[e].position;t=b.vertices[c].position;v=b.vertices[f].position;w=m[k];u=m[h];x=m[o];p=t.x-n.x;y=v.x-n.x;A=t.y-n.y;z=v.y-n.y;E=t.z-n.z;F=v.z-n.z;D=u.u-w.u;H=x.u-w.u;N=u.v-w.v;O=x.v-w.v;K=1/(D*O-H*N);J.set((O*p-N*y)*K,(O*A-N*z)*K,(O*E-N*F)*K);R.set((D*y-H*p)*K,(D*z-H*A)*K,(D*F-H*E)*K);B[e].addSelf(J);B[c].addSelf(J);B[f].addSelf(J);da[e].addSelf(R); +da[c].addSelf(R);da[f].addSelf(R)}var c,e,f,h,k,m,n,t,v,w,u,x,p,y,A,z,E,F,D,H,N,O,K,G,B=[],da=[],J=new THREE.Vector3,R=new THREE.Vector3,S=new THREE.Vector3,Y=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;cthis.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;t=this.points[e[0]];w=this.points[e[1]]; -v=this.points[e[2]];x=this.points[e[3]];n=h*h;o=h*n;f.x=c(t.x,w.x,v.x,x.x,h,n,o);f.y=c(t.y,w.y,v.y,x.y,h,n,o);f.z=c(t.z,w.z,v.z,x.z,h,n,o);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;bthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;cthis.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;v=this.points[e[0]];w=this.points[e[1]]; +u=this.points[e[2]];x=this.points[e[3]];n=m*m;t=m*n;f.x=c(v.x,w.x,u.x,x.x,m,n,t);f.y=c(v.y,w.y,u.y,x.y,m,n,t);f.z=c(v.z,w.z,u.z,x.z,m,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),m("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b* -255)+","+y+")"),u.fillRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight()))),T.empty())};this.render=function(b,t){function o(b){var e,c,f,k=b.lights;ia.setRGB(0,0,0);ra.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b>1,ya=o.height>>1,h=k.scale.x*v,t=k.scale.y*x,p=h*w,n=t*ya,W.set(b.x-p,b.y-n,b.x+p,b.y+n),O.intersects(W)&&(u.save(),u.translate(b.x,b.y),u.rotate(-k.rotation),u.scale(h,-t),u.translate(-w,-ya),u.drawImage(o,0,0),u.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(p=k.scale.x*v,n=k.scale.y*x,W.set(b.x-p,b.y-n,b.x+p,b.y+n),O.intersects(W)&&(f(h.color.getContextStyle()),m(h.color.getContextStyle()),u.save(),u.translate(b.x,b.y),u.rotate(-k.rotation),u.scale(p,n),h.program(u), -u.restore()))}function y(b,k,m,h){c(h.opacity);e(h.blending);u.beginPath();u.moveTo(b.positionScreen.x,b.positionScreen.y);u.lineTo(k.positionScreen.x,k.positionScreen.y);u.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(G!=b)u.lineWidth=G=b;b=h.linecap;if(I!=b)u.lineCap=I=b;b=h.linejoin;if(M!=b)u.lineJoin=M=b;f(h.color.getContextStyle());u.stroke();W.inflate(h.linewidth*2)}}function z(b,f,h,m,n,v,o,u,x){k.info.render.vertices+=3;k.info.render.faces++;c(u.opacity);e(u.blending); -R=b.positionScreen.x;$=b.positionScreen.y;X=f.positionScreen.x;p=f.positionScreen.y;da=h.positionScreen.x;U=h.positionScreen.y;E(R,$,X,p,da,U);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(qa=o.uvs[0],ab(R,$,X,p,da,U,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[v].u,qa[v].v,u.map));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=t.matrixWorldInverse,oa.copy(o.vertexNormalsWorld[0]),wa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5, -va=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(o.vertexNormalsWorld[1]),Ea=(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(o.vertexNormalsWorld[2]),Ca=(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,ab(R,$,X,p,da,U,wa,va,Ea,Aa,Ca,Fa,u.envMap)}else u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&& -(u.map.mapping instanceof THREE.UVMapping&&(qa=o.uvs[0],ab(R,$,X,p,da,U,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[v].u,qa[v].v,u.map)),e(THREE.SubtractiveBlending)),ka?!u.wireframe&&u.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(fa.r=V.r=ga.r=ia.r,fa.g=V.g=ga.g=ia.g,fa.b=V.b=ga.b=ia.b,w(x,o.v1.positionWorld,o.vertexNormalsWorld[0],fa),w(x,o.v2.positionWorld,o.vertexNormalsWorld[1],V),w(x,o.v3.positionWorld,o.vertexNormalsWorld[2],ga),fa.r=Math.max(0,Math.min(u.color.r*fa.r,1)),fa.g=Math.max(0, -Math.min(u.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(u.color.b*fa.b,1)),V.r=Math.max(0,Math.min(u.color.r*V.r,1)),V.g=Math.max(0,Math.min(u.color.g*V.g,1)),V.b=Math.max(0,Math.min(u.color.b*V.b,1)),ga.r=Math.max(0,Math.min(u.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(u.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(u.color.b*ga.b,1)),la.r=(V.r+ga.r)*0.5,la.g=(V.g+ga.g)*0.5,la.b=(V.b+ga.b)*0.5,ta=Ya(fa,V,ga,la),Va(R,$,X,p,da,U,0,0,1,0,0,1,ta)):(na.r=ia.r,na.g=ia.g,na.b=ia.b,w(x,o.centroidWorld,o.normalWorld, -na),ca.r=Math.max(0,Math.min(u.color.r*na.r,1)),ca.g=Math.max(0,Math.min(u.color.g*na.g,1)),ca.b=Math.max(0,Math.min(u.color.b*na.b,1)),u.wireframe?Na(ca,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(ca)):u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshDepthMaterial)pa=t.near,N=t.far,fa.r=fa.g=fa.b=1-Ra(b.positionScreen.z,pa,N),V.r=V.g=V.b=1-Ra(f.positionScreen.z,pa,N),ga.r=ga.g=ga.b=1-Ra(h.positionScreen.z, -pa,N),la.r=(V.r+ga.r)*0.5,la.g=(V.g+ga.g)*0.5,la.b=(V.b+ga.b)*0.5,ta=Ya(fa,V,ga,la),Va(R,$,X,p,da,U,0,0,1,0,0,1,ta);else if(u instanceof THREE.MeshNormalMaterial)ca.r=Wa(o.normalWorld.x),ca.g=Wa(o.normalWorld.y),ca.b=Wa(o.normalWorld.z),u.wireframe?Na(ca,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(ca)}function C(b,f,h,m,n,v,u,o,x){k.info.render.vertices+=4;k.info.render.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)z(b,f,m,0,1,3,u,o,x),z(n,h,v,1,2,3,u,o,x);else if(R=b.positionScreen.x, -$=b.positionScreen.y,X=f.positionScreen.x,p=f.positionScreen.y,da=h.positionScreen.x,U=h.positionScreen.y,ma=m.positionScreen.x,Z=m.positionScreen.y,ha=n.positionScreen.x,aa=n.positionScreen.y,ja=v.positionScreen.x,ea=v.positionScreen.y,o instanceof THREE.MeshBasicMaterial)D(R,$,X,p,da,U,ma,Z),o.wireframe?Na(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Oa(o.color);else if(o instanceof THREE.MeshLambertMaterial)ka?!o.wireframe&&o.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length== -4?(fa.r=V.r=ga.r=la.r=ia.r,fa.g=V.g=ga.g=la.g=ia.g,fa.b=V.b=ga.b=la.b=ia.b,w(x,u.v1.positionWorld,u.vertexNormalsWorld[0],fa),w(x,u.v2.positionWorld,u.vertexNormalsWorld[1],V),w(x,u.v4.positionWorld,u.vertexNormalsWorld[3],ga),w(x,u.v3.positionWorld,u.vertexNormalsWorld[2],la),fa.r=Math.max(0,Math.min(o.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(o.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(o.color.b*fa.b,1)),V.r=Math.max(0,Math.min(o.color.r*V.r,1)),V.g=Math.max(0,Math.min(o.color.g*V.g,1)),V.b=Math.max(0, -Math.min(o.color.b*V.b,1)),ga.r=Math.max(0,Math.min(o.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(o.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(o.color.b*ga.b,1)),la.r=Math.max(0,Math.min(o.color.r*la.r,1)),la.g=Math.max(0,Math.min(o.color.g*la.g,1)),la.b=Math.max(0,Math.min(o.color.b*la.b,1)),ta=Ya(fa,V,ga,la),E(R,$,X,p,ma,Z),Va(R,$,X,p,ma,Z,0,0,1,0,0,1,ta),E(ha,aa,da,U,ja,ea),Va(ha,aa,da,U,ja,ea,1,0,1,1,0,1,ta)):(na.r=ia.r,na.g=ia.g,na.b=ia.b,w(x,u.centroidWorld,u.normalWorld,na),ca.r=Math.max(0,Math.min(o.color.r* -na.r,1)),ca.g=Math.max(0,Math.min(o.color.g*na.g,1)),ca.b=Math.max(0,Math.min(o.color.b*na.b,1)),D(R,$,X,p,da,U,ma,Z),o.wireframe?Na(ca,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Oa(ca)):(D(R,$,X,p,da,U,ma,Z),o.wireframe?Na(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Oa(o.color));else if(o instanceof THREE.MeshNormalMaterial)ca.r=Wa(u.normalWorld.x),ca.g=Wa(u.normalWorld.y),ca.b=Wa(u.normalWorld.z),D(R,$,X,p,da,U,ma,Z),o.wireframe?Na(ca,o.wireframeLinewidth, -o.wireframeLinecap,o.wireframeLinejoin):Oa(ca);else if(o instanceof THREE.MeshDepthMaterial)pa=t.near,N=t.far,fa.r=fa.g=fa.b=1-Ra(b.positionScreen.z,pa,N),V.r=V.g=V.b=1-Ra(f.positionScreen.z,pa,N),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,pa,N),la.r=la.g=la.b=1-Ra(h.positionScreen.z,pa,N),ta=Ya(fa,V,ga,la),E(R,$,X,p,ma,Z),Va(R,$,X,p,ma,Z,0,0,1,0,0,1,ta),E(ha,aa,da,U,ja,ea),Va(ha,aa,da,U,ja,ea,1,0,1,1,0,1,ta)}function E(b,e,c,f,k,h){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(k,h);u.lineTo(b,e); -u.closePath()}function D(b,e,c,f,k,h,m,p){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(k,h);u.lineTo(m,p);u.lineTo(b,e);u.closePath()}function Na(b,e,c,k){if(G!=e)u.lineWidth=G=e;if(I!=c)u.lineCap=I=c;if(M!=k)u.lineJoin=M=k;f(b.getContextStyle());u.stroke();W.inflate(e*2)}function Oa(b){m(b.getContextStyle());u.fill()}function ab(b,e,c,f,k,h,p,n,o,t,v,w,x){if(x.image.width!=0){if(x.needsUpdate==!0||sa[x.id]==void 0){var ya=x.wrapS==THREE.RepeatWrapping,A=x.wrapT==THREE.RepeatWrapping;sa[x.id]= -u.createPattern(x.image,ya&&A?"repeat":ya&&!A?"repeat-x":!ya&&A?"repeat-y":"no-repeat");x.needsUpdate=!1}m(sa[x.id]);var ya=x.offset.x/x.repeat.x,A=x.offset.y/x.repeat.y,z=(x.image.width-1)*x.repeat.x,x=(x.image.height-1)*x.repeat.y,p=(p+ya)*z,n=(n+A)*x,o=(o+ya)*z,t=(t+A)*x,v=(v+ya)*z,w=(w+A)*x;c-=b;f-=e;k-=b;h-=e;o-=p;t-=n;v-=p;w-=n;ya=1/(o*w-v*t);x=(w*c-t*k)*ya;t=(w*f-t*h)*ya;c=(o*k-v*c)*ya;f=(o*h-v*f)*ya;b=b-x*p-c*n;e=e-t*p-f*n;u.save();u.transform(x,t,c,f,b,e);u.fill();u.restore()}}function Va(b, -e,c,f,k,h,m,p,n,o,t,v,x){var w,ya;w=x.width-1;ya=x.height-1;m*=w;p*=ya;n*=w;o*=ya;t*=w;v*=ya;c-=b;f-=e;k-=b;h-=e;n-=m;o-=p;t-=m;v-=p;ya=1/(n*v-t*o);w=(v*c-o*k)*ya;o=(v*f-o*h)*ya;c=(n*k-t*c)*ya;f=(n*h-t*f)*ya;b=b-w*m-c*p;e=e-o*m-f*p;u.save();u.transform(w,o,c,f,b,e);u.clip();u.drawImage(x,0,0);u.restore()}function Ya(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),o=~~(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]=p<0?0:p>255?255:p;Ba[6]=e<0?0:e>255?255:e;Ba[8]=n<0?0:n>255?255:n;Ba[9]=o<0?0:o>255?255:o;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;Da.putImageData(Ka,0,0);Y.drawImage(Ia,0,0);return Ga}function Ra(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(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 Za,bb,ua,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():u.setTransform(1,0,0,-1,v,x);k.info.render.vertices=0;k.info.render.faces=0;h=n.projectScene(b,t,this.sortElements);(ka=b.lights.length>0)&&o(b);Za=0;for(bb=h.length;Za0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(P.sub(h.position,e.centroidWorld),P.normalize(),m=e.normalWorld.dot(P)*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,h,p,n,t){k.info.render.vertices+=3;k.info.render.faces++;R=f($++); -R.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?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(I.r=M.r,I.g=M.g,I.b=M.b,b(t,p,I),G.r=Math.max(0,Math.min(n.color.r*I.r,1)),G.g=Math.max(0,Math.min(n.color.g*I.g,1)),G.b=Math.max(0,Math.min(n.color.b*I.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(L=1-n.__2near/(n.__farPlusNear- -p.z*n.__farMinusNear),G.setRGB(L,L,L)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(m(p.normalWorld.x),m(p.normalWorld.y),m(p.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);o.appendChild(R)}function e(e,c,h,n,p,t,v){k.info.render.vertices+= -4;k.info.render.faces++;R=f($++);R.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(I.r=M.r,I.g=M.g,I.b=M.b,b(v,p,I),G.r=Math.max(0,Math.min(t.color.r*I.r,1)),G.g=Math.max(0,Math.min(t.color.g*I.g,1)),G.b=Math.max(0,Math.min(t.color.b*I.b,1))): -G.copy(t.color):t instanceof THREE.MeshDepthMaterial?(L=1-t.__2near/(t.__farPlusNear-p.z*t.__farMinusNear),G.setRGB(L,L,L)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(m(p.normalWorld.x),m(p.normalWorld.y),m(p.normalWorld.z));t.wireframe?R.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):R.setAttribute("style","fill: "+G.getContextStyle()+ -"; fill-opacity: "+t.opacity);o.appendChild(R)}function f(b){K[b]==null&&(K[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),p==0&&K[b].setAttribute("shape-rendering","crispEdges"));return K[b]}function m(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,h=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,v,x,u,z,y,A,C=new THREE.Rectangle,E=new THREE.Rectangle,D=!1,G=new THREE.Color(16777215),I=new THREE.Color(16777215),M=new THREE.Color(0), -H=new THREE.Color(0),B=new THREE.Color(0),L,P=new THREE.Vector3,K=[],Q=[],R,$,X,p=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":p=1;break;case "low":p=0}};this.setSize=function(b,e){t=b;w=e;v=t/2;x=w/2;o.setAttribute("viewBox",-v+" "+-x+" "+t+" "+w);o.setAttribute("width",t);o.setAttribute("height",w);C.set(-v,-x,v,x)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])}; -this.render=function(b,f){var m,t,w,G,K,L,I,P;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;h=n.projectScene(b,f,this.sortElements);X=$=0;if(D=b.lights.length>0){I=b.lights;M.setRGB(0,0,0);H.setRGB(0,0,0);B.setRGB(0,0,0);m=0;for(t=I.length;m0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b* +255)+","+A+")"),p.fillRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight()))),U.empty())};this.render=function(b,v){function t(b){var e,c,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b>1,va=t.height>>1,m=k.scale.x*u,v=k.scale.y*x,o=m*w,n=v*va,M.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(M)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-v),p.translate(-w,-va),p.drawImage(t,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,M.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(M)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(o,n),m.program(p), +p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)p.lineWidth=H=b;b=m.linecap;if(N!=b)p.lineCap=N=b;b=m.linejoin;if(O!=b)p.lineJoin=O=b;f(m.color.getContextStyle());p.stroke();M.inflate(m.linewidth*2)}}function A(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=3;k.info.render.faces++;c(p.opacity);e(p.blending); +S=b.positionScreen.x;Y=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;Q=h.positionScreen.y;F(S,Y,W,o,ea,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(S,Y,W,o,ea,Q,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),wa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5, +ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(S,Y,W,o,ea,Q,wa,ta,Ea,Aa,Ca,Fa,p.envMap)}else p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&& +(p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(S,Y,W,o,ea,Q,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map)),e(THREE.SubtractiveBlending)),ua?!p.wireframe&&p.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?($.r=X.r=ga.r=ja.r,$.g=X.g=ga.g=ja.g,$.b=X.b=ga.b=ja.b,w(x,t.v1.positionWorld,t.vertexNormalsWorld[0],$),w(x,t.v2.positionWorld,t.vertexNormalsWorld[1],X),w(x,t.v3.positionWorld,t.vertexNormalsWorld[2],ga),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0, +Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),X.r=Math.max(0,Math.min(p.color.r*X.r,1)),X.g=Math.max(0,Math.min(p.color.g*X.g,1)),X.b=Math.max(0,Math.min(p.color.b*X.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(S,Y,W,o,ea,Q,0,0,1,0,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,t.centroidWorld,t.normalWorld, +ha),ca.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ha.b,1)),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)):p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,P),ga.r=ga.g=ga.b=1-Ra(h.positionScreen.z, +na,P),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(S,Y,W,o,ea,Q,0,0,1,0,0,1,oa);else if(p instanceof THREE.MeshNormalMaterial)ca.r=Wa(t.normalWorld.x),ca.g=Wa(t.normalWorld.y),ca.b=Wa(t.normalWorld.z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)}function E(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=4;k.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,m,0,1,3,t,p,x),A(n,h,u,1,2,3,t,p,x);else if(S=b.positionScreen.x, +Y=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=h.positionScreen.x,Q=h.positionScreen.y,ma=m.positionScreen.x,Z=m.positionScreen.y,ia=n.positionScreen.x,aa=n.positionScreen.y,ka=u.positionScreen.x,fa=u.positionScreen.y,p instanceof THREE.MeshBasicMaterial)D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)ua?!p.wireframe&&p.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length== +4?($.r=X.r=ga.r=la.r=ja.r,$.g=X.g=ga.g=la.g=ja.g,$.b=X.b=ga.b=la.b=ja.b,w(x,t.v1.positionWorld,t.vertexNormalsWorld[0],$),w(x,t.v2.positionWorld,t.vertexNormalsWorld[1],X),w(x,t.v4.positionWorld,t.vertexNormalsWorld[3],ga),w(x,t.v3.positionWorld,t.vertexNormalsWorld[2],la),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),X.r=Math.max(0,Math.min(p.color.r*X.r,1)),X.g=Math.max(0,Math.min(p.color.g*X.g,1)),X.b=Math.max(0,Math.min(p.color.b* +X.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),la.r=Math.max(0,Math.min(p.color.r*la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),oa=Ya($,X,ga,la),F(S,Y,W,o,ma,Z),Va(S,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,Q,ka,fa),Va(ia,aa,ea,Q,ka,fa,1,0,1,1,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,t.centroidWorld,t.normalWorld,ha),ca.r=Math.max(0,Math.min(p.color.r*ha.r, +1)),ca.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ha.b,1)),D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)):(D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color));else if(p instanceof THREE.MeshNormalMaterial)ca.r=Wa(t.normalWorld.x),ca.g=Wa(t.normalWorld.y),ca.b=Wa(t.normalWorld.z),D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap, +p.wireframeLinejoin):Oa(ca);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,P),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,na,P),la.r=la.g=la.b=1-Ra(h.positionScreen.z,na,P),oa=Ya($,X,ga,la),F(S,Y,W,o,ma,Z),Va(S,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,Q,ka,fa),Va(ia,aa,ea,Q,ka,fa,1,0,1,1,0,1,oa)}function F(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e);p.closePath()}function D(b, +e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Na(b,e,c,k){if(H!=e)p.lineWidth=H=e;if(N!=c)p.lineCap=N=c;if(O!=k)p.lineJoin=O=k;f(b.getContextStyle());p.stroke();M.inflate(e*2)}function Oa(b){h(b.getContextStyle());p.fill()}function ab(b,e,c,f,k,m,o,n,u,t,v,w,va){if(va.image.width!=0){if(va.needsUpdate==!0||ra[va.id]==void 0){var x=va.wrapS==THREE.RepeatWrapping,y=va.wrapT==THREE.RepeatWrapping;ra[va.id]=p.createPattern(va.image, +x&&y?"repeat":x&&!y?"repeat-x":!x&&y?"repeat-y":"no-repeat");va.needsUpdate=!1}h(ra[va.id]);var x=va.offset.x/va.repeat.x,y=va.offset.y/va.repeat.y,L=(va.image.width-1)*va.repeat.x,va=(va.image.height-1)*va.repeat.y,o=(o+x)*L,n=(n+y)*va,u=(u+x)*L,t=(t+y)*va,v=(v+x)*L,w=(w+y)*va;c-=b;f-=e;k-=b;m-=e;u-=o;t-=n;v-=o;w-=n;x=1/(u*w-v*t);va=(w*c-t*k)*x;t=(w*f-t*m)*x;c=(u*k-v*c)*x;f=(u*m-v*f)*x;b=b-va*o-c*n;e=e-t*o-f*n;p.save();p.transform(va,t,c,f,b,e);p.fill();p.restore()}}function Va(b,e,c,f,k,m,h,o,n, +u,t,v,va){var w,x;w=va.width-1;x=va.height-1;h*=w;o*=x;n*=w;u*=x;t*=w;v*=x;c-=b;f-=e;k-=b;m-=e;n-=h;u-=o;t-=h;v-=o;x=1/(n*v-t*u);w=(v*c-u*k)*x;u=(v*f-u*m)*x;c=(n*k-t*c)*x;f=(n*m-t*f)*x;b=b-w*h-c*o;e=e-u*h-f*o;p.save();p.transform(w,u,c,f,b,e);p.clip();p.drawImage(va,0,0);p.restore()}function Ya(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),u=~~(f.r*255),t=~~(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]=u<0?0:u>255?255:u;Ba[13]=t<0?0:t>255?255:t;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);V.drawImage(Ia,0,0);return Ga}function Ra(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(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 Za,bb,sa,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():p.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,v,this.sortElements);(ua=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(da.sub(h.position,e.centroidWorld),da.normalize(),m=e.normalWorld.dot(da)*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,m,o,n,p){k.info.render.vertices+=3;k.info.render.faces++;S=f(Y++); +S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(p,o,N),H.r=Math.max(0,Math.min(n.color.r*N.r,1)),H.g=Math.max(0,Math.min(n.color.g*N.g,1)),H.b=Math.max(0,Math.min(n.color.b*N.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(B=1-n.__2near/(n.__farPlusNear- +o.z*n.__farMinusNear),H.setRGB(B,B,B)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?S.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):S.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(S)}function e(e,c,m,n,o,p,u){k.info.render.vertices+= +4;k.info.render.faces++;S=f(Y++);S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?H.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(u,o,N),H.r=Math.max(0,Math.min(p.color.r*N.r,1)),H.g=Math.max(0,Math.min(p.color.g*N.g,1)),H.b=Math.max(0,Math.min(p.color.b*N.b,1))): +H.copy(p.color):p instanceof THREE.MeshDepthMaterial?(B=1-p.__2near/(p.__farPlusNear-o.z*p.__farMinusNear),H.setRGB(B,B,B)):p instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));p.wireframe?S.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):S.setAttribute("style","fill: "+H.getContextStyle()+ +"; fill-opacity: "+p.opacity);t.appendChild(S)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,w,u,x,p,y,A,z,E=new THREE.Rectangle,F=new THREE.Rectangle,D=!1,H=new THREE.Color(16777215),N=new THREE.Color(16777215),O=new THREE.Color(0), +K=new THREE.Color(0),G=new THREE.Color(0),B,da=new THREE.Vector3,J=[],R=[],S,Y,W,o=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){v=b;w=e;u=v/2;x=w/2;t.setAttribute("viewBox",-u+" "+-x+" "+v+" "+w);t.setAttribute("width",v);t.setAttribute("height",w);E.set(-u,-x,u,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])}; +this.render=function(b,f){var h,v,w,H,N,J,B,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=Y=0;if(D=b.lights.length>0){B=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);G.setRGB(0,0,0);h=0;for(v=B.length;h= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\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 )\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,m={};for(c=0;c=0)c&&(p.bindBuffer(p.ARRAY_BUFFER,h.__webglVertexBuffer),p.vertexAttribPointer(b.position,3,p.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(p.bindBuffer(p.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]), -p.vertexAttribPointer(f.position,3,p.FLOAT,!1,0,0)):f.position>=0&&(p.bindBuffer(p.ARRAY_BUFFER,h.__webglVertexBuffer),p.vertexAttribPointer(f.position,3,p.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var o=0,t=m.morphTargetForcedOrder,u=m.morphTargetInfluences;ov&&(x=w,v=u[x]);p.bindBuffer(p.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[x]);p.vertexAttribPointer(f["morphTarget"+o],3,p.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[o]=v;t[x]=1;v=-1;o++}}k.program.uniforms.morphTargetInfluences!==null&&p.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>= -0&&(f=h.__webglCustomAttributes[n],p.bindBuffer(p.ARRAY_BUFFER,f.buffer),p.vertexAttribPointer(b[n],f.size,p.FLOAT,!1,0,0));b.color>=0&&(p.bindBuffer(p.ARRAY_BUFFER,h.__webglColorBuffer),p.vertexAttribPointer(b.color,3,p.FLOAT,!1,0,0));b.normal>=0&&(p.bindBuffer(p.ARRAY_BUFFER,h.__webglNormalBuffer),p.vertexAttribPointer(b.normal,3,p.FLOAT,!1,0,0));b.tangent>=0&&(p.bindBuffer(p.ARRAY_BUFFER,h.__webglTangentBuffer),p.vertexAttribPointer(b.tangent,4,p.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(p.bindBuffer(p.ARRAY_BUFFER, -h.__webglUVBuffer),p.vertexAttribPointer(b.uv,2,p.FLOAT,!1,0,0),p.enableVertexAttribArray(b.uv)):p.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(p.bindBuffer(p.ARRAY_BUFFER,h.__webglUV2Buffer),p.vertexAttribPointer(b.uv2,2,p.FLOAT,!1,0,0),p.enableVertexAttribArray(b.uv2)):p.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(p.bindBuffer(p.ARRAY_BUFFER,h.__webglSkinVertexABuffer),p.vertexAttribPointer(b.skinVertexA,4, -p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),p.vertexAttribPointer(b.skinVertexB,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),p.vertexAttribPointer(b.skinIndex,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),p.vertexAttribPointer(b.skinWeight,4,p.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(k.wireframe?(p.lineWidth(k.wireframeLinewidth),c&&p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),p.drawElements(p.LINES,h.__webglLineCount, -p.UNSIGNED_SHORT,0)):(c&&p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),p.drawElements(p.TRIANGLES,h.__webglFaceCount,p.UNSIGNED_SHORT,0)),X.info.render.calls++,X.info.render.vertices+=h.__webglFaceCount,X.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?p.LINE_STRIP:p.LINES,p.lineWidth(k.linewidth),p.drawArrays(m,0,h.__webglLineCount),X.info.render.calls++):m instanceof THREE.ParticleSystem?(p.drawArrays(p.POINTS,0,h.__webglParticleCount),X.info.render.calls++): -m instanceof THREE.Ribbon&&(p.drawArrays(p.TRIANGLE_STRIP,0,h.__webglVertexCount),X.info.render.calls++)}}function m(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=p.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=p.createBuffer();b.hasPos&&(p.bindBuffer(p.ARRAY_BUFFER,b.__webglVertexBuffer),p.bufferData(p.ARRAY_BUFFER,b.positionArray,p.DYNAMIC_DRAW),p.enableVertexAttribArray(e.attributes.position),p.vertexAttribPointer(e.attributes.position,3,p.FLOAT,!1,0,0));if(b.hasNormal){p.bindBuffer(p.ARRAY_BUFFER, -b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,o,t,u,v,x,w=b.count*3;for(x=0;x=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]), +o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var u=0,p=m.morphTargetForcedOrder,v=m.morphTargetInfluences;ut&&(w=x,t=v[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+u],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[u]=t;p[w]=1;t=-1;u++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>= +0&&(f=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.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),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount, +o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++): +m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}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,u,p,v,t,w,x=b.count*3;for(w=0;w=0;c--)b[c].object==e&&b.splice(c,1)}function I(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(t[p].counter+=1,o=t[p].hash+"_"+t[p].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[], -materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[o].faces.push(h),b.geometryGroups[o].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function M(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(b){if(b!=ca){switch(b){case THREE.AdditiveBlending:p.blendEquation(p.FUNC_ADD);p.blendFunc(p.SRC_ALPHA,p.ONE);break;case THREE.SubtractiveBlending:p.blendEquation(p.FUNC_ADD); -p.blendFunc(p.ZERO,p.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:p.blendEquation(p.FUNC_ADD);p.blendFunc(p.ZERO,p.SRC_COLOR);break;default:p.blendEquationSeparate(p.FUNC_ADD,p.FUNC_ADD),p.blendFuncSeparate(p.SRC_ALPHA,p.ONE_MINUS_SRC_ALPHA,p.ONE,p.ONE_MINUS_SRC_ALPHA)}ca=b}}function B(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(p.texParameteri(b,p.TEXTURE_WRAP_S,$(e.wrapS)),p.texParameteri(b,p.TEXTURE_WRAP_T,$(e.wrapT)),p.texParameteri(b,p.TEXTURE_MAG_FILTER,$(e.magFilter)), -p.texParameteri(b,p.TEXTURE_MIN_FILTER,$(e.minFilter)),p.generateMipmap(b)):(p.texParameteri(b,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(b,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(b,p.TEXTURE_MAG_FILTER,R(e.magFilter)),p.texParameteri(b,p.TEXTURE_MIN_FILTER,R(e.minFilter)))}function L(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=p.createTexture(),X.info.memory.textures++;p.activeTexture(p.TEXTURE0+e);p.bindTexture(p.TEXTURE_2D,b.__webglTexture);b instanceof -THREE.DataTexture?p.texImage2D(p.TEXTURE_2D,0,$(b.format),b.image.width,b.image.height,0,$(b.format),p.UNSIGNED_BYTE,b.image.data):p.texImage2D(p.TEXTURE_2D,0,p.RGBA,p.RGBA,p.UNSIGNED_BYTE,b.image);B(p.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else p.activeTexture(p.TEXTURE0+e),p.bindTexture(p.TEXTURE_2D,b.__webglTexture)}function P(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=p.createRenderbuffer();b.__webglTexture=p.createTexture();if(e){p.bindTexture(p.TEXTURE_CUBE_MAP,b.__webglTexture);B(p.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=p.createFramebuffer(),p.texImage2D(p.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,$(b.format),b.width,b.height,0,$(b.format),$(b.type),null)}else b.__webglFramebuffer=p.createFramebuffer(),p.bindTexture(p.TEXTURE_2D,b.__webglTexture),B(p.TEXTURE_2D,b,b),p.texImage2D(p.TEXTURE_2D,0,$(b.format), -b.width,b.height,0,$(b.format),$(b.type),null);p.bindRenderbuffer(p.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)p.bindFramebuffer(p.FRAMEBUFFER,b.__webglFramebuffer[c]),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else p.bindFramebuffer(p.FRAMEBUFFER,b.__webglFramebuffer),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(p.renderbufferStorage(p.RENDERBUFFER, -p.DEPTH_COMPONENT16,b.width,b.height),p.framebufferRenderbuffer(p.FRAMEBUFFER,p.DEPTH_ATTACHMENT,p.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(p.renderbufferStorage(p.RENDERBUFFER,p.DEPTH_STENCIL,b.width,b.height),p.framebufferRenderbuffer(p.FRAMEBUFFER,p.DEPTH_STENCIL_ATTACHMENT,p.RENDERBUFFER,b.__webglRenderbuffer)):p.renderbufferStorage(p.RENDERBUFFER,p.RGBA4,b.width,b.height);e?p.bindTexture(p.TEXTURE_CUBE_MAP,null):p.bindTexture(p.TEXTURE_2D,null);p.bindRenderbuffer(p.RENDERBUFFER, -null);p.bindFramebuffer(p.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=ta,b=qa,f=pa,h=N);e!=ma&&(p.bindFramebuffer(p.FRAMEBUFFER,e),p.viewport(f,h,c,b),ma=e)}function K(b){b instanceof THREE.WebGLRenderTargetCube?(p.bindTexture(p.TEXTURE_CUBE_MAP,b.__webglTexture),p.generateMipmap(p.TEXTURE_CUBE_MAP),p.bindTexture(p.TEXTURE_CUBE_MAP,null)):(p.bindTexture(p.TEXTURE_2D,b.__webglTexture),p.generateMipmap(p.TEXTURE_2D), -p.bindTexture(p.TEXTURE_2D,null))}function Q(b,e){var c;b=="fragment"?c=p.createShader(p.FRAGMENT_SHADER):b=="vertex"&&(c=p.createShader(p.VERTEX_SHADER));p.shaderSource(c,e);p.compileShader(c);if(!p.getShaderParameter(c,p.COMPILE_STATUS))return console.error(p.getShaderInfoLog(c)),console.error(e),null;return c}function R(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return p.NEAREST;default:return p.LINEAR}}function $(b){switch(b){case THREE.RepeatWrapping:return p.REPEAT; -case THREE.ClampToEdgeWrapping:return p.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return p.MIRRORED_REPEAT;case THREE.NearestFilter:return p.NEAREST;case THREE.NearestMipMapNearestFilter:return p.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return p.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return p.LINEAR;case THREE.LinearMipMapNearestFilter:return p.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return p.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return p.BYTE; -case THREE.UnsignedByteType:return p.UNSIGNED_BYTE;case THREE.ShortType:return p.SHORT;case THREE.UnsignedShortType:return p.UNSIGNED_SHORT;case THREE.IntType:return p.INT;case THREE.UnsignedShortType:return p.UNSIGNED_INT;case THREE.FloatType:return p.FLOAT;case THREE.AlphaFormat:return p.ALPHA;case THREE.RGBFormat:return p.RGB;case THREE.RGBAFormat:return p.RGBA;case THREE.LuminanceFormat:return p.LUMINANCE;case THREE.LuminanceAlphaFormat:return p.LUMINANCE_ALPHA}return 0}var X=this,p,da=[],U=null, -ma=null,Z=-1,ha=null,aa=0,ja=null,ea=null,ca=null,fa=null,V=null,ga=null,la=null,sa=null,pa=0,N=0,ta=0,qa=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],va=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},O=b.canvas!==void 0?b.canvas:document.createElement("canvas"), -T=b.stencil!==void 0?b.stencil:!0,W=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ka=b.antialias!==void 0?b.antialias:!1,na=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ia=b.clearAlpha!==void 0?b.clearAlpha:0,ra=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=O;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=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 xa,oa=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader, -uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(p=O.getContext("experimental-webgl",{antialias:ka,stencil:T,preserveDrawingBuffer:W})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+p.getParameter(p.VERSION)+" | "+p.getParameter(p.VENDOR)+" | "+p.getParameter(p.RENDERER)+" | "+p.getParameter(p.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}p.clearColor(0,0,0,1);p.clearDepth(1);p.clearStencil(0);p.enable(p.DEPTH_TEST);p.depthFunc(p.LEQUAL); -p.frontFace(p.CCW);p.cullFace(p.BACK);p.enable(p.CULL_FACE);p.enable(p.BLEND);p.blendEquation(p.FUNC_ADD);p.blendFunc(p.SRC_ALPHA,p.ONE_MINUS_SRC_ALPHA);p.clearColor(na.r,na.g,na.b,ia);this.context=p;var Ga=p.getParameter(p.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,Y={};Y.vertices=new Float32Array(16);Y.faces=new Uint16Array(6);T=0;Y.vertices[T++]=-1;Y.vertices[T++]=-1;Y.vertices[T++]=0;Y.vertices[T++]=1;Y.vertices[T++]=1;Y.vertices[T++]=-1;Y.vertices[T++]=1;Y.vertices[T++]=1;Y.vertices[T++]=1;Y.vertices[T++]= -1;Y.vertices[T++]=1;Y.vertices[T++]=0;Y.vertices[T++]=-1;Y.vertices[T++]=1;Y.vertices[T++]=0;T=Y.vertices[T++]=0;Y.faces[T++]=0;Y.faces[T++]=1;Y.faces[T++]=2;Y.faces[T++]=0;Y.faces[T++]=2;Y.faces[T++]=3;Y.vertexBuffer=p.createBuffer();Y.elementBuffer=p.createBuffer();p.bindBuffer(p.ARRAY_BUFFER,Y.vertexBuffer);p.bufferData(p.ARRAY_BUFFER,Y.vertices,p.STATIC_DRAW);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);p.bufferData(p.ELEMENT_ARRAY_BUFFER,Y.faces,p.STATIC_DRAW);Y.program=p.createProgram(); -p.attachShader(Y.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));p.attachShader(Y.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));p.linkProgram(Y.program);Y.attributes={};Y.uniforms={};Y.attributes.position=p.getAttribLocation(Y.program,"position");Y.attributes.uv=p.getAttribLocation(Y.program,"uv");Y.uniforms.uvOffset=p.getUniformLocation(Y.program,"uvOffset");Y.uniforms.uvScale=p.getUniformLocation(Y.program,"uvScale");Y.uniforms.rotation=p.getUniformLocation(Y.program,"rotation"); -Y.uniforms.scale=p.getUniformLocation(Y.program,"scale");Y.uniforms.alignment=p.getUniformLocation(Y.program,"alignment");Y.uniforms.color=p.getUniformLocation(Y.program,"color");Y.uniforms.map=p.getUniformLocation(Y.program,"map");Y.uniforms.opacity=p.getUniformLocation(Y.program,"opacity");Y.uniforms.useScreenCoordinates=p.getUniformLocation(Y.program,"useScreenCoordinates");Y.uniforms.affectedByDistance=p.getUniformLocation(Y.program,"affectedByDistance");Y.uniforms.screenPosition=p.getUniformLocation(Y.program, -"screenPosition");Y.uniforms.modelViewMatrix=p.getUniformLocation(Y.program,"modelViewMatrix");Y.uniforms.projectionMatrix=p.getUniformLocation(Y.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,e){O.width=b;O.height=e;this.setViewport(0,0,O.width,O.height)};this.setViewport=function(b,e,c,f){pa=b;N=e;ta=c;qa=f;p.viewport(pa,N,ta,qa)};this.setScissor=function(b,e,c,f){p.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?p.enable(p.SCISSOR_TEST):p.disable(p.SCISSOR_TEST)};this.setClearColorHex= -function(b,e){na.setHex(b);ia=e;p.clearColor(na.r,na.g,na.b,ia)};this.setClearColor=function(b,e){na.copy(b);ia=e;p.clearColor(na.r,na.g,na.b,ia)};this.getClearColor=function(){return na};this.getClearAlpha=function(){return ia};this.clear=function(b,e,c){var f=0;if(b==void 0||b)f|=p.COLOR_BUFFER_BIT;if(e==void 0||e)f|=p.DEPTH_BUFFER_BIT;if(c==void 0||c)f|=p.STENCIL_BUFFER_BIT;p.clear(f)};this.getContext=function(){return p};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];p.deleteBuffer(e.__webglVertexBuffer);p.deleteBuffer(e.__webglNormalBuffer);p.deleteBuffer(e.__webglTangentBuffer);p.deleteBuffer(e.__webglColorBuffer);p.deleteBuffer(e.__webglUVBuffer);p.deleteBuffer(e.__webglUV2Buffer);p.deleteBuffer(e.__webglSkinVertexABuffer);p.deleteBuffer(e.__webglSkinVertexBBuffer);p.deleteBuffer(e.__webglSkinIndicesBuffer); -p.deleteBuffer(e.__webglSkinWeightsBuffer);p.deleteBuffer(e.__webglFaceBuffer);p.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(p[o].counter+=1,u=p[o].hash+"_"+p[o].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[], +materials:n,vertices:0,numMorphTargets:t})),b.geometryGroups[u].faces.push(h),b.geometryGroups[u].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function O(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ca){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)}ca=b}}function G(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Y(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Y(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(e.magFilter)), +o.texParameteri(b,o.TEXTURE_MIN_FILTER,Y(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,S(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,S(e.minFilter)))}function B(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof +THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(b.format),b.image.width,b.image.height,0,Y(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);G(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function da(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);G(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,Y(b.format),b.width,b.height,0,Y(b.format),Y(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),G(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,Y(b.format), +b.width,b.height,0,Y(b.format),Y(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=oa,b=qa,f=na,h=P);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}function J(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 R(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 S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Y(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 W=this,o,ea=[],Q=null, +ma=null,Z=-1,ia=null,aa=0,ka=null,fa=null,ca=null,$=null,X=null,ga=null,la=null,ra=null,na=0,P=0,oa=0,qa=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},L=b.canvas!==void 0?b.canvas:document.createElement("canvas"),U= +b.stencil!==void 0?b.stencil:!0,M=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ua=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ja=b.clearAlpha!==void 0?b.clearAlpha:0,ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=L;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=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 xa,pa=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader, +uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=L.getContext("experimental-webgl",{antialias:ua,stencil:U,preserveDrawingBuffer:M})))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(Ba){console.error(Ba)}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(ha.r,ha.g,ha.b,ja);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);U=0;V.vertices[U++]=-1;V.vertices[U++]=-1;V.vertices[U++]=0;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]= +1;V.vertices[U++]=1;V.vertices[U++]=0;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=0;U=V.vertices[U++]=0;V.faces[U++]=0;V.faces[U++]=1;V.faces[U++]=2;V.faces[U++]=0;V.faces[U++]=2;V.faces[U++]=3;V.vertexBuffer=o.createBuffer();V.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,V.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,V.faces,o.STATIC_DRAW);V.program=o.createProgram(); +o.attachShader(V.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(V.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=o.getAttribLocation(V.program,"position");V.attributes.uv=o.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=o.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=o.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=o.getUniformLocation(V.program,"rotation"); +V.uniforms.scale=o.getUniformLocation(V.program,"scale");V.uniforms.alignment=o.getUniformLocation(V.program,"alignment");V.uniforms.color=o.getUniformLocation(V.program,"color");V.uniforms.map=o.getUniformLocation(V.program,"map");V.uniforms.opacity=o.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=o.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=o.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=o.getUniformLocation(V.program, +"screenPosition");V.uniforms.modelViewMatrix=o.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=o.getUniformLocation(V.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,e){L.width=b;L.height=e;this.setViewport(0,0,L.width,L.height)};this.setViewport=function(b,e,c,f){na=b;P=e;oa=c;qa=f;o.viewport(na,P,oa,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.setClearColorHex= +function(b,e){ha.setHex(b);ja=e;o.clearColor(ha.r,ha.g,ha.b,ja)};this.setClearColor=function(b,e){ha.copy(b);ja=e;o.clearColor(ha.r,ha.g,ha.b,ja)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return ja};this.clear=function(b,e,c){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(e==void 0||e)f|=o.DEPTH_BUFFER_BIT;if(c==void 0||c)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};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&&p.enableVertexAttribArray(w.position);w.color>=0&&p.enableVertexAttribArray(w.color);w.normal>=0&&p.enableVertexAttribArray(w.normal);w.tangent>=0&&p.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(p.enableVertexAttribArray(w.skinVertexA), -p.enableVertexAttribArray(w.skinVertexB),p.enableVertexAttribArray(w.skinIndex),p.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(k in b.attributes)w[k]!==void 0&&w[k]>=0&&p.enableVertexAttribArray(w[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k=0&&(p.enableVertexAttribArray(w[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,e,c,f){P(b); -this.clear(e,c,f)};this.render=function(b,c,v,O){var W,T,E,D,G,I,B,L,pa=b.lights,ka=b.fog;Z=-1;this.shadowMapEnabled&&y(b,c);X.info.render.calls=0;X.info.render.vertices=0;X.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);va.multiply(c.projectionMatrix,c.matrixWorldInverse);t(va);this.initWebGLObjects(b);P(v);(this.autoClear||O)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil); -G=b.__webglObjects.length;for(O=0;O=0;O--)if(W=b.__webglObjects[O],W.render){B=W.object;L=W.buffer;E=W.opaque;k(B);for(W=0;W0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(o*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(o*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(o*4),m.__skinVertexBArray= -new Float32Array(o*4),m.__skinIndexArray=new Float32Array(o*4),m.__skinWeightArray=new Float32Array(o*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(A*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(z=m.numMorphTargets;w=0;k--)f[k]==h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0, -1)}e=0;for(f=b.__webglObjects.length;e0&&(p.bindBuffer(p.ARRAY_BUFFER, -t.__webglColorBuffer),p.bufferData(p.ARRAY_BUFFER,ca,y));Ga&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglNormalBuffer),p.bufferData(p.ARRAY_BUFFER,la,y));Ka&&va.hasTangents&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglTangentBuffer),p.bufferData(p.ARRAY_BUFFER,ha,y));Aa&&ta>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglUVBuffer),p.bufferData(p.ARRAY_BUFFER,xa,y));Aa&&$>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglUV2Buffer),p.bufferData(p.ARRAY_BUFFER,wa,y));Ba&&(p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer), -p.bufferData(p.ELEMENT_ARRAY_BUFFER,ma,y),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,sa,y));S>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexABuffer),p.bufferData(p.ARRAY_BUFFER,aa,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),p.bufferData(p.ARRAY_BUFFER,Z,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),p.bufferData(p.ARRAY_BUFFER,da,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),p.bufferData(p.ARRAY_BUFFER, -ea,y));A&&(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)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h= -k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=p.DYNAMIC_DRAW;n=w=A=A=void 0;v=k.vertices;o=k.colors;u=v.length;t=o.length;z=k.__vertexArray;y=k.__colorArray;O=k.__dirtyColors;if(k.__dirtyVertices){for(A=0;A=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA), +o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k=0&&(o.enableVertexAttribArray(x[L]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,e,c,f){da(b); +this.clear(e,c,f)};this.render=function(b,c,u,L){var M,U,F,D,H,na,B,G,ua=b.lights,N=b.fog;Z=-1;this.shadowMapEnabled&&A(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);v(ta);this.initWebGLObjects(b);da(u);(this.autoClear||L)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil); +H=b.__webglObjects.length;for(L=0;L=0;L--)if(M=b.__webglObjects[L],M.render){B=M.object;G=M.buffer;F=M.opaque;k(B);for(M=0;M0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(u*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(u*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(u*4),m.__skinVertexBArray= +new Float32Array(u*4),m.__skinIndexArray=new Float32Array(u*4),m.__skinWeightArray=new Float32Array(u*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(M*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(L=m.numMorphTargets;w=0;k--)f[k]==h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&H(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0, +1)}e=0;for(f=b.__webglObjects.length;e0&&(o.bindBuffer(o.ARRAY_BUFFER, +p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ca,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,xa,y));Aa&&da>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer), +o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));T>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER, +fa,y));M&&(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)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h= +k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=M=M=void 0;t=k.vertices;u=k.colors;v=t.length;p=u.length;L=k.__vertexArray;y=k.__colorArray;z=k.__dirtyColors;if(k.__dirtyVertices){for(M=0;M1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=k;return c}, +THREE.ColorUtils={adjustHSV:function(b,c,e,f){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,h);h.h=THREE.ColorUtils.clamp(h.h+c,0,1);h.s=THREE.ColorUtils.clamp(h.s+e,0,1);h.v=THREE.ColorUtils.clamp(h.v+f,0,1);b.setHSV(h.h,h.s,h.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,h=b.b,k=Math.max(Math.max(e,f),h),m=Math.min(Math.min(e,f),h);if(m==k)m=e=0;else{var n=k-m,m=n/k,e=e==k?(f-h)/n:f==k?2+(h-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=m;c.v=k;return c}, clamp:function(b,c,e){return be?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(b,c){var e,f,m=b.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,h=b.vertices,n=k.vertices,o=b.faces,t=k.faces,w=b.faceVertexUvs[0],k=k.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var v=0,x=n.length;v1&&(f=1-f,m=1-m);k=1-f-m;h.copy(b);h.multiplyScalar(f);n.copy(c);n.multiplyScalar(m);h.addSelf(n);n.copy(e);n.multiplyScalar(k);h.addSelf(n);return h},randomPointInFace:function(b,c,e){var f,m,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,m=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,m,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;m=c.vertices[b.b].position;k=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,m,c),h=THREE.GeometryUtils.triangleArea(m,k,c),b._area1=e,b._area2=h):(e=THREE.GeometryUtils.triangleArea(f,m,c),h=THREE.GeometryUtils.triangleArea(m,k,c));return THREE.GeometryUtils.random()*(e+h) -b?e(c,h-1):t[h]1&&(f=1-f,h=1-h);k=1-f-h;m.copy(b);m.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);m.addSelf(n);n.copy(e);n.multiplyScalar(k);m.addSelf(n);return m},randomPointInFace:function(b,c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position, +m;e?b._area1&&b._area2?(e=b._area1,m=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=m):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+m) +b?e(c,h-1):v[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),m,k=0;c.push(0);for(m=1;m<=b;m++)e=this.getPoint(m/b),k+=e.distanceTo(f),c.push(k),f=e;return this.cacheArcLengths=c}; -THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,m=e.length,k;k=c?c:b*e[m-1];time=Date.now();for(var h=0,n=m-1,o;h<=n;)if(f=Math.floor(h+(n-h)/2),o=e[f]-k,o<0)h=f+1;else if(o>0)n=f-1;else{n=f;break}f=n;if(e[f]==k)return f/(m-1);h=e[f];return e=(f+(k-h)/(e[f+1]-h))/(m-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),h,k=0;c.push(0);for(h=1;h<=b;h++)e=this.getPoint(h/b),k+=e.distanceTo(f),c.push(k),f=e;return this.cacheArcLengths=c}; +THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,h=e.length,k;k=c?c:b*e[h-1];time=Date.now();for(var m=0,n=h-1,t;m<=n;)if(f=Math.floor(m+(n-m)/2),t=e[f]-k,t<0)m=f+1;else if(t>0)n=f-1;else{n=f;break}f=n;if(e[f]==k)return f/(h-1);m=e[f];return e=(f+(k-m)/(e[f+1]-m))/(h-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)}; THREE.Curve.prototype.getTangent=function(b){var c=b-1.0E-4;b+=1.0E-4;c<0&&(c=0);b>1&&(b=1);var c=this.getPoint(c),b=this.getPoint(b),e=new THREE.Vector2;e.sub(b,c);return e.unit()};THREE.LineCurve=function(b,c){b instanceof THREE.Vector2?(this.v1=b,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(b,c,e,f){this.constructor(new THREE.Vector2(b,c),new THREE.Vector2(e,f))};THREE.LineCurve.prototype=new THREE.Curve; THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(b).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(b){return this.getPoint(b)};THREE.LineCurve.prototype.getTangent=function(){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.normalize();return b}; THREE.QuadraticBezierCurve=function(b,c,e){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),b=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),e=new THREE.Vector2(f[4],f[5]);this.v0=b;this.v1=c;this.v2=e};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,b)};THREE.QuadraticBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,b);c.normalize();return c}; -THREE.CubicBezierCurve=function(b,c,e,f){if(!(c instanceof THREE.Vector2))var m=Array.prototype.slice.call(arguments),b=new THREE.Vector2(m[0],m[1]),c=new THREE.Vector2(m[2],m[3]),e=new THREE.Vector2(m[4],m[5]),f=new THREE.Vector2(m[6],m[7]);this.v0=b;this.v1=c;this.v2=e;this.v3=f};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; +THREE.CubicBezierCurve=function(b,c,e,f){if(!(c instanceof THREE.Vector2))var h=Array.prototype.slice.call(arguments),b=new THREE.Vector2(h[0],h[1]),c=new THREE.Vector2(h[2],h[3]),e=new THREE.Vector2(h[4],h[5]),f=new THREE.Vector2(h[6],h[7]);this.v0=b;this.v1=c;this.v2=e;this.v3=f};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b3(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,b)};THREE.CubicBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,b);c.normalize();return c}; THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve; -THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,m;m=(f.length-1)*b;b=Math.floor(m);m-=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,m);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,m);return c};THREE.ArcCurve=function(b,c,e,f,m,k){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=m;this.aClockwise=k}; +THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,h;h=(f.length-1)*b;b=Math.floor(h);h-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,h);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,h);return c};THREE.ArcCurve=function(b,c,e,f,h,k){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=h;this.aClockwise=k}; THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(b=1-b);b=this.aStartAngle+b*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(b),this.aY+this.aRadius*Math.sin(b))}; -THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentCubicBezier:function(b,c,e,f,m){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*m},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,m){var b=(e-b)*0.5,f=(f-c)*0.5,k=m*m;return(2*c-2*e+b+f)*m*k+(-3*c+3*e-2*b-f)*k+b*m+c}}; +THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentCubicBezier:function(b,c,e,f,h){return-3*c*(1-b)*(1-b)+3*e*(1-b)*(1-b)-6*b*e*(1-b)+6*b*f*(1-b)-3*b*b*f+3*b*b*h},tangentSpline:function(b){return 6*b*b-6*b+(3*b*b-4*b+1)+(-6*b*b+6*b)+(3*b*b-2*b)},interpolate:function(b,c,e,f,h){var b=(e-b)*0.5,f=(f-c)*0.5,k=h*h;return(2*c-2*e+b+f)*h*k+(-3*c+3*e-2*b-f)*k+b*h+c}}; THREE.Curve.create=function(b,c){b.prototype=new THREE.Curve;b.prototype.constructor=b;b.prototype.getPoint=c;return b};THREE.LineCurve3=THREE.Curve.create(function(b,c){this.v1=b;this.v2=c},function(b){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(b);c.addSelf(this.v1);return c}); THREE.QuadraticBezierCurve3=THREE.Curve.create(function(b,c,e){this.v0=b;this.v1=c;this.v2=e},function(b){var c,e;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);e=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);b=THREE.Shape.Utils.b2(b,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,e,b)}); THREE.CubicBezierCurve3=THREE.Curve.create(function(b,c,e,f){this.v0=b;this.v1=c;this.v2=e;this.v3=f},function(b){var c,e;c=THREE.Shape.Utils.b3(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);e=THREE.Shape.Utils.b3(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=THREE.Shape.Utils.b3(b,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,e,b)}); -THREE.SplineCurve3=THREE.Curve.create(function(b){this.points=b},function(b){var c=new THREE.Vector3,e=[],f=this.points,m;m=(f.length-1)*b;b=Math.floor(m);m-=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,m);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,m);c.z=THREE.Curve.Utils.interpolate(f[e[0]].z,f[e[1]].z,f[e[2]].z,f[e[3]].z,m);return c}); +THREE.SplineCurve3=THREE.Curve.create(function(b){this.points=b},function(b){var c=new THREE.Vector3,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);c.z=THREE.Curve.Utils.interpolate(f[e[0]].z,f[e[1]].z,f[e[2]].z,f[e[3]].z,h);return c}); 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=k.x;else if(k.xe)e=k.y;else if(k.yc)c=k.x;else if(k.xe)e=k.y;else if(k.y0?(h=e[e.length-1],u=h.x,z=h.y):(h=this.actions[f-1].args,u=h[h.length-2],z=h[h.length-1]);for(h=1;h<=b;h++)y=h/b,k=THREE.Shape.Utils.b2(y,u,v,n),y=THREE.Shape.Utils.b2(y,z,x, -o),e.push(new THREE.Vector2(k,y));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];o=k[5];v=k[0];x=k[1];t=k[2];w=k[3];e.length>0?(h=e[e.length-1],u=h.x,z=h.y):(h=this.actions[f-1].args,u=h[h.length-2],z=h[h.length-1]);for(h=1;h<=b;h++)y=h/b,k=THREE.Shape.Utils.b3(y,u,v,t,n),y=THREE.Shape.Utils.b3(y,z,x,w,o),e.push(new THREE.Vector2(k,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*k[0].length;h=h.concat(k[0]);k=new THREE.SplineCurve(h); -for(h=1;h<=y;h++)e.push(k.getPointAt(h/y));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;n=k[0];o=k[1];t=k[2];v=k[3];y=k[4];x=!!k[5];w=h[h.length-2];u=h[h.length-1];h.length==0&&(w=u=0);z=y-v;var A=b*2;for(h=1;h<=A;h++)y=h/A,x||(y=1-y),y=v+y*z,k=w+n+t*Math.cos(y),y=u+o+t*Math.sin(y),e.push(new THREE.Vector2(k,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,m,k){var h=this.getPoints(),n,o,t,w,v;n=0;for(o=h.length;n0?(m=e[e.length-1],p=m.x,y=m.y):(m=this.actions[f-1].args,p=m[m.length-2],y=m[m.length-1]);for(m=1;m<=b;m++)A=m/b,k=THREE.Shape.Utils.b2(A,p,u,n),A=THREE.Shape.Utils.b2(A,y,x, +t),e.push(new THREE.Vector2(k,A));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];t=k[5];u=k[0];x=k[1];v=k[2];w=k[3];e.length>0?(m=e[e.length-1],p=m.x,y=m.y):(m=this.actions[f-1].args,p=m[m.length-2],y=m[m.length-1]);for(m=1;m<=b;m++)A=m/b,k=THREE.Shape.Utils.b3(A,p,u,v,n),A=THREE.Shape.Utils.b3(A,y,x,w,t),e.push(new THREE.Vector2(k,A));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];A=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m); +for(m=1;m<=A;m++)e.push(k.getPointAt(m/A));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];t=k[1];v=k[2];u=k[3];A=k[4];x=!!k[5];w=m[m.length-2];p=m[m.length-1];m.length==0&&(w=p=0);y=A-u;var z=b*2;for(m=1;m<=z;m++)A=m/z,x||(A=1-A),A=u+A*y,k=w+n+v*Math.cos(A),A=p+t+v*Math.sin(A),e.push(new THREE.Vector2(k,A))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; +THREE.Path.prototype.nltransform=function(b,c,e,f,h,k){var m=this.getPoints(),n,t,v,w,u;n=0;for(t=m.length;n=0?n-1:e.length-1;k=h-1>=0?h-1:t.length-1;var y=[t[h],e[n],e[m]];v=THREE.FontUtils.Triangulate.area(y);var A=[t[h],t[k],e[n]];x=THREE.FontUtils.Triangulate.area(A);u=n;w=h;n+=1;h+=-1;n< -0&&(n+=e.length);n%=e.length;h<0&&(h+=t.length);h%=t.length;m=n-1>=0?n-1:e.length-1;k=h-1>=0?h-1:t.length-1;y=[t[h],e[n],e[m]];y=THREE.FontUtils.Triangulate.area(y);A=[t[h],t[k],e[n]];A=THREE.FontUtils.Triangulate.area(A);v+x>y+A&&(n=u,h=w,n<0&&(n+=e.length),n%=e.length,h<0&&(h+=t.length),h%=t.length,m=n-1>=0?n-1:e.length-1,k=h-1>=0?h-1:t.length-1);v=e.slice(0,n);x=e.slice(n);u=t.slice(h);w=t.slice(0,h);k=[t[h],t[k],e[n]];z.push([t[h],e[n],e[m]]);z.push(k);e=v.concat(u).concat(w).concat(x)}return{shape:e, -isolatedPts:z,allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,m=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),k,h,n,o,t={};k=0;for(h=f.length;k=0?n-1:e.length-1;k=m-1>=0?m-1:v.length-1;var A=[v[m],e[n],e[h]];u=THREE.FontUtils.Triangulate.area(A);var z=[v[m],v[k],e[n]];x=THREE.FontUtils.Triangulate.area(z);p=n;w=m;n+=1;m+=-1;n< +0&&(n+=e.length);n%=e.length;m<0&&(m+=v.length);m%=v.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:v.length-1;A=[v[m],e[n],e[h]];A=THREE.FontUtils.Triangulate.area(A);z=[v[m],v[k],e[n]];z=THREE.FontUtils.Triangulate.area(z);u+x>A+z&&(n=p,m=w,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=v.length),m%=v.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:v.length-1);u=e.slice(0,n);x=e.slice(n);p=v.slice(m);w=v.slice(0,m);k=[v[m],v[k],e[n]];y.push([v[m],e[n],e[h]]);y.push(k);e=u.concat(p).concat(w).concat(x)}return{shape:e, +isolatedPts:y,allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),k,m,n,t,v={};k=0;for(m=f.length;k1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=m[0]+(k[0]-m[0])*f,e.y=m[1]+(k[1]-m[1])*f,e.z=m[2]+(k[2]-m[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",u,h.index-1).pos,this.points[1]=m,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",u,n.index+1).pos,f=f*0.33+0.33,m=this.interpolateCatmullRom(this.points,f),e.x=m[0],e.y=m[1],e.z=m[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(m,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=m[0]+(k[0]-m[0])*f,e.y=m[1]+(k[1]-m[1])*f,e.z=m[2]+(k[2]-m[2])*f}}if(this.JITCompile&&w[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;ub.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];n=b[e[1]];o=b[e[2]];t=b[e[3]];e=m*m;h=m*e;f[0]=this.interpolate(k[0],n[0],o[0],t[0],m,e,h);f[1]=this.interpolate(k[1],n[1],o[1],t[1],m,e,h);f[2]=this.interpolate(k[2],n[2],o[2],t[2],m,e,h);return f}; -THREE.Animation.prototype.interpolate=function(b,c,e,f,m,k,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*k+b*m+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 "+p),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",p,m.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",p,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,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&w[0][v]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;pb.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];n=b[e[1]];t=b[e[2]];v=b[e[3]];e=h*h;m=h*e;f[0]=this.interpolate(k[0],n[0],t[0],v[0],h,e,m);f[1]=this.interpolate(k[1],n[1],t[1],v[1],h,e,m);f[2]=this.interpolate(k[2],n[2],t[2],v[2],h,e,m);return f}; +THREE.Animation.prototype.interpolate=function(b,c,e,f,h,k,m){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*m+(-3*(c-e)-2*b-f)*k+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]}; THREE.CubeCamera=function(b,c,e,f){this.cameraPX=new THREE.Camera(90,1,b,c);this.cameraNX=new THREE.Camera(90,1,b,c);this.cameraPY=new THREE.Camera(90,1,b,c);this.cameraNY=new THREE.Camera(90,1,b,c);this.cameraPZ=new THREE.Camera(90,1,b,c);this.cameraNZ=new THREE.Camera(90,1,b,c);this.cameraPX.useTarget=!0;this.cameraNX.useTarget=!0;this.cameraPY.useTarget=!0;this.cameraNY.useTarget=!0;this.cameraPZ.useTarget=!0;this.cameraNZ.useTarget=!0;this.height=e;this.position=new THREE.Vector3(0,e,0);this.cameraPX.position= this.position;this.cameraNX.position=this.position;this.cameraPY.position=this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPY.up.set(0,0,1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.renderTarget=new THREE.WebGLRenderTargetCube(f,f,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(b){this.position.x=b.x;this.position.z=b.z;this.cameraPX.target.position.add(this.position, @@ -437,228 +437,220 @@ THREE.FirstPersonControls=function(b){function c(b,c){return function(){c.apply( function(b){switch(b.keyCode){case 38:case 87:this.object.moveForward=!0;break;case 37:case 65:this.object.moveLeft=!0;break;case 40:case 83:this.object.moveBackward=!0;break;case 39:case 68:this.object.moveRight=!0;break;case 82:this.object.moveUp=!0;break;case 70:this.object.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.object.moveForward=!1;break;case 37:case 65:this.object.moveLeft=!1;break;case 40:case 83:this.object.moveBackward= !1;break;case 39:case 68:this.object.moveRight=!1;break;case 82:this.object.moveUp=!1;break;case 70:this.object.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.object.position.ythis.heightMax?this.heightMax:this.object.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, -m=this.position;b.x=m.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=m.y+100*Math.cos(this.phi);b.z=m.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&(b=Math.PI/(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)/(Math.PI- -0)+this.verticalMin;b=this.target.position;m=this.position;b.x=m.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=m.y+100*Math.cos(this.phi);b.z=m.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, +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=Math.PI/(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)/(Math.PI- +0)+this.verticalMin;b=this.target.position;h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this, this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)}; -THREE.PathControls=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(),o=m.length,E=0;k=o-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+m;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.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft- -this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};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),o=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(o,h);b.position.set(0, +{srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.domElement=document;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var h=Math.PI*2,k=Math.PI/180;this.update=function(b,e, +c){var f,m;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;f=this.phi%h;this.phi=f>=0?f:f+h;f=this.verticalAngleMap.srcRange;m=this.verticalAngleMap.dstRange;var n=m[1]-m[0];this.phi=TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(m[1]-m[0])/(f[1]-f[0])+m[0]-m[0])/n)*n+m[0];f=this.horizontalAngleMap.srcRange; +m=this.horizontalAngleMap.dstRange;n=m[1]-m[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(m[1]-m[0])/(f[1]-f[0])+m[0]-m[0])/n)*n+m[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.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft- +this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};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}),m=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,m);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.PathCameraIdCounter=0; THREE.FlyControls=function(b){function c(b,c){return function(){c.apply(b,arguments)}}this.object=b;this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;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.domElement!==document&&this.domElement.setAttribute("tabindex",-1);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){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.object.moveForward= -!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),m=c.size[0]/2,k=c.size[1]/2;this.moveState.yawLeft=-(b.pageX-c.offset[0]-m)/m;this.moveState.pitchDown=(b.pageY-c.offset[1]-k)/k;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward= +!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),h=c.size[0]/2,k=c.size[1]/2;this.moveState.yawLeft=-(b.pageX-c.offset[0]-h)/h;this.moveState.pitchDown=(b.pageY-c.offset[1]-k)/k;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward= !1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c, 1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.position);this.object.matrix.setRotationFromQuaternion(this.quaternion);this.object.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);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()}; -THREE.RollControls=function(b){this.object=b;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 c=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,m=new THREE.Matrix4,k=!1,h=1,n=0,o=0,t=0,w=0,v=0,x=window.innerWidth/2,u=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*v));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*o);this.translateY(b*t);k&&(this.roll+=this.rollSpeed*this.delta*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y< -this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);e.set(0,1,0);c.cross(e,f).normalize();e.cross(f,c).normalize();this.matrix.n11=c.x;this.matrix.n12=e.x;this.matrix.n13=f.x;this.matrix.n21=c.y;this.matrix.n22=e.y;this.matrix.n23=f.y;this.matrix.n31=c.z;this.matrix.n32=e.z;this.matrix.n33=f.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m); +THREE.RollControls=function(b){this.object=b;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 c=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,k=!1,m=1,n=0,t=0,v=0,w=0,u=0,x=window.innerWidth/2,p=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*u));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*t);this.translateY(b*v);k&&(this.roll+=this.rollSpeed*this.delta*m);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y< +this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);e.set(0,1,0);c.cross(e,f).normalize();e.cross(f,c).normalize();this.matrix.n11=c.x;this.matrix.n12=e.x;this.matrix.n13=f.x;this.matrix.n21=c.y;this.matrix.n22=e.y;this.matrix.n23=f.y;this.matrix.n31=c.z;this.matrix.n32=e.z;this.matrix.n33=f.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.matrix.multiplySelf(h); this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-= this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){c.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);c.multiplyScalar(b);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(b){e.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);e.multiplyScalar(b);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove", -function(b){w=(b.clientX-x)/window.innerWidth;v=(b.clientY-u)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:o=-1;break; -case 40:case 83:n=-1;break;case 39:case 68:o=1;break;case 81:k=!0;h=1;break;case 69:k=!0;h=-1;break;case 82:t=1;break;case 70:t=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:o=0;break;case 40:case 83:n=0;break;case 39:case 68:o=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:t=0;break;case 70:t=0}},!1)}; +function(b){w=(b.clientX-x)/window.innerWidth;u=(b.clientY-p)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:t=-1;break; +case 40:case 83:n=-1;break;case 39:case 68:t=1;break;case 81:k=!0;m=1;break;case 69:k=!0;m=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:t=0;break;case 40:case 83:n=0;break;case 39:case 68:t=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:v=0;break;case 70:v=0}},!1)}; THREE.TrackballControls=function(b){function c(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=parameters.domElement||document;this.screen=parameters.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=parameters.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=parameters.rotateSpeed||1;this.zoomSpeed=parameters.zoomSpeed||1.2;this.panSpeed=parameters.panSpeed||0.3;this.noZoom=parameters.noZoom||!1;this.noPan= -parameters.noPan||!1;this.staticMoving=parameters.staticMoving||!1;this.dynamicDampingFactor=parameters.dynamicDampingFactor||0.2;this.minDistance=parameters.minDistance||0;this.maxDistance=parameters.maxDistance||Infinity;this.keys=parameters.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,m=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,n=new THREE.Vector2,o=new THREE.Vector2,t=new THREE.Vector2,w=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)}; -this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-e)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);m=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(m).setLength(c.x)); -f.addSelf(m.setLength(c.z));return f};this.rotateCamera=function(){var b=Math.acos(k.dot(h)/k.length()/h.length());if(b){var e=(new THREE.Vector3).cross(k,h).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(m);c.multiplyVector3(this.up);c.multiplyVector3(h);this.staticMoving?k=h:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(k))}};this.zoomCamera=function(){var b=1+(o.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(m.multiplyScalar(b), -this.staticMoving?n=o:n.y+=(o.y-n.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=w.clone().subSelf(t);if(b.lengthSq()){b.multiplyScalar(m.length()*this.panSpeed);var e=m.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?t=w:t.addSelf(b.sub(w,t).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance* -this.maxDistance&&this.position.setLength(this.maxDistance),m.lengthSq()1?c.normalize():c.z=Math.sqrt(1-f*f);h=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(h).setLength(c.x)); +f.addSelf(h.setLength(c.z));return f};this.rotateCamera=function(){var b=Math.acos(k.dot(m)/k.length()/m.length());if(b){var e=(new THREE.Vector3).cross(k,m).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(h);c.multiplyVector3(this.up);c.multiplyVector3(m);this.staticMoving?k=m:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(k))}};this.zoomCamera=function(){var b=1+(t.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b), +this.staticMoving?n=t:n.y+=(t.y-n.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=w.clone().subSelf(v);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var e=h.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?v=w:v.addSelf(b.sub(w,v).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance* +this.maxDistance&&this.position.setLength(this.maxDistance),h.lengthSq()0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,h,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-h,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;nb&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function m(b){for(K=b.length;--K>=0;){ja=K;ea=K-1;ea<0&&(ea=b.length- -1);for(var e=0,c=u+w*2,e=0;e=0;R--){$=R/w;X=o*(1-$);$=t*Math.sin($*Math.PI/2);K=0;for(Q=E.length;Kb&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(J=b.length;--J>=0;){ka=J;fa=J-1;fa<0&&(fa=b.length- +1);for(var e=0,c=p+w*2,e=0;e=0;S--){Y=S/w;W=t*(1-Y);Y=v*Math.sin(Y*Math.PI/2);J=0;for(R=F.length;J0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,n,x)))-1);t.push(w)}c.push(t)}for(var u,z,y,m=c.length,e=0;e0)for(f=0;f1&&(u= -this.vertices[h].position.clone(),z=this.vertices[o].position.clone(),y=this.vertices[t].position.clone(),u.normalize(),z.normalize(),y.normalize(),this.faces.push(new THREE.Face3(h,o,t,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([w,v,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,k=Math.max(3,c||8),m=Math.max(2,e||6),c=[],e=0;e0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,n,x)))-1);v.push(w)}c.push(v)}for(var p,y,A,h=c.length,e=0;e0)for(f=0;f1&&(p= +this.vertices[m].position.clone(),y=this.vertices[t].position.clone(),A=this.vertices[v].position.clone(),p.normalize(),y.normalize(),A.normalize(),this.faces.push(new THREE.Face3(m,t,v,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([w,u,z]))}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,m=String(b).split(""),k=m.length,h=[],b=0;b0)for(t=0;t2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}o=t;m<=o&&(o=0);t=o+1;m<=t&&(t=0);w=t+1;m<=w&&(w=0);var x;a:{x=b;var u=o,z=t,y=w,A=m,C=h,E=void 0,D=void 0,G=void 0, -I=void 0,M=void 0,H=void 0,B=void 0,L=void 0,P=void 0,D=x[C[u]].x,G=x[C[u]].y,I=x[C[z]].x,M=x[C[z]].y,H=x[C[y]].x,B=x[C[y]].y;if(1.0E-10>(I-D)*(B-G)-(M-G)*(H-D))x=!1;else{for(E=0;E=0&&R>=0&&X>=0){x=!1;break a}}x= -!0}}if(x){k.push([b[h[o]],b[h[t]],b[h[w]]]);n.push([h[o],h[t],h[w]]);o=t;for(w=t+1;w0)for(v=0;v2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}t=v;h<=t&&(t=0);v=t+1;h<=v&&(v=0);w=v+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=v,A=w,z=h,E=m,F=void 0,D=void 0,H=void 0, +N=void 0,O=void 0,K=void 0,G=void 0,B=void 0,da=void 0,D=x[E[p]].x,H=x[E[p]].y,N=x[E[y]].x,O=x[E[y]].y,K=x[E[A]].x,G=x[E[A]].y;if(1.0E-10>(N-D)*(G-H)-(O-H)*(K-D))x=!1;else{for(F=0;F=0&&S>=0&&W>=0){x= +!1;break a}}x=!0}}if(x){k.push([b[m[t]],b[m[v]],b[m[w]]]);n.push([m[t],m[v],m[w]]);t=v;for(w=v+1;w>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 m(b,e){var c=w(b,e),f=w(b,e+1),h=w(b,e+2);return(w(b,e+3)<<24)+(h<<16)+(f<<8)+c}function o(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function t(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function v(e){var c, -f,h;c=m(b,e);f=m(b,e+M);h=m(b,e+H);e=o(b,e+B);C.faces.push(new THREE.Face3(c,f,h,null,null,C.materials[e]))}function x(e){var c,f,h,k,p,t;c=m(b,e);f=m(b,e+M);h=m(b,e+H);k=o(b,e+B);p=m(b,e+L);t=m(b,e+P);e=m(b,e+K);k=C.materials[k];var u=G[t*3],v=G[t*3+1];t=G[t*3+2];var w=G[e*3],x=G[e*3+1],e=G[e*3+2];C.faces.push(new THREE.Face3(c,f,h,[new THREE.Vector3(G[p*3],G[p*3+1],G[p*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,e)],null,k))}function u(e){var c,f,h,k;c=m(b,e);f=m(b,e+Q);h=m(b,e+R);k=m(b, -e+$);e=o(b,e+X);C.faces.push(new THREE.Face4(c,f,h,k,null,null,C.materials[e]))}function z(e){var c,f,h,k,t,u,v,w;c=m(b,e);f=m(b,e+Q);h=m(b,e+R);k=m(b,e+$);t=o(b,e+X);u=m(b,e+p);v=m(b,e+da);w=m(b,e+U);e=m(b,e+ma);t=C.materials[t];var x=G[v*3],y=G[v*3+1];v=G[v*3+2];var z=G[w*3],A=G[w*3+1];w=G[w*3+2];var B=G[e*3],D=G[e*3+1],e=G[e*3+2];C.faces.push(new THREE.Face4(c,f,h,k,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,y,v),new THREE.Vector3(z,A,w),new THREE.Vector3(B,D,e)],null,t))} -function y(e){var c,f,h,k;c=m(b,e);f=m(b,e+Z);h=m(b,e+ha);e=I[c*2];k=I[c*2+1];c=I[f*2];var o=C.faceVertexUvs[0];f=I[f*2+1];var p=I[h*2];h=I[h*2+1];var t=[];t.push(new THREE.UV(e,k));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,h));o.push(t)}function A(e){var c,f,h,k,o,p;c=m(b,e);f=m(b,e+aa);h=m(b,e+ja);k=m(b,e+ea);e=I[c*2];o=I[c*2+1];c=I[f*2];p=I[f*2+1];f=I[h*2];var t=C.faceVertexUvs[0];h=I[h*2+1];var u=I[k*2];k=I[k*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,p));v.push(new THREE.UV(f, -h));v.push(new THREE.UV(u,k));t.push(v)}var C=this,E=0,D,G=[],I=[],M,H,B,L,P,K,Q,R,$,X,p,da,U,ma,Z,ha,aa,ja,ea,ca,fa,V,ga,la,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,e);D={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:m(b,E+16),nnormals:m(b,E+16+4),nuvs:m(b, -E+16+8),ntri_flat:m(b,E+16+12),ntri_smooth:m(b,E+16+16),ntri_flat_uv:m(b,E+16+20),ntri_smooth_uv:m(b,E+16+24),nquad_flat:m(b,E+16+28),nquad_smooth:m(b,E+16+32),nquad_flat_uv:m(b,E+16+36),nquad_smooth_uv:m(b,E+16+40)};E+=D.header_bytes;M=D.vertex_index_bytes;H=D.vertex_index_bytes*2;B=D.vertex_index_bytes*3;L=D.vertex_index_bytes*3+D.material_index_bytes;P=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;K=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Q=D.vertex_index_bytes; -R=D.vertex_index_bytes*2;$=D.vertex_index_bytes*3;X=D.vertex_index_bytes*4;p=D.vertex_index_bytes*4+D.material_index_bytes;da=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;U=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ma=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;Z=D.uv_index_bytes;ha=D.uv_index_bytes*2;aa=D.uv_index_bytes;ja=D.uv_index_bytes*2;ea=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;sa=D.vertex_index_bytes* -4+D.material_index_bytes;ca=D.ntri_flat*e;fa=D.ntri_smooth*(e+D.normal_index_bytes*3);V=D.ntri_flat_uv*(e+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);la=D.nquad_flat*sa;e=D.nquad_smooth*(sa+D.normal_index_bytes*4);sa=D.nquad_flat_uv*(sa+D.uv_index_bytes*4);E+=function(e){for(var f,k,m,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e>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,e){var c=w(b,e),f=w(b,e+1),k=w(b,e+2);return(w(b,e+3)<<24)+(k<<16)+(f<<8)+c}function t(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function v(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function u(e){var c, +f,k;c=h(b,e);f=h(b,e+O);k=h(b,e+K);e=t(b,e+G);E.faces.push(new THREE.Face3(c,f,k,null,null,E.materials[e]))}function x(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+O);k=h(b,e+K);m=t(b,e+G);o=h(b,e+B);p=h(b,e+da);e=h(b,e+J);m=E.materials[m];var u=H[p*3],v=H[p*3+1];p=H[p*3+2];var w=H[e*3],x=H[e*3+1],e=H[e*3+2];E.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(u,v,p),new THREE.Vector3(w,x,e)],null,m))}function p(e){var c,f,k,m;c=h(b,e);f=h(b,e+R);k=h(b,e+S);m=h(b, +e+Y);e=t(b,e+W);E.faces.push(new THREE.Face4(c,f,k,m,null,null,E.materials[e]))}function y(e){var c,f,k,m,p,u,v,w;c=h(b,e);f=h(b,e+R);k=h(b,e+S);m=h(b,e+Y);p=t(b,e+W);u=h(b,e+o);v=h(b,e+ea);w=h(b,e+Q);e=h(b,e+ma);p=E.materials[p];var x=H[v*3],L=H[v*3+1];v=H[v*3+2];var y=H[w*3],M=H[w*3+1];w=H[w*3+2];var z=H[e*3],A=H[e*3+1],e=H[e*3+2];E.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(H[u*3],H[u*3+1],H[u*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(y,M,w),new THREE.Vector3(z,A,e)],null,p))} +function A(e){var c,f,k,m;c=h(b,e);f=h(b,e+Z);k=h(b,e+ia);e=N[c*2];m=N[c*2+1];c=N[f*2];var o=E.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function z(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+aa);k=h(b,e+ka);m=h(b,e+fa);e=N[c*2];o=N[c*2+1];c=N[f*2];p=N[f*2+1];f=N[k*2];var t=E.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,p));v.push(new THREE.UV(f, +k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,F=0,D,H=[],N=[],O,K,G,B,da,J,R,S,Y,W,o,ea,Q,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,e);D={signature:b.substr(F,8),header_bytes:w(b,F+8),vertex_coordinate_bytes:w(b,F+9),normal_coordinate_bytes:w(b,F+10),uv_coordinate_bytes:w(b,F+11),vertex_index_bytes:w(b,F+12),normal_index_bytes:w(b,F+13),uv_index_bytes:w(b,F+14),material_index_bytes:w(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b, +F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=D.header_bytes;O=D.vertex_index_bytes;K=D.vertex_index_bytes*2;G=D.vertex_index_bytes*3;B=D.vertex_index_bytes*3+D.material_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;J=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;R=D.vertex_index_bytes; +S=D.vertex_index_bytes*2;Y=D.vertex_index_bytes*3;W=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;Q=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ma=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;Z=D.uv_index_bytes;ia=D.uv_index_bytes*2;aa=D.uv_index_bytes;ka=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes* +4+D.material_index_bytes;ca=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);X=D.ntri_flat_uv*(e+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);la=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);F+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e=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;j1?c[1].substr(0,e):"0";c[1].length1){o=new THREE.MeshFaceMaterial;for(j=0;j1?c[1].substr(0,e):"0";c[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;fe){t=p.output[o];break}m=t!==void 0?t instanceof THREE.Matrix4?m.multiply(m,t):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14, -e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};L.prototype.create=function(){var b= -{},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof B)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=sa[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color= -f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};P.prototype.parse=function(b){for(var e=0;e=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};B.prototype.create=function(){var b= +{},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof G)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ra[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color= +f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};da.prototype.parse=function(b){for(var e=0;e=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e1&&(P=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,P);object.name=u;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;U.scene.add(object);U.objects[u]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),U.scene.collisions.colliders.push(b)); -if(E.castsShadow)b=new THREE.ShadowVolume(M),U.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},U.triggers[object.name]=b)}}else D=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], -s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,U.scene.add(object),U.objects[u]=object,U.empties[u]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},U.triggers[object.name]=b)}function o(b){return function(c){U.geometries[b]=c;n();$-=1;e.onLoadComplete();w()}}function t(b){return function(e){U.geometries[b]=e}}function w(){e.callbackProgress({totalModels:p,totalTextures:da,loadedModels:p-$,loadedTextures:da-X},U);e.onLoadProgress();$==0&&X==0&&c(U)}var v, -x,u,z,y,A,C,E,D,G,I,M,H,B,L,P,K,Q,R,$,X,p,da,U;Q=b.data;L=new THREE.BinaryLoader;R=new THREE.JSONLoader;X=$=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in Q.objects)if(E=Q.objects[u],E.meshCollider){b=!0;break}if(b)U.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;G=Q.transform.rotation;var ma=Q.transform.scale;b&&U.scene.position.set(b[0],b[1],b[2]);G&&U.scene.rotation.set(G[0], -G[1],G[2]);ma&&U.scene.scale.set(ma[0],ma[1],ma[2]);(b||G||ma)&&U.scene.updateMatrix()}b=function(){X-=1;w();e.onLoadComplete()};for(y in Q.cameras){G=Q.cameras[y];if(G.type=="perspective")H=new THREE.Camera(G.fov,G.aspect,G.near,G.far),H.useTarget=!0;else if(G.type=="ortho")H=new THREE.Camera,H.useTarget=!0,H.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);D=G.position;G=G.target;H.position.set(D[0],D[1],D[2]);H.target.position.set(G[0],G[1],G[2]);U.cameras[y]= -H}for(z in Q.lights)y=Q.lights[z],H=y.color!==void 0?y.color:16777215,G=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(D=y.direction,K=new THREE.DirectionalLight(H,G),K.position.set(D[0],D[1],D[2]),K.position.normalize()):y.type=="point"?(D=y.position,d=y.distance,K=new THREE.PointLight(H,G,d),K.position.set(D[0],D[1],D[2])):y.type=="ambient"&&(K=new THREE.AmbientLight(H)),U.scene.add(K),U.lights[z]=K;for(A in Q.fogs)z=Q.fogs[A],z.type=="linear"?B=new THREE.Fog(0,z.near,z.far):z.type== -"exp2"&&(B=new THREE.FogExp2(0,z.density)),G=z.color,B.color.setRGB(G[0],G[1],G[2]),U.fogs[A]=B;if(U.cameras&&Q.defaults.camera)U.currentCamera=U.cameras[Q.defaults.camera];if(U.fogs&&Q.defaults.fog)U.scene.fog=U.fogs[Q.defaults.fog];G=Q.defaults.bgcolor;U.bgColor=new THREE.Color;U.bgColor.setRGB(G[0],G[1],G[2]);U.bgColorAlpha=Q.defaults.bgalpha;for(v in Q.geometries)if(A=Q.geometries[v],A.type=="bin_mesh"||A.type=="ascii_mesh")$+=1,e.onLoadStart();p=$;for(v in Q.geometries)A=Q.geometries[v],A.type== -"cube"?(M=new THREE.CubeGeometry(A.width,A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),U.geometries[v]=M):A.type=="plane"?(M=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),U.geometries[v]=M):A.type=="sphere"?(M=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),U.geometries[v]=M):A.type=="cylinder"?(M=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),U.geometries[v]=M):A.type=="torus"? -(M=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,A.segmentsT),U.geometries[v]=M):A.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(A.subdivisions),U.geometries[v]=M):A.type=="bin_mesh"?L.load({model:f(A.url,Q.urlBaseType),callback:o(v)}):A.type=="ascii_mesh"?R.load({model:f(A.url,Q.urlBaseType),callback:o(v)}):A.type=="embedded_mesh"&&(A=Q.embeds[A.id])&&R.createModel(A,t(v),"");for(C in Q.textures)if(v=Q.textures[C],v.url instanceof Array){X+=v.url.length;for(L=0;L1&&(da=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,da);object.name=p;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;Q.scene.add(object);Q.objects[p]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(b)); +if(F.castsShadow)b=new THREE.ShadowVolume(O),Q.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},Q.triggers[object.name]=b)}}else D=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], +s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,Q.scene.add(object),Q.objects[p]=object,Q.empties[p]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},Q.triggers[object.name]=b)}function t(b){return function(c){Q.geometries[b]=c;n();Y-=1;e.onLoadComplete();w()}}function v(b){return function(e){Q.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-W},Q);e.onLoadProgress();Y==0&&W==0&&c(Q)}var u, +x,p,y,A,z,E,F,D,H,N,O,K,G,B,da,J,R,S,Y,W,o,ea,Q;R=b.data;B=new THREE.BinaryLoader;S=new THREE.JSONLoader;W=Y=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in R.objects)if(F=R.objects[p],F.meshCollider){b=!0;break}if(b)Q.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;H=R.transform.rotation;var ma=R.transform.scale;b&&Q.scene.position.set(b[0],b[1],b[2]);H&&Q.scene.rotation.set(H[0], +H[1],H[2]);ma&&Q.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&Q.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(A in R.cameras){H=R.cameras[A];if(H.type=="perspective")K=new THREE.Camera(H.fov,H.aspect,H.near,H.far),K.useTarget=!0;else if(H.type=="ortho")K=new THREE.Camera,K.useTarget=!0,K.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);D=H.position;H=H.target;K.position.set(D[0],D[1],D[2]);K.target.position.set(H[0],H[1],H[2]);Q.cameras[A]= +K}for(y in R.lights)A=R.lights[y],K=A.color!==void 0?A.color:16777215,H=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(D=A.direction,J=new THREE.DirectionalLight(K,H),J.position.set(D[0],D[1],D[2]),J.position.normalize()):A.type=="point"?(D=A.position,d=A.distance,J=new THREE.PointLight(K,H,d),J.position.set(D[0],D[1],D[2])):A.type=="ambient"&&(J=new THREE.AmbientLight(K)),Q.scene.add(J),Q.lights[y]=J;for(z in R.fogs)y=R.fogs[z],y.type=="linear"?G=new THREE.Fog(0,y.near,y.far):y.type== +"exp2"&&(G=new THREE.FogExp2(0,y.density)),H=y.color,G.color.setRGB(H[0],H[1],H[2]),Q.fogs[z]=G;if(Q.cameras&&R.defaults.camera)Q.currentCamera=Q.cameras[R.defaults.camera];if(Q.fogs&&R.defaults.fog)Q.scene.fog=Q.fogs[R.defaults.fog];H=R.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(H[0],H[1],H[2]);Q.bgColorAlpha=R.defaults.bgalpha;for(u in R.geometries)if(z=R.geometries[u],z.type=="bin_mesh"||z.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(u in R.geometries)z=R.geometries[u],z.type== +"cube"?(O=new THREE.CubeGeometry(z.width,z.height,z.depth,z.segmentsWidth,z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),Q.geometries[u]=O):z.type=="plane"?(O=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),Q.geometries[u]=O):z.type=="sphere"?(O=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),Q.geometries[u]=O):z.type=="cylinder"?(O=new THREE.CylinderGeometry(z.topRad,z.botRad,z.height,z.radSegs,z.heightSegs),Q.geometries[u]=O):z.type=="torus"? +(O=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),Q.geometries[u]=O):z.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(z.subdivisions),Q.geometries[u]=O):z.type=="bin_mesh"?B.load({model:f(z.url,R.urlBaseType),callback:t(u)}):z.type=="ascii_mesh"?S.load({model:f(z.url,R.urlBaseType),callback:t(u)}):z.type=="embedded_mesh"&&(z=R.embeds[z.id])&&S.createModel(z,v(u),"");for(E in R.textures)if(u=R.textures[E],u.url instanceof Array){W+=u.url.length;for(B=0;B=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,m=0;m<8;m++){for(var k=0,h=0;h>1^-(n&1);e[8*h+m]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(m=h=0;m=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,m=0;m>1^-(n&1);e[8*m+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=m=0;h=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&&(o=this.size-1);var x=Math.floor(t-n);x<1&&(x=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var u=Math.floor(w-n);u<1&&(u=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size- -1);for(var z,y,A,C,E,D;v0&&(this.field[A+z]+=C)}}};this.addPlaneX=function(b,c){var m,k,h,n,o,t=this.size,w=this.yd,v=this.zd,x=this.field,u=t*Math.sqrt(b/c);u>t&&(u=t);for(m=0;m0)for(k=0;kw&&(z=w);for(k=0;k0){o=k*v;for(m=0;msize&&(dist=size);for(h=0;h0){o=zd*h;for(k=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&&(t=this.size-1);var x=Math.floor(v-n);x<1&&(x=1);v=Math.floor(v+n);v>this.size-1&&(v=this.size-1);var p=Math.floor(w-n);p<1&&(p=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size- +1);for(var y,A,z,E,F,D;u0&&(this.field[z+y]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,t,v=this.size,w=this.yd,u=this.zd,x=this.field,p=v*Math.sqrt(b/c);p>v&&(p=v);for(h=0;h0)for(k=0;kw&&(y=w);for(k=0;k0){t=k*u;for(h=0;hsize&&(dist=size);for(m=0;m0){t=zd*m;for(k=0;kk?this.hits.push(m):this.hits.unshift(m),k=f;return this.hits}; +THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,h,k=0;c=0;for(e=this.colliders.length;ck?this.hits.push(h):this.hits.unshift(h),k=f;return this.hits}; THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.distc.length)return null;return c[e]}; THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,m,k=0;k=n*m))return Number.MAX_VALUE;h/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(h);n.addSelf(b.origin);Math.abs(k.x)> -Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=n.y-c.y,k=e.y-c.y,m=f.y-c.y,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,k=e.x-c.x,m=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(k.y)>Math.abs(k.z)?(b=n.x-c.x,k=e.x-c.x,m=f.x-c.x,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,k=e.x-c.x,m=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y);c=k*f-e*m;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-n*m)*c;if(!(f>=0))return Number.MAX_VALUE;c*=k*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h}; +THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,k=0;k=n*h))return Number.MAX_VALUE;m/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(m);n.addSelf(b.origin);Math.abs(k.x)> +Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=n.y-c.y,k=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,k=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(k.y)>Math.abs(k.z)?(b=n.x-c.x,k=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,k=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=k*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*=k*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return m}; 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,m=0,k=0,h=0,n=0,o=0,t=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,t=!1,h=1);e.origin.yc.max.y&&(m=c.max.y-e.origin.y,m/=e.direction.y, -t=!1,n=1);e.origin.zc.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,t=!1,o=1);if(t)return-1;t=0;m>f&&(t=1,f=m);k>f&&(t=2,f=k);switch(t){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,o)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE}; +THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,k=0,m=0,n=0,t=0,v=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,v=!1,m=1);e.origin.yc.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y, +v=!1,n=1);e.origin.zc.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,v=!1,t=1);if(v)return-1;v=0;h>f&&(v=1,f=h);k>f&&(v=2,f=k);switch(v){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(m,0,0);break;case 1:m=e.origin.x+e.direction.x*f;if(mc.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:m=e.origin.x+e.direction.x*f;if(mc.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,m=new THREE.Camera,k=new THREE.Camera,h=new THREE.Matrix4,n=new THREE.Matrix4,o,t,w;m.useTarget=k.useTarget=!1;m.matrixAutoUpdate=k.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),u=new THREE.Camera(53,1,1,1E4);u.position.z= -2;_material=new THREE.ShaderMaterial({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.add(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(o!==e.aspect||t!==e.near||w!==e.fov){o=e.aspect;t=e.near;w=e.fov;var C=e.projectionMatrix.clone(),E=125/30*0.5,D=E*t/125,G=t*Math.tan(w*Math.PI/360),I;h.n14=E;n.n14=-E;E=-G*o+D;I=G*o+D;C.n11=2*t/(I-E);C.n13=(I+E)/(I-E);m.projectionMatrix=C.clone();E=-G*o-D;I=G*o-D;C.n11=2*t/(I-E);C.n13= -(I+E)/(I-E);k.projectionMatrix=C.clone()}m.matrix=e.matrixWorld.clone().multiplySelf(n);m.update(null,!0);m.position.copy(e.position);m.near=t;m.far=e.far;f.call(c,b,m,v,!0);k.matrix=e.matrixWorld.clone().multiplySelf(h);k.update(null,!0);k.position.copy(e.position);k.near=t;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,z,u)}}; -if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,m,k,h=new THREE.Camera;h.useTarget=!0;var n=new THREE.Camera;n.useTarget=!0;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;this.setSize=function(b,f){e.call(c,b,f);m=b/2;k=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;h.updateProjectionMatrix();h.position.copy(e.position); -h.target.position.copy(e.target.position);h.translateX(c.separation);n.projectionMatrix=h.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,m,k);f.call(c,b,h);this.setViewport(m,0,m,k);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,h=new THREE.Camera,k=new THREE.Camera,m=new THREE.Matrix4,n=new THREE.Matrix4,t,v,w;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),p=new THREE.Camera(53,1,1,1E4);p.position.z= +2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},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 y=new THREE.Scene;y.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(t!==e.aspect||v!==e.near||w!==e.fov){t=e.aspect;v=e.near;w=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,D=F*v/125,H=v*Math.tan(w*Math.PI/360),N;m.n14=F;n.n14=-F;F=-H*t+D;N=H*t+D;E.n11=2*v/(N-F);E.n13=(N+F)/(N-F);h.projectionMatrix=E.clone();F=-H*t-D;N=H*t-D;E.n11=2*v/(N-F);E.n13= +(N+F)/(N-F);k.projectionMatrix=E.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=v;h.far=e.far;f.call(c,b,h,u,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=v;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,y,p)}}; +if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,k,m=new THREE.Camera;m.useTarget=!0;var n=new THREE.Camera;n.useTarget=!0;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;this.setSize=function(b,f){e.call(c,b,f);h=b/2;k=f};this.render=function(b,e){this.clear();m.fov=e.fov;m.aspect=0.5*e.aspect;m.near=e.near;m.far=e.far;m.updateProjectionMatrix();m.position.copy(e.position); +m.target.position.copy(e.target.position);m.translateX(c.separation);n.projectionMatrix=m.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,k);f.call(c,b,m);this.setViewport(h,0,h,k);f.call(c,b,n,!1)}}; diff --git a/examples/canvas_geometry_subdivison.html b/examples/canvas_geometry_subdivison.html index 503aeeff..6e100b46 100644 --- a/examples/canvas_geometry_subdivison.html +++ b/examples/canvas_geometry_subdivison.html @@ -230,9 +230,9 @@ var meshmaterials = [ - new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } ) - // new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ), - // new THREE.MeshBasicMaterial( { color: 0x405040, wireframe:true, opacity:0.8 } ) + //new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } ) + new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ), + new THREE.MeshBasicMaterial( { color: 0x405040, wireframe:true, opacity:0.8 } ) ]; // new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ), @@ -253,7 +253,7 @@ cube.overdraw = true; scene.add( cube ); - renderer = new THREE.CanvasRenderer(); // WebGLRenderer CanvasRenderer + renderer = new THREE.WebGLRenderer(); // WebGLRenderer CanvasRenderer renderer.setSize( window.innerWidth, window.innerHeight ); container.appendChild( renderer.domElement ); diff --git a/src/extras/modifiers/SubdivisionModifier.js b/src/extras/modifiers/SubdivisionModifier.js index f5c7b293..42be0545 100644 --- a/src/extras/modifiers/SubdivisionModifier.js +++ b/src/extras/modifiers/SubdivisionModifier.js @@ -17,6 +17,10 @@ THREE.SubdivisionModifier = function( subdivisions ) { this.subdivisions = (subdivisions === undefined ) ? 1 : subdivisions; + // Settings + this.useOldVertexColors = false; + this.supportUVs = true; + }; //THREE.SubdivisionModifier.prototype = new THREE.Modifier(); @@ -45,12 +49,17 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) { function v( x, y, z ) { newVertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) ); } + + var scope = this; - function f4( a, b, c, d, color, material ) { + function f4( a, b, c, d, oldFace ) { - newFaces.push( new THREE.Face4( a, b, c, d, null, color, material) ); + var newFace = new THREE.Face4( a, b, c, d, null, oldFace.color, oldFace.material ); + if (scope.useOldVertexColors) newFace.vertexColors = oldFace.vertexColors; - if (!supportUVs || uvForVertices.length!=0) { + newFaces.push( newFace ); + + if (!scope.supportUVs || uvForVertices.length!=0) { newUVs.push( [ uvForVertices[a], uvForVertices[b], @@ -150,8 +159,6 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) { var uvForVertices = []; - var supportUVs = true; - // Step 1 // For each face, add a face point // Set each face point to be the centroid of all original points for the respective face. @@ -183,7 +190,7 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) { newPoints.push( new THREE.Vertex(face.centroid) ); - if (!supportUVs || uvForVertices.length==0) continue; + if (!scope.supportUVs || uvForVertices.length==0) continue; // Prepare subdivided uv @@ -251,7 +258,7 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) { edgeCount ++; - if (!supportUVs || uvForVertices.length==0) continue; + if (!scope.supportUVs || uvForVertices.length==0) continue; // Prepare subdivided uv @@ -290,9 +297,9 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) { hashCA = edge_hash( face.c, face.a ); - f4( currentVerticeIndex, edgePoints[hashAB], face.b, edgePoints[hashBC], face.color, face.material); - f4( currentVerticeIndex, edgePoints[hashBC], face.c, edgePoints[hashCA], face.color, face.material); - f4( currentVerticeIndex, edgePoints[hashCA], face.a, edgePoints[hashAB], face.color, face.material); + f4( currentVerticeIndex, edgePoints[hashAB], face.b, edgePoints[hashBC], face ); + f4( currentVerticeIndex, edgePoints[hashBC], face.c, edgePoints[hashCA], face ); + f4( currentVerticeIndex, edgePoints[hashCA], face.a, edgePoints[hashAB], face ); // face subdivide color and materials too? @@ -305,10 +312,10 @@ THREE.SubdivisionModifier.prototype.smooth = function ( oldGeometry ) { hashCD = edge_hash( face.c, face.d ); hashDA = edge_hash( face.d, face.a ); - f4( currentVerticeIndex, edgePoints[hashAB], face.b, edgePoints[hashBC], face.color, face.material); - f4( currentVerticeIndex, edgePoints[hashBC], face.c, edgePoints[hashCD], face.color, face.material); - f4( currentVerticeIndex, edgePoints[hashCD], face.d, edgePoints[hashDA], face.color, face.material); - f4( currentVerticeIndex, edgePoints[hashDA], face.a, edgePoints[hashAB], face.color, face.material); + f4( currentVerticeIndex, edgePoints[hashAB], face.b, edgePoints[hashBC], face ); + f4( currentVerticeIndex, edgePoints[hashBC], face.c, edgePoints[hashCD], face ); + f4( currentVerticeIndex, edgePoints[hashCD], face.d, edgePoints[hashDA], face ); + f4( currentVerticeIndex, edgePoints[hashDA], face.a, edgePoints[hashAB], face ); } else {